@@ -64,6 +64,7 @@ static void help(void) {
64
64
printf ("Run the test suite for the project with optional configuration.\n\n" );
65
65
printf ("Options:\n" );
66
66
printf (" -help, -h Show this help message\n" );
67
+ printf (" -print_tests Display list of all available tests and modules\n" );
67
68
printf (" -j=<num>, -jobs=<num> Number of parallel worker processes (default: 0 = sequential)\n" );
68
69
printf (" -iter=<num>, -iterations=<num> Number of iterations for each test (default: 16)\n" );
69
70
printf (" -seed=<hex> Set a specific RNG seed (default: random)\n" );
@@ -77,6 +78,24 @@ static void help(void) {
77
78
printf (" - The first two positional arguments (iterations and seed) are also supported for backward compatibility.\n" );
78
79
}
79
80
81
+ /* Print all tests in registry */
82
+ static void print_test_list (struct TestFramework * tf ) {
83
+ int m , t , total = 0 ;
84
+ printf ("\nAvailable tests (%d modules):\n" , tf -> num_modules );
85
+ printf ("========================================\n" );
86
+ for (m = 0 ; m < tf -> num_modules ; m ++ ) {
87
+ struct TestModule * mod = & tf -> registry_modules [m ];
88
+ printf ("Module: %s (%d tests)\n" , mod -> name , mod -> size );
89
+ for (t = 0 ; t < mod -> size ; t ++ ) {
90
+ printf ("\t[%3d] %s\n" , total + 1 , mod -> data [t ].name );
91
+ total ++ ;
92
+ }
93
+ printf ("----------------------------------------\n" );
94
+ }
95
+ printf ("\nRun specific module: ./tests -t=<module_name>\n" );
96
+ printf ("Run specific test: ./tests -t=<test_name>\n\n" );
97
+ }
98
+
80
99
static int parse_jobs_count (const char * key , const char * value , struct Args * out ) {
81
100
char * ptr_val ;
82
101
long val = strtol (value , & ptr_val , 10 ); /* base 10 */
@@ -275,6 +294,12 @@ static int tf_init(struct TestFramework* tf, int argc, char** argv)
275
294
exit (EXIT_SUCCESS );
276
295
}
277
296
297
+ /* Check if we need to print the available tests */
298
+ if (argv [1 ] && strcmp (argv [1 ], "-print_tests" ) == 0 ) {
299
+ print_test_list (tf );
300
+ exit (EXIT_SUCCESS );
301
+ }
302
+
278
303
/* Compatibility Note: The first two args were the number of iterations and the seed. */
279
304
/* If provided, parse them and adjust the starting index for named arguments accordingly. */
280
305
if (argv [1 ] && argv [1 ][0 ] != '-' ) {
0 commit comments