1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
4 * (C) 2003 by Argonne National Laboratory.
5 * See COPYRIGHT in top-level directory.
11 #include "mpitestconf.h"
17 int main(int argc, char *argv[])
21 char *keys[NKEYS] = { (char *) "file", (char *) "soft", (char *) "host" };
22 char *values[NKEYS] = { (char *) "runfile.txt", (char *) "2:1000:4,3:1000:7",
23 (char *) "myhost.myorg.org"
25 char value[MPI_MAX_INFO_VAL];
28 MTest_Init(&argc, &argv);
30 MPI_Info_create(&info);
31 /* Use only named keys incase the info implementation only supports
32 * the predefined keys (e.g., IBM) */
33 for (i = 0; i < NKEYS; i++) {
34 MPI_Info_set(info, keys[i], values[i]);
37 /* Check that all values are present */
38 for (i = 0; i < NKEYS; i++) {
39 MPI_Info_get(info, keys[i], MPI_MAX_INFO_VAL, value, &flag);
42 printf("No value for key %s\n", keys[i]);
44 if (strcmp(value, values[i])) {
46 printf("Incorrect value for key %s, got %s expected %s\n", keys[i], value, values[i]);
50 /* Now, change one value and remove another, then check again */
51 MPI_Info_delete(info, keys[NKEYS - 1]);
52 MPI_Info_get_nkeys(info, &nkeys);
53 if (nkeys != NKEYS - 1) {
55 printf("Deleting a key did not change the number of keys\n");
58 values[0] = (char *) "backfile.txt";
59 MPI_Info_set(info, keys[0], values[0]);
60 for (i = 0; i < NKEYS - 1; i++) {
61 MPI_Info_get(info, keys[i], MPI_MAX_INFO_VAL, value, &flag);
64 printf("(after reset) No value for key %s\n", keys[i]);
66 if (strcmp(value, values[i])) {
68 printf("(after reset) Incorrect value for key %s, got %s expected %s\n",
69 keys[i], value, values[i]);
74 if (info != MPI_INFO_NULL) {
76 printf("MPI_Info_free should set info to MPI_INFO_NULL\n");