[PATCH] selftests/verification: Simplify tlob tests
From: Gabriele Monaco
Date: Wed Jul 22 2026 - 09:29:21 EST
Squash this with the other patch should you accept it!
Drop nested Makefile in favour of lib.mk and simplify run_tlob_tests
---
.../testing/selftests/verification/.gitignore | 4 +-
tools/testing/selftests/verification/Makefile | 20 +----
.../verification/test.d/tlob/Makefile | 28 -------
.../test.d/tlob/run_tlob_tests.sh | 79 +------------------
.../verification/test.d/tlob/uprobe_bind.tc | 1 -
.../test.d/tlob/uprobe_detail_running.tc | 1 -
.../test.d/tlob/uprobe_detail_sleeping.tc | 1 -
.../test.d/tlob/uprobe_detail_waiting.tc | 1 -
.../verification/test.d/tlob/uprobe_multi.tc | 1 -
.../test.d/tlob/uprobe_violation.tc | 1 -
.../verification/{test.d/tlob =3D> }/tlob_sym.c | 0
.../{test.d/tlob =3D> }/tlob_target.c | 0
12 files changed, 9 insertions(+), 128 deletions(-)
delete mode 100644 tools/testing/selftests/verification/test.d/tlob/Makefi=
le
rename tools/testing/selftests/verification/{test.d/tlob =3D> }/tlob_sym.c=
(100%)
rename tools/testing/selftests/verification/{test.d/tlob =3D> }/tlob_targe=
t.c (100%)
diff --git a/tools/testing/selftests/verification/.gitignore b/tools/testin=
g/selftests/verification/.gitignore
index cbbd03ee16c7..d2f231f1bacb 100644
--- a/tools/testing/selftests/verification/.gitignore
+++ b/tools/testing/selftests/verification/.gitignore
@@ -1,4 +1,4 @@
# SPDX-License-Identifier: GPL-2.0-only
logs
-test.d/tlob/tlob_sym
-test.d/tlob/tlob_target
+tlob_sym
+tlob_target
diff --git a/tools/testing/selftests/verification/Makefile b/tools/testing/=
selftests/verification/Makefile
index 0b32bdfdb8db..17442e6bb87f 100644
--- a/tools/testing/selftests/verification/Makefile
+++ b/tools/testing/selftests/verification/Makefile
@@ -4,22 +4,8 @@ TEST_PROGS :=3D verificationtest-ktap
TEST_FILES :=3D test.d settings
EXTRA_CLEAN :=3D $(OUTPUT)/logs/*
=20
-# Subdirectories that provide binaries used by the test runner.
-# Each entry must contain a Makefile that accepts OUTDIR=3D and
-# deposits its binaries there.
-BUILD_SUBDIRS :=3D test.d/tlob
+TEST_GEN_FILES :=3D tlob_sym tlob_target
=20
-include ../lib.mk
-
-all: $(patsubst %,_build_%,$(BUILD_SUBDIRS))
-
-clean: $(patsubst %,_clean_%,$(BUILD_SUBDIRS))
+export RV_BINDIR :=3D $(OUTPUT)
=20
-.PHONY: $(patsubst %,_build_%,$(BUILD_SUBDIRS)) \
- $(patsubst %,_clean_%,$(BUILD_SUBDIRS))
-
-$(patsubst %,_build_%,$(BUILD_SUBDIRS)): _build_%:
- $(MAKE) -C $* OUTDIR=3D"$(OUTPUT)" TOOLS_INCLUDES=3D"$(TOOLS_INCLUDES)"
-
-$(patsubst %,_clean_%,$(BUILD_SUBDIRS)): _clean_%:
- $(MAKE) -C $* OUTDIR=3D"$(OUTPUT)" clean
+include ../lib.mk
diff --git a/tools/testing/selftests/verification/test.d/tlob/Makefile b/to=
ols/testing/selftests/verification/test.d/tlob/Makefile
deleted file mode 100644
index 05a2d2599c4e..000000000000
--- a/tools/testing/selftests/verification/test.d/tlob/Makefile
+++ /dev/null
@@ -1,28 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-# Builds tlob selftest helper binaries in the directory of this Makefile.
-#
-# Invoked by ../../Makefile via BUILD_SUBDIRS; outputs tlob_sym and
-# tlob_target alongside the .tc scripts so they are self-contained.
-
-CFLAGS +=3D $(TOOLS_INCLUDES)
-
-# For standalone execution via vng
-FTRACETEST :=3D ../../../ftrace/ftracetest
-LOGDIR ?=3D ../../logs
-
-.PHONY: all
-all: tlob_sym tlob_target
-
-tlob_sym: tlob_sym.c
- $(CC) $(CFLAGS) -o $@ $<
-
-tlob_target: tlob_target.c
- $(CC) $(CFLAGS) -o $@ $<
-
-.PHONY: run_tests
-run_tests: all
- @./run_tlob_tests.sh
-
-.PHONY: clean
-clean:
- $(RM) tlob_sym tlob_target
diff --git a/tools/testing/selftests/verification/test.d/tlob/run_tlob_test=
s.sh b/tools/testing/selftests/verification/test.d/tlob/run_tlob_tests.sh
index cd949756e713..6bedb1813891 100755
--- a/tools/testing/selftests/verification/test.d/tlob/run_tlob_tests.sh
+++ b/tools/testing/selftests/verification/test.d/tlob/run_tlob_tests.sh
@@ -2,89 +2,18 @@
# SPDX-License-Identifier: GPL-2.0
#
# Standalone runner for tlob selftests
-# Usage: ./run_tlob_tests.sh [options]
-#
-# Options:
-# -v, --verbose Verbose output
-# -k, --keep Keep test logs
-# -l, --logdir DIR Log directory (default: ../../logs)
-# -h, --help Show this help
=20
set -e
=20
SCRIPT_DIR=3D"$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
FTRACETEST=3D"$SCRIPT_DIR/../../../ftrace/ftracetest"
-LOGDIR=3D"$SCRIPT_DIR/../../logs"
-VERBOSE=3D""
-KEEP=3D""
-EXTRA_ARGS=3D""
-
-# Parse arguments
-while [[ $# -gt 0 ]]; do
- case $1 in
- -v|--verbose)
- VERBOSE=3D"-v"
- shift
- ;;
- -k|--keep)
- KEEP=3D"-k"
- shift
- ;;
- -l|--logdir)
- LOGDIR=3D"$2"
- shift 2
- ;;
- -h|--help)
- echo "Usage: $0 [options]"
- echo ""
- echo "Options:"
- echo " -v, --verbose Verbose output"
- echo " -k, --keep Keep test logs"
- echo " -l, --logdir DIR Log directory (default: ../../logs)"
- echo " -h, --help Show this help"
- echo ""
- echo "Examples:"
- echo " $0 # Run all tlob tests"
- echo " $0 -v # Run with verbose output=
"
- echo " $0 -v -l /tmp/tlob-logs # Custom log directory"
- echo ""
- echo "With vng:"
- echo " vng -v --rwdir $LOGDIR -- $0"
- exit 0
- ;;
- *)
- EXTRA_ARGS=3D"$EXTRA_ARGS $1"
- shift
- ;;
- esac
-done
=20
# Build test helpers
echo "Building tlob test helpers..."
-make -C "$SCRIPT_DIR" all
-
-# Check ftracetest exists
-if [ ! -x "$FTRACETEST" ]; then
- echo "Error: $FTRACETEST not found or not executable"
- echo "Make sure you're running from the correct directory"
- exit 1
-fi
-
-# Create log directory
-mkdir -p "$LOGDIR"
-
-# Run tests
-echo "Running tlob selftests..."
-echo "Log directory: $LOGDIR"
-echo ""
+make -C "$SCRIPT_DIR/../.." all
=20
# Export RV_BINDIR so test scripts can find tlob_target and tlob_sym
-export RV_BINDIR=3D"$SCRIPT_DIR"
-
-# Pass the test directory, not individual .tc files
-# ftracetest will discover all .tc files in the directory
-"$FTRACETEST" -K $VERBOSE $KEEP --rv --logdir "$LOGDIR" \
- "$SCRIPT_DIR" $EXTRA_ARGS
+export RV_BINDIR=3D"$(realpath "$SCRIPT_DIR/../..")"
=20
-echo ""
-echo "Tests completed. Logs saved to: $LOGDIR"
+# Run ftracetest, forwarding all options and passing the test directory
+exec "$FTRACETEST" -K --rv "$SCRIPT_DIR" "$@"
diff --git a/tools/testing/selftests/verification/test.d/tlob/uprobe_bind.t=
c b/tools/testing/selftests/verification/test.d/tlob/uprobe_bind.tc
index 4a1c18c7485a..be2f3555c30d 100644
--- a/tools/testing/selftests/verification/test.d/tlob/uprobe_bind.tc
+++ b/tools/testing/selftests/verification/test.d/tlob/uprobe_bind.tc
@@ -3,7 +3,6 @@
# description: Test tlob monitor uprobe binding (visible in monitor file, =
removable, duplicate rejected)
# requires: tlob:monitor
=20
-RV_BINDIR=3D"${RV_BINDIR:-$(realpath "$(dirname "${1:-$0}")")}"
UPROBE_TARGET=3D"${RV_BINDIR}/tlob_target"
TLOB_SYM=3D"${RV_BINDIR}/tlob_sym"
[ -x "$UPROBE_TARGET" ] || exit_unsupported
diff --git a/tools/testing/selftests/verification/test.d/tlob/uprobe_detail=
_running.tc b/tools/testing/selftests/verification/test.d/tlob/uprobe_detai=
l_running.tc
index afca157b5ea4..46c98ea03872 100644
--- a/tools/testing/selftests/verification/test.d/tlob/uprobe_detail_runnin=
g.tc
+++ b/tools/testing/selftests/verification/test.d/tlob/uprobe_detail_runnin=
g.tc
@@ -3,7 +3,6 @@
# description: Test tlob monitor detail running (running_ns dominates when=
task busy-spins between probes)
# requires: tlob:monitor
=20
-RV_BINDIR=3D"${RV_BINDIR:-$(realpath "$(dirname "${1:-$0}")")}"
UPROBE_TARGET=3D"${RV_BINDIR}/tlob_target"
TLOB_SYM=3D"${RV_BINDIR}/tlob_sym"
[ -x "$UPROBE_TARGET" ] || exit_unsupported
diff --git a/tools/testing/selftests/verification/test.d/tlob/uprobe_detail=
_sleeping.tc b/tools/testing/selftests/verification/test.d/tlob/uprobe_deta=
il_sleeping.tc
index 0a6470b4cadb..7e82c7c7f98b 100644
--- a/tools/testing/selftests/verification/test.d/tlob/uprobe_detail_sleepi=
ng.tc
+++ b/tools/testing/selftests/verification/test.d/tlob/uprobe_detail_sleepi=
ng.tc
@@ -3,7 +3,6 @@
# description: Test tlob monitor detail sleeping (sleeping_ns dominates wh=
en task blocks between probes)
# requires: tlob:monitor
=20
-RV_BINDIR=3D"${RV_BINDIR:-$(realpath "$(dirname "${1:-$0}")")}"
UPROBE_TARGET=3D"${RV_BINDIR}/tlob_target"
TLOB_SYM=3D"${RV_BINDIR}/tlob_sym"
[ -x "$UPROBE_TARGET" ] || exit_unsupported
diff --git a/tools/testing/selftests/verification/test.d/tlob/uprobe_detail=
_waiting.tc b/tools/testing/selftests/verification/test.d/tlob/uprobe_detai=
l_waiting.tc
index ef22fce700fc..43a33357f5ef 100644
--- a/tools/testing/selftests/verification/test.d/tlob/uprobe_detail_waitin=
g.tc
+++ b/tools/testing/selftests/verification/test.d/tlob/uprobe_detail_waitin=
g.tc
@@ -3,7 +3,6 @@
# description: Test tlob monitor detail waiting (waiting_ns dominates when=
task is preempted between probes)
# requires: tlob:monitor
=20
-RV_BINDIR=3D"${RV_BINDIR:-$(realpath "$(dirname "${1:-$0}")")}"
UPROBE_TARGET=3D"${RV_BINDIR}/tlob_target"
TLOB_SYM=3D"${RV_BINDIR}/tlob_sym"
[ -x "$UPROBE_TARGET" ] || exit_unsupported
diff --git a/tools/testing/selftests/verification/test.d/tlob/uprobe_multi.=
tc b/tools/testing/selftests/verification/test.d/tlob/uprobe_multi.tc
index a798f3e9b3fa..3c606b354ad2 100644
--- a/tools/testing/selftests/verification/test.d/tlob/uprobe_multi.tc
+++ b/tools/testing/selftests/verification/test.d/tlob/uprobe_multi.tc
@@ -3,7 +3,6 @@
# description: Test tlob monitor multiple uprobe bindings (different offse=
ts fire independently)
# requires: tlob:monitor
=20
-RV_BINDIR=3D"${RV_BINDIR:-$(realpath "$(dirname "${1:-$0}")")}"
UPROBE_TARGET=3D"${RV_BINDIR}/tlob_target"
TLOB_SYM=3D"${RV_BINDIR}/tlob_sym"
[ -x "$UPROBE_TARGET" ] || exit_unsupported
diff --git a/tools/testing/selftests/verification/test.d/tlob/uprobe_violat=
ion.tc b/tools/testing/selftests/verification/test.d/tlob/uprobe_violation.=
tc
index 8a94bd679b88..ff8b736932ca 100644
--- a/tools/testing/selftests/verification/test.d/tlob/uprobe_violation.tc
+++ b/tools/testing/selftests/verification/test.d/tlob/uprobe_violation.tc
@@ -3,7 +3,6 @@
# description: Test tlob monitor budget violation (error_env_tlob and deta=
il_env_tlob fire with correct fields)
# requires: tlob:monitor
=20
-RV_BINDIR=3D"${RV_BINDIR:-$(realpath "$(dirname "${1:-$0}")")}"
UPROBE_TARGET=3D"${RV_BINDIR}/tlob_target"
TLOB_SYM=3D"${RV_BINDIR}/tlob_sym"
[ -x "$UPROBE_TARGET" ] || exit_unsupported
diff --git a/tools/testing/selftests/verification/test.d/tlob/tlob_sym.c b/=
tools/testing/selftests/verification/tlob_sym.c
similarity index 100%
rename from tools/testing/selftests/verification/test.d/tlob/tlob_sym.c
rename to tools/testing/selftests/verification/tlob_sym.c
diff --git a/tools/testing/selftests/verification/test.d/tlob/tlob_target.c=
b/tools/testing/selftests/verification/tlob_target.c
similarity index 100%
rename from tools/testing/selftests/verification/test.d/tlob/tlob_target.c
rename to tools/testing/selftests/verification/tlob_target.c
--=20
2.55.0