-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrun_quick
More file actions
executable file
·148 lines (128 loc) · 3.03 KB
/
run_quick
File metadata and controls
executable file
·148 lines (128 loc) · 3.03 KB
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
#!/bin/bash
set -e
usage(){
cat <<EOUSAGE
Usage: $(basename -- $0) [-n=<jobs>] [-a] [-t=<template>] [-h|--help]
Usage: $(basename -- $0) [-n=<jobs>] -f=<file>
Usage: $(basename -- $0) [-n=<jobs>] <block_device>
Installs perl and fio dependencies, then runs a set of tests on <block_device>
Check the ./template directory for more fio example tests.
[-h] - prints this help message.
[-a] - attemtps to automatically create a volume with hybrid
placement (placeAll hdd placeTail ssd). Cleans up the volume afterwards.
[-t=<template>] - use template <template> instead, implies '-a'
[-n=<jobs>] - use <jobs> number of fio jobs instead of 1
EOUSAGE
}
njobs=1
vsize=100G
file=no
if [ -n "$*" ]; then
while test -n "$1"; do
case "$1" in
-h|--help)
usage
exit
;;
-a)
autof=1
shift
;;
-t=*)
template=${1##*=}
echo "using template $template"
shift
;;
-n=*)
njobs=${1##*=}
echo "number of jobs $njobs"
shift
;;
-f=*)
tvolume=${1##*=}
file=yes
echo "Using file $tvolume"
shift
;;
/dev/*)
tvolume="$1"
shift
;;
*)
usage
exit 1
;;
esac
done
else
usage
exit 1
fi
cleanup(){
if [[ -n "$autof" ]]; then
echo "Cleaning up $tname"
storpool detach volume "$tname" here
storpool volume "$tname" delete "$tname"
echo "Cleanup successful"
fi
}
chkdepend(){
local fio="$(which fio)"
if [[ ! -e $fio ]]; then
echo "Attempting to installing fio,perl dependencies"
if type -f yum 2>/dev/null; then
yum -y install epel-release perl-core
yum -y install perl-JSON-XS fio
elif type -f apt-get 2>/dev/null; then
apt-get --yes install perl libdata-dump-perl libjson-xs-perl fio
else
echo 'Neither apt-get, nor yum found, OS not supported?' 1>&2
exit 1
fi
fi
}
if [[ -n "$autof" ]]; then
if [[ -n $tvolume ]]; then
echo "Error: '-a' creates volume automatically, please remove it if you'd like to test on $tvolume" 1>&2
exit 1
fi
trap 'cleanup' EXIT INT QUIT TERM
echo 'Attempting to create hybrid test volume'
tname="test$$"
tvolume="/dev/storpool/$tname"
if [[ -z $template ]]; then
storpool volume "$tname" size $vsize replication 3 placeAll hdd placeTail ssd
else
storpool volume "$tname" size $vsize template "$template"
fi
storpool attach volume "$tname" here
fi
if [[ ! -b $tvolume ]] && [[ $file == no ]]; then
echo "$tvolume is not a block device, exiting"
exit 1
fi
chkdepend
echo Regenerating templates
cd template
./rm_templates
./gen.pl $njobs
cd ..
if [ -f ./tests.$njobs ]; then
tests=( $(cat ./tests.$njobs ) )
else
tests=( $(cat ./tests.4 ) )
fi
echo Cleaning results directory
./rm_res
# Use fio-detect here to set the variables so that we don't
# have to run `fio --version` for each test in run_one.
unset SP_FIO_DETECT_PRINT
. ./fio-detect
echo Running tests...
for test in ${tests[*]}; do
./run_one "$test" "$tvolume" "$vsize" "$njobs"
done
echo Displaying and saving result...
sed -i.bak '/{/,$!d' res/*.json
./get_res | sort | ./pretty_print
./get_res | sort >results.txt