xref: /freebsd/tools/test/stress2/misc/zfs15.sh (revision 718519f4efc71096422fc71dab90b2a3369871ff)
1#!/bin/sh
2
3# Test scenario suggestion by: markj@
4
5[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1
6kldstat -v | grep -q zfs.ko  || { kldload zfs.ko; loaded=1; } ||
7    exit 0
8
9. ../default.cfg
10
11here=`pwd`
12level=`jot -r 1 1 3`	# Redundancy levels
13mp1=/stress2_tank/test
14s=0
15u1=$mdstart
16u2=$((u1 + 1))
17u3=$((u1 + 2))
18u4=$((u1 + 3))
19u5=$((u1 + 4))
20
21set -e
22mdconfig -l | grep -q md$u1 && mdconfig -d -u $u1
23mdconfig -l | grep -q md$u2 && mdconfig -d -u $u2
24mdconfig -l | grep -q md$u3 && mdconfig -d -u $u3
25mdconfig -l | grep -q md$u4 && mdconfig -d -u $u4
26mdconfig -l | grep -q md$u5 && mdconfig -d -u $u5
27
28mdconfig -s 512m -u $u1
29mdconfig -s 512m -u $u2
30mdconfig -s 512m -u $u3
31mdconfig -s 512m -u $u4
32mdconfig -s 512m -u $u5
33
34zpool list | egrep -q "^stress2_tank" && zpool destroy stress2_tank
35[ -d /stress2_tank ] && rm -rf /stress2_tank
36zpool create stress2_tank raidz$level md$u1 md$u2 md$u3 md$u4
37zfs create stress2_tank/test
38set +e
39
40export RUNDIR=/stress2_tank/test/stressX
41export runRUNTIME=5m
42export LOAD=80
43export symlinkLOAD=80
44export rwLOAD=80
45export TESTPROGS="
46testcases/lockf2/lockf2
47testcases/symlink/symlink
48testcases/openat/openat
49testcases/rw/rw
50testcases/fts/fts
51testcases/link/link
52testcases/lockf/lockf
53testcases/creat/creat
54testcases/mkdir/mkdir
55testcases/rename/rename
56testcases/mkfifo/mkfifo
57testcases/dirnprename/dirnprename
58testcases/dirrename/dirrename
59testcases/swap/swap
60"
61
62(cd ..; ./testcases/run/run $TESTPROGS > /dev/null 2>&1) &
63
64sleep 60
65echo "zpool attach stress2_tank raidz$level-0 md$u5"
66zpool attach stress2_tank raidz$level-0 md$u5
67sleep 30
68zfs snapshot stress2_tank/test@1
69wait
70
71while zpool status | grep -q "in progress"; do
72	sleep 5
73done
74zpool scrub stress2_tank
75zpool status | grep -q "errors: No known data errors" ||
76    { zpool status; s=1; }
77
78zfs umount stress2_tank/test
79zfs destroy -r stress2_tank
80zpool destroy stress2_tank
81
82mdconfig -d -u $u1
83mdconfig -d -u $u2
84mdconfig -d -u $u3
85mdconfig -d -u $u4
86mdconfig -d -u $u5
87[ -n "$loaded" ] && kldunload zfs.ko
88exit $s
89