File: task.yaml

package info (click to toggle)
snapd 2.72-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 80,412 kB
  • sloc: sh: 16,506; ansic: 16,211; python: 11,213; makefile: 1,919; exp: 190; awk: 58; xml: 22
file content (47 lines) | stat: -rw-r--r-- 1,803 bytes parent folder | download | duplicates (3)
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
summary: Check that snap apps and services can write to writable areas.

details: |
    The confinement system allows snap applications to write to four locations:
    snap data specific to the current revision, snap data common across
    revisions, snap user data specific to the current revision and lastly snap
    user data common across revisions.

environment:
    # Ensure that running purely from the deb (without re-exec) works
    # correctly
    SNAP_REEXEC/reexec0: 0
    SNAP_REEXEC/reexec1: 1

prepare: |
    if [ "$SNAP_REEXEC" = "0" ] && tests.info is-snapd-from-archive; then
        tests.exec skip-test "No need to test when the snapd pkg is from the repository and reexec is disabled" && exit 0
    fi
    snap pack data-writer
    SNAP_MOUNT_DIR="$(os.paths snap-mount-dir)"
    if [ "$SNAP_REEXEC" = "1" ] && [ "$SNAP_MOUNT_DIR" != "/snap" ] && [ ! -L /snap ]; then
        # reexec expects to find the snapd snap under /snap, enable it to do so
        # on distros using /var/lib/snapd/snap
        ln -sf "$SNAP_MOUNT_DIR" /snap
        tests.cleanup defer rm -f /snap
    fi

execute: |
    tests.exec is-skipped && exit 0

    snap install --dangerous data-writer_1.0_all.snap

    echo "Apps can write to writable areas"

    data-writer.app
    [ -f /var/snap/data-writer/x1/from-app ]
    [ -f /var/snap/data-writer/common/from-app ]
    [ -f /root/snap/data-writer/x1/from-app ]
    [ -f /root/snap/data-writer/common/from-app ]

    echo "Waiting for data writer service to finish..."
    retry -n 20 --wait 1 sh -c 'test -f /root/snap/data-writer/x1/from-service'

    echo "Services can write to writable areas"
    [ -f /var/snap/data-writer/x1/from-service ]
    [ -f /var/snap/data-writer/common/from-service ]
    [ -f /root/snap/data-writer/common/from-service ]