diff options
author | Masami Hiramatsu <mhiramat@kernel.org> | 2018-10-16 23:33:23 -0400 |
---|---|---|
committer | Shuah Khan (Samsung OSG) <shuah@kernel.org> | 2018-10-24 16:49:37 -0400 |
commit | f73581f8d9a367459f36e6a4ef0065997ab14c75 (patch) | |
tree | be1f133d064418a972a9fdd7cc973cd79cff0aa2 | |
parent | 8096fbcf55c0da535bdca9adab982ec0c5affb67 (diff) |
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>
-rwxr-xr-x | tools/testing/selftests/ftrace/ftracetest | 11 |
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 | |||
167 | color_blue="\e[34m" | 167 | color_blue="\e[34m" |
168 | fi | 168 | fi |
169 | 169 | ||
170 | strip_esc() { | ||
171 | # busybox sed implementation doesn't accept "\x1B", so use [:cntrl:] instead. | ||
172 | sed -E "s/[[:cntrl:]]\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g" | ||
173 | } | ||
174 | |||
170 | prlog() { # messages | 175 | prlog() { # messages |
171 | [ -z "$LOG_FILE" ] && echo -e "$@" || echo -e "$@" | tee -a $LOG_FILE | 176 | echo -e "$@" |
177 | [ "$LOG_FILE" ] && echo -e "$@" | strip_esc >> $LOG_FILE | ||
172 | } | 178 | } |
173 | catlog() { #file | 179 | catlog() { #file |
174 | [ -z "$LOG_FILE" ] && cat $1 || cat $1 | tee -a $LOG_FILE | 180 | cat $1 |
181 | [ "$LOG_FILE" ] && cat $1 | strip_esc >> $LOG_FILE | ||
175 | } | 182 | } |
176 | prlog "=== Ftrace unit tests ===" | 183 | prlog "=== Ftrace unit tests ===" |
177 | 184 | ||