summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2019-11-27 09:49:55 +0100
committerAlexander Larsson <alexl@redhat.com>2019-11-27 09:49:55 +0100
commit86e16d7aaa2565f65dc548bfd9faf0b551606f2a (patch)
tree6f5dcef5ce006792cbd852dc833599bf5fb560b4
parente9980e36fc045d4fc8ec24a817b5f820c882c743 (diff)
downloadbubblewrap-86e16d7aaa2565f65dc548bfd9faf0b551606f2a.tar.gz
tests: Fix --userns tests
It seems the /proc file timestamp changes, so compare the namespaces with readlink instead of ls -l as that doesn't contain a timestamp.
-rwxr-xr-xtests/test-run.sh8
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/test-run.sh b/tests/test-run.sh
index 929bc9b..a01f41c 100755
--- a/tests/test-run.sh
+++ b/tests/test-run.sh
@@ -347,11 +347,11 @@ if test -n "${bwrap_is_suid:-}"; then
else
mkfifo donepipe
- $RUN --info-fd 42 --unshare-user sh -c 'ls -l /proc/self/ns/user > sandbox-userns; cat < donepipe' 42>info.json &
+ $RUN --info-fd 42 --unshare-user sh -c 'readlink /proc/self/ns/user > sandbox-userns; cat < donepipe' 42>info.json &
while ! test -f sandbox-userns; do sleep 1; done
SANDBOX1PID=$(extract_child_pid info.json)
- $RUN --userns 11 ls -l /proc/self/ns/user > sandbox2-userns 11< /proc/$SANDBOX1PID/ns/user
+ $RUN --userns 11 readlink /proc/self/ns/user > sandbox2-userns 11< /proc/$SANDBOX1PID/ns/user
echo foo > donepipe
assert_files_equal sandbox-userns sandbox2-userns
@@ -361,11 +361,11 @@ else
echo "ok - Test --userns"
mkfifo donepipe
- $RUN --info-fd 42 --unshare-user --unshare-pid sh -c 'ls -l /proc/self/ns/pid > sandbox-pidns; cat < donepipe' 42>info.json &
+ $RUN --info-fd 42 --unshare-user --unshare-pid sh -c 'readlink /proc/self/ns/pid > sandbox-pidns; cat < donepipe' 42>info.json &
while ! test -f sandbox-pidns; do sleep 1; done
SANDBOX1PID=$(extract_child_pid info.json)
- $RUN --userns 11 --pidns 12 ls -l /proc/self/ns/pid > sandbox2-pidns 11< /proc/$SANDBOX1PID/ns/user 12< /proc/$SANDBOX1PID/ns/pid
+ $RUN --userns 11 --pidns 12 readlink /proc/self/ns/pid > sandbox2-pidns 11< /proc/$SANDBOX1PID/ns/user 12< /proc/$SANDBOX1PID/ns/pid
echo foo > donepipe
assert_files_equal sandbox-pidns sandbox2-pidns