diff options
| author | Zygmunt Krynicki <me@zygoon.pl> | 2019-05-29 12:08:13 +0200 |
|---|---|---|
| committer | Zygmunt Krynicki <me@zygoon.pl> | 2019-05-29 12:13:27 +0200 |
| commit | 0d915a46babe5e5224f976620ab7692fdb01ad02 (patch) | |
| tree | 8b089b316355a5795bf75f196c1302f472afdcc5 | |
| parent | 839879f2ef721bd8d699677f23bef552f1a04562 (diff) | |
tests: correct application of ! / not
A single test started failing after introduction of the "not" program. The specific code was (broken down for readability): su -l -c 'test-snapd-sh.with-home-plug -c \ "ln /home/test/snap/test-snapd-sh/common/evil-2 /home/test/bin/evil-2"' test \ 2>&1 | not MATCH '.* Permission denied' Originally there was a `!` in front of the entire expression. At runtime we observe the actual denial, that is symlinking from `$SNAP_USER_COMMON` to `$HOME/bin` is correctly denied, but with, now correctly working negation, it started to fail the test. I'm unsure as to why this happened but a working theory is that the prior approach was designed for `set -o pipefail`, where the `su` command would return the result of failing `ln` command which would cause the whole pipe expression to fail. The fix is to simply remove the negation, since the test works as expected exactly as-is. Signed-off-by: Zygmunt Krynicki <me@zygoon.pl>
| -rw-r--r-- | tests/regression/lp-1797556/task.yaml | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/regression/lp-1797556/task.yaml b/tests/regression/lp-1797556/task.yaml index e76b442aca..c0951c33cf 100644 --- a/tests/regression/lp-1797556/task.yaml +++ b/tests/regression/lp-1797556/task.yaml @@ -19,9 +19,9 @@ execute: | test ! -e /home/test/bin/evil-1 test ! -e /home/test/bin/evil-2 if [ "$(snap debug confinement)" = "strict" ]; then - su -l -c 'test-snapd-sh.with-home-plug -c "touch /home/test/bin/evil-1"' test 2>&1 | not MATCH '.* Permission denied' + su -l -c 'test-snapd-sh.with-home-plug -c "touch /home/test/bin/evil-1"' test 2>&1 | MATCH '.* Permission denied' dmesg | grep 'apparmor="DENIED" operation="mknod".* name="/home/test/bin/evil-1"' - su -l -c 'test-snapd-sh.with-home-plug -c "ln /home/test/snap/test-snapd-sh/common/evil-2 /home/test/bin/evil-2"' test 2>&1 | not MATCH '.* Permission denied' + su -l -c 'test-snapd-sh.with-home-plug -c "ln /home/test/snap/test-snapd-sh/common/evil-2 /home/test/bin/evil-2"' test 2>&1 | MATCH '.* Permission denied' dmesg | grep 'apparmor="DENIED" operation="link".* name="/home/test/bin/evil-2"' fi test ! -e /home/test/bin/evil-1 |
