[PATCH -tip v3 3/9] selftests: ftrace: Add --quiet option not to show error logs on screen

From: Masami Hiramatsu
Date: Wed Nov 16 2016 - 03:13:35 EST


Since the verbose error logs scrolls out previous test results
--quiet option suppress to show such message.

e.g.
# ./ftracetest -q
=== Ftrace unit tests ===
[1] Basic trace file check [PASS]
[2] Basic test for tracers [PASS]
[3] Basic trace clock test [PASS]
[4] Basic event tracing check [PASS]
[5] event tracing - enable/disable with event level files [PASS]
[6] event tracing - restricts events based on pid [PASS]
[7] event tracing - enable/disable with subsystem level files [PASS]
[8] event tracing - enable/disable with top level files [PASS]
[9] ftrace - function graph filters with stack tracer [UNSUPPORTED]
[10] ftrace - function graph filters [UNSUPPORTED]
[11] ftrace - function profiler with function tracing [UNSUPPORTED]
[12] Test creation and deletion of trace instances while setting an event
[PASS]
[13] Test creation and deletion of trace instances [PASS]
[14] Kprobe dynamic event - adding and removing [UNSUPPORTED]
[15] Kprobe dynamic event - busy event check [UNSUPPORTED]
[16] Kprobe dynamic event with arguments [UNSUPPORTED]
[17] Kprobe dynamic event with function tracer [UNSUPPORTED]
[18] Kretprobe dynamic event with arguments [UNSUPPORTED]
[19] event trigger - test event enable/disable trigger [PASS]
[20] event trigger - test trigger filter [PASS]
[21] event trigger - test histogram modifiers [UNSUPPORTED]
[22] event trigger - test histogram trigger [UNSUPPORTED]
[23] event trigger - test multiple histogram triggers [UNSUPPORTED]
[24] event trigger - test snapshot-trigger [FAIL]
[25] event trigger - test stacktrace-trigger [PASS]
[26] event trigger - test traceon/off trigger [PASS]

# of passed: 14
# of failed: 1
# of unresolved: 0
# of untested: 0
# of unsupported: 11
# of xfailed: 0
# of undefined(test bug): 0

Signed-off-by: Masami Hiramatsu <mhiramat@xxxxxxxxxx>
---
tools/testing/selftests/ftrace/ftracetest | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/ftrace/ftracetest b/tools/testing/selftests/ftrace/ftracetest
index a03d366..d08235f 100755
--- a/tools/testing/selftests/ftrace/ftracetest
+++ b/tools/testing/selftests/ftrace/ftracetest
@@ -14,6 +14,7 @@ echo " Options:"
echo " -h|--help Show help message"
echo " -k|--keep Keep passed test logs"
echo " -v|--verbose Show all stdout messages in testcases"
+echo " -q|--quiet Do not show error log on stdout"
echo " -d|--debug Debug mode (trace all shell commands)"
exit $1
}
@@ -58,6 +59,10 @@ parse_opts() { # opts
VERBOSE=1
shift 1
;;
+ --quiet|-q)
+ BE_QUIET=1
+ shift 1
+ ;;
--debug|-d)
DEBUG=1
shift 1
@@ -101,6 +106,7 @@ LOG_DIR=$TOP_DIR/logs/`date +%Y%m%d-%H%M%S`/
KEEP_LOG=0
DEBUG=0
VERBOSE=0
+BE_QUIET=0
# Parse command-line options
parse_opts $*

@@ -249,7 +255,7 @@ run_test() { # testfile
# Remove test log if the test was done as it was expected.
[ $KEEP_LOG -eq 0 ] && rm $testlog
else
- catlog $testlog
+ [ $BE_QUIET -eq 0 ] && catlog $testlog
TOTAL_RESULT=1
fi
}