summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <smcv@collabora.com>2022-05-11 15:55:10 +0100
committerSimon McVittie <smcv@collabora.com>2022-05-11 15:55:10 +0100
commita996acc89235e30d32edcb5f276434ee9798e76a (patch)
tree2f97d39c8dd1dc7bb34dc5bf532146327f442314
parentc54bbc6d7b78e7a45016efe0c4ac8af9d209aa20 (diff)
downloadbubblewrap-a996acc89235e30d32edcb5f276434ee9798e76a.tar.gz
test-run: Skip a test if we can read /etc/shadow
Ordinarily, we would not be able to read /etc/shadow if we're not uid 0; but when building in a sysroot owned by the current user (for example by setting it up using bwrap, as steam-runtime-tools does), we might actually be able to read it. Skip the assertion that we cannot read it in this case. Signed-off-by: Simon McVittie <smcv@collabora.com>
-rwxr-xr-xtests/test-run.sh3
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/test-run.sh b/tests/test-run.sh
index f25a9bc..85c97dd 100755
--- a/tests/test-run.sh
+++ b/tests/test-run.sh
@@ -39,7 +39,8 @@ for ALT in "" "--unshare-user-try" "--unshare-pid" "--unshare-user-try --unshare
CAP=""
fi
- if ! ${is_uidzero} && $RUN $CAP $ALT --unshare-net --proc /proc --bind /etc/shadow /tmp/foo cat /etc/shadow; then
+ if ! cat /etc/shadow >/dev/null &&
+ $RUN $CAP $ALT --unshare-net --proc /proc --bind /etc/shadow /tmp/foo cat /etc/shadow; then
assert_not_reached Could read /etc/shadow
fi
echo "ok - cannot read /etc/shadow with $ALT"