Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'pikachuyann/simgrid-stoprofiles'
[simgrid.git] / teshsuite / smpi / mpich3-test / errhan / predef_eh.c
1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
2 /*
3  *
4  *  (C) 2012 by Argonne National Laboratory.
5  *      See COPYRIGHT in top-level directory.
6  */
7
8 #include <stdio.h>
9 #include <assert.h>
10 #include <stdlib.h>
11 #include "mpi.h"
12 #include "mpitest.h"
13
14 /* Ensure that setting a user-defined error handler on predefined
15  * communicators does not cause a problem at finalize time.  Regression
16  * test for ticket #1591 */
17 void errf(MPI_Comm * comm, int *ec);
18 void errf(MPI_Comm * comm, int *ec)
19 {
20     /* do nothing */
21 }
22
23 int main(int argc, char **argv)
24 {
25     MPI_Errhandler errh;
26     int wrank;
27     MTest_Init(&argc, &argv);
28     MPI_Comm_rank(MPI_COMM_WORLD, &wrank);
29     MPI_Comm_create_errhandler((MPI_Comm_errhandler_function *) errf, &errh);
30     MPI_Comm_set_errhandler(MPI_COMM_WORLD, errh);
31     MPI_Comm_set_errhandler(MPI_COMM_SELF, errh);
32     MPI_Errhandler_free(&errh);
33     MTest_Finalize(0);
34     return 0;
35 }