This repository has been archived by the owner on Jun 3, 2020. It is now read-only.
/
runtest.sh
266 lines (249 loc) · 7.82 KB
/
runtest.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
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
#!/bin/sh
#
# Copyright (c) 2019 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing
# to use, modify, copy, or redistribute it subject to the terms
# and conditions of the GNU General Public License version 2.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with this program; if not, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
#
if [[ ${_DEBUG_MODE} == "yes" ]]; then
#
# XXX: Don't involve the test harness if debug mode is enabled which
# is very helpful to manually run a single case without invoking
# function rstrnt-report-result() provided by test harness
#
function rstrnt-report-result { echo "$@"; }
else
source ../../cki_lib/libcki.sh
fi
NAME=$(basename $0)
CDIR=$(dirname $0)
function is_rhel7
{
#
# XXX: _TREE is set in kpet-db via:
#
# {% if TREE == "rhel7" %}
# <param name="_TREE" value="rhel7"/>
# {% else %}
# <param name="_TREE" value="rhel8|ark|upstream"/>
# {% endif %}
#
[[ ${_TREE} == "rhel7" ]] && return 0 || return 1
}
function get_timestamp
{
date +"%Y-%m-%d %H:%M:%S"
}
function get_test_result
{
typeset test_ws=$1
typeset test_case=$2
typeset result_dir="$test_ws/results"
typeset result_file=$(find $result_dir -type f | egrep "$test_case")
typeset result="UNTESTED"
if [[ -n $result_file ]]; then
typeset res=$(egrep "^status" $result_file | awk '{print $NF}')
if [[ $res == *"pass" ]]; then
result="PASS"
elif [[ $res == *"fail" ]]; then
result="FAIL"
else
result="OTHER"
fi
fi
echo $result
}
function do_test
{
typeset test_ws=$1
typeset test_case=$2
typeset this_case=$test_ws/tests/$test_case
echo ">>> $(get_timestamp) | Start to run test case $this_case ..."
(cd $test_ws && ./check $test_case)
typeset result=$(get_test_result $test_ws $test_case)
echo ">>> $(get_timestamp) | End $this_case | $result"
typeset -i ret=0
if [[ $result == "PASS" ]]; then
rstrnt-report-result "$TEST/tests/$test_case" PASS 0
ret=0
elif [[ $result == "FAIL" ]]; then
rstrnt-report-result "$TEST/tests/$test_case" FAIL 1
ret=1
else
rstrnt-report-result "$TEST/tests/$test_case" WARN 2
ret=2
fi
return $ret
}
function get_test_cases_block
{
typeset testcases=""
if is_rhel7; then
#
# XXX: There are 27 cases of block testing, and these cases
# in the following are not available to run
# - block/003 # XXX: Test device is required
# - block/004 # XXX: Test device is required
# - block/005 # XXX: Test device is required
# - block/006
# - block/007 # XXX: Test device is required
# - block/008
# - block/010
# - block/011 # XXX: Test device is required
# - block/012 # XXX: Test device is required
# - block/013 # XXX: Test device is required
# - block/014
# - block/015
# - block/017
# - block/018
# - block/019
# - block/021
# - block/022
# - block/024
# - block/026
# - block/028
#
# Disable block/001 for RHEL7.2/7.3/7.4/7.5
uname -ri | grep -qE "3.10.0-327|3.10.0-514|3.10.0-693|3.10.0-862" || testcases+=" block/001"
#testcases+=" block/002" # Test case issue: https://lore.kernel.org/linux-block/e84b29e1-209e-d598-0828-bed5e3b98093@acm.org/
#testcases+=" block/009" # Fail randomly on x86_64, powerpc
# block/016 failed on RHEL7.5
uname -ri | grep -qE "3.10.0-862" || testcases+=" block/016"
#testcases+=" block/020" # Fail randomly on arm64, powerpc
testcases+=" block/021"
testcases+=" block/023"
#testcases+=" block/025" # Fail randomly on powerpc
else
#
# XXX: There are 27 cases of block testing, and these cases
# in the following are not available to run
# - block/003 # XXX: Test device is required
# - block/004 # XXX: Test device is required
# - block/005 # XXX: Test device is required
# - block/007 # XXX: Test device is required
# - block/008
# - block/010 # XXX: Oops
# - block/011 # XXX: Test device is required
# - block/012 # XXX: Test device is required
# - block/013 # XXX: Test device is required
# - block/014
# - block/015
# - block/019
# - block/022
# - block/024
# - block/026
# - block/028
#
testcases+=" block/001"
#testcases+=" block/002" # Test case issue: https://lore.kernel.org/linux-block/e84b29e1-209e-d598-0828-bed5e3b98093@acm.org/
testcases+=" block/006"
#testcases+=" block/009" # Fail randomly on x86_64, powerpc
testcases+=" block/016"
#block/017 fails on s390x
uname -i | grep -q s390x || testcases+=" block/017"
testcases+=" block/018"
#testcases+=" block/020" # Fail randomly on arm64, powerpc
testcases+=" block/021"
testcases+=" block/023"
#testcases+=" block/025" # Fail randomly on powerpc
fi
echo $testcases
}
function get_test_cases_loop
{
typeset testcases=""
if is_rhel7; then
#
# XXX: There are 7 cases of loop testing, and these cases
# in the following are not available to run
# - loop/002
# - loop/004
# - loop/007
testcases+=" loop/001"
testcases+=" loop/003"
testcases+=" loop/005"
testcases+=" loop/006"
else
#
# XXX: There are 7 cases of loop testing, and these cases
# in the following are not available to run
# - loop/006
# - loop/007
#
uname -r | grep -q 5.0 || testcases+=" loop/001" # Fails on 5.0
#testcases+=" loop/002" # Fails randomly on x86_64
testcases+=" loop/003"
#testcases+=" loop/004" # Fails randomly on powerpc
testcases+=" loop/005"
fi
echo $testcases
}
function get_test_cases_nvme
{
typeset testcases=""
if is_rhel7; then
testcases+=" nvme/004"
testcases+=" nvme/006"
testcases+=" nvme/008"
uname -ri | grep -q "3.10.0" || testcases+=" nvme/012"
uname -ri | grep -qE "3.10.0-.*ppc64$|3.10.0-.*s390x" || testcases+=" nvme/014"
uname -ri | grep -qE "3.10.0-.*ppc64$|3.10.0-.*s390x" || testcases+=" nvme/016"
uname -ri | grep -q "3.10.0-.*s390x" || testcases+=" nvme/019"
testcases+=" nvme/023"
uname -ri | grep -qE "3.10.0-327|3.10.0-514|3.10.0-693" && testcases=""
uname -ri | grep -qE "3.10.0-862" && testcases=" nvme/006"
else
#testcases+=" nvme/002" #disable
#testcases+=" nvme/003" #disable
uname -ri | grep -qE "4.18.0-.*ppc64le" || testcases+=" nvme/004"
#testcases+=" nvme/005" modprobe/modprobe -r nvme-core will be failed
testcases+=" nvme/006"
testcases+=" nvme/007"
uname -ri | grep -qE "4.18.0-.*ppc64le" || testcases+=" nvme/008"
testcases+=" nvme/009"
testcases+=" nvme/010"
uname -r | grep -Eq "5\.|4.18.0" || testcases+=" nvme/011"
uname -r | grep -q "4.18.0-80" || testcases+=" nvme/012"
uname -r | grep -qE "5\.|4.18.0" || testcases+=" nvme/013"
testcases+=" nvme/014"
uname -r | grep -qE "5\.|4.18.0" || testcases+=" nvme/015"
#testcases+=" nvme/016" #disable
#testcases+=" nvme/017" #disable
testcases+=" nvme/019"
testcases+=" nvme/020"
testcases+=" nvme/021"
testcases+=" nvme/022"
testcases+=" nvme/023"
testcases+=" nvme/024"
testcases+=" nvme/026"
testcases+=" nvme/027"
testcases+=" nvme/028"
fi
echo $testcases
}
testcases_default=""
testcases_default+=" $(get_test_cases_block)"
testcases_default+=" $(get_test_cases_loop)"
uname -ri | grep -qE "3.10.0-862.*s390x" || testcases_default+=" $(get_test_cases_nvme)"
testcases=${_DEBUG_MODE_TESTCASES:-"$(echo $testcases_default)"}
test_ws=$CDIR/blktests
ret=0
for testcase in $testcases; do
do_test $test_ws $testcase
((ret += $?))
done
if [[ $ret -ne 0 ]]; then
echo ">> There are failing tests, pls check it"
fi
exit 0