Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix getopt for BSD systems
[simgrid.git] / teshsuite / smpi / pt2pt-pingpong / pt2pt-pingpong.c
index e42b1b8..6ddb623 100644 (file)
@@ -9,6 +9,21 @@
 #include <stdio.h>
 #include <mpi.h>
 
+static void test_opts(int* argc, char **argv[]){
+  int found = 0, ret;
+  while ((ret = getopt(*argc, *argv, "s")) >= 0)
+  {
+    switch (ret) {
+    case 's':
+      found = 1;
+      break;
+    }
+  }
+  if (found!=1){
+    printf("(smpi_)getopt failed ! \n");
+  }
+}
+
 int main(int argc, char *argv[])
 {
   const int tag1 = 42;
@@ -19,6 +34,10 @@ int main(int argc, char *argv[])
   MPI_Status status;
 
   int err = MPI_Init(&argc, &argv); /* Initialize MPI */
+
+  /* test getopt function */
+  test_opts(&argc, &argv);
+
   if (err != MPI_SUCCESS) {
     printf("MPI initialization failed!\n");
     exit(1);