From: Stefano Brivio <sbrivio@redhat.com>
To: passt-dev@passt.top
Subject: [PATCH] test/lib/setup: Unshare PID namespace in pasta_setup()
Date: Wed, 02 Mar 2022 10:28:06 +0100 [thread overview]
Message-ID: <20220302092806.1390007-1-sbrivio@redhat.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1137 bytes --]
...otherwise, we'll leave processes (dhclient) around.
Signed-off-by: Stefano Brivio <sbrivio(a)redhat.com>
---
test/lib/setup | 12 ++++++++----
1 file 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
}
--
@@ -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
}
--
2.34.1
reply other threads:[~2022-03-02 9:28 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220302092806.1390007-1-sbrivio@redhat.com \
--to=sbrivio@redhat.com \
--cc=passt-dev@passt.top \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://passt.top/passt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).