Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
activate a sleeping test
[simgrid.git] / teshsuite / smpi / privatization / privatization.c
1
2 #include <stdio.h>
3 #include <stdlib.h>
4 #include <mpi.h>
5
6
7 static int myvalue = 0;
8 static void test_opts(int* argc, char **argv[]){
9   int found = 0, ret;
10   static struct option long_options[] = {
11   {"long",     no_argument, 0,  0 },
12   {0,         0,                 0,  0 }
13   };
14   while (1) {
15     ret = getopt_long_only(*argc, *argv, "s",
16                 long_options, NULL);
17     if(ret==-1)
18       break;
19
20     switch (ret) {
21       case 0:
22         found++;
23       break;
24       case 's':
25         found ++;
26       break;
27       default:
28         printf("option %s", long_options[0].name);
29       break;
30     }
31   }
32   if (found!=2){
33     printf("(smpi_)getopt_long_only failed ! \n");
34   }
35 }
36 int main(int argc, char **argv)
37 {
38     int me;
39
40     MPI_Init(&argc, &argv);
41     /* test getopt_long function */
42     test_opts(&argc, &argv);
43
44     MPI_Comm_rank(MPI_COMM_WORLD, &me);
45
46     MPI_Barrier(MPI_COMM_WORLD);
47
48     myvalue = me;
49
50     MPI_Barrier(MPI_COMM_WORLD);
51
52     if(myvalue!=me)
53       printf("Privatization error - %d != %d\n", myvalue, me);
54     MPI_Finalize();
55     return 0;
56 }