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@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@kernel.org
Make kprobe_ftrace.tc checkbashisms clean. Since "grep function available_tracers" causes an error on checkbashisms, fix it by explicitly escaping with double-quotations.
Signed-off-by: Masami Hiramatsu mhiramat@kernel.org --- .../ftrace/test.d/kprobe/kprobe_ftrace.tc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_ftrace.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_ftrace.tc index 492426e95e09..7650a82db3f5 100644 --- a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_ftrace.tc +++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_ftrace.tc @@ -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
Add a meta-testcase which tests ftracetest itself with checkbasisms. This helps us to keep our test script bashisms clean.
Signed-off-by: Masami Hiramatsu mhiramat@kernel.org --- 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
diff --git a/tools/testing/selftests/ftrace/ftracetest b/tools/testing/selftests/ftrace/ftracetest index 75244db70331..72b6df37cdb9 100755 --- a/tools/testing/selftests/ftrace/ftracetest +++ b/tools/testing/selftests/ftrace/ftracetest @@ -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 diff --git a/tools/testing/selftests/ftrace/test.d/selftest/bashisms.tc b/tools/testing/selftests/ftrace/test.d/selftest/bashisms.tc new file mode 100644 index 000000000000..1b081e910e14 --- /dev/null +++ b/tools/testing/selftests/ftrace/test.d/selftest/bashisms.tc @@ -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
Hi Shuah,
Could you pick this to your tree? I think this can prevent further simillar errors before release...
Thank you,
On Fri, 22 Feb 2019 10:26:27 +0900 Masami Hiramatsu mhiramat@kernel.org 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@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@kernel.org
Shuah,
Want to take this or would you want me to?
-- Steve
On Sat, 23 Mar 2019 19:27:46 +0900 Masami Hiramatsu mhiramat@kernel.org wrote:
Hi Shuah,
Could you pick this to your tree? I think this can prevent further simillar errors before release...
Thank you,
On Fri, 22 Feb 2019 10:26:27 +0900 Masami Hiramatsu mhiramat@kernel.org 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@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@kernel.org
linux-kselftest-mirror@lists.linaro.org