Lines Matching +full:message +full:- +full:handling +full:- +full:unit
2 # SPDX-License-Identifier: GPL-2.0-only
4 # ftracetest - Ftrace test shell scripts
10 usage() { # errno [message]
11 [ ! -z "$2" ] && echo $2
12 echo "Usage: ftracetest [options] [testcase(s)] [testcase-directory(s)]"
14 echo " -h|--help Show help message"
15 echo " -k|--keep Keep passed test logs"
16 echo " -v|--verbose Increase verbosity of test messages"
17 echo " -vv Alias of -v -v (Show all results in stdout)"
18 echo " -vvv Alias of -v -v -v (Show all commands immediately)"
19 echo " --fail-unsupported Treat UNSUPPORTED as a failure"
20 echo " --fail-unresolved Treat UNRESOLVED as a failure"
21 echo " -d|--debug Debug mode (trace all shell commands)"
22 echo " -l|--logdir <dir> Save logs on the <dir>"
23 echo " If <dir> is -, all logs output in console only"
42 echo -1 > $sched_rt_runtime
49 errexit() { # message
56 if [ `id -u` -ne 0 ]; then
72 echo `find $1 -name \*.tc | sort`
79 while [ ! -z "$1" ]; do
81 --help|-h)
84 --keep|-k)
88 --verbose|-v|-vv|-vvv)
89 if [ $VERBOSE -eq -1 ]; then
90 usage "--console can not use with --verbose"
93 [ $1 = '-vv' ] && VERBOSE=$((VERBOSE + 1))
94 [ $1 = '-vvv' ] && VERBOSE=$((VERBOSE + 2))
97 --console)
98 if [ $VERBOSE -ne 0 ]; then
99 usage "--console can not use with --verbose"
101 VERBOSE=-1
104 --debug|-d)
108 --stop-fail)
112 --fail-unsupported)
116 --fail-unresolved)
120 --logdir|-l)
125 if [ -f "$1" ]; then
133 if [ -d "$1" ]; then
143 if [ ! -z "$OPT_TEST_CASES" ]; then
149 TRACING_DIR=`grep tracefs /proc/mounts | cut -f2 -d' ' | head -1`
150 if [ -z "$TRACING_DIR" ]; then
151 DEBUGFS_DIR=`grep debugfs /proc/mounts | cut -f2 -d' ' | head -1`
152 if [ -z "$DEBUGFS_DIR" ]; then
154 if [ -d "/sys/kernel/tracing" ]; then
155 mount -t tracefs nodev /sys/kernel/tracing ||
159 elif [ -d "/sys/kernel/debug" ]; then
160 mount -t debugfs nodev /sys/kernel/debug ||
171 if [ ! -d "$TRACING_DIR" ]; then
179 LOG_DIR=$TOP_DIR/logs/`date +%Y%m%d-%H%M%S`/
186 # Parse command-line options
189 [ $DEBUG -ne 0 ] && set -x
192 if [ -z "$TRACING_DIR" -o ! -d "$TRACING_DIR" ]; then
197 if [ "x$LOG_DIR" = "x-" ]; then
202 mkdir -p $LOG_DIR || errexit "Failed to make a log directory: $LOG_DIR"
214 if [ -t 1 -a "$ncolors" -ge 8 ]; then
223 sed -E "s/[[:cntrl:]]\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g"
228 if [ "$1" = "-n" ] ; then
239 prlog "=== Ftrace unit tests ==="
243 # Test result codes - Dejagnu extended code
266 desc=`grep "^#[ \t]*description:" $1 | cut -f2- -d:`
267 prlog -n "[$CASENO]$INSTANCE$desc"
271 requires=`grep "^#[ \t]*requires:" $1 | cut -f2- -d:`
272 # Use eval to pass quoted-patterns correctly.
277 grep -q "^#[ \t]*flags:.*instance" $1
320 # Signal handling for result codes
337 kill -s $SIG_UNRESOLVED $SIG_PID
344 kill -s $SIG_UNTESTED $SIG_PID
351 kill -s $SIG_UNSUPPORTED $SIG_PID
358 kill -s $SIG_XFAIL $SIG_PID
365 (cd $TRACING_DIR; read PID _ < /proc/self/stat; set -e; set -x;
367 [ $? -ne 0 ] && kill -s $SIG_FAIL $SIG_PID
374 if [ ! -z "$LOG_FILE" ] ; then
375 local testlog=`mktemp $LOG_DIR/${CASENO}-${testname}-log.XXXXXX`
379 export TMPDIR=`mktemp -d /tmp/ftracetest-dir.XXXXXX`
383 if [ $VERBOSE -eq -1 ]; then
385 elif [ -z "$LOG_FILE" ]; then
387 elif [ $VERBOSE -ge 3 ]; then
388 __run_test $1 | tee -a $testlog 2>&1
389 elif [ $VERBOSE -eq 2 ]; then
390 __run_test $1 2>> $testlog | tee -a $testlog
395 if [ $? -eq 0 ]; then
397 [ $KEEP_LOG -eq 0 -a ! -z "$LOG_FILE" ] && rm $testlog
399 [ $VERBOSE -eq 1 -o $VERBOSE -eq 2 ] && catlog $testlog
402 rm -rf $TMPDIR
411 if [ $STOP_FAILURE -ne 0 -a $TOTAL_RESULT -ne 0 ]; then
422 export TRACING_DIR=`mktemp -d $TRACING_DIR/instances/ftracetest.XXXXXX`
426 if [ $STOP_FAILURE -ne 0 -a $TOTAL_RESULT -ne 0 ]; then
434 prlog "# of passed: " `echo $PASSED_CASES | wc -w`
435 prlog "# of failed: " `echo $FAILED_CASES | wc -w`
436 prlog "# of unresolved: " `echo $UNRESOLVED_CASES | wc -w`
437 prlog "# of untested: " `echo $UNTESTED_CASES | wc -w`
438 prlog "# of unsupported: " `echo $UNSUPPORTED_CASES | wc -w`
439 prlog "# of xfailed: " `echo $XFAILED_CASES | wc -w`
440 prlog "# of undefined(test bug): " `echo $UNDEFINED_CASES | wc -w`