On Mon, 2026-06-08 at 00:13 +0800, [email protected] wrote:
> From: Wen Yang <[email protected]>
> 
> Add selftest coverage for the tlob uprobe monitoring interface under
> tools/testing/selftests/verification/.
> 
> test.d/tlob/ contains both the helper sources (tlob_target, tlob_sym)
> and the seven test scripts so the test suite is self-contained.
> tlob_target provides busy-spin, sleep, and preempt workloads;
> tlob_sym
> resolves ELF symbol offsets for uprobe registration.
> 
> Seven test scripts exercise uprobe binding management, budget
> violation
> detection, and per-state time accounting (running_ns, waiting_ns,
> sleeping_ns).
> 
> Signed-off-by: Wen Yang <[email protected]>
> ---
>  .../testing/selftests/verification/.gitignore |   2 +
>  tools/testing/selftests/verification/Makefile |  19 +-
>  .../verification/test.d/tlob/Makefile         |  20 ++
>  .../verification/test.d/tlob/test.d/functions |   1 +

Tests seems to work fine, thanks. I think I'm getting what you're
trying to do and probably defining a dummy functions for tlob isn't the
right thing to do.

ftracetest --rv doesn't quite work with different folders as you'd pick
the ftrace functions. We shouldn't be adding a dummy functions script
every time but rather fix ftracetest directly.

Try the attached patch, it seems to work on my side. Then you'd be able
to use ftracetest --rv as you please (folder is mandatory, I don't
think we need a version inside selftests/verification,
verificationtest-ktap is only meant for the makefile just like
ftracetest-ktap).

Thanks,
Gabriele

---
>From 32242f83af8214a51c47167a1904d3663aa43870 Mon Sep 17 00:00:00 2001
From: Gabriele Monaco <[email protected]>
Date: Tue, 16 Jun 2026 16:26:53 +0200
Subject: [PATCH] selftests/tracing: support flexible helper functions

Target directory or file arguments passed to ftracetest had
to contain their own nested test.d/functions files to properly override
the top-level directory (TOP_DIR). This works for standard ftrace tests
that would fall back to ftrace's functions, but doesn't for rv tests.

Introduce find_functions() to recursively check parent and grandparent
directories of the target test directory/file to dynamically locate the
appropriate root functions config.
This allows to define additional directories for rv selftests and run
them with the appropriate rv functions:

  ftracetest --rv tools/testing/selftests/verification/test.d/<topic>

Signed-off-by: Gabriele Monaco <[email protected]>
---
 tools/testing/selftests/ftrace/ftracetest | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/ftrace/ftracetest 
b/tools/testing/selftests/ftrace/ftracetest
index 0a56bf209f..5d1b1f9380 100755
--- a/tools/testing/selftests/ftrace/ftracetest
+++ b/tools/testing/selftests/ftrace/ftracetest
@@ -80,6 +80,23 @@ find_testcases() { #directory
   echo `find $1 -name \*.tc | sort`
 }
 
+find_functions() { # [directory] [test_cases]
+  local BASE_DIR="$1"
+  if [ -f "$1" ]; then
+    BASE_DIR="`absdir $1`"
+  elif [ ! -d "$1" ]; then
+    return
+  fi
+
+  if [ -f "$BASE_DIR"/test.d/functions ]; then
+    echo "$BASE_DIR"
+  elif [ -f "$BASE_DIR"/../test.d/functions ]; then
+    abspath "$BASE_DIR"/..
+  elif [ -f "$BASE_DIR"/../../test.d/functions ]; then
+    abspath "$BASE_DIR"/../..
+  fi
+}
+
 parse_opts() { # opts
   local OPT_TEST_CASES=
   local OPT_TEST_DIR=
@@ -159,7 +176,8 @@ parse_opts() { # opts
   if [ -n "$OPT_TEST_CASES" ]; then
     TEST_CASES=$OPT_TEST_CASES
   fi
-  if [ -n "$OPT_TEST_DIR" -a -f "$OPT_TEST_DIR"/test.d/functions ]; then
+  OPT_TEST_DIR="`find_functions $OPT_TEST_DIR $OPT_TEST_CASES`"
+  if [ -n "$OPT_TEST_DIR" ]; then
     TOP_DIR=$OPT_TEST_DIR
     TEST_DIR=$TOP_DIR/test.d
   fi
-- 
2.54.0


Reply via email to