mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-16 07:51:31 -04:00
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>
This commit is contained in:
committed by
Tejun Heo
parent
393754191b
commit
ff1befcb16
@@ -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];
|
||||
|
||||
Reference in New Issue
Block a user