Skip to content

Commit

Permalink
selftests/tracing: Test only toplevel README file not the instances
Browse files Browse the repository at this point in the history
For the tests that have both a README attribute as well as the instance
flag to run the tests as an instance, the instance version will always
exit with UNSUPPORTED. That's because the instance directory does not
contain a README file. Currently, the tests check for a README file in the
directory that the test runs in and if there's a requirement for something
to be present in the README file, it will not find it, as the instance
directory doesn't have it.

Have the tests check if the current directory is an instance directory,
and if it is, check two directories above the current directory for the
README file:

  /sys/kernel/tracing/README
  /sys/kernel/tracing/instances/foo/../../README

Link: https://lore.kernel.org/r/20250220185846.130216270@goodmis.org
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
  • Loading branch information
Steven Rostedt authored and Shuah Khan committed Feb 20, 2025
1 parent a64dcfb commit 4a3134b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tools/testing/selftests/ftrace/test.d/functions
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,13 @@ check_requires() { # Check required files and tracers
exit_unsupported
fi
elif [ "$r" != "$i" ]; then
if ! grep -Fq "$r" README ; then
# If this is an instance, check the top directory
if echo $TRACING_DIR | grep -q "/instances/"; then
test="$TRACING_DIR/../.."
else
test=$TRACING_DIR
fi
if ! grep -Fq "$r" $test/README ; then
echo "Required feature pattern \"$r\" is not in README."
exit_unsupported
fi
Expand Down

0 comments on commit 4a3134b

Please sign in to comment.