Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Reduce the size of partial shared malloc tests.
[simgrid.git] / teshsuite / smpi / mpich3-test / rma / winname.c
1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
2 /*
3  *
4  *  (C) 2001 by Argonne National Laboratory.
5  *      See COPYRIGHT in top-level directory.
6  */
7
8 #include "mpi.h"
9 #include <stdio.h>
10 #include <stdlib.h>
11 #include "mpitestconf.h"
12 #include "mpitest.h"
13 #ifdef HAVE_STRING_H
14 #include <string.h>
15 #endif
16
17 int main(int argc, char *argv[])
18 {
19     int errs = 0;
20     MPI_Win win;
21     int cnt, namelen;
22     char name[MPI_MAX_OBJECT_NAME], nameout[MPI_MAX_OBJECT_NAME];
23
24     MTest_Init(&argc, &argv);
25
26     cnt = 0;
27     while (MTestGetWin(&win, 1)) {
28         if (win == MPI_WIN_NULL)
29             continue;
30
31         sprintf(name, "win-%d", cnt);
32         cnt++;
33         MPI_Win_set_name(win, name);
34         nameout[0] = 0;
35         MPI_Win_get_name(win, nameout, &namelen);
36         if (strcmp(name, nameout)) {
37             errs++;
38             printf("Unexpected name, was %s but should be %s\n", nameout, name);
39         }
40
41         MTestFreeWin(&win);
42     }
43
44     MTest_Finalize(errs);
45     MPI_Finalize();
46     return 0;
47 }