Skip to content

Commit 57c6c58

Browse files
broonieshuahkh
authored andcommitted
tracing/selftests: Support log output when generating KTAP output
When -v is specified ftracetest will dump logs of test execution to the console which if -K is also specified for KTAP output will result in output that is not properly KTAP formatted. All that's required for KTAP formatting is that anything we log have a '#' at the start of the line so we can improve things by washing the output through a simple read loop. This will help automated parsers when verbose mode is enabled. Signed-off-by: Mark Brown <[email protected]> Reviewed-by: Muhammad Usama Anjum <[email protected]> Acked-by: Steven Rostedt (Google) <[email protected]> Acked-by: Masami Hiramatsu (Google) <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
1 parent 9c84b89 commit 57c6c58

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

tools/testing/selftests/ftrace/ftracetest

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,13 @@ prlog() { # messages
255255
[ "$LOG_FILE" ] && printf "$*$newline" | strip_esc >> $LOG_FILE
256256
}
257257
catlog() { #file
258-
cat $1
258+
if [ "${KTAP}" = "1" ]; then
259+
cat $1 | while read line ; do
260+
echo "# $line"
261+
done
262+
else
263+
cat $1
264+
fi
259265
[ "$LOG_FILE" ] && cat $1 | strip_esc >> $LOG_FILE
260266
}
261267
prlog "=== Ftrace unit tests ==="

0 commit comments

Comments
 (0)