git: 005dd61dd6d6 - main - stress2: Change fixed number of test loops to timed loops. This to improve testing with qemu.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 04 Jun 2024 07:40:09 UTC
The branch main has been updated by pho: URL: https://cgit.FreeBSD.org/src/commit/?id=005dd61dd6d64a60bb01c27319cd457302e20aee commit 005dd61dd6d64a60bb01c27319cd457302e20aee Author: Peter Holm <pho@FreeBSD.org> AuthorDate: 2024-06-04 07:39:40 +0000 Commit: Peter Holm <pho@FreeBSD.org> CommitDate: 2024-06-04 07:39:40 +0000 stress2: Change fixed number of test loops to timed loops. This to improve testing with qemu. --- tools/test/stress2/misc/crossmp.sh | 3 ++- tools/test/stress2/misc/crossmp2.sh | 3 ++- tools/test/stress2/misc/crossmp5.sh | 5 ++++- tools/test/stress2/misc/crossmp6.sh | 3 ++- tools/test/stress2/misc/crossmp7.sh | 3 ++- tools/test/stress2/misc/flock_open_close.sh | 7 +++++-- tools/test/stress2/misc/gnop2.sh | 2 ++ tools/test/stress2/misc/mmap5.sh | 14 ++++++++------ tools/test/stress2/misc/procfs.sh | 3 ++- tools/test/stress2/misc/rename3.sh | 3 ++- tools/test/stress2/misc/rename7.sh | 6 ++++-- tools/test/stress2/misc/tmpfs2.sh | 6 ++++-- tools/test/stress2/misc/umountf4.sh | 6 ++++-- tools/test/stress2/misc/umountf6.sh | 6 ++++-- tools/test/stress2/misc/vunref.sh | 3 ++- 15 files changed, 49 insertions(+), 24 deletions(-) diff --git a/tools/test/stress2/misc/crossmp.sh b/tools/test/stress2/misc/crossmp.sh index 0bd07cea2aaf..b61506dcc477 100755 --- a/tools/test/stress2/misc/crossmp.sh +++ b/tools/test/stress2/misc/crossmp.sh @@ -74,7 +74,8 @@ else else # The test: Parallel mount and unmounts - for i in `jot 1024`; do + start=`date +%s` + while [ $((`date +%s`- start)) -lt 300 ]; do m=$1 mount /dev/md${m} ${mntpoint}$m while mount | grep -q "on ${mntpoint}$m "; do diff --git a/tools/test/stress2/misc/crossmp2.sh b/tools/test/stress2/misc/crossmp2.sh index 03cd04e077c1..1f2f1a921e10 100755 --- a/tools/test/stress2/misc/crossmp2.sh +++ b/tools/test/stress2/misc/crossmp2.sh @@ -67,7 +67,8 @@ else else # The test: Parallel mount and unmounts - for i in `jot 128`; do + start=`date +%s` + while [ $((`date +%s`- start)) -lt 300 ]; do m=$1 mount -t nfs -o tcp -o nfsv3 -o retrycnt=3 \ -o intr,soft -o rw $nfs_export ${mntpoint}$m diff --git a/tools/test/stress2/misc/crossmp5.sh b/tools/test/stress2/misc/crossmp5.sh index b5a8304f2dcb..038dea7ebe4f 100755 --- a/tools/test/stress2/misc/crossmp5.sh +++ b/tools/test/stress2/misc/crossmp5.sh @@ -74,8 +74,10 @@ else done else # The test: Parallel mount and unmount + i=0 m=$1 - for i in `jot 200`; do + start=`date +%s` + while [ $((`date +%s`- start)) -lt 300 ]; do mount /dev/md${m} ${mntpoint}$m chmod 777 ${mntpoint}$m l=`jot -r 1 65535` @@ -88,6 +90,7 @@ else echo "-f") umount $opt ${mntpoint}$m > /dev/null 2>&1 done + i=$((i + 1)) done rm -f /tmp/crossmp.continue fi diff --git a/tools/test/stress2/misc/crossmp6.sh b/tools/test/stress2/misc/crossmp6.sh index 92ca0abcba27..d5abd27f99f1 100755 --- a/tools/test/stress2/misc/crossmp6.sh +++ b/tools/test/stress2/misc/crossmp6.sh @@ -72,7 +72,8 @@ if [ $# -eq 0 ]; then exit 0 else if [ $1 = find ]; then - for i in `jot 128`; do + start=`date +%s` + while [ $((`date +%s`- start)) -lt 300 ]; do find ${mntpoint}* -maxdepth 1 -type f > \ /dev/null 2>&1 (lockf -t 10 ${mntpoint}$2/$0.$$.$i sleep 1 &) > \ diff --git a/tools/test/stress2/misc/crossmp7.sh b/tools/test/stress2/misc/crossmp7.sh index c2c2752f38e7..f4f12e64c35f 100755 --- a/tools/test/stress2/misc/crossmp7.sh +++ b/tools/test/stress2/misc/crossmp7.sh @@ -91,7 +91,8 @@ else else # The test: Parallel mount and unmounts m=$1 - for i in `jot 1024`; do + start=`date +%s` + while [ $((`date +%s`- start)) -lt 300 ]; do zfs mount stress2_tank/test$m zfs umount -f stress2_tank/test$m done 2>/dev/null diff --git a/tools/test/stress2/misc/flock_open_close.sh b/tools/test/stress2/misc/flock_open_close.sh index 01e376319abe..39b894da8a63 100755 --- a/tools/test/stress2/misc/flock_open_close.sh +++ b/tools/test/stress2/misc/flock_open_close.sh @@ -87,6 +87,7 @@ EOF #include <fcntl.h> #include <stdio.h> #include <stdlib.h> +#include <time.h> #include <unistd.h> static void @@ -135,7 +136,8 @@ main(int ac, char **av) { struct stat sb; pid_t pid; - int e, i, status; + time_t start; + int e, status; if (ac < 2) usage(); @@ -150,7 +152,8 @@ main(int ac, char **av) if (pid == 0) child(av[1]); e = 0; - for (i = 0; i < 200000; i++) { + start = time(NULL); + while (time(NULL) - start < 150) { pid = fork(); if (pid < 0) err(1, "vfork"); diff --git a/tools/test/stress2/misc/gnop2.sh b/tools/test/stress2/misc/gnop2.sh index d38754d58456..0a6b830ce749 100755 --- a/tools/test/stress2/misc/gnop2.sh +++ b/tools/test/stress2/misc/gnop2.sh @@ -71,8 +71,10 @@ test() { gnop status || exit 1 +start=`date +%s` for i in 1k 2k 4k 8k; do test $i + [ $((`date +%s` - start)) -gt 1200 ] && break done [ $notloaded ] && gnop unload diff --git a/tools/test/stress2/misc/mmap5.sh b/tools/test/stress2/misc/mmap5.sh index e6dee6d551de..c7369118e0e2 100755 --- a/tools/test/stress2/misc/mmap5.sh +++ b/tools/test/stress2/misc/mmap5.sh @@ -52,15 +52,16 @@ rm -f /tmp/mmap5 /tmp/mmap5.inputfile exit EOF -#include <err.h> -#include <errno.h> -#include <stdlib.h> +#include <sys/param.h> #include <sys/fcntl.h> #include <sys/mman.h> -#include <sys/param.h> #include <sys/stat.h> #include <sys/types.h> #include <sys/wait.h> +#include <err.h> +#include <errno.h> +#include <stdlib.h> +#include <time.h> #include <unistd.h> const char *file; @@ -113,13 +114,14 @@ test(void) int main(int argc, char *argv[]) { - int i; + time_t start; if (argc != 2) errx(1, "Usage: %s <file>", argv[0]); file = argv[1]; - for (i = 0; i < 30000; i++) { + start = time(NULL); + while (time(NULL) - start < 120) { if (fork() == 0) test(); wait(NULL); diff --git a/tools/test/stress2/misc/procfs.sh b/tools/test/stress2/misc/procfs.sh index 6b445b0d7e48..a59235c6d521 100755 --- a/tools/test/stress2/misc/procfs.sh +++ b/tools/test/stress2/misc/procfs.sh @@ -56,7 +56,8 @@ else else # The test: Parallel mount and unmounts - for i in `jot 128`; do + start=`date +%s` + while [ $((`date +%s`- start)) -lt 300 ]; do m=$1 mount -t procfs proc ${mntpoint}$m while mount | grep -qw $mntpoint$m; do diff --git a/tools/test/stress2/misc/rename3.sh b/tools/test/stress2/misc/rename3.sh index c7ce91f0d359..aa4a3754bfab 100755 --- a/tools/test/stress2/misc/rename3.sh +++ b/tools/test/stress2/misc/rename3.sh @@ -36,7 +36,8 @@ # Test scenario by Tor Egge root=/tmp -for i in `jot 10000`; do +start=`date +%s` +while [ $((`date +%s` - start)) -lt 60 ]; do rm -rf $root/a mkdir -p $root/a/b/c/d/e/f/g mkdir -p $root/a/b/c/d/e/f/z diff --git a/tools/test/stress2/misc/rename7.sh b/tools/test/stress2/misc/rename7.sh index 9f6954916411..fdaa8f575117 100755 --- a/tools/test/stress2/misc/rename7.sh +++ b/tools/test/stress2/misc/rename7.sh @@ -122,7 +122,8 @@ int main(void) { pid_t wpid, spid; - int e, fd, i, status; + time_t start; + int e, fd, status; if ((wpid = fork()) == 0) r1(); @@ -132,7 +133,8 @@ main(void) setproctitle("main"); e = 0; - for (i = 0; i < 800000; i++) { + start = time(NULL); + while (time(NULL) - start < 60) { if ((fd = open(logfile, O_RDWR | O_CREAT | O_TRUNC, 0644)) == -1) warn("creat(%s)", logfile); close(fd); diff --git a/tools/test/stress2/misc/tmpfs2.sh b/tools/test/stress2/misc/tmpfs2.sh index 80885c331e14..09a2cfd68266 100755 --- a/tools/test/stress2/misc/tmpfs2.sh +++ b/tools/test/stress2/misc/tmpfs2.sh @@ -45,13 +45,15 @@ if [ $# -eq 0 ]; then else if [ $1 = find ]; then - for i in `jot 1024`; do + start=`date +%s` + while [ $((`date +%s`- start)) -lt 300 ]; do find ${mntpoint}* -type f > /dev/null 2>&1 done else # The test: Parallel mount and unmounts - for i in `jot 1024`; do + start=`date +%s` + while [ $((`date +%s`- start)) -lt 300 ]; do m=$1 opt=`[ $(( m % 2 )) -eq 0 ] && echo -f` mount -t tmpfs tmpfs ${mntpoint}$m diff --git a/tools/test/stress2/misc/umountf4.sh b/tools/test/stress2/misc/umountf4.sh index 4f5ea0fff660..e26555e7c6f3 100755 --- a/tools/test/stress2/misc/umountf4.sh +++ b/tools/test/stress2/misc/umountf4.sh @@ -65,13 +65,15 @@ if [ $# -eq 0 ]; then else if [ $1 = find ]; then - for i in `jot 100`; do + start=`date +%s` + while [ $((`date +%s`- start)) -lt 300 ]; do find ${mntpoint}* -type f > /dev/null 2>&1 done else # The test: Parallel mount and unmounts - for i in `jot 100`; do + start=`date +%s` + while [ $((`date +%s`- start)) -lt 300 ]; do m=$1 opt=`[ $(( m % 2 )) -eq 0 ] && echo -f` mount $opt /dev/md${m} ${mntpoint}$m diff --git a/tools/test/stress2/misc/umountf6.sh b/tools/test/stress2/misc/umountf6.sh index aeb4454ea69c..628342689b38 100755 --- a/tools/test/stress2/misc/umountf6.sh +++ b/tools/test/stress2/misc/umountf6.sh @@ -65,13 +65,15 @@ if [ $# -eq 0 ]; then else if [ $1 = find ]; then - for i in `jot 100`; do + start=`date +%s` + while [ $((`date +%s`- start)) -lt 300 ]; do find ${mntpoint}* -type f > /dev/null 2>&1 done else # The test: Parallel mount and unmounts - for i in `jot 100`; do + start=`date +%s` + while [ $((`date +%s`- start)) -lt 300 ]; do m=$1 opt=`[ $(( m % 2 )) -eq 0 ] && echo -f` mount $opt /dev/md${m} ${mntpoint}$m diff --git a/tools/test/stress2/misc/vunref.sh b/tools/test/stress2/misc/vunref.sh index f844a0dd3625..f08035a95694 100755 --- a/tools/test/stress2/misc/vunref.sh +++ b/tools/test/stress2/misc/vunref.sh @@ -82,7 +82,8 @@ if [ $# -eq 0 ]; then else if [ $1 = mmap ]; then touch $RUNDIR/active.$2 - for i in `jot 500`; do + start=`date +%s` + while [ $((`date +%s`- start)) -lt 300 ]; do cd ${mntpoint}$2 /tmp/vunref > /dev/null 2>&1 cd /