xref: /freebsd/tools/test/stress2/misc/pfl4.sh (revision 608c97bff921c8936eb71f4b1a177625cfa60250)
18a272653SPeter Holm#!/bin/sh
28a272653SPeter Holm
38a272653SPeter Holm#
48a272653SPeter Holm# Copyright (c) 2017 Dell EMC Isilon
58a272653SPeter Holm# All rights reserved.
68a272653SPeter Holm#
78a272653SPeter Holm# Redistribution and use in source and binary forms, with or without
88a272653SPeter Holm# modification, are permitted provided that the following conditions
98a272653SPeter Holm# are met:
108a272653SPeter Holm# 1. Redistributions of source code must retain the above copyright
118a272653SPeter Holm#    notice, this list of conditions and the following disclaimer.
128a272653SPeter Holm# 2. Redistributions in binary form must reproduce the above copyright
138a272653SPeter Holm#    notice, this list of conditions and the following disclaimer in the
148a272653SPeter Holm#    documentation and/or other materials provided with the distribution.
158a272653SPeter Holm#
168a272653SPeter Holm# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
178a272653SPeter Holm# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
188a272653SPeter Holm# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
198a272653SPeter Holm# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
208a272653SPeter Holm# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
218a272653SPeter Holm# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
228a272653SPeter Holm# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
238a272653SPeter Holm# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
248a272653SPeter Holm# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
258a272653SPeter Holm# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
268a272653SPeter Holm# SUCH DAMAGE.
278a272653SPeter Holm#
288a272653SPeter Holm
298a272653SPeter Holm# "panic: invalid queue 255" seen:
308a272653SPeter Holm# https://people.freebsd.org/~pho/stress/log/pfl4.txt
318a272653SPeter Holm
328a272653SPeter Holm. ../default.cfg
338a272653SPeter Holm[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1
348a272653SPeter Holm[ $((`sysctl -n hw.usermem` / 1024 / 1024 / 1024)) -le 8 ] && exit 0
358a272653SPeter Holm
368a272653SPeter Holmmounts=4
378a272653SPeter Holmnewfs_flags=""
388a272653SPeter Holm
398a272653SPeter Holmexport runRUNTIME=10m
408a272653SPeter Holmexport LOAD=80
418a272653SPeter Holmexport symlinkLOAD=80
428a272653SPeter Holmexport rwLOAD=80
438a272653SPeter Holmexport TESTPROGS="
448a272653SPeter Holmtestcases/lockf2/lockf2
458a272653SPeter Holmtestcases/symlink/symlink
468a272653SPeter Holmtestcases/openat/openat
478a272653SPeter Holmtestcases/rw/rw
488a272653SPeter Holmtestcases/fts/fts
498a272653SPeter Holmtestcases/link/link
508a272653SPeter Holmtestcases/lockf/lockf
518a272653SPeter Holmtestcases/creat/creat
528a272653SPeter Holmtestcases/mkdir/mkdir
538a272653SPeter Holmtestcases/rename/rename
548a272653SPeter Holmtestcases/mkfifo/mkfifo
558a272653SPeter Holm"
568a272653SPeter Holm
578a272653SPeter Holmprefix=$mntpoint
588a272653SPeter Holmstart=$mdstart
598a272653SPeter Holmfor i in `jot $mounts $start`; do
608a272653SPeter Holm	mdstart=$i
618a272653SPeter Holm	mntpoint=${prefix}$i
628a272653SPeter Holm	[ -d $mntpoint ] || mkdir -p $mntpoint
638a272653SPeter Holm
648a272653SPeter Holm	mount | grep "on $mntpoint " | grep -q /dev/md && umount -f $mntpoint
658a272653SPeter Holm	mdconfig -a -t swap -s 2g -u $mdstart
66*608c97bfSPeter Holm	newfs $newfs_flags md$mdstart > /dev/null
67*608c97bfSPeter Holm	mount /dev/md$mdstart $mntpoint
688a272653SPeter Holm	chmod 777 $mntpoint
698a272653SPeter Holm
708a272653SPeter Holm	export RUNDIR=$mntpoint/stressX
718a272653SPeter Holm	export CTRLDIR=$mntpoint/stressX.control
728a272653SPeter Holm	set `df -ik $mntpoint | tail -1 | awk '{print $4,$7}'`
738a272653SPeter Holm	export KBLOCKS=$(($1 / 1))
748a272653SPeter Holm	export INODES=$(($2 / 1))
758a272653SPeter Holm	su $testuser -c 'sleep 2; cd ..; ./testcases/run/run $TESTPROGS' > \
768a272653SPeter Holm	    /dev/null 2>&1 &
778a272653SPeter Holmdone
788a272653SPeter Holmsu $testuser -c "sleep 2; cd ..; ./testcases/swap/swap -t 10m -i 20" &
798a272653SPeter Holm
808a272653SPeter Holmwait
818a272653SPeter Holm
828a272653SPeter Holms=0
838a272653SPeter Holmfor i in `jot $mounts $start`; do
848a272653SPeter Holm	mdstart=$i
858a272653SPeter Holm	mntpoint=${prefix}$i
868a272653SPeter Holm	n=0
878a272653SPeter Holm	while mount | grep -q "on $mntpoint "; do
88bfdcd042SPeter Holm		umount $mntpoint || sleep 1
898a272653SPeter Holm		n=$((n += 1))
908a272653SPeter Holm		[ $n -gt 60 ] && exit 1
918a272653SPeter Holm	done
92*608c97bfSPeter Holm	checkfs /dev/md$mdstart || s=$?
93bfdcd042SPeter Holm	mdconfig -d -u $mdstart
948a272653SPeter Holmdone
958a272653SPeter Holmexit $s
96