git: 2f0baec1ecb2 - main - stress2: Fix cleanup after test run

From: Peter Holm <pho_at_FreeBSD.org>
Date: Wed, 13 Apr 2022 09:08:23 UTC
The branch main has been updated by pho:

URL: https://cgit.FreeBSD.org/src/commit/?id=2f0baec1ecb2e79cfb97a19e1bbfb27741365847

commit 2f0baec1ecb2e79cfb97a19e1bbfb27741365847
Author:     Peter Holm <pho@FreeBSD.org>
AuthorDate: 2022-04-13 09:07:49 +0000
Commit:     Peter Holm <pho@FreeBSD.org>
CommitDate: 2022-04-13 09:07:49 +0000

    stress2: Fix cleanup after test run
---
 tools/test/stress2/misc/force4.sh      | 2 +-
 tools/test/stress2/misc/syzkaller16.sh | 3 ++-
 tools/test/stress2/misc/syzkaller17.sh | 3 ++-
 tools/test/stress2/misc/syzkaller18.sh | 3 ++-
 tools/test/stress2/misc/syzkaller19.sh | 3 ++-
 5 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/tools/test/stress2/misc/force4.sh b/tools/test/stress2/misc/force4.sh
index b1b05dc54efa..72932aec1fe6 100755
--- a/tools/test/stress2/misc/force4.sh
+++ b/tools/test/stress2/misc/force4.sh
@@ -82,7 +82,7 @@ done
 sleep 1
 ../tools/killall.sh
 wait
-umount $mp2
+mount | grep -q "on $mp2 " && umount $mp2
 n=0
 while mount | grep $mntpoint | grep -q /dev/md; do
 	umount $mntpoint || sleep 1
diff --git a/tools/test/stress2/misc/syzkaller16.sh b/tools/test/stress2/misc/syzkaller16.sh
index 4ded2f61388f..8671b46474ac 100755
--- a/tools/test/stress2/misc/syzkaller16.sh
+++ b/tools/test/stress2/misc/syzkaller16.sh
@@ -410,7 +410,8 @@ mycc -o /tmp/syzkaller16 -Wall -Wextra -O0 -m32 /tmp/syzkaller16.c -pthread ||
 (cd ../testcases/swap; ./swap -t 1m -i 20 -h > /dev/null 2>&1) &
 (cd /tmp; ./syzkaller16) &
 sleep 60
-pkill -9 syzkaller16 swap
+pkill -9 syzkaller16
+while pkill swap; do sleep 1; done
 wait
 
 rm -f /tmp/syzkaller16 /tmp/syzkaller16.c /tmp/syzkaller16.core
diff --git a/tools/test/stress2/misc/syzkaller17.sh b/tools/test/stress2/misc/syzkaller17.sh
index 94b33771c59c..1e3f3ec2eb91 100755
--- a/tools/test/stress2/misc/syzkaller17.sh
+++ b/tools/test/stress2/misc/syzkaller17.sh
@@ -124,7 +124,8 @@ while pgrep -q swap; do
 	(cd /tmp; timeout 1m ./syzkaller17)
 	[ $((`date +%s` - start)) -ge 60 ] && break
 done
-pkill -9 syzkaller17 swap
+pkill -9 syzkaller17
+while pkill swap; do sleep 1; done
 wait
 
 rm -f /tmp/syzkaller17 /tmp/syzkaller17.c /tmp/syzkaller17.core
diff --git a/tools/test/stress2/misc/syzkaller18.sh b/tools/test/stress2/misc/syzkaller18.sh
index 12432d23bc65..6a1d41c33084 100755
--- a/tools/test/stress2/misc/syzkaller18.sh
+++ b/tools/test/stress2/misc/syzkaller18.sh
@@ -121,7 +121,8 @@ while pgrep -q swap; do
 	(cd /tmp; timeout 1m ./syzkaller18)
 	[ $((`date +%s` - start)) -ge 60 ] && break
 done
-pkill -9 syzkaller18 swap
+pkill -9 syzkaller18
+while pkill swap; do sleep 1; done
 wait
 
 rm -f /tmp/syzkaller18 /tmp/syzkaller18.c /tmp/syzkaller18.core
diff --git a/tools/test/stress2/misc/syzkaller19.sh b/tools/test/stress2/misc/syzkaller19.sh
index 651f444203e4..b36b12e524f2 100755
--- a/tools/test/stress2/misc/syzkaller19.sh
+++ b/tools/test/stress2/misc/syzkaller19.sh
@@ -164,7 +164,8 @@ mycc -o /tmp/syzkaller19 -Wall -Wextra -O2 /tmp/syzkaller19.c -lpthread ||
 (cd ../testcases/swap; ./swap -t 1m -i 20 -h > /dev/null 2>&1) &
 (cd /tmp; ./syzkaller19) &
 sleep 60
-pkill -9 syzkaller19 swap
+pkill -9 syzkaller19
+while pkill swap; do sleep 1; done
 wait
 
 rm -f /tmp/syzkaller19 /tmp/syzkaller19.c /tmp/syzkaller19.core