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
|
summary: check the container validator logs on error
details: |
Snapd contains logic to validate the contents of the squashfs and ensure
that files are readable and that application entry points are executable.
The test mounts a snap with violates those rules to test that snapd detects
and reports the problems accurately.
environment:
SNAP: test-snapd-validate-container-failures
prepare: |
# git doesn't preserve permissions properly :-(
# sets up all the permissions, so I don't have to remember which
# ones it does preserve (it basically mangles everything anyway)
chmod 0600 "$SNAP/comp.sh"
chmod 0644 "$SNAP/bin/bar"
chmod 0700 "$SNAP/bin/foo"
chmod 0 "$SNAP/meta/unreadable"
chmod 0644 "$SNAP/meta/hooks/what"
execute: |
echo "Snap refuses to install"
not snap try "$SNAP" 2>error.log
echo "The error tells you to ask the dev"
tr -s '\n ' ' ' < error.log | MATCH 'contact developer'
echo "And the journal counts the ways"
"$TESTSTOOLS"/journal-state match-log '[\]?"comp.sh[\]?" should be world-readable' -u snapd
"$TESTSTOOLS"/journal-state match-log '[\]?"bin/bar[\]?" should be executable' -u snapd
"$TESTSTOOLS"/journal-state match-log '[\]?"bin/foo[\]?" should be world-readable and executable' -u snapd
"$TESTSTOOLS"/journal-state match-log '[\]?"meta/unreadable[\]?" should be world-readable' -u snapd
"$TESTSTOOLS"/journal-state match-log '[\]?"meta/hooks/what[\]?" should be executable' -u snapd
"$TESTSTOOLS"/journal-state match-log '[\]?"bin/stahp[\]?" does not exist' -u snapd
|