Skip to content

Commit 6f3260b

Browse files
committed
benchmark mode command-line option
Well-written clar tests (those that clean up after themselves) are capable of running in benchmark mode. Provide it as an option.
1 parent d3d9669 commit 6f3260b

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

clar.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,7 @@ clar_usage(const char *arg)
505505
printf(" -q Only report tests that had an error\n");
506506
printf(" -Q Quit as soon as a test fails\n");
507507
printf(" -t Display results in tap format\n");
508+
printf(" -b Run in benchmark mode, displaying times\n");
508509
printf(" -l Print suite names\n");
509510
printf(" -r[filename] Write summary file (to the optional filename)\n");
510511
exit(1);
@@ -611,6 +612,15 @@ clar_parse_args(int argc, char **argv)
611612
_clar.output_format = CL_OUTPUT_TAP;
612613
break;
613614

615+
case 'b':
616+
if (argument[2] != '\0')
617+
clar_usage(argv[0]);
618+
619+
_clar.test_mode = CL_TEST_BENCHMARK;
620+
_clar.output_format = CL_OUTPUT_TIMING;
621+
_clar.summary_format = CL_SUMMARY_JSON;
622+
break;
623+
614624
case 'l': {
615625
size_t j;
616626

test/expected/help

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@ Options:
88
-q Only report tests that had an error
99
-Q Quit as soon as a test fails
1010
-t Display results in tap format
11+
-b Run in benchmark mode, displaying times
1112
-l Print suite names
1213
-r[filename] Write summary file (to the optional filename)

0 commit comments

Comments
 (0)