Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

sched_ext: Add option -l in selftest runner to list all available tests

The selftest runner currently allows selecting tests via the -t
option. This patch adds a new -l option that lists all available tests,
providing users with an overview of the tests they can choose from. This
enhancement is especially useful for scripting and automation purposes,
making it easier to discover and run tests.

Signed-off-by: Shizhao Chen <shichen@redhat.com>
Signed-off-by: Tejun Heo <tj@kernel.org>

authored by

Shizhao Chen and committed by
Tejun Heo
a73bca3d 382d7efc

+13 -2
+13 -2
tools/testing/selftests/sched_ext/runner.c
··· 22 22 "\n" 23 23 " -t TEST Only run tests whose name includes this string\n" 24 24 " -s Include print output for skipped tests\n" 25 + " -l List all available tests\n" 25 26 " -q Don't print the test descriptions during run\n" 26 27 " -h Display this help and exit\n"; 27 28 28 29 static volatile int exit_req; 29 - static bool quiet, print_skipped; 30 + static bool quiet, print_skipped, list; 30 31 31 32 #define MAX_SCX_TESTS 2048 32 33 ··· 134 133 135 134 libbpf_set_strict_mode(LIBBPF_STRICT_ALL); 136 135 137 - while ((opt = getopt(argc, argv, "qst:h")) != -1) { 136 + while ((opt = getopt(argc, argv, "qslt:h")) != -1) { 138 137 switch (opt) { 139 138 case 'q': 140 139 quiet = true; 141 140 break; 142 141 case 's': 143 142 print_skipped = true; 143 + break; 144 + case 'l': 145 + list = true; 144 146 break; 145 147 case 't': 146 148 filter = optarg; ··· 157 153 for (i = 0; i < __scx_num_tests; i++) { 158 154 enum scx_test_status status; 159 155 struct scx_test *test = &__scx_tests[i]; 156 + 157 + if (list) { 158 + printf("%s\n", test->name); 159 + if (i == (__scx_num_tests - 1)) 160 + return 0; 161 + continue; 162 + } 160 163 161 164 if (filter && should_skip_test(test, filter)) { 162 165 /*