stress2: Change fixed number of test loops to timed loops. This to

improve testing with qemu.
This commit is contained in:
Peter Holm 2024-06-04 09:39:40 +02:00
parent e425e601b9
commit 005dd61dd6
15 changed files with 49 additions and 24 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 &) > \

View File

@ -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

View File

@ -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");

View File

@ -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

View File

@ -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);

View File

@ -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

View File

@ -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

View File

@ -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);

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 /