-
Notifications
You must be signed in to change notification settings - Fork 0
/
run-ql-fstest.sh
executable file
·107 lines (89 loc) · 2.14 KB
/
run-ql-fstest.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!/bin/sh
set -e
CWD=$(realpath $(dirname $0))
PID=$$
nproc=8
theusage()
{
cat <<EOF
run-ql-fstest.sh [options ] -d <targetdir>
options:
-d <target-dir> Dir to run ql-fstest in
-D random direct IO
-e Stop on error - fail immediately
-n <num_processes> Number of processes to start, defaults to ${nproc}
-p <fill-level> File system fill level, ql-fstest will write data up
to that level (approximate, with multiple processes),
defaults to 90
-t <max-run-time> How log to run (default: unlimited)
-h This help
-l <log-dir> Dir to write log files to
EOF
exit 1
}
opts=""
targetdir=""
while getopts "d:Den:p:t:hl:" opt; do
case $opt in
d)
targetdir=$OPTARG
;;
D) opts="$opts --directIO"
;;
e)
opts="$opts --error-stop"
;;
n)
nproc=$OPTARG
;;
p)
opts="$opts -p $OPTARG"
;;
t)
opts="$opts --timeout=$OPTARG"
;;
h)
theusage
;;
l) logdir="${OPTARG}"
;;
esac
done
if [ -z "${targetdir}" ]; then
echo
echo "Missing required argument: -d <targetdir"
echo
theusage
fi
if [ -z "${logdir}" ]; then
logdir="${targetdir}";
fi
mkdir -p ${targetdir}
mkdir -p ${logdir}
dir=`dirname $0`
cd $dir
export PATH=$PATH:$dir
if [ -z "$1" ]; then
echo
echo "usage: `basename $0` <directory>"
echo
exit 1
fi
#make
#tmp script, run from screen
tmprun="$targetdir/tmp-ql-fstest-run-$$.sh"
cat <<EOF >${tmprun}
${CWD}/fstest $opts $targetdir 2>${logdir}/fstest-\$\$.err | tee ${logdir}/fstest-\$\$.log
EOF
chmod +x ${tmprun}
# create a screenrc with the given number of ql-fstest processes
screenrc="${targetdir}/tmp-screenrc_ql_fstest-$$"
cp ${dir}/screenrc_ql_fstest.in ${screenrc}
# add commands to the screenrc
for i in $(seq 1 $nproc); do
cat <<EOF >> $screenrc
screen -t ql-fstest ${tmprun}
EOF
done
echo "Starting tests in screen session"
screen -S ql_fstests -dm -c $screenrc