summaryrefslogtreecommitdiff
path: root/tools/testing
diff options
context:
space:
mode:
authorMasami Hiramatsu <mhiramat@kernel.org>2018-10-17 06:33:23 +0300
committerShuah Khan (Samsung OSG) <shuah@kernel.org>2018-10-24 23:49:37 +0300
commitf73581f8d9a367459f36e6a4ef0065997ab14c75 (patch)
treebe1f133d064418a972a9fdd7cc973cd79cff0aa2 /tools/testing
parent8096fbcf55c0da535bdca9adab982ec0c5affb67 (diff)
downloadlinux-f73581f8d9a367459f36e6a4ef0065997ab14c75.tar.xz
selftests/ftrace: Strip escape sequences for log file
Strip escape sequences from the stream to the ftracetest summary log file. Note that all test-case results are dumped raw in each file. Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Signed-off-by: Shuah Khan (Samsung OSG) <shuah@kernel.org>
Diffstat (limited to 'tools/testing')
-rwxr-xr-xtools/testing/selftests/ftrace/ftracetest11
1 files changed, 9 insertions, 2 deletions
diff --git a/tools/testing/selftests/ftrace/ftracetest b/tools/testing/selftests/ftrace/ftracetest
index d987bbec675f..75244db70331 100755
--- a/tools/testing/selftests/ftrace/ftracetest
+++ b/tools/testing/selftests/ftrace/ftracetest
@@ -167,11 +167,18 @@ if [ -t 1 -a "$ncolors" -a "$ncolors" -ge 8 ]; then
color_blue="\e[34m"
fi
+strip_esc() {
+ # busybox sed implementation doesn't accept "\x1B", so use [:cntrl:] instead.
+ sed -E "s/[[:cntrl:]]\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g"
+}
+
prlog() { # messages
- [ -z "$LOG_FILE" ] && echo -e "$@" || echo -e "$@" | tee -a $LOG_FILE
+ echo -e "$@"
+ [ "$LOG_FILE" ] && echo -e "$@" | strip_esc >> $LOG_FILE
}
catlog() { #file
- [ -z "$LOG_FILE" ] && cat $1 || cat $1 | tee -a $LOG_FILE
+ cat $1
+ [ "$LOG_FILE" ] && cat $1 | strip_esc >> $LOG_FILE
}
prlog "=== Ftrace unit tests ==="