Debian Codegraph @

tools/testing/selftests/ftrace/ftracetest

raw symbols SCIP
1 #!/bin/shscip-shell filesystem . . `/bin/sh`.
2 # SPDX-License-Identifier: GPL-2.0-only
3
4 # ftracetest - Ftrace test shell scripts
5 #
6 # Copyright (C) Hitachi Ltd., 2014
7 # Written by Masami Hiramatsu <[email protected]>
8 #
9
10 usagescip-shell shell linux 7.0.9-1 usage().() { # errno [message]
11 [scip-shell system . . `[`. ! -z "$2" ] && echoscip-shell system . . echo. $2
12 echoscip-shell system . . echo. "Usage: ftracetest [options] [testcase(s)] [testcase-directory(s)]"
13 echoscip-shell system . . echo. " Options:"
14 echoscip-shell system . . echo. " -h|--help Show help message"
15 echoscip-shell system . . echo. " -k|--keep Keep passed test logs"
16 echoscip-shell system . . echo. " -K|--ktap Output in KTAP format"
17 echoscip-shell system . . echo. " -v|--verbose Increase verbosity of test messages"
18 echoscip-shell system . . echo. " -vv Alias of -v -v (Show all results in stdout)"
19 echoscip-shell system . . echo. " -vvv Alias of -v -v -v (Show all commands immediately)"
20 echoscip-shell system . . echo. " --fail-unsupported Treat UNSUPPORTED as a failure"
21 echoscip-shell system . . echo. " --fail-unresolved Treat UNRESOLVED as a failure"
22 echoscip-shell system . . echo. " -d|--debug Debug mode (trace all shell commands)"
23 echoscip-shell system . . echo. " -l|--logdir <dir> Save logs on the <dir>"
24 echoscip-shell system . . echo. " If <dir> is -, all logs output in console only"
25 echoscip-shell system . . echo. " --rv Run RV selftests instead of ftrace ones"
26 exit $1
27 }
28
29 # default error
30 err_ret=1
31
32 # kselftest skip code is 4
33 err_skip=4
34
35 # umount required
36 UMOUNT_DIR=""
37
38 # cgroup RT scheduling prevents chrt commands from succeeding, which
39 # induces failures in test wakeup tests. Disable for the duration of
40 # the tests.
41
42 readonly sched_rt_runtime=/proc/sys/kernel/sched_rt_runtime_usscip-shell filesystem . . `/proc/sys/kernel/sched_rt_runtime_us`.
43
44 sched_rt_runtime_orig=$(catscip-shell system . . cat. $sched_rt_runtime)
45
46 setupscip-shell shell linux 7.0.9-1 setup().() {
47 echoscip-shell system . . echo. -1 > $sched_rt_runtime
48 }
49
50 cleanupscip-shell shell linux 7.0.9-1 cleanup().() {
51 echoscip-shell system . . echo. $sched_rt_runtime_orig > $sched_rt_runtime
52 if [scip-shell system . . `[`. -n "${UMOUNT_DIR}" ]; then
53 umountscip-shell system . . umount. ${UMOUNT_DIR} ||:
54 fi
55 }
56
57 errexitscip-shell shell linux 7.0.9-1 errexit().() { # message
58 echoscip-shell system . . echo. "Error: $1" 1>&2
59 cleanupscip-shell shell linux 7.0.9-1 cleanup().
60 exit $err_ret
61 }
62
63 # Ensuring user privilege
64 if [scip-shell system . . `[`. `idscip-shell system . . id. -u` -ne 0 ]; then
65 errexitscip-shell shell linux 7.0.9-1 errexit(). "this must be run by root user"
66 fi
67
68 setupscip-shell shell linux 7.0.9-1 setup().
69
70 # Utilities
71 absdirscip-shell shell linux 7.0.9-1 absdir().() { # file_path
72 (cd `dirnamescip-shell system . . dirname. $1`; pwdscip-shell system . . pwd.)
73 }
74
75 abspathscip-shell shell linux 7.0.9-1 abspath().() {
76 echoscip-shell system . . echo. `absdirscip-shell shell linux 7.0.9-1 absdir(). $1`/`basenamescip-shell system . . basename. $1`
77 }
78
79 find_testcasesscip-shell shell linux 7.0.9-1 find_testcases().() { #directory
80 echoscip-shell system . . echo. `findscip-shell system . . find. $1 -name \*.tc | sortscip-shell system . . sort.`
81 }
82
83 parse_optsscip-shell shell linux 7.0.9-1 parse_opts().() { # opts
84 local OPT_TEST_CASES=
85 local OPT_TEST_DIR=
86
87 while [scip-shell system . . `[`. ! -z "$1" ]; do
88 case "$1" in
89 --help|-h)
90 usagescip-shell shell linux 7.0.9-1 usage(). 0
91 ;;
92 --keep|-k)
93 KEEP_LOG=1
94 shift 1
95 ;;
96 --ktap|-K)
97 KTAP=1
98 shift 1
99 ;;
100 --verbose|-v|-vv|-vvv)
101 if [scip-shell system . . `[`. $VERBOSE -eq -1 ]; then
102 usagescip-shell shell linux 7.0.9-1 usage(). "--console can not use with --verbose"
103 fi
104 VERBOSE=$((VERBOSE + 1))
105 [scip-shell system . . `[`. $1 = '-vv' ] && VERBOSE=$((VERBOSE + 1))
106 [scip-shell system . . `[`. $1 = '-vvv' ] && VERBOSE=$((VERBOSE + 2))
107 shift 1
108 ;;
109 --console)
110 if [scip-shell system . . `[`. $VERBOSE -ne 0 ]; then
111 usagescip-shell shell linux 7.0.9-1 usage(). "--console can not use with --verbose"
112 fi
113 VERBOSE=-1
114 shift 1
115 ;;
116 --debug|-d)
117 DEBUG=1
118 shift 1
119 ;;
120 --stop-fail)
121 STOP_FAILURE=1
122 shift 1
123 ;;
124 --fail-unsupported)
125 UNSUPPORTED_RESULT=1
126 shift 1
127 ;;
128 --fail-unresolved)
129 UNRESOLVED_RESULT=1
130 shift 1
131 ;;
132 --logdir|-l)
133 LOG_DIR=$2
134 LINK_PTR=
135 shift 2
136 ;;
137 --rv)
138 RV_TEST=1
139 shift 1
140 ;;
141 *.tc)
142 if [scip-shell system . . `[`. -f "$1" ]; then
143 OPT_TEST_CASES="$OPT_TEST_CASES `abspathscip-shell shell linux 7.0.9-1 abspath(). $1`"
144 shift 1
145 else
146 usagescip-shell shell linux 7.0.9-1 usage(). 1 "$1 is not a testcase"
147 fi
148 ;;
149 *)
150 if [scip-shell system . . `[`. -d "$1" ]; then
151 OPT_TEST_DIR=`abspathscip-shell shell linux 7.0.9-1 abspath(). $1`
152 OPT_TEST_CASES="$OPT_TEST_CASES `find_testcasesscip-shell shell linux 7.0.9-1 find_testcases(). $OPT_TEST_DIR`"
153 shift 1
154 else
155 usagescip-shell shell linux 7.0.9-1 usage(). 1 "Invalid option ($1)"
156 fi
157 ;;
158 esac
159 done
160 if [scip-shell system . . `[`. -n "$OPT_TEST_CASES" ]; then
161 TEST_CASES=$OPT_TEST_CASES
162 fi
163 if [scip-shell system . . `[`. -n "$OPT_TEST_DIR" -a -f "$OPT_TEST_DIR"/test.d/functions ]; then
164 TOP_DIR=$OPT_TEST_DIR
165 TEST_DIR=$TOP_DIR/test.d
166 fi
167 }
168
169 # Parameters
170 TRACING_DIR=`grepscip-shell system . . grep. tracefs /proc/mountsscip-shell filesystem . . `/proc/mounts`. | cutscip-shell system . . cut. -f2 -d' ' | headscip-shell system . . head. -1`
171 if [scip-shell system . . `[`. -z "$TRACING_DIR" ]; then
172 DEBUGFS_DIR=`grepscip-shell system . . grep. debugfs /proc/mountsscip-shell filesystem . . `/proc/mounts`. | cutscip-shell system . . cut. -f2 -d' ' | headscip-shell system . . head. -1`
173 if [scip-shell system . . `[`. -z "$DEBUGFS_DIR" ]; then
174 # If tracefs exists, then so does /sys/kernel/tracing
175 if [scip-shell system . . `[`. -d "/sys/kernel/tracingscip-shell filesystem . . `/sys/kernel/tracing`." ]; then
176 mountscip-shell system . . mount. -t tracefs nodev /sys/kernel/tracingscip-shell filesystem . . `/sys/kernel/tracing`. ||
177 errexitscip-shell shell linux 7.0.9-1 errexit(). "Failed to mount /sys/kernel/tracing"
178 TRACING_DIR="/sys/kernel/tracingscip-shell filesystem . . `/sys/kernel/tracing`."
179 UMOUNT_DIR=${TRACING_DIR}
180 # If debugfs exists, then so does /sys/kernel/debug
181 elif [scip-shell system . . `[`. -d "/sys/kernel/debugscip-shell filesystem . . `/sys/kernel/debug`." ]; then
182 mountscip-shell system . . mount. -t debugfs nodev /sys/kernel/debugscip-shell filesystem . . `/sys/kernel/debug`. ||
183 errexitscip-shell shell linux 7.0.9-1 errexit(). "Failed to mount /sys/kernel/debug"
184 TRACING_DIR="/sys/kernel/debug/tracingscip-shell filesystem . . `/sys/kernel/debug/tracing`."
185 UMOUNT_DIR=${TRACING_DIR}
186 else
187 err_ret=$err_skip
188 errexitscip-shell shell linux 7.0.9-1 errexit(). "debugfs and tracefs are not configured in this kernel"
189 fi
190 else
191 TRACING_DIR="$DEBUGFS_DIR/tracing"
192 fi
193 fi
194 if [scip-shell system . . `[`. ! -d "$TRACING_DIR" ]; then
195 err_ret=$err_skip
196 errexitscip-shell shell linux 7.0.9-1 errexit(). "ftrace is not configured in this kernel"
197 fi
198
199 TOP_DIR=`absdirscip-shell shell linux 7.0.9-1 absdir(). $0`
200 TEST_DIR=$TOP_DIR/test.d
201 TEST_CASES=`find_testcasesscip-shell shell linux 7.0.9-1 find_testcases(). $TEST_DIR`
202 KEEP_LOG=0
203 KTAP=0
204 DEBUG=0
205 VERBOSE=0
206 UNSUPPORTED_RESULT=0
207 UNRESOLVED_RESULT=0
208 STOP_FAILURE=0
209 RV_TEST=0
210 # Parse command-line options
211 parse_optsscip-shell shell linux 7.0.9-1 parse_opts(). $*
212
213 LOG_TOP_DIR=$TOP_DIR/logs
214 LOG_DATE=`datescip-shell system . . date. +%Y%m%d-%H%M%S`
215 LOG_DIR=$LOG_TOP_DIR/$LOG_DATE/
216 LINK_PTR=$LOG_TOP_DIR/latest
217
218 [scip-shell system . . `[`. $DEBUG -ne 0 ] && set -x
219
220 if [scip-shell system . . `[`. $RV_TEST -ne 0 ]; then
221 TRACING_DIR=$TRACING_DIR/rv
222 if [scip-shell system . . `[`. ! -d "$TRACING_DIR" ]; then
223 err_ret=$err_skip
224 errexitscip-shell shell linux 7.0.9-1 errexit(). "rv is not configured in this kernel"
225 fi
226 fi
227
228 # Preparing logs
229 if [scip-shell system . . `[`. "x$LOG_DIR" = "x-" ]; then
230 LOG_FILE=
231 datescip-shell system . . date.
232 else
233 LOG_FILE=$LOG_DIR/ftracetest.log
234 mkdirscip-shell system . . mkdir. -p $LOG_DIR || errexitscip-shell shell linux 7.0.9-1 errexit(). "Failed to make a log directory: $LOG_DIR"
235 datescip-shell system . . date. > $LOG_FILE
236 if [scip-shell system . . `[`. "x-$LINK_PTR" != "x-" ]; then
237 unlinkscip-shell system . . unlink. $LINK_PTR
238 lnscip-shell system . . ln. -fs $LOG_DATE $LINK_PTR
239 fi
240 fi
241
242 # Define text colors
243 # Check available colors on the terminal, if any
244 ncolors=`tputscip-shell system . . tput. colors 2>/dev/nullscip-shell filesystem . . `/dev/null`. || echoscip-shell system . . echo. 0`
245 color_reset=
246 color_red=
247 color_green=
248 color_blue=
249 # If stdout exists and number of colors is eight or more, use them
250 if [scip-shell system . . `[`. -t 1 -a "$ncolors" -ge 8 ]; then
251 color_reset="\033[0m"
252 color_red="\033[31m"
253 color_green="\033[32m"
254 color_blue="\033[34m"
255 fi
256
257 strip_escscip-shell shell linux 7.0.9-1 strip_esc().() {
258 # busybox sed implementation doesn't accept "\x1B", so use [:cntrl:] instead.
259 sedscip-shell system . . sed. -E "s/[[:cntrl:]]\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g"
260 }
261
262 prlogscip-shell shell linux 7.0.9-1 prlog().() { # messages
263 newline="\n"
264 if [scip-shell system . . `[`. "$1" = "-n" ] ; then
265 newline=
266 shift
267 fi
268 [scip-shell system . . `[`. "$KTAP" != "1" ] && printfscip-shell system . . printf. "$*$newline"
269 [scip-shell system . . `[`. "$LOG_FILE" ] && printfscip-shell system . . printf. "$*$newline" | strip_escscip-shell shell linux 7.0.9-1 strip_esc(). >> $LOG_FILE
270 }
271 catlogscip-shell shell linux 7.0.9-1 catlog().() { #file
272 if [scip-shell system . . `[`. "${KTAP}" = "1" ]; then
273 catscip-shell system . . cat. $1 | while read line ; do
274 echoscip-shell system . . echo. "# $line"
275 done
276 else
277 catscip-shell system . . cat. $1
278 fi
279 [scip-shell system . . `[`. "$LOG_FILE" ] && catscip-shell system . . cat. $1 | strip_escscip-shell shell linux 7.0.9-1 strip_esc(). >> $LOG_FILE
280 }
281 prlogscip-shell shell linux 7.0.9-1 prlog(). "=== Ftrace unit tests ==="
282
283
284 # Testcase management
285 # Test result codes - Dejagnu extended code
286 PASS=0 # The test succeeded.
287 FAIL=1 # The test failed, but was expected to succeed.
288 UNRESOLVED=2 # The test produced indeterminate results. (e.g. interrupted)
289 UNTESTED=3 # The test was not run, currently just a placeholder.
290 UNSUPPORTED=4 # The test failed because of lack of feature.
291 XFAIL=5 # The test failed, and was expected to fail.
292
293 # Accumulations
294 PASSED_CASES=
295 FAILED_CASES=
296 UNRESOLVED_CASES=
297 UNTESTED_CASES=
298 UNSUPPORTED_CASES=
299 XFAILED_CASES=
300 UNDEFINED_CASES=
301 TOTAL_RESULT=0
302
303 INSTANCE=
304 CASENO=0
305 CASENAME=
306
307 testcasescip-shell shell linux 7.0.9-1 testcase().() { # testfile
308 CASENO=$((CASENO+1))
309 CASENAME=`grepscip-shell system . . grep. "^#[ \t]*description:" $1 | cutscip-shell system . . cut. -f2- -d:`
310 }
311
312 checkreqscip-shell shell linux 7.0.9-1 checkreq().() { # testfile
313 requires=`grepscip-shell system . . grep. "^#[ \t]*requires:" $1 | cutscip-shell system . . cut. -f2- -d:`
314 # Use eval to pass quoted-patterns correctly.
315 eval check_requires "$requires"
316 }
317
318 test_on_instancescip-shell shell linux 7.0.9-1 test_on_instance().() { # testfile
319 grepscip-shell system . . grep. -q "^#[ \t]*flags:.*instance" $1
320 }
321
322 ktaptestscip-shell shell linux 7.0.9-1 ktaptest().() { # result comment
323 if [scip-shell system . . `[`. "$KTAP" != "1" ]; then
324 return
325 fi
326
327 local result=
328 if [scip-shell system . . `[`. "$1" = "1" ]; then
329 result="ok"
330 else
331 result="not ok"
332 fi
333 shift
334
335 local comment=$*
336 if [scip-shell system . . `[`. "$comment" != "" ]; then
337 comment="# $comment"
338 fi
339
340 echoscip-shell system . . echo. $result $CASENO $INSTANCE$CASENAME $comment
341 }
342
343 eval_resultscip-shell shell linux 7.0.9-1 eval_result().() { # sigval
344 case $1 in
345 $PASS)
346 prlogscip-shell shell linux 7.0.9-1 prlog(). " [${color_green}PASS${color_reset}]"
347 ktaptestscip-shell shell linux 7.0.9-1 ktaptest(). 1
348 PASSED_CASES="$PASSED_CASES $CASENO"
349 return 0
350 ;;
351 $FAIL)
352 prlogscip-shell shell linux 7.0.9-1 prlog(). " [${color_red}FAIL${color_reset}]"
353 ktaptestscip-shell shell linux 7.0.9-1 ktaptest(). 0
354 FAILED_CASES="$FAILED_CASES $CASENO"
355 return 1 # this is a bug.
356 ;;
357 $UNRESOLVED)
358 prlogscip-shell shell linux 7.0.9-1 prlog(). " [${color_blue}UNRESOLVED${color_reset}]"
359 ktaptestscip-shell shell linux 7.0.9-1 ktaptest(). 0 UNRESOLVED
360 UNRESOLVED_CASES="$UNRESOLVED_CASES $CASENO"
361 return $UNRESOLVED_RESULT # depends on use case
362 ;;
363 $UNTESTED)
364 prlogscip-shell shell linux 7.0.9-1 prlog(). " [${color_blue}UNTESTED${color_reset}]"
365 ktaptestscip-shell shell linux 7.0.9-1 ktaptest(). 1 SKIP
366 UNTESTED_CASES="$UNTESTED_CASES $CASENO"
367 return 0
368 ;;
369 $UNSUPPORTED)
370 prlogscip-shell shell linux 7.0.9-1 prlog(). " [${color_blue}UNSUPPORTED${color_reset}]"
371 ktaptestscip-shell shell linux 7.0.9-1 ktaptest(). 1 SKIP
372 UNSUPPORTED_CASES="$UNSUPPORTED_CASES $CASENO"
373 return $UNSUPPORTED_RESULT # depends on use case
374 ;;
375 $XFAIL)
376 prlogscip-shell shell linux 7.0.9-1 prlog(). " [${color_green}XFAIL${color_reset}]"
377 ktaptestscip-shell shell linux 7.0.9-1 ktaptest(). 1 XFAIL
378 XFAILED_CASES="$XFAILED_CASES $CASENO"
379 return 0
380 ;;
381 *)
382 prlogscip-shell shell linux 7.0.9-1 prlog(). " [${color_blue}UNDEFINED${color_reset}]"
383 ktaptestscip-shell shell linux 7.0.9-1 ktaptest(). 0 error
384 UNDEFINED_CASES="$UNDEFINED_CASES $CASENO"
385 return 1 # this must be a test bug
386 ;;
387 esac
388 }
389
390 # Signal handling for result codes
391 SIG_RESULT=
392 SIG_BASE=36 # Use realtime signals
393 SIG_PID=$$
394
395 exit_passscip-shell shell linux 7.0.9-1 exit_pass(). () {
396 exit 0
397 }
398
399 SIG_FAIL=$((SIG_BASE + FAIL))
400 exit_failscip-shell shell linux 7.0.9-1 exit_fail(). () {
401 exit 1
402 }
403 trap 'SIG_RESULT=$FAIL' $SIG_FAIL
404
405 SIG_UNRESOLVED=$((SIG_BASE + UNRESOLVED))
406 exit_unresolvedscip-shell shell linux 7.0.9-1 exit_unresolved(). () {
407 killscip-shell system . . kill. -s $SIG_UNRESOLVED $SIG_PID
408 exit 0
409 }
410 trap 'SIG_RESULT=$UNRESOLVED' $SIG_UNRESOLVED
411
412 SIG_UNTESTED=$((SIG_BASE + UNTESTED))
413 exit_untestedscip-shell shell linux 7.0.9-1 exit_untested(). () {
414 killscip-shell system . . kill. -s $SIG_UNTESTED $SIG_PID
415 exit 0
416 }
417 trap 'SIG_RESULT=$UNTESTED' $SIG_UNTESTED
418
419 SIG_UNSUPPORTED=$((SIG_BASE + UNSUPPORTED))
420 exit_unsupportedscip-shell shell linux 7.0.9-1 exit_unsupported(). () {
421 killscip-shell system . . kill. -s $SIG_UNSUPPORTED $SIG_PID
422 exit 0
423 }
424 trap 'SIG_RESULT=$UNSUPPORTED' $SIG_UNSUPPORTED
425
426 SIG_XFAIL=$((SIG_BASE + XFAIL))
427 exit_xfailscip-shell shell linux 7.0.9-1 exit_xfail(). () {
428 killscip-shell system . . kill. -s $SIG_XFAIL $SIG_PID
429 exit 0
430 }
431 trap 'SIG_RESULT=$XFAIL' $SIG_XFAIL
432
433 __run_testscip-shell shell linux 7.0.9-1 __run_test().() { # testfile
434 # setup PID and PPID, $$ is not updated.
435 (cd $TRACING_DIR; read PID _ < /proc/self/statscip-shell filesystem . . `/proc/self/stat`.; set -e; set -x;
436 checkreqscip-shell shell linux 7.0.9-1 checkreq(). $1; initialize_system; . $1)
437 [scip-shell system . . `[`. $? -ne 0 ] && killscip-shell system . . kill. -s $SIG_FAIL $SIG_PID
438 }
439
440 # Run one test case
441 run_testscip-shell shell linux 7.0.9-1 run_test().() { # testfile
442 local testname=`basenamescip-shell system . . basename. $1`
443 testcasescip-shell shell linux 7.0.9-1 testcase(). $1
444 prlogscip-shell shell linux 7.0.9-1 prlog(). -n "[$CASENO]$INSTANCE$CASENAME"
445 if [scip-shell system . . `[`. ! -z "$LOG_FILE" ] ; then
446 local testlog=`mktempscip-shell system . . mktemp. $LOG_DIR/${CASENO}-${testname}-log.XXXXXX`
447 else
448 local testlog=/proc/self/fd/1scip-shell filesystem . . `/proc/self/fd/1`.
449 fi
450 export TMPDIR=`mktempscip-shell system . . mktemp. -d /tmp/ftracetest-dir.XXXXXXscip-shell filesystem . . `/tmp/ftracetest-dir.XXXXXX`.`
451 export FTRACETEST_ROOT=$TOP_DIR
452 echoscip-shell system . . echo. "execute$INSTANCE: "$1 > $testlog
453 SIG_RESULT=0
454 if [scip-shell system . . `[`. $VERBOSE -eq -1 ]; then
455 __run_testscip-shell shell linux 7.0.9-1 __run_test(). $1
456 elif [scip-shell system . . `[`. -z "$LOG_FILE" ]; then
457 __run_testscip-shell shell linux 7.0.9-1 __run_test(). $1 2>&1
458 elif [scip-shell system . . `[`. $VERBOSE -ge 3 ]; then
459 __run_testscip-shell shell linux 7.0.9-1 __run_test(). $1 | teescip-shell system . . tee. -a $testlog 2>&1
460 elif [scip-shell system . . `[`. $VERBOSE -eq 2 ]; then
461 __run_testscip-shell shell linux 7.0.9-1 __run_test(). $1 2>> $testlog | teescip-shell system . . tee. -a $testlog
462 else
463 __run_testscip-shell shell linux 7.0.9-1 __run_test(). $1 >> $testlog 2>&1
464 fi
465 eval_resultscip-shell shell linux 7.0.9-1 eval_result(). $SIG_RESULT
466 if [scip-shell system . . `[`. $? -eq 0 ]; then
467 # Remove test log if the test was done as it was expected.
468 [scip-shell system . . `[`. $KEEP_LOG -eq 0 -a ! -z "$LOG_FILE" ] && rmscip-shell system . . rm. $testlog
469 else
470 [scip-shell system . . `[`. $VERBOSE -eq 1 -o $VERBOSE -eq 2 ] && catlogscip-shell shell linux 7.0.9-1 catlog(). $testlog
471 TOTAL_RESULT=1
472 fi
473 rmscip-shell system . . rm. -rf $TMPDIR
474 }
475
476 # load in the helper functions
477 . $TEST_DIR/functions
478
479 if [scip-shell system . . `[`. "$KTAP" = "1" ]; then
480 echoscip-shell system . . echo. "TAP version 13"
481
482 casecount=`echoscip-shell system . . echo. $TEST_CASES | wcscip-shell system . . wc. -w`
483 for t in $TEST_CASES; do
484 test_on_instancescip-shell shell linux 7.0.9-1 test_on_instance(). $t || continue
485 casecount=$((casecount+1))
486 done
487 echoscip-shell system . . echo. "1..${casecount}"
488 fi
489
490 # Main loop
491 for t in $TEST_CASES; do
492 run_testscip-shell shell linux 7.0.9-1 run_test(). $t
493 if [scip-shell system . . `[`. $STOP_FAILURE -ne 0 -a $TOTAL_RESULT -ne 0 ]; then
494 echoscip-shell system . . echo. "A failure detected. Stop test."
495 exit 1
496 fi
497 done
498
499 # Test on instance loop
500 INSTANCE=" (instance) "
501 for t in $TEST_CASES; do
502 test_on_instancescip-shell shell linux 7.0.9-1 test_on_instance(). $t || continue
503 SAVED_TRACING_DIR=$TRACING_DIR
504 export TRACING_DIR=`mktempscip-shell system . . mktemp. -d $TRACING_DIR/instances/ftracetest.XXXXXX`
505 run_testscip-shell shell linux 7.0.9-1 run_test(). $t
506 rmdirscip-shell system . . rmdir. $TRACING_DIR
507 TRACING_DIR=$SAVED_TRACING_DIR
508 if [scip-shell system . . `[`. $STOP_FAILURE -ne 0 -a $TOTAL_RESULT -ne 0 ]; then
509 echoscip-shell system . . echo. "A failure detected. Stop test."
510 exit 1
511 fi
512 done
513 (cd $TRACING_DIR; finish_system) # for cleanup
514
515 prlogscip-shell shell linux 7.0.9-1 prlog(). ""
516 prlogscip-shell shell linux 7.0.9-1 prlog(). "# of passed: " `echoscip-shell system . . echo. $PASSED_CASES | wcscip-shell system . . wc. -w`
517 prlogscip-shell shell linux 7.0.9-1 prlog(). "# of failed: " `echoscip-shell system . . echo. $FAILED_CASES | wcscip-shell system . . wc. -w`
518 prlogscip-shell shell linux 7.0.9-1 prlog(). "# of unresolved: " `echoscip-shell system . . echo. $UNRESOLVED_CASES | wcscip-shell system . . wc. -w`
519 prlogscip-shell shell linux 7.0.9-1 prlog(). "# of untested: " `echoscip-shell system . . echo. $UNTESTED_CASES | wcscip-shell system . . wc. -w`
520 prlogscip-shell shell linux 7.0.9-1 prlog(). "# of unsupported: " `echoscip-shell system . . echo. $UNSUPPORTED_CASES | wcscip-shell system . . wc. -w`
521 prlogscip-shell shell linux 7.0.9-1 prlog(). "# of xfailed: " `echoscip-shell system . . echo. $XFAILED_CASES | wcscip-shell system . . wc. -w`
522 prlogscip-shell shell linux 7.0.9-1 prlog(). "# of undefined(test bug): " `echoscip-shell system . . echo. $UNDEFINED_CASES | wcscip-shell system . . wc. -w`
523
524 if [scip-shell system . . `[`. "$KTAP" = "1" ]; then
525 echoscip-shell system . . echo. -n "# Totals:"
526 echoscip-shell system . . echo. -n " pass:"`echoscip-shell system . . echo. $PASSED_CASES | wcscip-shell system . . wc. -w`
527 echoscip-shell system . . echo. -n " fail:"`echoscip-shell system . . echo. $FAILED_CASES | wcscip-shell system . . wc. -w`
528 echoscip-shell system . . echo. -n " xfail:"`echoscip-shell system . . echo. $XFAILED_CASES | wcscip-shell system . . wc. -w`
529 echoscip-shell system . . echo. -n " xpass:0"
530 echoscip-shell system . . echo. -n " skip:"`echoscip-shell system . . echo. $UNTESTED_CASES $UNSUPPORTED_CASES | wcscip-shell system . . wc. -w`
531 echoscip-shell system . . echo. -n " error:"`echoscip-shell system . . echo. $UNRESOLVED_CASES $UNDEFINED_CASES | wcscip-shell system . . wc. -w`
532 echoscip-shell system . . echo.
533 fi
534
535 cleanupscip-shell shell linux 7.0.9-1 cleanup().
536
537 # if no error, return 0
538 exit $TOTAL_RESULT