summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2019-11-22 11:21:07 +0100
committerAlexander Larsson <alexl@redhat.com>2019-11-26 09:28:51 +0100
commit1402b0c41b5529ddc91eee3cb9b38795935bb896 (patch)
treea6854af2ad716f9738d07411f463d2821d62cb5d
parent46c7f1cca5f9a8ff985976a9d0477cf5ecb0162f (diff)
downloadbubblewrap-1402b0c41b5529ddc91eee3cb9b38795935bb896.tar.gz
Add tests for --pidns
-rwxr-xr-xtests/test-run.sh18
1 files changed, 17 insertions, 1 deletions
diff --git a/tests/test-run.sh b/tests/test-run.sh
index d11da80..929bc9b 100755
--- a/tests/test-run.sh
+++ b/tests/test-run.sh
@@ -80,7 +80,7 @@ if ! $RUN true; then
skip Seems like bwrap is not working at all. Maybe setuid is not working
fi
-echo "1..48"
+echo "1..49"
# Test help
${BWRAP} --help > help.txt
@@ -343,6 +343,7 @@ echo "ok - we can mount another directory inside /tmp"
# These tests need user namespaces
if test -n "${bwrap_is_suid:-}"; then
echo "ok - # SKIP no setuid support for --unshare-user"
+ echo "ok - # SKIP no setuid support for --unshare-user"
else
mkfifo donepipe
@@ -358,6 +359,21 @@ else
rm donepipe info.json sandbox-userns
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 &
+ 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
+ echo foo > donepipe
+
+ assert_files_equal sandbox-pidns sandbox2-pidns
+
+ rm donepipe info.json sandbox-pidns
+
+ echo "ok - Test --pidns"
fi
+
echo "ok - End of test"