1 /* Procedures for recording and printing test results */
8 #if defined(USE_STDARG)
12 static int tests_passed = 0;
13 static int tests_failed = 0;
14 static char failed_tests[255][81];
15 static char suite_name[255];
18 void Test_Init(suite, rank)
24 sprintf(filename, "%s-%d.out", suite, rank);
25 strncpy(suite_name, suite, 255);
26 fileout = fopen(filename, "w");
28 fprintf( stderr, "Could not open %s on node %d\n", filename, rank );
29 MPI_Abort( MPI_COMM_WORLD, 1 );
34 void Test_Printf(char *format, ...)
38 va_start(arglist, format);
39 (void)vfprintf(fileout, format, arglist);
43 void Test_Printf(va_alist)
50 format = va_arg(arglist, char *);
51 (void)vfprintf(fileout, format, arglist);
57 void Test_Message(mess)
60 fprintf(fileout, "[%s]: %s\n", suite_name, mess);
64 void Test_Failed(test)
67 fprintf(fileout, "[%s]: *** Test '%s' Failed! ***\n", suite_name, test);
68 strncpy(failed_tests[tests_failed], test, 81);
73 void Test_Passed(test)
77 fprintf(fileout, "[%s]: Test '%s' Passed.\n", suite_name, test);
83 int Summarize_Test_Results()
86 fprintf(fileout, "For test suite '%s':\n", suite_name);
91 fprintf(fileout, "Of %d attempted tests, %d passed, %d failed.\n",
92 tests_passed + tests_failed, tests_passed, tests_failed);
94 if (tests_failed > 0) {
97 fprintf(fileout, "*** Tests Failed:\n");
98 for (i = 0; i < tests_failed; i++)
99 fprintf(fileout, "*** %s\n", failed_tests[i]);
111 /* Wait for every process to pass through this point. This test is used
112 to make sure that all processes complete, and that a test "passes" because
113 it executed, not because it some process failed.
115 void Test_Waitforall( )
117 int m, one, myrank, n;
119 MPI_Comm_rank( MPI_COMM_WORLD, &myrank );
120 MPI_Comm_size( MPI_COMM_WORLD, &n );
122 MPI_Allreduce( &one, &m, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD );
125 printf( "[%d] Expected %d processes to wait at end, got %d\n", myrank,
129 printf( " No Errors\n" );