* [PATCH sched_ext/for-7.1] selftests/sched_ext: Improve runner error reporting for invalid arguments
@ 2026-04-07 17:49 Cheng-Yang Chou
2026-04-07 18:30 ` Tejun Heo
0 siblings, 1 reply; 4+ messages in thread
From: Cheng-Yang Chou @ 2026-04-07 17:49 UTC (permalink / raw)
To: sched-ext, Tejun Heo, David Vernet, Andrea Righi, Changwoo Min
Cc: Ching-Chun Huang, Chia-Ping Tsai, yphbchou0911
Report an error for 'sudo ./runner foo' (positional arg instead of -t)
and for 'sudo ./runner -t foo' when the filter matches no tests.
Previously both cases produced no error output.
Signed-off-by: Cheng-Yang Chou <yphbchou0911@gmail.com>
---
tools/testing/selftests/sched_ext/runner.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/tools/testing/selftests/sched_ext/runner.c b/tools/testing/selftests/sched_ext/runner.c
index d84f71eee049..e5640841cbfd 100644
--- a/tools/testing/selftests/sched_ext/runner.c
+++ b/tools/testing/selftests/sched_ext/runner.c
@@ -164,6 +164,12 @@ int main(int argc, char **argv)
}
}
+ if (optind < argc) {
+ fprintf(stderr, "Unexpected argument '%s'. Use -t to filter tests.\n",
+ argv[optind]);
+ return 1;
+ }
+
for (i = 0; i < __scx_num_tests; i++) {
enum scx_test_status status;
struct scx_test *test = &__scx_tests[i];
@@ -207,6 +213,15 @@ int main(int argc, char **argv)
break;
}
}
+
+ if (filter && testnum == 0 && !exit_req) {
+ 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;
+ }
+
printf("\n\n=============================\n\n");
printf("RESULTS:\n\n");
printf("PASSED: %u\n", passed);
--
2.48.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH sched_ext/for-7.1] selftests/sched_ext: Improve runner error reporting for invalid arguments
2026-04-07 17:49 [PATCH sched_ext/for-7.1] selftests/sched_ext: Improve runner error reporting for invalid arguments Cheng-Yang Chou
@ 2026-04-07 18:30 ` Tejun Heo
2026-04-07 23:57 ` [PATCH v2 " Cheng-Yang Chou
0 siblings, 1 reply; 4+ messages in thread
From: Tejun Heo @ 2026-04-07 18:30 UTC (permalink / raw)
To: Cheng-Yang Chou
Cc: sched-ext, David Vernet, Andrea Righi, Changwoo Min,
Ching-Chun Huang, Chia-Ping Tsai
Hello,
On Wed, Apr 8, 2026 at 01:49:02AM +0800, Cheng-Yang Chou wrote:
> + if (filter && testnum == 0 && !exit_req) {
testnum is also bumped by the print_skipped path, so with
`-s -t nomatch` this check never fires.
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2 sched_ext/for-7.1] selftests/sched_ext: Improve runner error reporting for invalid arguments
2026-04-07 18:30 ` Tejun Heo
@ 2026-04-07 23:57 ` Cheng-Yang Chou
2026-04-09 1:35 ` Tejun Heo
0 siblings, 1 reply; 4+ messages in thread
From: Cheng-Yang Chou @ 2026-04-07 23:57 UTC (permalink / raw)
To: tj; +Cc: arighi, changwoo, chia7712, jserv, sched-ext, void, yphbchou0911
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>
---
v2: Pre-scan before the main loop instead of checking testnum after,
as testnum is also bumped by the print_skipped path. (Tejun Heo)
tools/testing/selftests/sched_ext/runner.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
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];
--
2.48.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2 sched_ext/for-7.1] selftests/sched_ext: Improve runner error reporting for invalid arguments
2026-04-07 23:57 ` [PATCH v2 " Cheng-Yang Chou
@ 2026-04-09 1:35 ` Tejun Heo
0 siblings, 0 replies; 4+ messages in thread
From: Tejun Heo @ 2026-04-09 1:35 UTC (permalink / raw)
To: Cheng-Yang Chou; +Cc: arighi, changwoo, chia7712, jserv, sched-ext, void
Hello,
On Wed, Apr 08, 2026 at 07:57:15AM +0800, Cheng-Yang Chou wrote:
> 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.
Applied to sched_ext/for-7.1.
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-04-09 1:35 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-07 17:49 [PATCH sched_ext/for-7.1] selftests/sched_ext: Improve runner error reporting for invalid arguments Cheng-Yang Chou
2026-04-07 18:30 ` Tejun Heo
2026-04-07 23:57 ` [PATCH v2 " Cheng-Yang Chou
2026-04-09 1:35 ` Tejun Heo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox