@@ -67,6 +67,22 @@ static int parse_arg(const char* key, const char* value, struct TestFramework* t
6767 return 0 ;
6868}
6969
70+ static void help (void ) {
71+ printf ("Usage: ./tests [options]\n\n" );
72+ printf ("Run the test suite for the project with optional configuration.\n\n" );
73+ printf ("Options:\n" );
74+ printf (" -help, -h Show this help message\n" );
75+ printf (" -j=<num>, -jobs=<num> Number of parallel worker processes (default: 0 = sequential)\n" );
76+ printf (" -iter=<num>, -iterations=<num> Number of iterations for each test (default: 16)\n" );
77+ printf (" -seed=<hex> Set a specific RNG seed (default: random)\n" );
78+ printf ("\n" );
79+ printf ("Notes:\n" );
80+ printf (" - All arguments must be provided in the form '-key=value'.\n" );
81+ printf (" - Unknown arguments are reported but ignored.\n" );
82+ printf (" - Sequential execution occurs if -jobs=0 or unspecified.\n" );
83+ printf (" - The first two positional arguments (iterations and seed) are also supported for backward compatibility.\n" );
84+ }
85+
7086static int parse_jobs_count (const char * key , const char * value , struct Args * out ) {
7187 char * ptr_val ;
7288 long val = strtol (value , & ptr_val , 10 ); /* base 10 */
@@ -236,6 +252,12 @@ static int tf_init(struct TestFramework* tf, int argc, char** argv)
236252 return EXIT_FAILURE ;
237253 }
238254
255+ /* Check if we need to print help */
256+ if (argv [1 ] && (strcmp (argv [1 ], "-help" ) == 0 || strcmp (argv [1 ], "-h" ) == 0 )) {
257+ help ();
258+ exit (EXIT_SUCCESS );
259+ }
260+
239261 /* Compatibility Note: The first two args were the number of iterations and the seed. */
240262 /* If provided, parse them and adjust the starting index for named arguments accordingly. */
241263 if (argv [1 ] && argv [1 ][0 ] != '-' ) {
0 commit comments