[mpich2-commits] r8005 - mpich2/trunk/test/mpi/manual

goodell at mcs.anl.gov goodell at mcs.anl.gov
Tue Feb 22 08:24:06 CST 2011


Author: goodell
Date: 2011-02-22 08:24:05 -0600 (Tue, 22 Feb 2011)
New Revision: 8005

Added:
   mpich2/trunk/test/mpi/manual/segfault.c
Modified:
   mpich2/trunk/test/mpi/manual/Makefile.sm
   mpich2/trunk/test/mpi/manual/README
Log:
add test/mpi/manual/segfault.c, for checking mpiexec error output

See the description in test/mpi/manual/README for more info.

Reviewed by balaji at .

Modified: mpich2/trunk/test/mpi/manual/Makefile.sm
===================================================================
--- mpich2/trunk/test/mpi/manual/Makefile.sm	2011-02-21 23:00:50 UTC (rev 8004)
+++ mpich2/trunk/test/mpi/manual/Makefile.sm	2011-02-22 14:24:05 UTC (rev 8005)
@@ -8,6 +8,7 @@
 dimsbalanced_SOURCES      = dimsbalanced.c
 spawntest_master_SOURCES  = spawntest_master.c
 spawntest_child_SOURCES   = spawntest_child.c
+segfault_SOURCES          = segfault.c
 
 testconnectserial.o: testconnectserial.c
 	$(C_COMPILE) -c -DMPICHLIBSTR=\"$(MPIDIR)\" $<

Modified: mpich2/trunk/test/mpi/manual/README
===================================================================
--- mpich2/trunk/test/mpi/manual/README	2011-02-21 23:00:50 UTC (rev 8004)
+++ mpich2/trunk/test/mpi/manual/README	2011-02-22 14:24:05 UTC (rev 8005)
@@ -27,3 +27,8 @@
 		  works correctly, the spawned children (4 by default), 
 		  should exit roughly 30 seconds before the master.
 
+segfault - a simple test that intentionally segfaults if its rank is 0,
+           otherwise does nothing.  The output from mpiexec should make it clear
+           that one of the processes segfaulted (not just terminated badly), and
+           ideally indicate which process.  Make sure to run it with a range of
+           comm_world sizes, including 1 and 2.

Added: mpich2/trunk/test/mpi/manual/segfault.c
===================================================================
--- mpich2/trunk/test/mpi/manual/segfault.c	                        (rev 0)
+++ mpich2/trunk/test/mpi/manual/segfault.c	2011-02-22 14:24:05 UTC (rev 8005)
@@ -0,0 +1,20 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include "mpi.h"
+
+int main(int argc, char **argv)
+{
+    int *ptr = NULL;
+    int rank;
+
+    MPI_Init(&argc, &argv);
+    MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+    if (rank == 0) {
+        (*ptr)++; /* will segfault */
+        /* never get below here, just present to prevent dead-code elimination */
+        printf("*ptr=%d\n", (*ptr));
+    }
+    MPI_Finalize();
+    return 0;
+}
+



More information about the mpich2-commits mailing list