Signed-off-by: Coiby Xu coxu@redhat.com --- tests/scripts/testcases/nfs-kdump/0-server.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/scripts/testcases/nfs-kdump/0-server.sh b/tests/scripts/testcases/nfs-kdump/0-server.sh index 41a0212..cf54e70 100755 --- a/tests/scripts/testcases/nfs-kdump/0-server.sh +++ b/tests/scripts/testcases/nfs-kdump/0-server.sh @@ -17,7 +17,7 @@ on_build() { img_run_cmd "systemctl enable dnsmasq"
img_run_cmd 'echo DEVICE="eth0" > /etc/sysconfig/network-scripts/ifcfg-eth0' - img_run_cmd 'echo BOOTPROTO="none >> /etc/sysconfig/network-scripts/ifcfg-eth0"' + img_run_cmd 'echo BOOTPROTO="none" >> /etc/sysconfig/network-scripts/ifcfg-eth0' img_run_cmd 'echo ONBOOT="yes" >> /etc/sysconfig/network-scripts/ifcfg-eth0' img_run_cmd 'echo PREFIX="24" >> /etc/sysconfig/network-scripts/ifcfg-eth0' img_run_cmd 'echo IPADDR="192.168.77.1" >> /etc/sysconfig/network-scripts/ifcfg-eth0'
qemu is launched in nested subprocess and can't be killed by simply killing the job ids,
PID Command 2269634 │ ├─ sshd: root [priv] 2269637 │ │ └─ sshd: root@pts/0 2269638 │ │ └─ -bash 2269744 │ │ └─ make test-run V=1 2273117 │ │ └─ /bin/bash /root/kexec-tools-300/tests/scripts/run-test.sh 2273712 │ │ ├─ /bin/bash /root/kexec-tools-300/tests/scripts/run-test.sh 2273714 │ │ │ └─ /bin/bash /root/kexec-tools-300/tests/scripts/run-test.sh 2273737 │ │ │ └─ timeout --foreground 10m /root/kexec-tools-300/tests/scripts/run-qemu -nodefaults -nographic -smp 2 -m 768M -monitor no 2273738 │ │ │ └─ /usr/bin/qemu-system-x86_64 -enable-kvm -cpu host -nodefaults -nographic -smp 2 -m 768M -monitor none -serial stdio 2273746 │ │ │ ├─ /usr/bin/qemu-system-x86_64 -enable-kvm -cpu host -nodefaults -nographic -smp 2 -m 768M -monitor none -serial std 2273797 │ │ ├─ /bin/bash /root/kexec-tools-300/tests/scripts/run-test.sh 2273798 │ │ │ └─ /bin/bash /root/kexec-tools-300/tests/scripts/run-test.sh 2273831 │ │ │ └─ timeout --foreground 10m /root/kexec-tools-300/tests/scripts/run-qemu -nodefaults -nographic -smp 2 -m 768M -monitor no 2273832 │ │ │ └─ /usr/bin/qemu-system-x86_64 -enable-kvm -cpu host -nodefaults -nographic -smp 2 -m 768M -monitor none -serial stdio 2273840 │ │ │ ├─ /usr/bin/qemu-system-x86_64 -enable-kvm -cpu host -nodefaults -nographic -smp 2 -m 768M -monitor none -serial std
This patch will kill qemu by killing all the children of the job id.
Signed-off-by: Coiby Xu coxu@redhat.com --- tests/scripts/run-test.sh | 9 +++++++-- tests/scripts/test-lib.sh | 3 +-- 2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/tests/scripts/run-test.sh b/tests/scripts/run-test.sh index a68504d..51c785c 100755 --- a/tests/scripts/run-test.sh +++ b/tests/scripts/run-test.sh @@ -3,7 +3,12 @@ _kill_all_jobs() { local _jobs=$(jobs -r -p)
- [ -n "$_jobs" ] && kill $_jobs + if [ -n "$_jobs" ]; then + for job in `echo $_jobs` + do + kill $(pstree $job -p -a -l | cut -d, -f2 | cut -d' ' -f1) + done + fi }
trap ' @@ -121,7 +126,7 @@ for test_case in $testcases; do
[ $? -ne 0 ] && ret=$(expr $ret + 1) results[$test_case]="$res" - + _kill_all_jobs echo -e "-------- Test finished: $test_case $res --------" for script in $scripts; do script="$testdir/$script" diff --git a/tests/scripts/test-lib.sh b/tests/scripts/test-lib.sh index f8a2249..8b24b2a 100644 --- a/tests/scripts/test-lib.sh +++ b/tests/scripts/test-lib.sh @@ -146,8 +146,7 @@ watch_test_outputs() { ret=$?
if [ $ret -ne 255 ]; then - # Test finished, kill VMs - kill $(jobs -p) + # Test finished break 2 fi done