public inbox for sched-ext@lists.linux.dev
 help / color / mirror / Atom feed
* [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

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