aboutsummaryrefslogtreecommitdiff
path: root/tools/test
diff options
context:
space:
mode:
authorPeter Holm <pho@FreeBSD.org>2021-11-11 09:11:49 +0000
committerPeter Holm <pho@FreeBSD.org>2021-11-11 09:11:49 +0000
commit7e3c4b09a09ee7317d215f81c2a95eb0acbf8fde (patch)
tree96e2f2f0eff87c5c6257828f63c2f8a6a7507162 /tools/test
parentc5e0492ae81e4b0d7946ccfbedb434a9c4071256 (diff)
downloadsrc-7e3c4b09a09ee7317d215f81c2a95eb0acbf8fde.tar.gz
src-7e3c4b09a09ee7317d215f81c2a95eb0acbf8fde.zip
stress2: Added two test scenarios for future gunion(8)
Diffstat (limited to 'tools/test')
-rwxr-xr-xtools/test/stress2/misc/gunion.sh83
-rwxr-xr-xtools/test/stress2/misc/gunion2.sh106
2 files changed, 189 insertions, 0 deletions
diff --git a/tools/test/stress2/misc/gunion.sh b/tools/test/stress2/misc/gunion.sh
new file mode 100755
index 000000000000..6ba60de3f988
--- /dev/null
+++ b/tools/test/stress2/misc/gunion.sh
@@ -0,0 +1,83 @@
+#!/bin/sh
+
+#
+# SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+#
+# Copyright (c) 2021 Peter Holm <pho@FreeBSD.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+
+# geom union test
+
+[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1
+. ../default.cfg
+
+kldstat -v | grep -q geom_union.ko ||
+ { kldload geom_union.ko 2>/dev/null || exit 0; loaded=1; }
+log=/tmp/gunion.sh.log
+md1=$mdstart
+md2=$((mdstart + 1))
+mp1=$mntpoint$md1
+mp2=$mntpoint$md2
+s=0
+
+set -e
+mdconfig -a -t swap -s 5g -u $md1
+newfs $newfs_flags -n /dev/md$md1
+mkdir -p $mp1 $mp2
+mount /dev/md$md1 $mp1
+cp -r ../../stress2 $mp1
+umount $mp1
+
+mdconfig -a -t swap -s 5g -u $md2
+gunion create -v /dev/md$md2 /dev/md$md1
+mount /dev/md$md2-md$md1.union $mntpoint
+
+export RUNDIR=$mntpoint/stressX
+export runRUNTIME=5m
+export RUNTIME=2m
+export CTRLDIR=$mntpoint/stressX.control
+
+set +e
+chmod 777 $mntpoint
+su $testuser -c \
+ "(cd $mntpoint/stress2; ./run.sh marcus.cfg)"
+
+for i in `jot 6`; do
+ mount | grep -q "on $mntpoint " || break
+ umount $mntpoint && break || sleep 10
+ [ $i -eq 6 ] &&
+ { echo FATAL; fstat -mf $mntpoint; exit 1; }
+done
+fsck_ffs -fyR /dev/md$md2-md$md1.union > $log 2>&1
+grep -Eq "IS CLEAN|MARKED CLEAN" $log || { s=2; cat $log; }
+set +e
+gunion commit /dev/md$md2-md$md1.union
+gunion destroy /dev/md$md2-md$md1.union
+fsck_ffs -fyR /dev/md$md1 > $log 2>&1
+grep -Eq "IS CLEAN|MARKED CLEAN" $log || { s=3; cat $log; }
+mdconfig -d -u $md2
+mdconfig -d -u $md1
+rm -f $log
+[ loaded ] && gunion unload
+exit $s
diff --git a/tools/test/stress2/misc/gunion2.sh b/tools/test/stress2/misc/gunion2.sh
new file mode 100755
index 000000000000..e6a7ab6331cb
--- /dev/null
+++ b/tools/test/stress2/misc/gunion2.sh
@@ -0,0 +1,106 @@
+#!/bin/sh
+
+#
+# SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+#
+# Copyright (c) 2021 Peter Holm <pho@FreeBSD.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+
+# geom union test
+
+[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1
+. ../default.cfg
+
+kldstat -v | grep -q geom_union.ko ||
+ { kldload geom_union.ko 2>/dev/null || exit 0; loaded=1; }
+log=/tmp/gunion2.sh.log
+md1=$mdstart
+md2=$((mdstart + 1))
+mp1=$mntpoint$md1
+mp2=$mntpoint$md2
+s=0
+
+set -e
+mdconfig -a -t swap -s 5g -u $md1
+newfs $newfs_flags -n /dev/md$md1 > /dev/null
+mkdir -p $mp1 $mp2
+mount /dev/md$md1 $mp1
+cp -r ../../stress2 $mp1
+umount $mp1
+
+mdconfig -a -t swap -s 5g -u $md2
+gunion create -v /dev/md$md2 /dev/md$md1
+mount /dev/md$md2-md$md1.union $mntpoint
+
+export CTRLDIR=$mntpoint/stressX.control
+export INCARNATIONS=10
+export LOAD=80
+export RUNDIR=$mntpoint/stressX
+export runRUNTIME=5m
+export rwLOAD=80
+export symlinkLOAD=80
+
+export TESTPROGS="
+testcases/lockf2/lockf2
+testcases/symlink/symlink
+testcases/openat/openat
+testcases/rw/rw
+testcases/fts/fts
+testcases/link/link
+testcases/lockf/lockf
+testcases/creat/creat
+testcases/mkdir/mkdir
+testcases/rename/rename
+testcases/mkfifo/mkfifo
+testcases/dirnprename/dirnprename
+testcases/dirrename/dirrename
+testcases/swap/swap
+"
+export TESTPROGS=`echo $TESTPROGS | sed 's/\n/ /g'`
+
+set +e
+chmod 777 $mntpoint
+su $testuser -c \
+ "(cd $mntpoint/stress2; ./testcases/run/run $TESTPROGS)"
+
+n=`find $mntpoint/stressX | wc -l`
+[ $n -eq 1 ] && s=0 || s=1
+for i in `jot 6`; do
+ mount | grep -q "on $mntpoint " || break
+ umount $mntpoint && break || sleep 10
+ [ $i -eq 6 ] &&
+ { echo FATAL; fstat -mf $mntpoint; exit 1; }
+done
+fsck_ffs -fyR /dev/md$md2-md$md1.union > $log 2>&1
+grep -Eq "IS CLEAN|MARKED CLEAN" $log || { s=2; cat $log; }
+set +e
+gunion commit /dev/md$md2-md$md1.union
+gunion destroy /dev/md$md2-md$md1.union
+fsck_ffs -fyR /dev/md$md1 > $log 2>&1
+grep -Eq "IS CLEAN|MARKED CLEAN" $log || { s=3; cat $log; }
+mdconfig -d -u $md2
+mdconfig -d -u $md1
+rm -f $log
+[ loaded ] && gunion unload
+exit $s