Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Reduce the size of partial shared malloc tests.
[simgrid.git] / teshsuite / smpi / mpich3-test / group / groupnullincl.c
1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
2 /*
3  *
4  *  (C) 2003 by Argonne National Laboratory.
5  *      See COPYRIGHT in top-level directory.
6  */
7 #include "mpi.h"
8 #include <stdio.h>
9 #include "mpitest.h"
10
11 int main(int argc, char *argv[])
12 {
13     int errs = 0;
14     int rc, result;
15     int ranks[1];
16     MPI_Group group, outgroup;
17     MPI_Comm comm;
18
19     MTest_Init(&argc, &argv);
20     /* To improve reporting of problems about operations, we
21      * change the error handler to errors return */
22     MPI_Comm_set_errhandler(MPI_COMM_WORLD, MPI_ERRORS_RETURN);
23
24     while (MTestGetComm(&comm, 1)) {
25         if (comm == MPI_COMM_NULL)
26             continue;
27
28         MPI_Comm_group(comm, &group);
29         rc = MPI_Group_incl(group, 0, 0, &outgroup);
30         if (rc) {
31             errs++;
32             MTestPrintError(rc);
33             printf("Error in creating an empty group with (0,0)\n");
34
35             /* Some MPI implementations may reject a null "ranks" pointer */
36             rc = MPI_Group_incl(group, 0, ranks, &outgroup);
37             if (rc) {
38                 errs++;
39                 MTestPrintError(rc);
40                 printf("Error in creating an empty group with (0,ranks)\n");
41             }
42         }
43
44         if (outgroup != MPI_GROUP_EMPTY) {
45             /* Is the group equivalent to group empty? */
46             rc = MPI_Group_compare(outgroup, MPI_GROUP_EMPTY, &result);
47             if (result != MPI_IDENT) {
48                 errs++;
49                 MTestPrintError(rc);
50                 printf("Did not create a group equivalent to an empty group\n");
51             }
52         }
53         rc = MPI_Group_free(&group);
54         if (rc) {
55             errs++;
56             MTestPrintError(rc);
57         }
58         if (outgroup != MPI_GROUP_NULL) {
59             rc = MPI_Group_free(&outgroup);
60             if (rc) {
61                 errs++;
62                 MTestPrintError(rc);
63             }
64         }
65
66         MTestFreeComm(&comm);
67     }
68
69     MTest_Finalize(errs);
70     MPI_Finalize();
71     return 0;
72
73 }