aboutgitcodebugslistschat
path: root/test/lib/setup
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2022-09-12 20:56:22 +1000
committerStefano Brivio <sbrivio@redhat.com>2022-09-13 05:32:00 +0200
commit56e755ba1146dc6bd488bedc155db5be9c47ac12 (patch)
tree7123e2f9ae1d1ff9b125d897e2f0f93d880d9667 /test/lib/setup
parenta8a437abd6c03161c0d7430f969f6a32d046dc29 (diff)
downloadpasst-56e755ba1146dc6bd488bedc155db5be9c47ac12.tar
passt-56e755ba1146dc6bd488bedc155db5be9c47ac12.tar.gz
passt-56e755ba1146dc6bd488bedc155db5be9c47ac12.tar.bz2
passt-56e755ba1146dc6bd488bedc155db5be9c47ac12.tar.lz
passt-56e755ba1146dc6bd488bedc155db5be9c47ac12.tar.xz
passt-56e755ba1146dc6bd488bedc155db5be9c47ac12.tar.zst
passt-56e755ba1146dc6bd488bedc155db5be9c47ac12.zip
test: Use context system for guest commands
Extends the context system in the test scripts to allow executing commands within a guest. Do this without requiring an existing network in the guest by using socat to run ssh via a vsock connection. We do need some additional "sleep"s in the tests, because the new faster dispatch means that sometimes we attempt to connect before socat has managed to listen. For now, only use this for the plain "passt" tests. The "passt_in_ns" and other tests have additional complications we still need to deal with. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'test/lib/setup')
-rwxr-xr-xtest/lib/setup13
1 files changed, 9 insertions, 4 deletions
diff --git a/test/lib/setup b/test/lib/setup
index a87bce9..5e9072c 100755
--- a/test/lib/setup
+++ b/test/lib/setup
@@ -35,6 +35,7 @@ setup_distro() {
setup_passt() {
context_setup_host host
context_setup_host passt
+ context_setup_host qemu
layout_passt
@@ -55,7 +56,8 @@ setup_passt() {
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)' \
+ GUEST_CID=94557
+ context_run_bg qemu './qrap 5 qemu-system-$(uname -m)' \
' -machine accel=kvm' \
' -m '${VMEM}' -cpu host -smp '${VCPUS} \
' -kernel ' "/boot/vmlinuz-$(uname -r)" \
@@ -65,8 +67,10 @@ setup_passt() {
'virtio-net.napi_tx=1"' \
" -device virtio-net-pci,netdev=hostnet0,x-txburst=16384" \
" -netdev socket,fd=5,id=hostnet0" \
- ' -pidfile passt_qemu.pid'
- pane_status GUEST
+ " -pidfile passt_qemu.pid" \
+ " -device vhost-vsock-pci,guest-cid=$GUEST_CID"
+
+ context_setup_guest guest $GUEST_CID
}
# setup_pasta() - Create a network and user namespace, connect pasta to it
@@ -307,11 +311,12 @@ 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_context_watch ${PANE_GUEST} qemu guest
}
# teardown_passt() - Exit namespace, kill pasta process