File: task.yaml

package info (click to toggle)
snapd 2.71-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 79,536 kB
  • sloc: ansic: 16,114; sh: 16,105; python: 9,941; makefile: 1,890; exp: 190; awk: 40; xml: 22
file content (58 lines) | stat: -rw-r--r-- 2,540 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
summary: Checks for parallel installation of sideloaded snaps containing desktop applications

details: |
    Snapd allows installation of the same snap more than once by combining the
    same snap name with different values of an instance key.

    One aspect of the instance system is that applications with desktop files
    need a mechanism to alter each desktop file so that each instance can be
    individually found and started in the desktop shell.

    The test installs a snap with a desktop file and looks at the contents of
    the instance-aware desktop file written by snapd, to ensure that in each
    case the launched application is correct, and that some attributes contain
    the name of the instance.

    The test also checks that removal of one instance does not affect the
    desktop files of other instances, for example by careless use of a glob
    pattern to remove generated files.

restore: |
    snap set system experimental.parallel-instances=null

execute: |
    echo "Sideload the regular snap"
    "$TESTSTOOLS"/snaps-state install-local basic-desktop

    snap set system experimental.parallel-instances=true

    SNAP_MOUNT_DIR="$(os.paths snap-mount-dir)"
    for instance in foo longname; do
        echo "Sideload same snap as different instance named basic-desktop+$instance"
        expected="^basic-desktop_$instance 1.0 installed\$"
        "$TESTSTOOLS"/snaps-state install-local-as basic-desktop "basic-desktop_$instance" | MATCH "$expected"

        diff -u <(head -n6 "/var/lib/snapd/desktop/applications/basic-desktop+${instance}_echo.desktop") - <<-EOF
    [Desktop Entry]
    X-SnapInstanceName=basic-desktop_${instance}
    Name=Echo
    Comment=It echos stuff
    X-SnapAppName=echo
    Exec=env BAMF_DESKTOP_FILE_HINT=/var/lib/snapd/desktop/applications/basic-desktop+${instance}_echo.desktop $SNAP_MOUNT_DIR/bin/basic-desktop_$instance.echo
    EOF

        test -d "$SNAP_MOUNT_DIR/basic-desktop_$instance/x1"
    done

    echo "All snaps are listed"
    snap list | MATCH '^basic-desktop '
    snap list | MATCH '^basic-desktop_foo '
    snap list | MATCH '^basic-desktop_longname '

    echo "Removing one instance does not remove other instances' data"
    snap remove --purge basic-desktop_foo
    test -f /var/lib/snapd/desktop/applications/basic-desktop+longname_echo.desktop
    test -f /var/lib/snapd/desktop/applications/basic-desktop_echo.desktop

    snap remove --purge basic-desktop
    test -f /var/lib/snapd/desktop/applications/basic-desktop+longname_echo.desktop