aboutgitcodebugslistschat
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/pasta_options/no_pidns25
-rwxr-xr-xtest/run1
2 files changed, 26 insertions, 0 deletions
diff --git a/test/pasta_options/no_pidns b/test/pasta_options/no_pidns
new file mode 100644
index 0000000..f565b2f
--- /dev/null
+++ b/test/pasta_options/no_pidns
@@ -0,0 +1,25 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
+# PASST - Plug A Simple Socket Transport
+# for qemu/UNIX domain socket mode
+#
+# PASTA - Pack A Subtle Tap Abstraction
+# for network namespace/tap device mode
+#
+# test/pasta_options/no_pidns - Check --no-pidns handling
+
+htools readlink
+
+test Command is spawned in a new PID namespace by default
+set PIDNS __STATEDIR__/pidns
+set OUT __STATEDIR__/no-pidns.out
+set ERR __STATEDIR__/no-pidns.err
+
+passt readlink /proc/self/ns/pid > __PIDNS__
+passt ./pasta -q -- readlink /proc/self/ns/pid > __OUT__ 2> __ERR__
+check [ "$(cat __PIDNS__)" != "$(cat __OUT__)" ]
+
+test --no-pidns keeps command in the caller's PID namespace
+passt ./pasta -q --no-pidns -- readlink /proc/self/ns/pid > __OUT__ 2> __ERR__
+check [ "$(cat __PIDNS__)" = "$(cat __OUT__)" ]
+check [ ! -s __ERR__ ]
diff --git a/test/run b/test/run
index c4073cc..14ddbbf 100755
--- a/test/run
+++ b/test/run
@@ -86,6 +86,7 @@ run() {
setup pasta_options
test pasta_options/log_to_file
test pasta_options/netns_only
+ test pasta_options/no_pidns
teardown pasta_options
setup build