[PATCH 2/2] ftrace/selftest: absence of modules/programs should trigger unsupported errors

From: Alan Maguire
Date: Thu Feb 06 2020 - 10:10:36 EST


In a number of cases, the ftrace tests check for the presence of
ftrace testing-related modules (ftrace-direct, trace-printk) and
programs (checkbashisms), returning exit_unresolved if these
are not found. The problem is, exit_unresolved causes execution
of ftracetest to return an error, when really our tests are
failing due to not having the requisite kernel configuration/tools
present, which is I think more of an unsupported error condition.
With these fixed, we see no unresolved test cases and ftracetest
returns success ("ok" when run via kselftest).

Fixes: 646f01ccdd59 ("ftrace/selftest: Add tests to test register_ftrace_direct()")
Fixes: 4d23e9b4fd2e ("selftests/ftrace: Add trace_printk sample module test")
Fixes: 7bc026d6c032 ("selftests/ftrace: Add function filter on module testcase")
Fixes: ff431b1390cb ("selftests/ftrace: Add a test to probe module functions")
Fixes: 4a075bd4e13f ("selftests/ftrace: Add checkbashisms meta-testcase")
Signed-off-by: Alan Maguire <alan.maguire@xxxxxxxxxx>
---
tools/testing/selftests/ftrace/test.d/direct/ftrace-direct.tc | 2 +-
tools/testing/selftests/ftrace/test.d/direct/kprobe-direct.tc | 2 +-
tools/testing/selftests/ftrace/test.d/event/trace_printk.tc | 2 +-
tools/testing/selftests/ftrace/test.d/ftrace/func_mod_trace.tc | 2 +-
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_module.tc | 2 +-
tools/testing/selftests/ftrace/test.d/selftest/bashisms.tc | 2 +-
6 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/tools/testing/selftests/ftrace/test.d/direct/ftrace-direct.tc b/tools/testing/selftests/ftrace/test.d/direct/ftrace-direct.tc
index d75a869..3d6189e 100644
--- a/tools/testing/selftests/ftrace/test.d/direct/ftrace-direct.tc
+++ b/tools/testing/selftests/ftrace/test.d/direct/ftrace-direct.tc
@@ -5,7 +5,7 @@
rmmod ftrace-direct ||:
if ! modprobe ftrace-direct ; then
echo "No ftrace-direct sample module - please make CONFIG_SAMPLE_FTRACE_DIRECT=m"
- exit_unresolved;
+ exit_unsupported;
fi

echo "Let the module run a little"
diff --git a/tools/testing/selftests/ftrace/test.d/direct/kprobe-direct.tc b/tools/testing/selftests/ftrace/test.d/direct/kprobe-direct.tc
index 801ecb6..3d0e3ca 100644
--- a/tools/testing/selftests/ftrace/test.d/direct/kprobe-direct.tc
+++ b/tools/testing/selftests/ftrace/test.d/direct/kprobe-direct.tc
@@ -5,7 +5,7 @@
rmmod ftrace-direct ||:
if ! modprobe ftrace-direct ; then
echo "No ftrace-direct sample module - please build with CONFIG_SAMPLE_FTRACE_DIRECT=m"
- exit_unresolved;
+ exit_unsupported;
fi

if [ ! -f kprobe_events ]; then
diff --git a/tools/testing/selftests/ftrace/test.d/event/trace_printk.tc b/tools/testing/selftests/ftrace/test.d/event/trace_printk.tc
index b02550b..dd8b10d 100644
--- a/tools/testing/selftests/ftrace/test.d/event/trace_printk.tc
+++ b/tools/testing/selftests/ftrace/test.d/event/trace_printk.tc
@@ -5,7 +5,7 @@
rmmod trace-printk ||:
if ! modprobe trace-printk ; then
echo "No trace-printk sample module - please make CONFIG_SAMPLE_TRACE_PRINTK=m"
- exit_unresolved;
+ exit_unsupported;
fi

echo "Waiting for irq work"
diff --git a/tools/testing/selftests/ftrace/test.d/ftrace/func_mod_trace.tc b/tools/testing/selftests/ftrace/test.d/ftrace/func_mod_trace.tc
index 9330c87..fc22ac0 100644
--- a/tools/testing/selftests/ftrace/test.d/ftrace/func_mod_trace.tc
+++ b/tools/testing/selftests/ftrace/test.d/ftrace/func_mod_trace.tc
@@ -13,7 +13,7 @@ echo '*:mod:trace_printk' > set_ftrace_filter
if ! modprobe trace-printk ; then
echo "No trace-printk sample module - please make CONFIG_SAMPLE_TRACE_PRINTK=
m"
- exit_unresolved;
+ exit_unsupported;
fi

: "Wildcard should be resolved after loading module"
diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_module.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_module.tc
index d861bd7..4e07c69 100644
--- a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_module.tc
+++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_module.tc
@@ -8,7 +8,7 @@ rmmod trace-printk ||:
if ! modprobe trace-printk ; then
echo "No trace-printk sample module - please make CONFIG_SAMPLE_TRACE_PRINTK=
m"
- exit_unresolved;
+ exit_unsupported;
fi

MOD=trace_printk
diff --git a/tools/testing/selftests/ftrace/test.d/selftest/bashisms.tc b/tools/testing/selftests/ftrace/test.d/selftest/bashisms.tc
index 1b081e9..1b339bd 100644
--- a/tools/testing/selftests/ftrace/test.d/selftest/bashisms.tc
+++ b/tools/testing/selftests/ftrace/test.d/selftest/bashisms.tc
@@ -9,7 +9,7 @@ fi

if ! which checkbashisms > /dev/null 2>&1 ; then
echo "No checkbashisms found. skipped."
- exit_unresolved
+ exit_unsupported
fi

checkbashisms $FTRACETEST_ROOT/ftracetest
--
1.8.3.1