aboutgitcodebugslistschat
path: root/test/lib/setup
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2022-03-02 05:00:21 +0100
committerStefano Brivio <sbrivio@redhat.com>2022-03-02 05:00:21 +0100
commitbec6d3e084cdefff6ab8e86e9ae3f3f77b301ff0 (patch)
tree2db6b029dea2c15f3dc1108aa2e5a725bbbf092e /test/lib/setup
parent71ab6d9972bd89692e28dc321a79bb105e66b918 (diff)
downloadpasst-bec6d3e084cdefff6ab8e86e9ae3f3f77b301ff0.tar
passt-bec6d3e084cdefff6ab8e86e9ae3f3f77b301ff0.tar.gz
passt-bec6d3e084cdefff6ab8e86e9ae3f3f77b301ff0.tar.bz2
passt-bec6d3e084cdefff6ab8e86e9ae3f3f77b301ff0.tar.lz
passt-bec6d3e084cdefff6ab8e86e9ae3f3f77b301ff0.tar.xz
passt-bec6d3e084cdefff6ab8e86e9ae3f3f77b301ff0.tar.zst
passt-bec6d3e084cdefff6ab8e86e9ae3f3f77b301ff0.zip
test/lib/setup: Unshare PID namespace in pasta_setup()
...otherwise, we'll leave processes (dhclient) around. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'test/lib/setup')
-rwxr-xr-xtest/lib/setup12
1 files changed, 8 insertions, 4 deletions
diff --git a/test/lib/setup b/test/lib/setup
index b076eff..f04949e 100755
--- a/test/lib/setup
+++ b/test/lib/setup
@@ -69,12 +69,16 @@ setup_pasta() {
layout_pasta
- pane_run NS "unshare -rUn /bin/sh "
+ pane_run NS 'echo $$'
pane_wait NS
+ __tty_pid="$(pane_parse NS)"
- pane_run NS 'echo $$'
+ pane_run NS "unshare -rUnpf /bin/sh"
pane_wait NS
- __pasta_pid="$(pane_parse NS)"
+
+ pane_run PASST "pstree -p ${__tty_pid} | sed -n 's/.*(\([0-9].*\))$/\1/p'"
+ pane_wait PASST
+ __target_pid="$(pane_parse PASST)"
# Ports:
#
@@ -87,7 +91,7 @@ setup_pasta() {
[ ${PCAP} -eq 1 ] && __opts="${__opts} -p /tmp/pasta.pcap"
[ ${DEBUG} -eq 1 ] && __opts="${__opts} -d"
- pane_run PASST "./pasta ${__opts} -f -t 10002 -T 10003 -u 10002 -U 10003 ${__pasta_pid}"
+ pane_run PASST "./pasta ${__opts} -f -t 10002 -T 10003 -u 10002 -U 10003 ${__target_pid}"
sleep 1
}