git: ec7199bf3ffb - main - stress2: Fix cleanup of temporary files
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 14 Sep 2025 10:09:19 UTC
The branch main has been updated by pho:
URL: https://cgit.FreeBSD.org/src/commit/?id=ec7199bf3ffb73d43ce834d6cada2efe37cb4f56
commit ec7199bf3ffb73d43ce834d6cada2efe37cb4f56
Author: Peter Holm <pho@FreeBSD.org>
AuthorDate: 2025-09-14 10:08:40 +0000
Commit: Peter Holm <pho@FreeBSD.org>
CommitDate: 2025-09-14 10:08:40 +0000
stress2: Fix cleanup of temporary files
---
tools/test/stress2/misc/beneath4.sh | 4 ++--
tools/test/stress2/misc/kevent16.sh | 2 +-
tools/test/stress2/misc/maxproc.sh | 2 +-
tools/test/stress2/misc/mmap43.sh | 2 +-
tools/test/stress2/misc/nfs_halfpage.sh | 10 +++++-----
tools/test/stress2/misc/nfs_halfpage2.sh | 8 ++++----
tools/test/stress2/misc/nullfs29.sh | 2 +-
tools/test/stress2/misc/setrlimit2.sh | 2 +-
tools/test/stress2/misc/sigreturn3.sh | 2 +-
tools/test/stress2/misc/sigreturn4.sh | 2 +-
tools/test/stress2/misc/syzkaller13.sh | 1 +
tools/test/stress2/misc/syzkaller21.sh | 2 +-
tools/test/stress2/misc/syzkaller73.sh | 2 +-
tools/test/stress2/misc/syzkaller74.sh | 2 +-
tools/test/stress2/misc/temp.sh | 8 ++++----
15 files changed, 26 insertions(+), 25 deletions(-)
diff --git a/tools/test/stress2/misc/beneath4.sh b/tools/test/stress2/misc/beneath4.sh
index 48458f088a96..3ba448cd06c7 100755
--- a/tools/test/stress2/misc/beneath4.sh
+++ b/tools/test/stress2/misc/beneath4.sh
@@ -88,7 +88,7 @@ main(int argc, char *argv[])
warn("cwd=%s, top=%s. flag=%0.6x. fstatf(%s) = %2d (expect %2d). %4s",
cwd, dir, flag, obj, r, exp, s);
- return (r == exp ? 0 : errno);
+ return (r != exp);
}
EOF
cc -o beneath4 -Wall -Wextra -O2 -g beneath4.c || exit 1
@@ -129,5 +129,5 @@ $dir/beneath4 $top $top/.. 0x2000 93 || s=1
$dir/beneath4 $top ../a 0x2000 93 || s=1
printf "\nNo flag\n"
$dir/beneath4 $top ../a 0x0000 0 || s=1
-rm -rf $top
+rm -rf $dir
exit $s
diff --git a/tools/test/stress2/misc/kevent16.sh b/tools/test/stress2/misc/kevent16.sh
index 23dd222821da..58a8f6971c21 100755
--- a/tools/test/stress2/misc/kevent16.sh
+++ b/tools/test/stress2/misc/kevent16.sh
@@ -88,5 +88,5 @@ cc -o /tmp/kevent16 -Wall -Wextra -O2 /tmp/kevent16.c || exit 1
/tmp/kevent16; s=$?
-rm -f /tmp/kevent16.c kevent16 kevent16.core
+rm -f /tmp/kevent16.c /tmp/kevent16 kevent16.core
exit $s
diff --git a/tools/test/stress2/misc/maxproc.sh b/tools/test/stress2/misc/maxproc.sh
index c425c307e06b..0574def8a605 100755
--- a/tools/test/stress2/misc/maxproc.sh
+++ b/tools/test/stress2/misc/maxproc.sh
@@ -32,12 +32,12 @@
. ../default.cfg
+[ `sysctl -n kern.maxproc` -gt 37028 ] && exit 0 # Excessive run time
here=`pwd`
cd /tmp
sed '1,/^EOF/d' < $here/$0 > maxproc.c
mycc -o maxproc -Wall -Wextra maxproc.c -lkvm || exit 1
rm -f maxproc.c
-[ `sysctl -n kern.maxproc` -gt 37028 ] && exit 0 # Excessive run time
cd $here
/tmp/maxproc
diff --git a/tools/test/stress2/misc/mmap43.sh b/tools/test/stress2/misc/mmap43.sh
index 8508d5865aef..424e189b8b84 100755
--- a/tools/test/stress2/misc/mmap43.sh
+++ b/tools/test/stress2/misc/mmap43.sh
@@ -180,7 +180,7 @@ cd $here
umount $mntpoint
mdconfig -d -u $mdstart
-rm /tmp/$prog /tmp/$prog.c /tmp/$prog.sort
+rm /tmp/$prog /tmp/$prog.c /tmp/$prog.sort /tmp/$prog.serial.c /tmp/$prog.serial $log
[ $s -eq 0 ] &&
printf "OK File size is %9d, tail is %4d bytes. (%3d loops)\n" $size $tail $counter ||
printf "FAIL File size is %9d, tail is %4d bytes. (%3d loops)\n" $size $tail $counter
diff --git a/tools/test/stress2/misc/nfs_halfpage.sh b/tools/test/stress2/misc/nfs_halfpage.sh
index 8d02ca8ebbcf..b2f606e9607b 100755
--- a/tools/test/stress2/misc/nfs_halfpage.sh
+++ b/tools/test/stress2/misc/nfs_halfpage.sh
@@ -35,6 +35,11 @@
# https://reviews.freebsd.org/D11697
# Committed as r321580 + r321581.
+[ -z "$nfs_export" ] && exit 0
+ping -c 2 `echo $nfs_export | sed 's/:.*//'` > /dev/null 2>&1 ||
+ exit 0
+
+mount | grep "$mntpoint" | grep -q nfs && umount $mntpoint
dir=/tmp
odir=`pwd`
cd $dir
@@ -43,11 +48,6 @@ mycc -o nfs_halfpage -Wall -Wextra -O0 -g nfs_halfpage.c || exit 1
rm -f nfs_halfpage.c
cd $odir
-[ -z "$nfs_export" ] && exit 0
-ping -c 2 `echo $nfs_export | sed 's/:.*//'` > /dev/null 2>&1 ||
- exit 0
-
-mount | grep "$mntpoint" | grep -q nfs && umount $mntpoint
mount -t nfs -o tcp -o retrycnt=3 -o intr,soft -o rw $nfs_export $mntpoint
file=$mntpoint/nfs_halfpage.file
diff --git a/tools/test/stress2/misc/nfs_halfpage2.sh b/tools/test/stress2/misc/nfs_halfpage2.sh
index b916531c7a9d..8ca907f25e09 100755
--- a/tools/test/stress2/misc/nfs_halfpage2.sh
+++ b/tools/test/stress2/misc/nfs_halfpage2.sh
@@ -35,6 +35,10 @@
# https://reviews.freebsd.org/D11697
# Committed as r321580 + r321581.
+[ -z "$nfs_export" ] && exit 0
+ping -c 2 `echo $nfs_export | sed 's/:.*//'` > /dev/null 2>&1 ||
+ exit 0
+
dir=/tmp
odir=`pwd`
cd $dir
@@ -43,10 +47,6 @@ mycc -o nfs_halfpage -Wall -Wextra -O0 -g nfs_halfpage.c || exit 1
rm -f nfs_halfpage.c
cd $odir
-[ -z "$nfs_export" ] && exit 0
-ping -c 2 `echo $nfs_export | sed 's/:.*//'` > /dev/null 2>&1 ||
- exit 0
-
mount | grep "$mntpoint" | grep -q nfs && umount $mntpoint
mount -t nfs -o tcp -o retrycnt=3 -o intr,soft -o rw $nfs_export $mntpoint
diff --git a/tools/test/stress2/misc/nullfs29.sh b/tools/test/stress2/misc/nullfs29.sh
index aa606fd5f526..977e3c087523 100755
--- a/tools/test/stress2/misc/nullfs29.sh
+++ b/tools/test/stress2/misc/nullfs29.sh
@@ -73,5 +73,5 @@ while mount | grep $mp1 | grep -q /dev/md; do
[ $n -gt 30 ] && { echo FAIL; s=2; }
done
mdconfig -d -u $mdstart
-rm -f /tmp/nullfs29.c
+rm -f /tmp/nullfs29.c /tmp/nullfs29
exit $s
diff --git a/tools/test/stress2/misc/setrlimit2.sh b/tools/test/stress2/misc/setrlimit2.sh
index 4eea25ef3ee4..8c717fe72458 100755
--- a/tools/test/stress2/misc/setrlimit2.sh
+++ b/tools/test/stress2/misc/setrlimit2.sh
@@ -114,5 +114,5 @@ h1=`md5 < $data`
./setrlimit2 $data
h2=`md5 < $data`
-rm -f /tmp/setrlimit2 /tmp/setrlimit2.c
+rm -f /tmp/setrlimit2 /tmp/setrlimit2.c $data
[ $h1 = $h2 ] && exit 1 || exit 0
diff --git a/tools/test/stress2/misc/sigreturn3.sh b/tools/test/stress2/misc/sigreturn3.sh
index 271ade287e9a..a2d865b73847 100755
--- a/tools/test/stress2/misc/sigreturn3.sh
+++ b/tools/test/stress2/misc/sigreturn3.sh
@@ -177,5 +177,5 @@ start=`date +%s`
while [ $((`date +%s` - start)) -lt 300 ]; do
./$prog > /dev/null 2>&1
done
-rm -f /tmp/$prog /tmp/$ptog.c /tmp/$prog.core
+rm -f /tmp/$prog /tmp/$prog.c /tmp/$prog.core
exit 0
diff --git a/tools/test/stress2/misc/sigreturn4.sh b/tools/test/stress2/misc/sigreturn4.sh
index 9e2a6a32715c..c77140de0518 100755
--- a/tools/test/stress2/misc/sigreturn4.sh
+++ b/tools/test/stress2/misc/sigreturn4.sh
@@ -203,5 +203,5 @@ start=`date +%s`
while [ $((`date +%s` - start)) -lt 300 ]; do
./$prog > /dev/null 2>&1
done
-rm -f /tmp/$prog /tmp/$ptog.c /tmp/$prog.core
+rm -f /tmp/$prog /tmp/$prog.c /tmp/$prog.core
exit 0
diff --git a/tools/test/stress2/misc/syzkaller13.sh b/tools/test/stress2/misc/syzkaller13.sh
index 9b46ebd290af..fe15652b0a25 100755
--- a/tools/test/stress2/misc/syzkaller13.sh
+++ b/tools/test/stress2/misc/syzkaller13.sh
@@ -246,4 +246,5 @@ pkill -9 syzkaller13
wait
rm -f /tmp/syzkaller13 /tmp/syzkaller13.* /tmp/file0
+rm -rf /tmp/syzkaller.*
exit 0
diff --git a/tools/test/stress2/misc/syzkaller21.sh b/tools/test/stress2/misc/syzkaller21.sh
index 3a7eeb05ef6c..07eef4bc5861 100755
--- a/tools/test/stress2/misc/syzkaller21.sh
+++ b/tools/test/stress2/misc/syzkaller21.sh
@@ -398,6 +398,6 @@ if pgrep -q syzkaller21; then
fi
wait
-rm -rf /tmp/syzkaller21.*
+rm -rf /tmp/syzkaller21.* /tmp/syzkaller.*
rm -f /tmp/syzkaller21
exit 0
diff --git a/tools/test/stress2/misc/syzkaller73.sh b/tools/test/stress2/misc/syzkaller73.sh
index 776ace385f21..fa07dc7ff26f 100755
--- a/tools/test/stress2/misc/syzkaller73.sh
+++ b/tools/test/stress2/misc/syzkaller73.sh
@@ -533,5 +533,5 @@ done
while pkill swap; do :; done
wait
-rm -rf /tmp/$prog /tmp/$prog.c /tmp/$prog.core
+rm -rf /tmp/$prog /tmp/$prog.c /tmp/$prog.core /tmp/syzkaller.*
exit 0
diff --git a/tools/test/stress2/misc/syzkaller74.sh b/tools/test/stress2/misc/syzkaller74.sh
index 886c6047585b..0c2b4e1d5325 100755
--- a/tools/test/stress2/misc/syzkaller74.sh
+++ b/tools/test/stress2/misc/syzkaller74.sh
@@ -465,5 +465,5 @@ mycc -o /tmp/$prog -Wall -Wextra -O0 /tmp/$prog.c -lpthread || exit 1
cd /tmp
timeout 3m /tmp/$prog > /dev/null 2>&1
-rm -rf /tmp/$prog /tmp/$prog.c /tmp/$prog.core /tmp/$prog.??????
+rm -rf /tmp/$prog /tmp/$prog.c /tmp/$prog.core /tmp/$prog.?????? /tmp/syzkaller.*
exit 0
diff --git a/tools/test/stress2/misc/temp.sh b/tools/test/stress2/misc/temp.sh
index 5c1a73cd18e1..4cddd48079ec 100755
--- a/tools/test/stress2/misc/temp.sh
+++ b/tools/test/stress2/misc/temp.sh
@@ -32,6 +32,10 @@
. ../default.cfg
[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1
+[ -z "$nfs_export" ] && exit 0
+ping -c 2 `echo $nfs_export | sed 's/:.*//'` > /dev/null 2>&1 ||
+ exit 0
+
export LANG=C
dir=/tmp
odir=`pwd`
@@ -41,10 +45,6 @@ mycc -o temp -Wall -Wextra -O0 -g temp.c || exit 1
rm -f temp.c
cd $odir
-[ -z "$nfs_export" ] && exit 0
-ping -c 2 `echo $nfs_export | sed 's/:.*//'` > /dev/null 2>&1 ||
- exit 0
-
mount | grep "on $mntpoint " | grep -q nfs && umount $mntpoint
mount -t nfs -o tcp -o retrycnt=3 -o soft -o rw $nfs_export $mntpoint
mp2=$mntpoint/temp.`jot -rc 8 a z | tr -d '\n'`/temp.dir