Skip to content

Commit

Permalink
stress2: Change fixed number of test loops to timed loops. This to
Browse files Browse the repository at this point in the history
improve testing with qemu.
  • Loading branch information
phoatfreebsd committed Jun 4, 2024
1 parent e425e60 commit 005dd61
Show file tree
Hide file tree
Showing 15 changed files with 49 additions and 24 deletions.
3 changes: 2 additions & 1 deletion tools/test/stress2/misc/crossmp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion tools/test/stress2/misc/crossmp2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion tools/test/stress2/misc/crossmp5.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand All @@ -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
Expand Down
3 changes: 2 additions & 1 deletion tools/test/stress2/misc/crossmp6.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 &) > \
Expand Down
3 changes: 2 additions & 1 deletion tools/test/stress2/misc/crossmp7.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 5 additions & 2 deletions tools/test/stress2/misc/flock_open_close.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ EOF
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>

static void
Expand Down Expand Up @@ -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();
Expand All @@ -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");
Expand Down
2 changes: 2 additions & 0 deletions tools/test/stress2/misc/gnop2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 8 additions & 6 deletions tools/test/stress2/misc/mmap5.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion tools/test/stress2/misc/procfs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion tools/test/stress2/misc/rename3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions tools/test/stress2/misc/rename7.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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);
Expand Down
6 changes: 4 additions & 2 deletions tools/test/stress2/misc/tmpfs2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions tools/test/stress2/misc/umountf4.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions tools/test/stress2/misc/umountf6.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion tools/test/stress2/misc/vunref.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 /
Expand Down

0 comments on commit 005dd61

Please sign in to comment.