Commit c12d5441 authored by David Goodell's avatar David Goodell
Browse files

[svn-r8005] 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@.
parent 024b2862
......@@ -8,6 +8,7 @@ testconnectserial_LDADD = -lm
dimsbalanced_SOURCES = dimsbalanced.c
spawntest_master_SOURCES = spawntest_master.c
spawntest_child_SOURCES = spawntest_child.c
segfault_SOURCES = segfault.c
testconnectserial.o: testconnectserial.c
......@@ -27,3 +27,8 @@ spawntest_master, spawntest_child - A test of MPI_Comm_disconnect to ensure
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.
#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));
return 0;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment