Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Update info
authordegomme <augustin.degomme@unibas.ch>
Sat, 11 Feb 2017 20:28:12 +0000 (21:28 +0100)
committerdegomme <augustin.degomme@unibas.ch>
Sun, 12 Feb 2017 01:08:28 +0000 (02:08 +0100)
teshsuite/smpi/mpich3-test/info/CMakeLists.txt
teshsuite/smpi/mpich3-test/info/infodel.c
teshsuite/smpi/mpich3-test/info/infodup.c
teshsuite/smpi/mpich3-test/info/infoenv.c
teshsuite/smpi/mpich3-test/info/infoget.c [new file with mode: 0644]
teshsuite/smpi/mpich3-test/info/infomany.c
teshsuite/smpi/mpich3-test/info/infomany2.c
teshsuite/smpi/mpich3-test/info/infoorder.c
teshsuite/smpi/mpich3-test/info/infotest.c
teshsuite/smpi/mpich3-test/info/infovallen.c
teshsuite/smpi/mpich3-test/info/testlist

index 6d29723..f8cefeb 100644 (file)
@@ -9,7 +9,7 @@ if(enable_smpi AND enable_smpi_MPICH3_testsuite)
   include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi")
   include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../include/")
 
-  foreach(file infodel infodup infomany2 infomany infoorder infotest infovallen) #infoenv
+  foreach(file infodel infodup infomany2 infomany infoorder infotest infoget infovallen) #infoenv
     add_executable(${file} ${file}.c)
     target_link_libraries(${file} simgrid mtest_c)
   endforeach()
@@ -20,7 +20,7 @@ if (enable_smpi_MPICH3_testsuite AND HAVE_RAW_CONTEXTS)
   SET_TESTS_PROPERTIES(test-smpi-mpich3-info-raw PROPERTIES PASS_REGULAR_EXPRESSION "tests passed!")
 endif()
 
-foreach(file infodel infodup infomany2 infomany infoorder infotest infovallen infoenv)
+foreach(file infodel infodup infomany2 infomany infoorder infotest infoget infovallen infoenv)
   set(examples_src  ${examples_src} ${CMAKE_CURRENT_SOURCE_DIR}/${file}.c)
 endforeach()
 
index a62f362..b281847 100644 (file)
 #endif
 
 #define NKEYS 3
-int main( int argc, char *argv[] )
+int main(int argc, char *argv[])
 {
     int errs = 0;
     MPI_Info info;
-    char *keys[NKEYS] = { (char*)"file", (char*)"soft", (char*)"host" };
-    char *values[NKEYS] = { (char*)"runfile.txt", (char*)"2:1000:4,3:1000:7", 
-                           (char*)"myhost.myorg.org" };
+    char *keys[NKEYS] = { (char *) "file", (char *) "soft", (char *) "host" };
+    char *values[NKEYS] = { (char *) "runfile.txt", (char *) "2:1000:4,3:1000:7",
+        (char *) "myhost.myorg.org"
+    };
     char value[MPI_MAX_INFO_VAL];
     int i, flag, nkeys;
 
-    MTest_Init( &argc, &argv );
+    MTest_Init(&argc, &argv);
 
-    MPI_Info_create( &info );
+    MPI_Info_create(&info);
     /* Use only named keys incase the info implementation only supports
-       the predefined keys (e.g., IBM) */
-    for (i=0; i<NKEYS; i++) {
-       MPI_Info_set( info, keys[i], values[i] );
+     * the predefined keys (e.g., IBM) */
+    for (i = 0; i < NKEYS; i++) {
+        MPI_Info_set(info, keys[i], values[i]);
     }
 
     /* Check that all values are present */
-    for (i=0; i<NKEYS; i++) { 
-       MPI_Info_get( info, keys[i], MPI_MAX_INFO_VAL, value, &flag );
-       if (!flag) {
-           errs++;
-           printf( "No value for key %s\n", keys[i] );
-       }
-       if (strcmp( value, values[i] )) {
-           errs++;
-           printf( "Incorrect value for key %s, got %s expected %s\n", 
-                   keys[i], value, values[i] );
-       }
+    for (i = 0; i < NKEYS; i++) {
+        MPI_Info_get(info, keys[i], MPI_MAX_INFO_VAL, value, &flag);
+        if (!flag) {
+            errs++;
+            printf("No value for key %s\n", keys[i]);
+        }
+        if (strcmp(value, values[i])) {
+            errs++;
+            printf("Incorrect value for key %s, got %s expected %s\n", keys[i], value, values[i]);
+        }
     }
 
     /* Now, change one value and remove another, then check again */
-    MPI_Info_delete( info, keys[NKEYS-1] );
-    MPI_Info_get_nkeys( info, &nkeys );
+    MPI_Info_delete(info, keys[NKEYS - 1]);
+    MPI_Info_get_nkeys(info, &nkeys);
     if (nkeys != NKEYS - 1) {
-       errs++;
-       printf( "Deleting a key did not change the number of keys\n" );
+        errs++;
+        printf("Deleting a key did not change the number of keys\n");
     }
 
-    values[0] = (char*)"backfile.txt";
-    MPI_Info_set( info, keys[0], values[0] );
-    for (i=0; i<NKEYS-1; i++) {
-       MPI_Info_get( info, keys[i], MPI_MAX_INFO_VAL, value, &flag );
-       if (!flag) {
-           errs++;
-           printf( "(after reset) No value for key %s\n", keys[i] );
-       }
-       if (strcmp( value, values[i] )) {
-           errs++;
-           printf( "(after reset) Incorrect value for key %s, got %s expected %s\n", 
-                   keys[i], value, values[i] );
-       }
+    values[0] = (char *) "backfile.txt";
+    MPI_Info_set(info, keys[0], values[0]);
+    for (i = 0; i < NKEYS - 1; i++) {
+        MPI_Info_get(info, keys[i], MPI_MAX_INFO_VAL, value, &flag);
+        if (!flag) {
+            errs++;
+            printf("(after reset) No value for key %s\n", keys[i]);
+        }
+        if (strcmp(value, values[i])) {
+            errs++;
+            printf("(after reset) Incorrect value for key %s, got %s expected %s\n",
+                   keys[i], value, values[i]);
+        }
     }
 
-    MPI_Info_free( &info );
+    MPI_Info_free(&info);
     if (info != MPI_INFO_NULL) {
-       errs++;
-       printf( "MPI_Info_free should set info to MPI_INFO_NULL\n" );
+        errs++;
+        printf("MPI_Info_free should set info to MPI_INFO_NULL\n");
     }
 
-    MTest_Finalize( errs );
+    MTest_Finalize(errs);
     MPI_Finalize();
     return 0;
-  
+
 }
index b89d020..4c79749 100644 (file)
@@ -13,7 +13,7 @@
 #include <string.h>
 #endif
 
-int main( int argc, char *argv[] )
+int main(int argc, char *argv[])
 {
     int errs = 0;
     MPI_Info info1, infodup;
@@ -21,62 +21,61 @@ int main( int argc, char *argv[] )
     char key[MPI_MAX_INFO_KEY], keydup[MPI_MAX_INFO_KEY];
     char value[MPI_MAX_INFO_VAL], valdup[MPI_MAX_INFO_VAL];
 
-    MTest_Init( &argc, &argv );
+    MTest_Init(&argc, &argv);
 
-    MPI_Info_create( &info1 );
+    MPI_Info_create(&info1);
     /* Use only named keys incase the info implementation only supports
-       the predefined keys (e.g., IBM) */
-    MPI_Info_set( info1, (char*)"host", (char*)"myhost.myorg.org" );
-    MPI_Info_set( info1, (char*)"file", (char*)"runfile.txt" );
-    MPI_Info_set( info1, (char*)"soft", (char*)"2:1000:4,3:1000:7" );
+     * the predefined keys (e.g., IBM) */
+    MPI_Info_set(info1, (char *) "host", (char *) "myhost.myorg.org");
+    MPI_Info_set(info1, (char *) "file", (char *) "runfile.txt");
+    MPI_Info_set(info1, (char *) "soft", (char *) "2:1000:4,3:1000:7");
 
-    MPI_Info_dup( info1, &infodup );
+    MPI_Info_dup(info1, &infodup);
 
-    MPI_Info_get_nkeys( infodup, &nkeysdup );
-    MPI_Info_get_nkeys( info1, &nkeys );
+    MPI_Info_get_nkeys(infodup, &nkeysdup);
+    MPI_Info_get_nkeys(info1, &nkeys);
     if (nkeys != nkeysdup) {
-       errs++;
-       printf( "Dup'ed info has a different number of keys; is %d should be %d\n",
-               nkeysdup, nkeys );
+        errs++;
+        printf("Dup'ed info has a different number of keys; is %d should be %d\n", nkeysdup, nkeys);
     }
     vallen = MPI_MAX_INFO_VAL;
-    for (i=0; i<nkeys; i++) {
-       /* MPI requires that the keys are in the same order after the dup */
-       MPI_Info_get_nthkey( info1, i, key );
-       MPI_Info_get_nthkey( infodup, i, keydup );
-       if (strcmp(key, keydup)) {
-           errs++;
-           printf( "keys do not match: %s should be %s\n", keydup, key );
-       }
+    for (i = 0; i < nkeys; i++) {
+        /* MPI requires that the keys are in the same order after the dup */
+        MPI_Info_get_nthkey(info1, i, key);
+        MPI_Info_get_nthkey(infodup, i, keydup);
+        if (strcmp(key, keydup)) {
+            errs++;
+            printf("keys do not match: %s should be %s\n", keydup, key);
+        }
 
-       vallen = MPI_MAX_INFO_VAL;
-       MPI_Info_get( info1, key, vallen, value, &flag );
-       MPI_Info_get( infodup, keydup, vallen, valdup, &flagdup );
-       if (!flag || !flagdup) {
-           errs++;
-           printf( "Info get failed for key %s\n", key );
-       }
-       else if (strcmp( value, valdup )) {
-           errs++;
-           printf( "Info values for key %s not the same after dup\n", key );
-       }
+        vallen = MPI_MAX_INFO_VAL;
+        MPI_Info_get(info1, key, vallen, value, &flag);
+        MPI_Info_get(infodup, keydup, vallen, valdup, &flagdup);
+        if (!flag || !flagdup) {
+            errs++;
+            printf("Info get failed for key %s\n", key);
+        }
+        else if (strcmp(value, valdup)) {
+            errs++;
+            printf("Info values for key %s not the same after dup\n", key);
+        }
     }
 
-    /* Change info and check that infodup does NOT have the new value 
-       (ensure that lazy dups are still duped) */
-    MPI_Info_set( info1, (char*)"path", (char*)"/a:/b:/c/d" );
+    /* Change info and check that infodup does NOT have the new value
+     * (ensure that lazy dups are still duped) */
+    MPI_Info_set(info1, (char *) "path", (char *) "/a:/b:/c/d");
 
-    MPI_Info_get( infodup, (char*)"path", vallen, value, &flag );
+    MPI_Info_get(infodup, (char *) "path", vallen, value, &flag);
     if (flag) {
-       errs++;
-       printf( "inserting path into info changed infodup\n" );
+        errs++;
+        printf("inserting path into info changed infodup\n");
     }
-    
-    MPI_Info_free( &info1 );
-    MPI_Info_free( &infodup );
-    
-    MTest_Finalize( errs );
+
+    MPI_Info_free(&info1);
+    MPI_Info_free(&infodup);
+
+    MTest_Finalize(errs);
     MPI_Finalize();
     return 0;
-  
+
 }
index ff895c8..5b0fa1c 100644 (file)
@@ -13,7 +13,8 @@ int main(int argc, char *argv[])
 {
     char value[MPI_MAX_INFO_VAL];
     char *keys[] = { "command", "argv", "maxprocs", "soft", "host", "arch", "wdir", "file",
-                     "thread_level", 0 };
+        "thread_level", 0
+    };
     int flag, i;
 
     MPI_Init(NULL, NULL);
diff --git a/teshsuite/smpi/mpich3-test/info/infoget.c b/teshsuite/smpi/mpich3-test/info/infoget.c
new file mode 100644 (file)
index 0000000..9eee8af
--- /dev/null
@@ -0,0 +1,42 @@
+/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
+/*
+ *  (C) 2001 by Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+/* Test code provided by Hajime Fujita. See Trac ticket #2225. */
+
+#include "mpi.h"
+#include <stdio.h>
+#include "mpitest.h"
+#include <string.h>
+
+int main(int argc, char *argv[])
+{
+    MPI_Info info;
+    const char *key = "key", *val = "val";
+    char buff[3 + 1];           /* strlen("val") + 1 */
+    int flag, errs = 0;
+
+    MTest_Init(&argc, &argv);
+
+    MPI_Info_create(&info);
+    MPI_Info_set(info, (char*)key, (char*)val);
+    MPI_Info_get(info, (char*)key, sizeof(buff) - 1, buff, &flag);
+    if (flag) {
+        if (strncmp(buff, val, sizeof(buff) - 1) != 0) {
+            errs++;
+            printf("returned value is %s, should be %s\n", buff, val);
+        }
+    }
+    else {
+        errs++;
+        printf("key not found\n");
+    }
+    MPI_Info_free(&info);
+
+    MTest_Finalize(errs);
+    MPI_Finalize();
+
+    return 0;
+}
index c9f8213..7f71f57 100644 (file)
 #define info_list 16
 /* #define DBG  */
 
-int main( int argc, char *argv[] )
+int main(int argc, char *argv[])
 {
     MPI_Info infos[MAX_INFOS];
     char key[64], value[64];
-    int  errs = 0;
-    int  i, j;
+    int errs = 0;
+    int i, j;
 
-    MTest_Init( &argc, &argv );
-    
-    for (i=0; i<MAX_INFOS; i++) {
-       MPI_Info_create( &infos[i] );
+    MTest_Init(&argc, &argv);
+
+    for (i = 0; i < MAX_INFOS; i++) {
+        MPI_Info_create(&infos[i]);
 #ifdef DBG
-       printf( "Info handle is %x\n", infos[i] );
+        printf("Info handle is %x\n", infos[i]);
 #endif
-       for (j=0; j<info_list; j++) {
-           sprintf( key, "key%d-%d", i, j );
-           sprintf( value, "value%d-%d", i, j );
+        for (j = 0; j < info_list; j++) {
+            sprintf(key, "key%d-%d", i, j);
+            sprintf(value, "value%d-%d", i, j);
 #ifdef DBG
-           printf( "Creating key/value %s=%s\n", key, value );
+            printf("Creating key/value %s=%s\n", key, value);
 #endif
-           MPI_Info_set( infos[i], key, value );
-       }
+            MPI_Info_set(infos[i], key, value);
+        }
 #ifdef DBG
-       { int nkeys;
-       MPI_Info_get_nkeys( infos[0], &nkeys );
-       if (nkeys != info_list) {
-           printf( "infos[0] changed at %d info\n", i );}
-       }
+        {
+            int nkeys;
+            MPI_Info_get_nkeys(infos[0], &nkeys);
+            if (nkeys != info_list) {
+                printf("infos[0] changed at %d info\n", i);
+            }
+        }
 #endif
     }
-    
-    for (i=0; i<MAX_INFOS; i++) {
-       int nkeys;
-       /*printf( "info = %x\n", infos[i] );
-         print_handle( infos[i] ); printf( "\n" );*/
-       MPI_Info_get_nkeys( infos[i], &nkeys );
-       if (nkeys != info_list) {
-           errs++;
-           if (errs < MAX_ERRORS) {
-               printf( "Wrong number of keys for info %d; got %d, should be %d\n",
-                       i, nkeys, info_list );
-           }
-       }
-       for (j=0; j<nkeys; j++) {
-           char keystr[64];
-           char valstr[64];
-           int  flag;
-           MPI_Info_get_nthkey( infos[i], j, key );
-           sprintf( keystr, "key%d-%d", i, j );
-           if (strcmp( keystr, key ) != 0) {
-               errs++;
-               if (errs < MAX_ERRORS) {
-                   printf( "Wrong key for info %d; got %s expected %s\n", 
-                           i, key, keystr );
-               }
-               continue;
-           }
-           MPI_Info_get( infos[i], key, sizeof(value), value, &flag );
-           if (!flag) {
-               errs++;
-               if (errs < MAX_ERRORS) {
-                   printf( "Get failed to return value for info %d\n", i );
-               }
-               continue;
-           }
-           sprintf( valstr, "value%d-%d", i, j );
-           if (strcmp( valstr, value ) != 0) {
-               errs++;
-               if (errs < MAX_ERRORS) {
-                   printf( "Wrong value for info %d; got %s expected %s\n",
-                           i, value, valstr );
-               }
-           }
-       }
+
+    for (i = 0; i < MAX_INFOS; i++) {
+        int nkeys;
+        /*printf("info = %x\n", infos[i]);
+         * print_handle(infos[i]); printf("\n"); */
+        MPI_Info_get_nkeys(infos[i], &nkeys);
+        if (nkeys != info_list) {
+            errs++;
+            if (errs < MAX_ERRORS) {
+                printf("Wrong number of keys for info %d; got %d, should be %d\n",
+                       i, nkeys, info_list);
+            }
+        }
+        for (j = 0; j < nkeys; j++) {
+            char keystr[64];
+            char valstr[64];
+            int flag;
+            MPI_Info_get_nthkey(infos[i], j, key);
+            sprintf(keystr, "key%d-%d", i, j);
+            if (strcmp(keystr, key) != 0) {
+                errs++;
+                if (errs < MAX_ERRORS) {
+                    printf("Wrong key for info %d; got %s expected %s\n", i, key, keystr);
+                }
+                continue;
+            }
+            MPI_Info_get(infos[i], key, sizeof(value), value, &flag);
+            if (!flag) {
+                errs++;
+                if (errs < MAX_ERRORS) {
+                    printf("Get failed to return value for info %d\n", i);
+                }
+                continue;
+            }
+            sprintf(valstr, "value%d-%d", i, j);
+            if (strcmp(valstr, value) != 0) {
+                errs++;
+                if (errs < MAX_ERRORS) {
+                    printf("Wrong value for info %d; got %s expected %s\n", i, value, valstr);
+                }
+            }
+        }
     }
-    for (i=0; i<MAX_INFOS; i++) {
-       MPI_Info_free( &infos[i] );
+    for (i = 0; i < MAX_INFOS; i++) {
+        MPI_Info_free(&infos[i]);
     }
-    
-    MTest_Finalize( errs );
-    MPI_Finalize( );
+
+    MTest_Finalize(errs);
+    MPI_Finalize();
     return 0;
 }
index f400648..68f4271 100644 (file)
 #define DBGPRINTF(a)
 #endif
 
-int main( int argc, char *argv[] )
+int main(int argc, char *argv[])
 {
     MPI_Info infos[MAX_INFOS];
     char key[64], value[64];
-    int  errs = 0;
-    int  i, j;
+    int errs = 0;
+    int i, j;
 
-    MTest_Init( &argc, &argv );
+    MTest_Init(&argc, &argv);
 
     /* We create max_info items, then delete the middle third of them,
-       then recreate them, then check them, then 
-       delete them all.  This checks that the MPICH algorithm for 
-       handling large numbers of items works correctly; other MPI 
-       implementations should also be able to handle this */
+     * then recreate them, then check them, then
+     * delete them all.  This checks that the MPICH algorithm for
+     * handling large numbers of items works correctly; other MPI
+     * implementations should also be able to handle this */
 
     /* Create them all */
-    for (i=0; i<MAX_INFOS; i++) {
-       MPI_Info_create( &infos[i] );
-       DBGPRINTF( ( "Info handle is %x\n", infos[i] ) );
-       for (j=0; j<info_list; j++) {
-           sprintf( key, "key%d-%d", i, j );
-           sprintf( value, "value%d-%d", i, j );
-           DBGPRINTF( ( "Creating key/value %s=%s\n", key, value ));
-           MPI_Info_set( infos[i], key, value );
-       }
+    for (i = 0; i < MAX_INFOS; i++) {
+        MPI_Info_create(&infos[i]);
+        DBGPRINTF(("Info handle is %x\n", infos[i]));
+        for (j = 0; j < info_list; j++) {
+            sprintf(key, "key%d-%d", i, j);
+            sprintf(value, "value%d-%d", i, j);
+            DBGPRINTF(("Creating key/value %s=%s\n", key, value));
+            MPI_Info_set(infos[i], key, value);
+        }
 #ifdef DBG
-       { int nkeys;
-       MPI_Info_get_nkeys( infos[0], &nkeys );
-       if (nkeys != info_list) {
-           printf( "infos[0] changed at %d info\n", i );}
-       }
+        {
+            int nkeys;
+            MPI_Info_get_nkeys(infos[0], &nkeys);
+            if (nkeys != info_list) {
+                printf("infos[0] changed at %d info\n", i);
+            }
+        }
 #endif
     }
 
     /* Delete the middle set */
-    for (i=MAX_INFOS/3; i<(2*MAX_INFOS/3); i++) {
-       MPI_Info_free( &infos[i] );
+    for (i = MAX_INFOS / 3; i < (2 * MAX_INFOS / 3); i++) {
+        MPI_Info_free(&infos[i]);
     }
-    
+
     /* Recreate the middle set */
-    for (i=MAX_INFOS/3; i<(2*MAX_INFOS/3); i++) {
-       MPI_Info_create( &infos[i] );
-       DBGPRINTF( ( "Info handle is %x\n", infos[i] ) );
-       for (j=0; j<info_list; j++) {
-           sprintf( key, "key%d-%d", i, j );
-           sprintf( value, "value%d-%d", i, j );
-           DBGPRINTF( ( "Creating key/value %s=%s\n", key, value ));
-           MPI_Info_set( infos[i], key, value );
-       }
+    for (i = MAX_INFOS / 3; i < (2 * MAX_INFOS / 3); i++) {
+        MPI_Info_create(&infos[i]);
+        DBGPRINTF(("Info handle is %x\n", infos[i]));
+        for (j = 0; j < info_list; j++) {
+            sprintf(key, "key%d-%d", i, j);
+            sprintf(value, "value%d-%d", i, j);
+            DBGPRINTF(("Creating key/value %s=%s\n", key, value));
+            MPI_Info_set(infos[i], key, value);
+        }
     }
 
     /* Now, check that they are still valid */
-    for (i=0; i<MAX_INFOS; i++) {
-       int nkeys;
-       /*printf( "info = %x\n", infos[i] );
-         print_handle( infos[i] ); printf( "\n" );*/
-       MPI_Info_get_nkeys( infos[i], &nkeys );
-       if (nkeys != info_list) {
-           errs++;
-           if (errs < MAX_ERRORS) {
-               printf( "Wrong number of keys for info %d; got %d, should be %d\n",
-                       i, nkeys, info_list );
-           }
-       }
-       for (j=0; j<nkeys; j++) {
-           char keystr[64];
-           char valstr[64];
-           int  flag;
-           MPI_Info_get_nthkey( infos[i], j, key );
-           sprintf( keystr, "key%d-%d", i, j );
-           if (strcmp( keystr, key ) != 0) {
-               errs++;
-               if (errs < MAX_ERRORS) {
-                   printf( "Wrong key for info %d; got %s expected %s\n", 
-                           i, key, keystr );
-               }
-               continue;
-           }
-           MPI_Info_get( infos[i], key, 64, value, &flag );
-           if (!flag) {
-               errs++;
-               if (errs < MAX_ERRORS) {
-                   printf( "Get failed to return value for info %d\n", i );
-               }
-               continue;
-           }
-           sprintf( valstr, "value%d-%d", i, j );
-           if (strcmp( valstr, value ) != 0) {
-               errs++;
-               if (errs < MAX_ERRORS) {
-                   printf( "Wrong value for info %d; got %s expected %s\n",
-                           i, value, valstr );
-               }
-           }
-       }
+    for (i = 0; i < MAX_INFOS; i++) {
+        int nkeys;
+        /*printf("info = %x\n", infos[i]);
+         * print_handle(infos[i]); printf("\n"); */
+        MPI_Info_get_nkeys(infos[i], &nkeys);
+        if (nkeys != info_list) {
+            errs++;
+            if (errs < MAX_ERRORS) {
+                printf("Wrong number of keys for info %d; got %d, should be %d\n",
+                       i, nkeys, info_list);
+            }
+        }
+        for (j = 0; j < nkeys; j++) {
+            char keystr[64];
+            char valstr[64];
+            int flag;
+            MPI_Info_get_nthkey(infos[i], j, key);
+            sprintf(keystr, "key%d-%d", i, j);
+            if (strcmp(keystr, key) != 0) {
+                errs++;
+                if (errs < MAX_ERRORS) {
+                    printf("Wrong key for info %d; got %s expected %s\n", i, key, keystr);
+                }
+                continue;
+            }
+            MPI_Info_get(infos[i], key, 64, value, &flag);
+            if (!flag) {
+                errs++;
+                if (errs < MAX_ERRORS) {
+                    printf("Get failed to return value for info %d\n", i);
+                }
+                continue;
+            }
+            sprintf(valstr, "value%d-%d", i, j);
+            if (strcmp(valstr, value) != 0) {
+                errs++;
+                if (errs < MAX_ERRORS) {
+                    printf("Wrong value for info %d; got %s expected %s\n", i, value, valstr);
+                }
+            }
+        }
     }
-    for (i=0; i<MAX_INFOS; i++) {
-       MPI_Info_free( &infos[i] );
+    for (i = 0; i < MAX_INFOS; i++) {
+        MPI_Info_free(&infos[i]);
     }
-    
-    MTest_Finalize( errs );
-    MPI_Finalize( );
+
+    MTest_Finalize(errs);
+    MPI_Finalize();
     return 0;
 }
index aa1db8c..e1189c4 100644 (file)
 #endif
 
 #define NKEYS 3
-int main( int argc, char *argv[] )
+int main(int argc, char *argv[])
 {
     int errs = 0;
     MPI_Info info;
-    char *keys1[NKEYS] = { (char*)"file", (char*)"soft", (char*)"host" };
-    char *values1[NKEYS] = { (char*)"runfile.txt", (char*)"2:1000:4,3:1000:7", 
-                            (char*)"myhost.myorg.org" };
+    char *keys1[NKEYS] = { (char *) "file", (char *) "soft", (char *) "host" };
+    char *values1[NKEYS] = { (char *) "runfile.txt", (char *) "2:1000:4,3:1000:7",
+        (char *) "myhost.myorg.org"
+    };
 
     char value[MPI_MAX_INFO_VAL];
     int i, flag;
 
-    MTest_Init( &argc, &argv );
+    MTest_Init(&argc, &argv);
 
     /* 1,2,3 */
-    MPI_Info_create( &info );
+    MPI_Info_create(&info);
     /* Use only named keys incase the info implementation only supports
-       the predefined keys (e.g., IBM) */
-    for (i=0; i<NKEYS; i++) {
-       MPI_Info_set( info, keys1[i], values1[i] );
+     * the predefined keys (e.g., IBM) */
+    for (i = 0; i < NKEYS; i++) {
+        MPI_Info_set(info, keys1[i], values1[i]);
     }
 
     /* Check that all values are present */
-    for (i=0; i<NKEYS; i++) {
-       MPI_Info_get( info, keys1[i], MPI_MAX_INFO_VAL, value, &flag );
-       if (!flag) {
-           errs++;
-           printf( "No value for key %s\n", keys1[i] );
-       }
-       if (strcmp( value, values1[i] )) {
-           errs++;
-           printf( "Incorrect value for key %s\n", keys1[i] );
-       }
+    for (i = 0; i < NKEYS; i++) {
+        MPI_Info_get(info, keys1[i], MPI_MAX_INFO_VAL, value, &flag);
+        if (!flag) {
+            errs++;
+            printf("No value for key %s\n", keys1[i]);
+        }
+        if (strcmp(value, values1[i])) {
+            errs++;
+            printf("Incorrect value for key %s\n", keys1[i]);
+        }
     }
-    MPI_Info_free( &info );
+    MPI_Info_free(&info);
 
     /* 3,2,1 */
-    MPI_Info_create( &info );
+    MPI_Info_create(&info);
     /* Use only named keys incase the info implementation only supports
-       the predefined keys (e.g., IBM) */
-    for (i=NKEYS-1; i>=0; i--) {
-       MPI_Info_set( info, keys1[i], values1[i] );
+     * the predefined keys (e.g., IBM) */
+    for (i = NKEYS - 1; i >= 0; i--) {
+        MPI_Info_set(info, keys1[i], values1[i]);
     }
 
     /* Check that all values are present */
-    for (i=0; i<NKEYS; i++) {
-       MPI_Info_get( info, keys1[i], MPI_MAX_INFO_VAL, value, &flag );
-       if (!flag) {
-           errs++;
-           printf( "No value for key %s\n", keys1[i] );
-       }
-       if (strcmp( value, values1[i] )) {
-           errs++;
-           printf( "Incorrect value for key %s\n", keys1[i] );
-       }
+    for (i = 0; i < NKEYS; i++) {
+        MPI_Info_get(info, keys1[i], MPI_MAX_INFO_VAL, value, &flag);
+        if (!flag) {
+            errs++;
+            printf("No value for key %s\n", keys1[i]);
+        }
+        if (strcmp(value, values1[i])) {
+            errs++;
+            printf("Incorrect value for key %s\n", keys1[i]);
+        }
     }
-    MPI_Info_free( &info );
+    MPI_Info_free(&info);
 
     /* 1,3,2 */
-    MPI_Info_create( &info );
+    MPI_Info_create(&info);
     /* Use only named keys incase the info implementation only supports
-       the predefined keys (e.g., IBM) */
-    MPI_Info_set( info, keys1[0], values1[0] );
-    MPI_Info_set( info, keys1[2], values1[2] );
-    MPI_Info_set( info, keys1[1], values1[1] );
+     * the predefined keys (e.g., IBM) */
+    MPI_Info_set(info, keys1[0], values1[0]);
+    MPI_Info_set(info, keys1[2], values1[2]);
+    MPI_Info_set(info, keys1[1], values1[1]);
 
     /* Check that all values are present */
-    for (i=0; i<NKEYS; i++) {
-       MPI_Info_get( info, keys1[i], MPI_MAX_INFO_VAL, value, &flag );
-       if (!flag) {
-           errs++;
-           printf( "No value for key %s\n", keys1[i] );
-       }
-       if (strcmp( value, values1[i] )) {
-           errs++;
-           printf( "Incorrect value for key %s\n", keys1[i] );
-       }
+    for (i = 0; i < NKEYS; i++) {
+        MPI_Info_get(info, keys1[i], MPI_MAX_INFO_VAL, value, &flag);
+        if (!flag) {
+            errs++;
+            printf("No value for key %s\n", keys1[i]);
+        }
+        if (strcmp(value, values1[i])) {
+            errs++;
+            printf("Incorrect value for key %s\n", keys1[i]);
+        }
     }
-    MPI_Info_free( &info );
+    MPI_Info_free(&info);
 
     /* 2,1,3 */
-    MPI_Info_create( &info );
+    MPI_Info_create(&info);
     /* Use only named keys incase the info implementation only supports
-       the predefined keys (e.g., IBM) */
-    MPI_Info_set( info, keys1[1], values1[1] );
-    MPI_Info_set( info, keys1[0], values1[0] );
-    MPI_Info_set( info, keys1[2], values1[2] );
+     * the predefined keys (e.g., IBM) */
+    MPI_Info_set(info, keys1[1], values1[1]);
+    MPI_Info_set(info, keys1[0], values1[0]);
+    MPI_Info_set(info, keys1[2], values1[2]);
 
     /* Check that all values are present */
-    for (i=0; i<NKEYS; i++) {
-       MPI_Info_get( info, keys1[i], MPI_MAX_INFO_VAL, value, &flag );
-       if (!flag) {
-           errs++;
-           printf( "No value for key %s\n", keys1[i] );
-       }
-       if (strcmp( value, values1[i] )) {
-           errs++;
-           printf( "Incorrect value for key %s\n", keys1[i] );
-       }
+    for (i = 0; i < NKEYS; i++) {
+        MPI_Info_get(info, keys1[i], MPI_MAX_INFO_VAL, value, &flag);
+        if (!flag) {
+            errs++;
+            printf("No value for key %s\n", keys1[i]);
+        }
+        if (strcmp(value, values1[i])) {
+            errs++;
+            printf("Incorrect value for key %s\n", keys1[i]);
+        }
     }
-    MPI_Info_free( &info );
+    MPI_Info_free(&info);
 
     /* 2,3,1 */
-    MPI_Info_create( &info );
+    MPI_Info_create(&info);
     /* Use only named keys incase the info implementation only supports
-       the predefined keys (e.g., IBM) */
-    MPI_Info_set( info, keys1[1], values1[1] );
-    MPI_Info_set( info, keys1[2], values1[2] );
-    MPI_Info_set( info, keys1[0], values1[0] );
+     * the predefined keys (e.g., IBM) */
+    MPI_Info_set(info, keys1[1], values1[1]);
+    MPI_Info_set(info, keys1[2], values1[2]);
+    MPI_Info_set(info, keys1[0], values1[0]);
 
     /* Check that all values are present */
-    for (i=0; i<NKEYS; i++) {
-       MPI_Info_get( info, keys1[i], MPI_MAX_INFO_VAL, value, &flag );
-       if (!flag) {
-           errs++;
-           printf( "No value for key %s\n", keys1[i] );
-       }
-       if (strcmp( value, values1[i] )) {
-           errs++;
-           printf( "Incorrect value for key %s\n", keys1[i] );
-       }
+    for (i = 0; i < NKEYS; i++) {
+        MPI_Info_get(info, keys1[i], MPI_MAX_INFO_VAL, value, &flag);
+        if (!flag) {
+            errs++;
+            printf("No value for key %s\n", keys1[i]);
+        }
+        if (strcmp(value, values1[i])) {
+            errs++;
+            printf("Incorrect value for key %s\n", keys1[i]);
+        }
     }
-    MPI_Info_free( &info );
-    
+    MPI_Info_free(&info);
+
     /* 3,1,2 */
-    MPI_Info_create( &info );
+    MPI_Info_create(&info);
     /* Use only named keys incase the info implementation only supports
-       the predefined keys (e.g., IBM) */
-    MPI_Info_set( info, keys1[2], values1[2] );
-    MPI_Info_set( info, keys1[0], values1[0] );
-    MPI_Info_set( info, keys1[1], values1[1] );
+     * the predefined keys (e.g., IBM) */
+    MPI_Info_set(info, keys1[2], values1[2]);
+    MPI_Info_set(info, keys1[0], values1[0]);
+    MPI_Info_set(info, keys1[1], values1[1]);
 
     /* Check that all values are present */
-    for (i=0; i<NKEYS; i++) {
-       MPI_Info_get( info, keys1[i], MPI_MAX_INFO_VAL, value, &flag );
-       if (!flag) {
-           errs++;
-           printf( "No value for key %s\n", keys1[i] );
-       }
-       if (strcmp( value, values1[i] )) {
-           errs++;
-           printf( "Incorrect value for key %s\n", keys1[i] );
-       }
+    for (i = 0; i < NKEYS; i++) {
+        MPI_Info_get(info, keys1[i], MPI_MAX_INFO_VAL, value, &flag);
+        if (!flag) {
+            errs++;
+            printf("No value for key %s\n", keys1[i]);
+        }
+        if (strcmp(value, values1[i])) {
+            errs++;
+            printf("Incorrect value for key %s\n", keys1[i]);
+        }
     }
-    MPI_Info_free( &info );
-    
-    MTest_Finalize( errs );
+    MPI_Info_free(&info);
+
+    MTest_Finalize(errs);
     MPI_Finalize();
     return 0;
-  
+
 }
index 1ce76ae..4e73caf 100644 (file)
 #include <string.h>
 #endif
 
-int main( int argc, char *argv[] )
+int main(int argc, char *argv[])
 {
     MPI_Info i1, i2;
     int errs = 0;
     char value[64];
     int flag;
 
-    MPI_Init( &argc, &argv );
-    
-    MPI_Info_create( &i1 );
-    MPI_Info_create( &i2 );
+    MPI_Init(&argc, &argv);
 
-    MPI_Info_set( i1, (char*)"key1", (char*)"value1" );
-    MPI_Info_set( i2, (char*)"key2", (char*)"value2" );
+    MPI_Info_create(&i1);
+    MPI_Info_create(&i2);
 
-    MPI_Info_get( i1, (char*)"key2", 64, value, &flag );
+    MPI_Info_set(i1, (char *) "key1", (char *) "value1");
+    MPI_Info_set(i2, (char *) "key2", (char *) "value2");
+
+    MPI_Info_get(i1, (char *) "key2", 64, value, &flag);
     if (flag) {
-       printf( "Found key2 in info1\n" );
-       errs ++;
+        printf("Found key2 in info1\n");
+        errs++;
     }
-    MPI_Info_get( i1, (char*)"key1", 64, value, &flag );
+    MPI_Info_get(i1, (char *) "key1", 64, value, &flag);
     if (!flag) {
-       errs++;
-       printf( "Did not find key1 in info1\n" );
+        errs++;
+        printf("Did not find key1 in info1\n");
     }
-    else if (strcmp( value, "value1" )) {
-       errs++;
-       printf( "Found wrong value (%s), expected value1\n", value );
+    else if (strcmp(value, "value1")) {
+        errs++;
+        printf("Found wrong value (%s), expected value1\n", value);
     }
 
-    MPI_Info_free( &i1 );
-    MPI_Info_free( &i2 );
+    MPI_Info_free(&i1);
+    MPI_Info_free(&i2);
     if (errs) {
-       printf( " Found %d errors\n", errs );
+        printf(" Found %d errors\n", errs);
     }
     else {
-       printf( " No Errors\n" );
+        printf(" No Errors\n");
     }
-    MPI_Finalize( );
+    MPI_Finalize();
     return 0;
 }
index fdce0e3..22fbfe5 100644 (file)
 #include "mpitest.h"
 
 #define NKEYS 3
-int main( int argc, char *argv[] )
+int main(int argc, char *argv[])
 {
     int errs = 0;
     MPI_Info info;
-    char *keys[NKEYS] = { (char*)"file", (char*)"soft", (char*)"host" };
-    char *values[NKEYS] = { (char*)"runfile.txt", (char*)"2:1000:4,3:1000:7", 
-                           (char*)"myhost.myorg.org" };
+    char *keys[NKEYS] = { (char *) "file", (char *) "soft", (char *) "host" };
+    char *values[NKEYS] = { (char *) "runfile.txt", (char *) "2:1000:4,3:1000:7",
+        (char *) "myhost.myorg.org"
+    };
     char value[MPI_MAX_INFO_VAL];
     int i, flag, vallen;
 
-    MTest_Init( &argc, &argv );
+    MTest_Init(&argc, &argv);
 
-    MPI_Info_create( &info );
+    MPI_Info_create(&info);
     /* Use only named keys incase the info implementation only supports
-       the predefined keys (e.g., IBM) */
-    for (i=0; i<NKEYS; i++) {
-       MPI_Info_set( info, keys[i], values[i] );
+     * the predefined keys (e.g., IBM) */
+    for (i = 0; i < NKEYS; i++) {
+        MPI_Info_set(info, keys[i], values[i]);
     }
 
     /* Check that all values are present */
-    for (i=0; i<NKEYS; i++) {
-       MPI_Info_get_valuelen( info, keys[i], &vallen, &flag );
-       if (!flag) {
-           errs++;
-           printf( "get_valuelen failed for valid key %s\n", keys[i] );
-       }
-       MPI_Info_get( info, keys[i], MPI_MAX_INFO_VAL, value, &flag );
-       if (!flag) {
-           errs++;
-           printf( "No value for key %s\n", keys[i] );
-       }
-       if (strcmp( value, values[i] )) {
-           errs++;
-           printf( "Incorrect value for key %s\n", keys[i] );
-       }
-       if (strlen(value) != vallen) {
-           errs++;
-           printf( "value_len returned %d but actual len is %d\n", 
-                   vallen, (int) strlen(value) );
-       }
+    for (i = 0; i < NKEYS; i++) {
+        MPI_Info_get_valuelen(info, keys[i], &vallen, &flag);
+        if (!flag) {
+            errs++;
+            printf("get_valuelen failed for valid key %s\n", keys[i]);
+        }
+        MPI_Info_get(info, keys[i], MPI_MAX_INFO_VAL, value, &flag);
+        if (!flag) {
+            errs++;
+            printf("No value for key %s\n", keys[i]);
+        }
+        if (strcmp(value, values[i])) {
+            errs++;
+            printf("Incorrect value for key %s\n", keys[i]);
+        }
+        if (strlen(value) != vallen) {
+            errs++;
+            printf("value_len returned %d but actual len is %d\n", vallen, (int) strlen(value));
+        }
     }
 
-    MPI_Info_free( &info );
-    
-    MTest_Finalize( errs );
+    MPI_Info_free(&info);
+
+    MTest_Finalize(errs);
     MPI_Finalize();
     return 0;
-  
+
 }
index 3ecf7f7..070868d 100644 (file)
@@ -5,5 +5,6 @@ infoorder 1
 #need a really working mpi_info_get_nthkey..
 #infomany 1
 #infomany2 1
+infoget 1
 infotest 1
 infoenv 1 mpiversion=3.0