aboutgitcodebugslistschat
path: root/test/lib/setup
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2022-09-12 20:56:19 +1000
committerStefano Brivio <sbrivio@redhat.com>2022-09-13 05:32:00 +0200
commit2f87265d8b25cbeeadfb662f2a46db00795747a3 (patch)
treeaee58a8338cec4da063f0a48c9bc0db0be8e5eaf /test/lib/setup
parentd9b9c252cd494e23056c3ec28080a88636409865 (diff)
downloadpasst-2f87265d8b25cbeeadfb662f2a46db00795747a3.tar
passt-2f87265d8b25cbeeadfb662f2a46db00795747a3.tar.gz
passt-2f87265d8b25cbeeadfb662f2a46db00795747a3.tar.bz2
passt-2f87265d8b25cbeeadfb662f2a46db00795747a3.tar.lz
passt-2f87265d8b25cbeeadfb662f2a46db00795747a3.tar.xz
passt-2f87265d8b25cbeeadfb662f2a46db00795747a3.tar.zst
passt-2f87265d8b25cbeeadfb662f2a46db00795747a3.zip
test: Use new-style contexts for passt pane in the pasta and passt tests
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 <david@gibson.dropbear.id.au>
Diffstat (limited to 'test/lib/setup')
-rwxr-xr-xtest/lib/setup19
1 files changed, 9 insertions, 10 deletions
diff --git a/test/lib/setup b/test/lib/setup
index 09608dd..6598422 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
layout_passt
@@ -48,11 +49,9 @@ setup_passt() {
[ ${DEBUG} -eq 1 ] && __opts="${__opts} -d"
[ ${TRACE} -eq 1 ] && __opts="${__opts} --trace"
- pane_run PASST "make clean"
- pane_status PASST
- pane_run PASST "make valgrind"
- pane_status PASST
- pane_run PASST "valgrind --max-stackframe=$((4 * 1024 * 1024)) --trace-children=yes --vgdb=no --error-exitcode=1 --suppressions=test/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=$((4 * 1024 * 1024)) --trace-children=yes --vgdb=no --error-exitcode=1 --suppressions=test/valgrind.supp ./passt ${__opts} -f -t 10001 -u 10001 -P passt.pid"
sleep 5
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
layout_pasta
@@ -82,9 +82,7 @@ setup_pasta() {
pane_run NS "unshare -rUnpf /bin/sh"
pane_status NS
- pane_run PASST "pstree -p ${__tty_pid} | sed -n 's/.*(\([0-9].*\))$/\1/p'"
- pane_wait PASST
- __target_pid="$(pane_parse PASST)"
+ __target_pid=$(pstree -p ${__tty_pid} | sed -n 's/.*(\([0-9].*\))$/\1/p')
# Ports:
#
@@ -98,7 +96,7 @@ setup_pasta() {
[ ${DEBUG} -eq 1 ] && __opts="${__opts} -d"
[ ${TRACE} -eq 1 ] && __opts="${__opts} --trace"
- 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 10003 -P passt.pid ${__target_pid}"
sleep 1
}
@@ -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
teardown_context_watch ${PANE_HOST} host
+ teardown_context_watch ${PANE_PASST} passt
}
# teardown_passt() - Exit namespace, kill pasta process
@@ -324,6 +322,7 @@ teardown_pasta() {
pane_wait NS
teardown_context_watch ${PANE_HOST} host
+ teardown_context_watch ${PANE_PASST} passt
}
# teardown_passt_in_ns() - Exit namespace, kill qemu and pasta, remove pid file