From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Gibson To: passt-dev@passt.top Subject: [PATCH 06/11] test: Use new-style contexts for passt pane in the pasta and passt tests Date: Fri, 02 Sep 2022 12:14:55 +1000 Message-ID: <20220902021500.25358-7-david@gibson.dropbear.id.au> In-Reply-To: <20220902021500.25358-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============8763312485578289917==" --===============8763312485578289917== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Convert the pasta and passt tests to use new-style context execution for the things that run in the "passt" frame. Don't touch the passt_in_ns or two_guests tests yet, because they run passt inside a namespace which introduces some additional complications we have yet to handle. Signed-off-by: David Gibson --- test/lib/layout | 8 ++------ test/lib/setup | 19 +++++++++---------- test/shutdown/passt | 4 +--- 3 files changed, 12 insertions(+), 19 deletions(-) diff --git a/test/lib/layout b/test/lib/layout index 09c213a..95bd035 100644 --- a/test/lib/layout +++ b/test/lib/layout @@ -69,9 +69,7 @@ layout_pasta() { tmux select-pane -t ${PANE_INFO} -T "test log" =20 pane_watch_contexts ${PANE_HOST} host host - - tmux pipe-pane -O -t ${PANE_PASST} "cat >> ${LOGDIR}/pane_passt.log" - tmux select-pane -t ${PANE_PASST} -T "pasta" + pane_watch_contexts ${PANE_PASST} pasta passt =20 info_layout "single pasta instance with namespace" =20 @@ -104,9 +102,7 @@ layout_passt() { tmux select-pane -t ${PANE_INFO} -T "test log" =20 pane_watch_contexts ${PANE_HOST} host host - - tmux pipe-pane -O -t ${PANE_PASST} "cat >> ${LOGDIR}/pane_passt.log" - tmux select-pane -t ${PANE_PASST} -T "passt" + pane_watch_contexts ${PANE_PASST} passt passt =20 info_layout "single passt instance with guest" =20 diff --git a/test/lib/setup b/test/lib/setup index 9b5e9ff..8430f4f 100755 --- a/test/lib/setup +++ b/test/lib/setup @@ -33,6 +33,7 @@ setup_distro() { # setup_passt() - Start qemu and passt setup_passt() { context_setup_host host + context_setup_host passt =20 layout_passt =20 @@ -48,11 +49,9 @@ setup_passt() { [ ${DEBUG} -eq 1 ] && __opts=3D"${__opts} -d" [ ${TRACE} -eq 1 ] && __opts=3D"${__opts} --trace" =20 - pane_run PASST "make clean" - pane_status PASST - pane_run PASST "make valgrind" - pane_status PASST - pane_run PASST "valgrind --max-stackframe=3D$((4 * 1024 * 1024)) --trace-ch= ildren=3Dyes --vgdb=3Dno --error-exitcode=3D1 --suppressions=3Dtest/valgrind.= supp ./passt ${__opts} -f -t 10001 -u 10001 -P passt.pid" + context_run passt "make clean" + context_run passt "make valgrind" + context_run_bg passt "valgrind --max-stackframe=3D$((4 * 1024 * 1024)) --tr= ace-children=3Dyes --vgdb=3Dno --error-exitcode=3D1 --suppressions=3Dtest/val= grind.supp ./passt ${__opts} -f -t 10001 -u 10001 -P passt.pid" sleep 5 =20 pane_run GUEST './qrap 5 qemu-system-$(uname -m)' \ @@ -72,6 +71,7 @@ setup_passt() { # setup_pasta() - Create a network and user namespace, connect pasta to it setup_pasta() { context_setup_host host + context_setup_host passt =20 layout_pasta =20 @@ -82,9 +82,7 @@ setup_pasta() { pane_run NS "unshare -rUnpf /bin/sh" pane_status NS =20 - pane_run PASST "pstree -p ${__tty_pid} | sed -n 's/.*(\([0-9].*\))$/\1/p'" - pane_wait PASST - __target_pid=3D"$(pane_parse PASST)" + __target_pid=3D$(pstree -p ${__tty_pid} | sed -n 's/.*(\([0-9].*\))$/\1/p') =20 # Ports: # @@ -98,7 +96,7 @@ setup_pasta() { [ ${DEBUG} -eq 1 ] && __opts=3D"${__opts} -d" [ ${TRACE} -eq 1 ] && __opts=3D"${__opts} --trace" =20 - pane_run PASST "./pasta ${__opts} -f -t 10002 -T 10003 -u 10002 -U 10003 -P= passt.pid ${__target_pid}" + context_run_bg passt "./pasta ${__opts} -f -t 10002 -T 10003 -u 10002 -U 10= 003 -P passt.pid ${__target_pid}" sleep 1 } =20 @@ -311,11 +309,11 @@ teardown_distro() { # teardown_passt() - Kill qemu, remove passt PID file teardown_passt() { kill $(cat passt_qemu.pid) - pane_wait GUEST rm passt.pid =20 teardown_context_watch ${PANE_HOST} host + teardown_context_watch ${PANE_PASST} passt } =20 # teardown_passt() - Exit namespace, kill pasta process @@ -324,6 +322,7 @@ teardown_pasta() { pane_wait NS =20 teardown_context_watch ${PANE_HOST} host + teardown_context_watch ${PANE_PASST} passt } =20 # teardown_passt_in_ns() - Exit namespace, kill qemu and pasta, remove pid f= ile diff --git a/test/shutdown/passt b/test/shutdown/passt index 4a7b702..ac8ff08 100644 --- a/test/shutdown/passt +++ b/test/shutdown/passt @@ -17,6 +17,4 @@ test shutdown: exit code hout PASST_PID cat passt.pid host kill __PASST_PID__ sleep 1 - -pout EXIT echo $? -check [ "__EXIT__" =3D "0" ] +passtw --=20 2.37.2 --===============8763312485578289917==--