-
Notifications
You must be signed in to change notification settings - Fork 61
Expand file tree
/
Copy pathrun-all-tests.sh
More file actions
executable file
·335 lines (301 loc) · 6.56 KB
/
run-all-tests.sh
File metadata and controls
executable file
·335 lines (301 loc) · 6.56 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
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
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
#!/bin/bash
set -e
# This entire script is a hack. We need to re-use some existing test
# runner from some existing test framework eventually
# These can also be overriden by the environment
very_short_tests()
{
small_loop=1
medium_loop=1
large_loop=1
medium_count=5
large_count=10
long_duration=3
large_round=3
}
testlist="
kernel-boot-log
tplg-binary
pcm_list
sof-logger
ipc-flood
playback-d100l1r1
capture-d100l1r1
playback-d1l100r1
capture_d1l100r1
playback_d1l1r50
capture_d1l1r50
playback_all_formats
capture_all_formats
speaker
runtime-pm-status
pause-resume-playback
pause-resume-capture
signal-stop-start-playback
signal-stop-start-capture
simultaneous-playback-capture
multiple-pipeline-playback
multiple-pipeline-capture
multiple-pipeline-all
multiple-pause-resume
kmod-load-unload
kmod-load-unload-after-playback
suspend-resume
suspend-resume-with-playback
suspend-resume-with-capture"
# Requires Octave
testlist="$testlist volume_levels"
# To focus on some particular tests edit and rename this to
# 'testlist'. Last definition wins.
# shellcheck disable=SC2034
shorter_testlist='
firmware-presence
speaker
firmware-load
playback-d100l1r1
capture_d1l100r1
tplg-binary
sof-logger
'
main()
{
# Default values overriden by the environment if any
: "${small_loop:=15}"
: "${medium_loop:=50}"
: "${large_loop:=100}"
: "${medium_count:=50}"
: "${large_count:=100}"
: "${long_duration:=100}"
: "${large_round:=50}"
local mydir
mydir=$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd)
local failures=()
local passed=()
# On Ctrl-C
trap interrupted_results INT
local tests_length=10 time_delay=3 exit_first=false
while getopts "l:T:xh" OPTION; do
case "$OPTION" in
l) tests_length="$OPTARG" ;;
T) time_delay="$OPTARG"
export SOF_TEST_INTERVAL="$OPTARG"
;;
x) exit_first=true ;;
*) usage; exit 1 ;;
esac
done
if [ -z "$TPLG" ]; then
printf "Please specify topology path with TPLG env\n"
exit 1
fi
case "$tests_length" in
1) very_short_tests ;;
10) ;; # default
*) usage; exit 1 ;;
esac
declare -A durations
local start_time
for t in $testlist;
do
start_time=$(date +%s)
printf "\033[40;32m ---------- \033[0m\n"
printf "\033[40;32m ---------- \033[0m\n"
printf "\033[40;32m starting test_%s \033[0m\n" "$t"
# set -x logs the test parameters
local ret=0
( set -x; "test_$t" ) || ret=$?
case "$ret" in
0) passed+=( "$t" ) ;;
2) skipped+=( "$t" ) ;;
*) failures+=( "$t" )
if $exit_first; then break; fi
;;
esac
durations["$t"]=$(($(date +%s) - start_time))
sleep "$time_delay"
done
print_results
exit "${#failures[@]}"
}
print_results()
{
printf "\n\nDurations in seconds:\n\t"
declare -p durations | sed -e 's/^declare -A//'
printf "\n\nPASS:"; printf ' %s;' "${passed[@]}"
if [ "${#failures[@]}" -gt 0 ]; then
printf "\nFAIL:"; printf ' %s;' "${failures[@]}"
fi
if [ "${#skipped[@]}" -gt 0 ]; then
printf "\nSKIP:"; printf ' %s;' "${skipped[@]}"
fi
printf "\n\n\033[40;32m test end with %d failed tests\033[0m\n\n" "${#failures[@]}"
}
interrupted_results()
{
# Users often hit Ctrl-C multiple times which would interrupt
# this function too.
trap '' INT
# Give subprocesses some time to avoid mixed up output
sleep 3
print_results
printf 'Testing was INTERRUPTED, results are incomplete!\n'
exit 1
}
test_kernel-boot-log()
{
"$mydir"/verify-kernel-boot-log.sh
}
test_firmware-presence()
{
"$mydir"/verify-firmware-presence.sh
}
test_firmware-load()
{
"$mydir"/verify-sof-firmware-load.sh
}
test_tplg-binary()
{
"$mydir"/verify-tplg-binary.sh
}
test_pcm_list()
{
"$mydir"/verify-pcm-list.sh
}
test_sof-logger()
{
( set +x
if [ "$SOF_LOGGING" = 'none' ]; then
printf '$''SOF_LOGGING=none, skipping check-sof-logger.sh\n'
fi )
return 2
"$mydir"/check-sof-logger.sh
}
test_ipc-flood()
{
"$mydir"/check-ipc-flood.sh -l "$small_loop"
}
test_playback-d100l1r1()
{
"$mydir"/check-playback.sh -d "${long_duration}" -l 1 -r 1
}
test_capture-d100l1r1()
{
"$mydir"/check-capture.sh -d "${long_duration}" -l 1 -r 1
}
test_playback-d1l100r1()
{
"$mydir"/check-playback.sh -d 1 -l "$large_loop" -r 1
}
test_capture_d1l100r1()
{
"$mydir"/check-capture.sh -d 1 -l "$large_loop" -r 1
}
test_playback_d1l1r50()
{
"$mydir"/check-playback.sh -d 1 -l 1 -r "$large_round"
}
test_capture_d1l1r50()
{
"$mydir"/check-capture.sh -d 1 -l 1 -r "$large_round"
}
test_playback_all_formats()
{
"$mydir"/check-playback.sh -d 3 -l "$small_loop" -r 1 -F
}
test_capture_all_formats()
{
"$mydir"/check-capture.sh -d 3 -l "$small_loop" -r 1 -F
}
test_speaker()
{
"$mydir"/test-speaker.sh -l "$medium_loop"
}
test_runtime-pm-status()
{
"$mydir"/check-runtime-pm-status.sh -d 10
}
test_pause-resume-playback()
{
"$mydir"/check-pause-resume.sh -c "$large_count" -m playback
}
test_pause-resume-capture()
{
"$mydir"/check-pause-resume.sh -c "$large_count" -m capture
}
test_volume()
{
"$mydir"/volume-basic-test.sh -l "$large_loop"
}
test_volume_levels()
{
"$mydir"/check-volume-levels.sh
}
test_signal-stop-start-playback()
{
"$mydir"/check-signal-stop-start.sh -m playback -c "$medium_count"
}
test_signal-stop-start-capture()
{
"$mydir"/check-signal-stop-start.sh -m capture -c "$medium_count"
}
test_xrun-injection-playback()
{
"$mydir"/check-xrun-injection.sh -m playback -c "$medium_count"
}
test_xrun-injection-capture()
{
"$mydir"/check-xrun-injection.sh -m capture -c "$medium_count"
}
test_simultaneous-playback-capture()
{
"$mydir"/simultaneous-playback-capture.sh -l "$medium_loop"
}
test_multiple-pipeline-playback()
{
"$mydir"/multiple-pipeline-playback.sh -l "$medium_loop"
}
test_multiple-pipeline-capture()
{
"$mydir"/multiple-pipeline-capture.sh -l "$medium_loop"
}
test_multiple-pipeline-all()
{
"$mydir"/multiple-pipeline.sh -f p -c 20
}
test_multiple-pause-resume()
{
"$mydir"/multiple-pause-resume.sh -l "$small_loop" -r 25
}
test_kmod-load-unload()
{
"$mydir"/check-kmod-load-unload.sh -l "$medium_loop"
}
test_kmod-load-unload-after-playback()
{
"$mydir"/check-kmod-load-unload-after-playback.sh -l "$small_loop"
}
test_suspend-resume()
{
"$mydir"/check-suspend-resume.sh -l "$medium_loop"
}
test_suspend-resume-with-playback()
{
"$mydir"/check-suspend-resume-with-audio.sh -l "$small_loop" -m playback
}
test_suspend-resume-with-capture()
{
"$mydir"/check-suspend-resume-with-audio.sh -l "$small_loop" -m capture
}
usage()
{
cat <<EOF
Wrapper script to run all test cases. Please use TPLG env to
pass-through topology path to test caess.
usage: $0 [options]
-h Show script usage
-x exit on first failure
-l 1 Very small test counts/loops/rounds (< 20 min)
-T time Delay between cases, default: 3s
EOF
}
main "$@"