1 /* Procedures for recording and printing test results */
8 static int tests_passed = 0;
9 static int tests_failed = 0;
10 static char failed_tests[255][81];
11 static char suite_name[255];
14 void Test_Init(suite, rank)
20 sprintf(filename, "%s-%d.out", suite, rank);
21 strncpy(suite_name, suite, 255);
22 fileout = fopen(filename, "w");
24 fprintf( stderr, "Could not open %s on node %d\n", filename, rank );
25 MPI_Abort( MPI_COMM_WORLD, 1 );
29 void Test_Message(mess)
32 fprintf(fileout, "[%s]: %s\n", suite_name, mess);
36 void Test_Failed(test)
39 fprintf(fileout, "[%s]: *** Test '%s' Failed! ***\n", suite_name, test);
40 strncpy(failed_tests[tests_failed], test, 81);
45 void Test_Passed(test)
49 fprintf(fileout, "[%s]: Test '%s' Passed.\n", suite_name, test);
55 int Summarize_Test_Results()
58 fprintf(fileout, "For test suite '%s':\n", suite_name);
63 fprintf(fileout, "Of %d attempted tests, %d passed, %d failed.\n",
64 tests_passed + tests_failed, tests_passed, tests_failed);
66 if (tests_failed > 0) {
69 fprintf(fileout, "*** Tests Failed:\n");
70 for (i = 0; i < tests_failed; i++)
71 fprintf(fileout, "*** %s\n", failed_tests[i]);
83 /* Wait for every process to pass through this point. This test is used
84 to make sure that all processes complete, and that a test "passes" because
85 it executed, not because it some process failed.
87 void Test_Waitforall( )
89 int m, one, myrank, n;
91 MPI_Comm_rank( MPI_COMM_WORLD, &myrank );
92 MPI_Comm_size( MPI_COMM_WORLD, &n );
94 MPI_Allreduce( &one, &m, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD );
97 printf( "[%d] Expected %d processes to wait at end, got %d\n", myrank,
101 printf( " No Errors\n" );