From d933ccd30bf1879a3e0df47c4b39021daa6cd01e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Thu, 8 Apr 2021 09:45:28 +0200 Subject: [PATCH] TEST-43: fix exit condition testing We were invoking 'systemd-run bash', but the test invoked by bash was not effective. When the result of that check is propagated, the outer command fails. --- test/units/testsuite-43.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/test/units/testsuite-43.sh b/test/units/testsuite-43.sh index d9453e81a1..f3c0ca4fd2 100755 --- a/test/units/testsuite-43.sh +++ b/test/units/testsuite-43.sh @@ -34,9 +34,10 @@ test -e /home/testuser/works.txt runas testuser systemd-run --wait --user --unit=test-protect-home-read-only \ -p PrivateUsers=yes -p ProtectHome=read-only \ -P bash -c ' - test -e /home/testuser/works.txt - ! touch /home/testuser/blocked.txt - ' + test -e /home/testuser/works.txt || exit 10 + touch /home/testuser/blocked.txt && exit 11 + ' \ + && { echo 'unexpected success'; exit 1; } test ! -e /home/testuser/blocked.txt # Check that tmpfs hides the whole directory @@ -57,9 +58,10 @@ runas testuser systemd-run --wait --user --unit=test-protect-home-yes \ # namespace (no CAP_SETGID in the parent namespace to write the additional # mapping of the user supplied group and thus cannot change groups to an # unmapped group ID) -! runas testuser systemd-run --wait --user --unit=test-group-fail \ +runas testuser systemd-run --wait --user --unit=test-group-fail \ -p PrivateUsers=yes -p Group=daemon \ - -P true + -P true \ + && { echo 'unexpected success'; exit 1; } systemd-analyze log-level info -- 2.25.1