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 (37 lines) | stat: -rw-r--r-- 1,563 bytes parent folder | download | duplicates (4)
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
summary: check that snap pack creates squashfs files

details: |
    Verify that snap pack creates squashfs files or fails in a predictable
    manner.

restore: |
    snap remove test-snapd-sh-lzo

execute: |
    echo "Packing a simple snap works"
    snap pack "$TESTSLIB/snaps/test-snapd-sh" . --filename test-snapd-sh.snap
    test -e test-snapd-sh.snap
    unsquashfs -l test-snapd-sh.snap

    snap install core18
    # the core snap includes files that are not accessible to the user due to
    # permissions
    echo "Packing the core snap as root works"
    SNAP_MOUNT_DIR="$(os.paths snap-mount-dir)"
    snap pack "$SNAP_MOUNT_DIR/core18/current" . --filename core18-as-root.snap
    unsquashfs -l core18-as-root.snap > /dev/null

    echo "Packing the core snap as a user fails due to permission checks"
    not su test -c "snap pack \"$SNAP_MOUNT_DIR/core18/current\" . --filename core18-as-user.snap" 2> stderr.log
    MATCH 'error: cannot pack ".*core18.*": cannot access the following locations in the snap source directory:' < stderr.log
    MATCH -- '- etc.* \(owner .* mode .*\)' < stderr.log

    echo "Packing a simple snap with lzo works"
    snap pack --compression=lzo "$TESTSLIB/snaps/test-snapd-sh" . --filename test-snapd-sh-lzo.snap
    test -e test-snapd-sh-lzo.snap
    unsquashfs -l test-snapd-sh-lzo.snap
    unsquashfs -s test-snapd-sh-lzo.snap | MATCH "Compression lzo"

    echo "The lzo snap can be used normally"
    snap install --dangerous test-snapd-sh-lzo.snap
    test-snapd-sh.sh -c "echo hello-lzo" | MATCH "hello-lzo"