From: Masami Hiramatsu <mhiramat@kernel.org>
To: shuah@kernel.org, Steven Rostedt <rostedt@goodmis.org>
Cc: "Daniel Díaz" <daniel.diaz@linaro.org>,
linux-kselftest@vger.kernel.org, "Ingo Molnar" <mingo@redhat.com>,
linux-kernel@vger.kernel.org,
"Masami Hiramatsu" <mhiramat@kernel.org>
Subject: [PATCH] selftests/ftrace: Strip escape sequences for log file
Date: Wed, 17 Oct 2018 12:33:23 +0900 [thread overview]
Message-ID: <153974720272.17748.17439079576533415951.stgit@devbox> (raw)
In-Reply-To: <20181017100305.0b3c03461b098f8943805455@gmail.com>
In-Reply-To: <20181017100305.0b3c03461b098f8943805455@gmail.com>
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>
---
tools/testing/selftests/ftrace/ftracetest | 11 +++++++++--
1 file 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 ==="
WARNING: multiple messages have this Message-ID (diff)
From: mhiramat at kernel.org (Masami Hiramatsu)
Subject: [PATCH] selftests/ftrace: Strip escape sequences for log file
Date: Wed, 17 Oct 2018 12:33:23 +0900 [thread overview]
Message-ID: <153974720272.17748.17439079576533415951.stgit@devbox> (raw)
In-Reply-To: <20181017100305.0b3c03461b098f8943805455@gmail.com>
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 at kernel.org>
---
tools/testing/selftests/ftrace/ftracetest | 11 +++++++++--
1 file 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 ==="
WARNING: multiple messages have this Message-ID (diff)
From: mhiramat@kernel.org (Masami Hiramatsu)
Subject: [PATCH] selftests/ftrace: Strip escape sequences for log file
Date: Wed, 17 Oct 2018 12:33:23 +0900 [thread overview]
Message-ID: <153974720272.17748.17439079576533415951.stgit@devbox> (raw)
Message-ID: <20181017033323.MOI49hC72rEHeYulAxZyWXvdWOVjFsehUN_mVkYP_0g@z> (raw)
In-Reply-To: <20181017100305.0b3c03461b098f8943805455@gmail.com>
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 at kernel.org>
---
tools/testing/selftests/ftrace/ftracetest | 11 +++++++++--
1 file 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 ==="
next prev parent reply other threads:[~2018-10-17 3:33 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-16 17:02 [PATCH] selftests/ftrace: Use colored output when available Daniel Díaz
2018-10-16 17:02 ` Daniel Díaz
2018-10-16 17:02 `
2018-10-16 17:09 ` Steven Rostedt
2018-10-16 17:09 ` Steven Rostedt
2018-10-16 17:09 ` rostedt
2018-10-17 1:03 ` Masami Hiramatsu
2018-10-17 1:03 ` Masami Hiramatsu
2018-10-17 1:03 ` masami.hiramatsu
2018-10-17 3:33 ` Masami Hiramatsu [this message]
2018-10-17 3:33 ` [PATCH] selftests/ftrace: Strip escape sequences for log file Masami Hiramatsu
2018-10-17 3:33 ` mhiramat
2018-10-17 20:45 ` Steven Rostedt
2018-10-17 20:45 ` Steven Rostedt
2018-10-17 20:45 ` rostedt
2018-10-17 23:02 ` Shuah Khan
2018-10-17 23:02 ` Shuah Khan
2018-10-17 23:02 ` shuah
2018-10-16 17:43 ` [PATCH] selftests/ftrace: Use colored output when available Shuah Khan
2018-10-16 17:43 ` Shuah Khan
2018-10-16 17:43 ` shuah
2018-10-16 18:20 ` Daniel Díaz
2018-10-16 18:20 ` Daniel Díaz
2018-10-16 18:20 `
2018-10-16 18:34 ` Steven Rostedt
2018-10-16 18:34 ` Steven Rostedt
2018-10-16 18:34 ` rostedt
2018-10-17 15:19 ` Shuah Khan
2018-10-17 15:19 ` Shuah Khan
2018-10-17 15:19 ` shuah
2018-10-17 20:41 ` Steven Rostedt
2018-10-17 20:41 ` Steven Rostedt
2018-10-17 20:41 ` rostedt
2018-10-17 23:01 ` Shuah Khan
2018-10-17 23:01 ` Shuah Khan
2018-10-17 23:01 ` shuah
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=153974720272.17748.17439079576533415951.stgit@devbox \
--to=mhiramat@kernel.org \
--cc=daniel.diaz@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=rostedt@goodmis.org \
--cc=shuah@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.