stress2: Fix cleanup of temporary files

This commit is contained in:
Peter Holm
2025-09-14 12:08:40 +02:00
parent a85525a5c8
commit ec7199bf3f
15 changed files with 26 additions and 25 deletions
+2 -2
View File
@@ -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
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
+5 -5
View File
@@ -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
+4 -4
View File
@@ -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
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
+1
View File
@@ -246,4 +246,5 @@ pkill -9 syzkaller13
wait
rm -f /tmp/syzkaller13 /tmp/syzkaller13.* /tmp/file0
rm -rf /tmp/syzkaller.*
exit 0
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
+4 -4
View File
@@ -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