diff options
author | Sven Gothel <[email protected]> | 2021-01-02 06:41:27 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2021-01-02 06:41:27 +0100 |
commit | 67f6831a7f8389b23295a81eec2400f5473c30c8 (patch) | |
tree | 7a3c5ececc5fa2db89e06e215c7ad498c7dbf333 /include/jau/test | |
parent | 55e39f140a3cb335011e12f0d18f61f992d1465e (diff) |
catch2_my_main.cpp: Add 'catch_perf_analysis' flag, set via argument '--perf_analysis' for manual (non) catch2 benchmark run
Diffstat (limited to 'include/jau/test')
-rw-r--r-- | include/jau/test/catch2_my_main.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/include/jau/test/catch2_my_main.cpp b/include/jau/test/catch2_my_main.cpp index 9352bff..334f44c 100644 --- a/include/jau/test/catch2_my_main.cpp +++ b/include/jau/test/catch2_my_main.cpp @@ -38,17 +38,32 @@ /** Run w/o command-line args, i.e. default CI unit test. */ bool catch_auto_run; +/** Run w/ command-line arg '--perf_analysis'. */ +bool catch_perf_analysis; + int main( int argc, char* argv[] ) { Catch::Session session; // There must be exactly one instance catch_auto_run = ( 1 >= argc ); - fprintf(stderr, "argc %d, auto-run %d\n", argc, catch_auto_run); + + int argc_2=0; + char* argv_2[argc]; + + for(int i=0; i<argc; i++) { + if( 0 == strcmp("--perf_analysis", argv[i]) ) { + catch_perf_analysis = true; + } else { + argv_2[argc_2++] = argv[i]; + } + } + fprintf(stderr, "argc %d, auto_run %d, perf_analysis %d\n", + argc, catch_auto_run, catch_perf_analysis); // writing to session.configData() here sets defaults // this is the preferred way to set them - int returnCode = session.applyCommandLine( argc, argv ); + int returnCode = session.applyCommandLine( argc_2, argv_2 ); if( returnCode != 0 ) { // Indicates a command line error return returnCode; |