[mpich2-commits] r5604 - mpich2/trunk/test/mpi/errhan

goodell at mcs.anl.gov goodell at mcs.anl.gov
Wed Oct 28 18:24:42 CDT 2009


Author: goodell
Date: 2009-10-28 18:24:42 -0500 (Wed, 28 Oct 2009)
New Revision: 5604

Modified:
   mpich2/trunk/test/mpi/errhan/commcall.c
Log:
Add errhandler resetting to the commcall test.

This is a regression test for the bad BUILTIN check in
MPI_Comm_set_errhandler.  This diff is best viewed ignoring whitespace.

Reviewed by buntinas at .

Modified: mpich2/trunk/test/mpi/errhan/commcall.c
===================================================================
--- mpich2/trunk/test/mpi/errhan/commcall.c	2009-10-28 21:56:56 UTC (rev 5603)
+++ mpich2/trunk/test/mpi/errhan/commcall.c	2009-10-28 23:24:42 UTC (rev 5604)
@@ -31,6 +31,7 @@
     MPI_Comm       comm;
     MPI_Errhandler newerr;
     int            i;
+    int            reset_handler;
 
     MTest_Init( &argc, &argv );
 
@@ -48,32 +49,39 @@
     }
 
     /* Here we apply the test to many copies of a communicator */
-    for (i=0; i<1000; i++) {
-	MPI_Comm comm2;
-	calls = 0;
-	MPI_Comm_dup( MPI_COMM_WORLD, &comm );
-	mycomm = comm;
-	MPI_Comm_create_errhandler( eh, &newerr );
+    for (reset_handler = 0; reset_handler <= 1; ++reset_handler) {
+        for (i=0; i<1000; i++) {
+            MPI_Comm comm2;
+            calls = 0;
+            MPI_Comm_dup( MPI_COMM_WORLD, &comm );
+            mycomm = comm;
+            MPI_Comm_create_errhandler( eh, &newerr );
 
-	MPI_Comm_set_errhandler( comm, newerr );
-	MPI_Comm_call_errhandler( comm, MPI_ERR_OTHER );
-	if (calls != 1) {
-	    errs++;
-	    printf( "Error handler not called\n" );
-	}
-	MPI_Comm_dup( comm, &comm2 );
-	calls = 0;
-	mycomm = comm2;
-	/* comm2 must inherit the error handler from comm */
-	MPI_Comm_call_errhandler( comm2, MPI_ERR_OTHER );
-	MPI_Errhandler_free( &newerr );
-	if (calls != 1) {
-	    errs++;
-	    printf( "Error handler not called\n" );
-	}
+            MPI_Comm_set_errhandler( comm, newerr );
+            MPI_Comm_call_errhandler( comm, MPI_ERR_OTHER );
+            if (calls != 1) {
+                errs++;
+                printf( "Error handler not called\n" );
+            }
+            MPI_Comm_dup( comm, &comm2 );
+            calls = 0;
+            mycomm = comm2;
+            /* comm2 must inherit the error handler from comm */
+            MPI_Comm_call_errhandler( comm2, MPI_ERR_OTHER );
+            if (calls != 1) {
+                errs++;
+                printf( "Error handler not called\n" );
+            }
 
-	MPI_Comm_free( &comm );
-	MPI_Comm_free( &comm2 );
+            if (reset_handler) {
+                /* extra checking of the reference count handling */
+                MPI_Comm_set_errhandler( comm, MPI_ERRORS_ARE_FATAL );
+            }
+            MPI_Errhandler_free( &newerr );
+
+            MPI_Comm_free( &comm );
+            MPI_Comm_free( &comm2 );
+        }
     }
 
     MTest_Finalize( errs );



More information about the mpich2-commits mailing list