Add checkbashisms meta-testcase
Masami Hiramatsu
maintainercover Add checkbashisms meta-testcase
Hi,
Here are patches for making sure the ftracetest testcases are checkbashisms clean.
This actually needs a patch from Juerg, "selftests/ftrace:
Make the coloring POSIX compliant" to complete the work.
http://lkml.kernel.org/r/20190220161333.28109-1-juergh at canonical.com (Note that this is still under development)
So as Juerg pointed, recently ftracetest becomes not POSIX compliant, and such kind of issues happened repeatedly. To avoid those anymore, I decided to introduce a testcase which runs checkbasisms on ftracetest and its testcases. I think this can help us to find out whether it was written in a way out of POSIX.
Thank you,
---
Masami Hiramatsu (2):
selftests/ftrace: Make a script checkbashisms clean selftests/ftrace: Add checkbashisms meta-testcase
tools/testing/selftests/ftrace/ftracetest | 1 + .../ftrace/test.d/kprobe/kprobe_ftrace.tc | 2 +- .../selftests/ftrace/test.d/selftest/bashisms.tc | 21 ++++++++++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/ftrace/test.d/selftest/bashisms.tc
--
Masami Hiramatsu (Linaro) <mhiramat at kernel.org>
Masami Hiramatsu
maintainerPATCH 1/2 selftests/ftrace: Make a script checkbashisms clean
Make kprobe_ftrace.tc checkbashisms clean. Since
"grep function available_tracers" causes an error
on checkbashisms, fix it by explicitly escaping
with double-quotations.
--- .../ftrace/test.d/kprobe/kprobe_ftrace.tc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_ftrace.tc +1 -1
@@ -3,7 +3,7 @@ # description: Kprobe dynamic event with function tracer [ -f kprobe_events ] || exit_unsupported # this is configurable -grep function available_tracers || exit_unsupported # this is configurable +grep "function" available_tracers || exit_unsupported # this is configurable # prepare echo nop > current_tracer
Masami Hiramatsu
maintainerPATCH 2/2 selftests/ftrace: Add checkbashisms meta-testcase
In reply to Masami HiramatsuAdd a meta-testcase which tests ftracetest itself with checkbasisms. This helps us to keep our test script bashisms clean.
--- tools/testing/selftests/ftrace/ftracetest | 1 + .../selftests/ftrace/test.d/selftest/bashisms.tc | 21 ++++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 tools/testing/selftests/ftrace/test.d/selftest/bashisms.tc
tools/testing/selftests/ftrace/ftracetest +1 -0
@@ -313,6 +313,7 @@ run_test() { # testfile local testlog=/proc/self/fd/1 fi export TMPDIR=`mktemp -d /tmp/ftracetest-dir.XXXXXX` + export FTRACETEST_ROOT=$TOP_DIR echo "execute$INSTANCE: "$1 > $testlog SIG_RESULT=0 if [ $VERBOSE -eq -1 ]; then
tools/testing/selftests/ftrace/test.d/selftest/bashisms.tc new file +21 -0
@@ -0,0 +1,21 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# description: Meta-selftest: Checkbashisms + +if [ ! -f $FTRACETEST_ROOT/ftracetest ]; then + echo "Hmm, we can not find ftracetest" + exit_unresolved +fi + +if ! which checkbashisms > /dev/null 2>&1 ; then + echo "No checkbashisms found. skipped." + exit_unresolved +fi + +checkbashisms $FTRACETEST_ROOT/ftracetest +checkbashisms $FTRACETEST_ROOT/test.d/functions +for t in $(find $FTRACETEST_ROOT/test.d -name \*.tc); do + checkbashisms $t +done + +exit 0
Masami Hiramatsu
maintainerHi Shuah,
Could you pick this to your tree? I think this can prevent further simillar errors before release...
Thank you,
Quoted 35 lines · On Fri, 22 Feb 2019 10:26:27 +0900 Masami Hiramatsu <[email protected]> wrote:
Hi,
Here are patches for making sure the ftracetest testcases are checkbashisms clean.
This actually needs a patch from Juerg, "selftests/ftrace:
Make the coloring POSIX compliant" to complete the work.http://lkml.kernel.org/r/20190220161333.28109-1-juergh at canonical.com (Note that this is still under development)
So as Juerg pointed, recently ftracetest becomes not POSIX compliant, and such kind of issues happened repeatedly. To avoid those anymore, I decided to introduce a testcase which runs checkbasisms on ftracetest and its testcases. I think this can help us to find out whether it was written in a way out of POSIX.
Thank you,
---
Masami Hiramatsu (2):
selftests/ftrace: Make a script checkbashisms clean selftests/ftrace: Add checkbashisms meta-testcasetools/testing/selftests/ftrace/ftracetest | 1 + .../ftrace/test.d/kprobe/kprobe_ftrace.tc | 2 +- .../selftests/ftrace/test.d/selftest/bashisms.tc | 21 ++++++++++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/ftrace/test.d/selftest/bashisms.tc--
Masami Hiramatsu (Linaro) <mhiramat at kernel.org>
Signature · 1 line
Masami Hiramatsu <mhiramat at kernel.org>
Steven Rostedt
maintainerShuah,
Want to take this or would you want me to?
-- Steve
Quoted 47 lines · On Sat, 23 Mar 2019 19:27:46 +0900 Masami Hiramatsu <mhiramat at kernel.org>…
Hi Shuah,
Could you pick this to your tree? I think this can prevent further simillar errors before release...
Thank you,
Quoted 35 lines · On Fri, 22 Feb 2019 10:26:27 +0900 Masami Hiramatsu <mhiramat at kernel.org>…
Hi,
Here are patches for making sure the ftracetest testcases are checkbashisms clean.
This actually needs a patch from Juerg, "selftests/ftrace:
Make the coloring POSIX compliant" to complete the work.http://lkml.kernel.org/r/20190220161333.28109-1-juergh at canonical.com (Note that this is still under development)
So as Juerg pointed, recently ftracetest becomes not POSIX compliant, and such kind of issues happened repeatedly. To avoid those anymore, I decided to introduce a testcase which runs checkbasisms on ftracetest and its testcases. I think this can help us to find out whether it was written in a way out of POSIX.
Thank you,
---
Masami Hiramatsu (2):
selftests/ftrace: Make a script checkbashisms clean selftests/ftrace: Add checkbashisms meta-testcasetools/testing/selftests/ftrace/ftracetest | 1 + .../ftrace/test.d/kprobe/kprobe_ftrace.tc | 2 +- .../selftests/ftrace/test.d/selftest/bashisms.tc | 21 ++++++++++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/ftrace/test.d/selftest/bashisms.tc--
Masami Hiramatsu (Linaro) <mhiramat at kernel.org>
shuah
maintainerQuoted 8 lines · Steven Rostedt
Shuah,
Want to take this or would you want me to?
-- Steve
I can take them through my tree.
thanks,
-- Shuah