summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorCheng-Yang Chou <yphbchou0911@gmail.com>2026-04-08 02:57:15 +0300
committerTejun Heo <tj@kernel.org>2026-04-09 04:20:44 +0300
commitff1befcb168395481fd6a28d8036b707cb7e7a13 (patch)
tree13a18da424e2404d62e7ec42709d2b9768774cdf /tools
parent393754191b85b3f76d9cc44dda5209ef23337e8a (diff)
downloadlinux-ff1befcb168395481fd6a28d8036b707cb7e7a13.tar.xz
selftests/sched_ext: Improve runner error reporting for invalid arguments
Report an error for './runner foo' (positional arg instead of -t) and for './runner -t foo' when the filter matches no tests. Previously both cases produced no error output. Pre-scan the test list before the main loop so the error is reported immediately, avoiding spurious SKIP output from '-s' when no tests match. Signed-off-by: Cheng-Yang Chou <yphbchou0911@gmail.com> Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/testing/selftests/sched_ext/runner.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/tools/testing/selftests/sched_ext/runner.c b/tools/testing/selftests/sched_ext/runner.c
index d84f71eee049..c264807caa91 100644
--- a/tools/testing/selftests/sched_ext/runner.c
+++ b/tools/testing/selftests/sched_ext/runner.c
@@ -164,6 +164,26 @@ int main(int argc, char **argv)
}
}
+ if (optind < argc) {
+ fprintf(stderr, "Unexpected argument '%s'. Use -t to filter tests.\n",
+ argv[optind]);
+ return 1;
+ }
+
+ if (filter) {
+ for (i = 0; i < __scx_num_tests; i++) {
+ if (!should_skip_test(&__scx_tests[i], filter))
+ break;
+ }
+ if (i == __scx_num_tests) {
+ fprintf(stderr, "No tests matched filter '%s'\n", filter);
+ fprintf(stderr, "Available tests (use -l to list):\n");
+ for (i = 0; i < __scx_num_tests; i++)
+ fprintf(stderr, " %s\n", __scx_tests[i].name);
+ return 1;
+ }
+ }
+
for (i = 0; i < __scx_num_tests; i++) {
enum scx_test_status status;
struct scx_test *test = &__scx_tests[i];