1 #ifndef TEST_RUNNER_HPP
2 #define TEST_RUNNER_HPP
14 #define REGISTER_TEST( TEST_FUNC ) runner_register_test( __FILE__, __LINE__, #TEST_FUNC, ( TEST_FUNC ), NULL )
22 #define REGISTER_DEP_TEST( TEST_FUNC, REQUIRED_FUNC ) \
23 runner_register_test( __FILE__, __LINE__, #TEST_FUNC, ( TEST_FUNC ), ( REQUIRED_FUNC ) )
31 #define RUN_TESTS( ARGC, ARGV ) runner_run_tests( ( ARGC ), ( ARGV ) )
45 static void runner_usage( FILE* str,
int argc,
char* argv[] );
94 if( !new_RunnerTestList )
96 fprintf( stderr,
"TestRunner::runner_add_test(): reallocation of RunnerTestList failed\n" );
140 "Error registering requisite for test: \"%s\"\n"
142 "\tRequisite test function not registered.\n",
152 fprintf( str,
"%s [-l|-L] [-h] [-r] [<test_name> [<test_name> ...]]\n", argv[0] );
158 fprintf( stdout,
"-l : List test names and exit\n"
159 "-L : List test names and requisites and exit\n"
160 "-h : This help text\n"
161 "-r : Recursively run requisite tests for any specified test\n"
168 printf(
"Test List:\n" );
178 printf(
" Requires : \n" );
190 int num_selected = 0;
194 int run_requisites = 0;
196 int first_selected = 1;
199 int changed_some, ran_some, can_run,
fail;
205 for( k = 1; k < argc; ++k )
207 if( argv[k][0] ==
'-' )
209 for( c = argv[k] + 1; *c; ++c )
220 run_requisites =
true;
227 fprintf( stderr,
"Unknown flag: '%c'\n", *c );
246 fprintf( stderr,
"Unknown test name: \"%s\"\n", argv[k] );
275 }
while( changed_some );
307 if( !can_run )
continue;
329 MPI_Initialized( &isInit );
341 printf(
"All %d tests passed.\n", num_run );
343 else if( num_run == num_selected && !fail_count )
345 printf(
"All %d selected tests passed.\n", num_run );
346 printf(
"Skipped %d non-selected tests\n", (
int)(
RunnerTestCount - num_selected ) );
351 if( num_selected == num_run )
352 printf(
"%2d tests selected\n", num_selected );
354 printf(
"%2d of %2d tests ran\n", num_run, num_selected );
357 printf(
"%2d of %2d tests passed\n", num_run - fail_count, num_run );
358 if( fail_count ) printf(
"%2d of %2d tests FAILED\n", fail_count, num_run );