From: David Gibson <david@gibson.dropbear.id.au>
To: passt-dev@passt.top
Subject: [PATCH 10/10] test: Kill qemu by pidfile rather than ^C
Date: Thu, 18 Aug 2022 16:13:58 +1000 [thread overview]
Message-ID: <20220818061358.1775944-11-david@gibson.dropbear.id.au> (raw)
In-Reply-To: <20220818061358.1775944-1-david@gibson.dropbear.id.au>
[-- Attachment #1: Type: text/plain, Size: 3477 bytes --]
Currently in at least some of the testcases we kill qemu processes we're
done with by issuing a Control-C to the tmux panel it's running in. That
makes things harder as we try to move towards allowing "headless" testing
without tmux.
So, instead always use an explicit kill on a pid derived from a pidfile
for killing qemu. Note that we don't need to remove the pidfiles
afterwards, because qemu does that itself when terminated.
Signed-off-by: David Gibson <david(a)gibson.dropbear.id.au>
---
test/lib/setup | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/test/lib/setup b/test/lib/setup
index 450b68a..42f03c1 100755
--- a/test/lib/setup
+++ b/test/lib/setup
@@ -60,7 +60,8 @@ setup_passt() {
' -append "console=ttyS0 mitigations=off apparmor=0 ' \
'virtio-net.napi_tx=1"' \
" -device virtio-net-pci,netdev=hostnet0,x-txburst=16384" \
- " -netdev socket,fd=5,id=hostnet0"
+ " -netdev socket,fd=5,id=hostnet0" \
+ ' -pidfile passt_qemu.pid'
pane_status GUEST
# Set things up to reduce problems parsing host command output
@@ -178,7 +179,8 @@ setup_passt_in_ns() {
' -append "console=ttyS0 mitigations=off apparmor=0 ' \
'virtio-net.napi_tx=1"' \
" -device virtio-net-pci,netdev=hostnet0,x-txburst=524288" \
- " -netdev socket,fd=5,id=hostnet0"
+ " -netdev socket,fd=5,id=hostnet0" \
+ ' -pidfile passt_in_ns_qemu.pid'
pane_status GUEST
# Set things up to reduce problems parsing host command output
@@ -271,7 +273,8 @@ setup_two_guests() {
' -append "console=ttyS0 mitigations=off apparmor=0 ' \
'virtio-net.napi_tx=1"' \
" -device virtio-net-pci,netdev=hostnet0,x-txburst=16384" \
- " -netdev socket,fd=5,id=hostnet0"
+ " -netdev socket,fd=5,id=hostnet0" \
+ ' -pidfile two_guests_qemu_1.pid'
pane_run GUEST_2 './qrap 5 qemu-system-$(uname -m)' \
' -M accel=kvm:tcg' \
' -m '${VMEM}' -cpu host -smp '${VCPUS} \
@@ -281,7 +284,8 @@ setup_two_guests() {
' -append "console=ttyS0 mitigations=off apparmor=0 ' \
'virtio-net.napi_tx=1"' \
" -device virtio-net-pci,netdev=hostnet0,x-txburst=16384" \
- " -netdev socket,fd=5,id=hostnet0"
+ " -netdev socket,fd=5,id=hostnet0" \
+ ' -pidfile two_guests_qemu_2.pid'
pane_status GUEST_1
pane_status GUEST_2
}
@@ -298,7 +302,7 @@ teardown_distro() {
# teardown_passt() - Kill qemu, remove passt PID file
teardown_passt() {
- tmux send-keys -t ${PANE_GUEST} "C-c"
+ kill $(cat passt_qemu.pid)
pane_wait GUEST
rm passt.pid
}
@@ -311,7 +315,7 @@ teardown_pasta() {
# teardown_passt_in_ns() - Exit namespace, kill qemu and pasta, remove pid file
teardown_passt_in_ns() {
- tmux send-keys -t ${PANE_GUEST} "C-c"
+ kill $(cat passt_in_ns_qemu.pid)
pane_wait GUEST
tmux send-keys -t ${PANE_GUEST} "C-d"
@@ -326,11 +330,11 @@ teardown_passt_in_ns() {
# teardown_two_guests() - Exit namespaces, kill qemu processes, passt and pasta
teardown_two_guests() {
- tmux send-keys -t ${PANE_GUEST_1} "C-c"
+ kill $(cat two_guests_qemu_1.pid)
pane_wait GUEST_1
tmux send-keys -t ${PANE_GUEST_1} "C-d"
- tmux send-keys -t ${PANE_GUEST_2} "C-c"
+ kill $(cat two_guests_qemu_2.pid)
pane_wait GUEST_2
tmux send-keys -t ${PANE_GUEST_2} "C-d"
--
@@ -60,7 +60,8 @@ setup_passt() {
' -append "console=ttyS0 mitigations=off apparmor=0 ' \
'virtio-net.napi_tx=1"' \
" -device virtio-net-pci,netdev=hostnet0,x-txburst=16384" \
- " -netdev socket,fd=5,id=hostnet0"
+ " -netdev socket,fd=5,id=hostnet0" \
+ ' -pidfile passt_qemu.pid'
pane_status GUEST
# Set things up to reduce problems parsing host command output
@@ -178,7 +179,8 @@ setup_passt_in_ns() {
' -append "console=ttyS0 mitigations=off apparmor=0 ' \
'virtio-net.napi_tx=1"' \
" -device virtio-net-pci,netdev=hostnet0,x-txburst=524288" \
- " -netdev socket,fd=5,id=hostnet0"
+ " -netdev socket,fd=5,id=hostnet0" \
+ ' -pidfile passt_in_ns_qemu.pid'
pane_status GUEST
# Set things up to reduce problems parsing host command output
@@ -271,7 +273,8 @@ setup_two_guests() {
' -append "console=ttyS0 mitigations=off apparmor=0 ' \
'virtio-net.napi_tx=1"' \
" -device virtio-net-pci,netdev=hostnet0,x-txburst=16384" \
- " -netdev socket,fd=5,id=hostnet0"
+ " -netdev socket,fd=5,id=hostnet0" \
+ ' -pidfile two_guests_qemu_1.pid'
pane_run GUEST_2 './qrap 5 qemu-system-$(uname -m)' \
' -M accel=kvm:tcg' \
' -m '${VMEM}' -cpu host -smp '${VCPUS} \
@@ -281,7 +284,8 @@ setup_two_guests() {
' -append "console=ttyS0 mitigations=off apparmor=0 ' \
'virtio-net.napi_tx=1"' \
" -device virtio-net-pci,netdev=hostnet0,x-txburst=16384" \
- " -netdev socket,fd=5,id=hostnet0"
+ " -netdev socket,fd=5,id=hostnet0" \
+ ' -pidfile two_guests_qemu_2.pid'
pane_status GUEST_1
pane_status GUEST_2
}
@@ -298,7 +302,7 @@ teardown_distro() {
# teardown_passt() - Kill qemu, remove passt PID file
teardown_passt() {
- tmux send-keys -t ${PANE_GUEST} "C-c"
+ kill $(cat passt_qemu.pid)
pane_wait GUEST
rm passt.pid
}
@@ -311,7 +315,7 @@ teardown_pasta() {
# teardown_passt_in_ns() - Exit namespace, kill qemu and pasta, remove pid file
teardown_passt_in_ns() {
- tmux send-keys -t ${PANE_GUEST} "C-c"
+ kill $(cat passt_in_ns_qemu.pid)
pane_wait GUEST
tmux send-keys -t ${PANE_GUEST} "C-d"
@@ -326,11 +330,11 @@ teardown_passt_in_ns() {
# teardown_two_guests() - Exit namespaces, kill qemu processes, passt and pasta
teardown_two_guests() {
- tmux send-keys -t ${PANE_GUEST_1} "C-c"
+ kill $(cat two_guests_qemu_1.pid)
pane_wait GUEST_1
tmux send-keys -t ${PANE_GUEST_1} "C-d"
- tmux send-keys -t ${PANE_GUEST_2} "C-c"
+ kill $(cat two_guests_qemu_2.pid)
pane_wait GUEST_2
tmux send-keys -t ${PANE_GUEST_2} "C-d"
--
2.37.2
next prev parent reply other threads:[~2022-08-18 6:13 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-18 6:13 [PATCH 00/10] passt test fixes, batch 6 David Gibson
2022-08-18 6:13 ` [PATCH 01/10] test: Convert distro tests to use socat instead of nc/ncat David Gibson
2022-08-18 6:13 ` [PATCH 02/10] test: Split cppcheck and clang-tidy tests into different files David Gibson
2022-08-18 6:13 ` [PATCH 03/10] test: Remove unused *_XTERM variables David Gibson
2022-08-18 6:13 ` [PATCH 04/10] test: Ignore video processing temporary files David Gibson
2022-08-18 6:13 ` [PATCH 05/10] test: Split setup/teardown functions for build and distro tests David Gibson
2022-08-18 6:13 ` [PATCH 06/10] test: Only select a single interface or gateway in tests David Gibson
2022-08-18 6:13 ` [PATCH 07/10] test: Rename slightly misleading "valgrind" tests David Gibson
2022-08-18 6:13 ` [PATCH 08/10] test: Use shutdown test for pasta David Gibson
2022-08-18 6:13 ` [PATCH 09/10] test: Log debugging output from test script David Gibson
2022-08-18 6:13 ` David Gibson [this message]
2022-08-21 20:23 ` [PATCH 00/10] passt test fixes, batch 6 Stefano Brivio
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=20220818061358.1775944-11-david@gibson.dropbear.id.au \
--to=david@gibson.dropbear.id.au \
--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).