Skip to content

Commit

Permalink
Modifications based on PR review comments: verify the key and value r…
Browse files Browse the repository at this point in the history
…etrieved

are same as what is set before.
  • Loading branch information
vchoi-hdfgroup committed Oct 24, 2023
1 parent 7964b98 commit 6bf3647
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion testpar/t_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -1131,8 +1131,16 @@ test_fapl_preserve_hints(void)
hid_t fid = H5I_INVALID_HID; /* HDF5 file ID */
hid_t fapl_id = H5I_INVALID_HID; /* File access plist */
const char *filename;

MPI_Info info = MPI_INFO_NULL;
const char *key = "hdf_info_fapl";
const char *value = "xyz";

MPI_Info info_used = MPI_INFO_NULL;
int flag = -1;
char value_used[20];
char key_used[20];

herr_t ret; /* Generic return value */
int mpi_ret; /* MPI return value */

Expand All @@ -1142,7 +1150,7 @@ test_fapl_preserve_hints(void)
mpi_ret = MPI_Info_create(&info);
VRFY((mpi_ret >= 0), "MPI_Info_create succeeded");

mpi_ret = MPI_Info_set(info, "hdf_info_fapl", "true");
mpi_ret = MPI_Info_set(info, key, value);
VRFY((mpi_ret == MPI_SUCCESS), "MPI_Info_set succeeded");

fapl_id = H5Pcreate(H5P_FILE_ACCESS);
Expand All @@ -1165,6 +1173,21 @@ test_fapl_preserve_hints(void)

VRFY((info_used != MPI_INFO_NULL), "H5Pget_fapl_mpio");

memset(key_used, 0, 20);
memset(value_used, 0, 20);

mpi_ret = MPI_Info_get_nthkey(info_used, 0, key_used);
VRFY((mpi_ret == MPI_SUCCESS), "MPI_Info_get_nthkey succeeded");

mpi_ret = MPI_Info_get(info_used, key_used, 20, value_used, &flag);
VRFY((mpi_ret == MPI_SUCCESS), "MPI_Info_get succeeded");

ret = strcmp(key_used, key);
VRFY(ret == 0, "strcmp key");

ret = strcmp(value_used, value);
VRFY(ret == 0, "strcmp value");

ret = H5Pclose(fapl_id);
VRFY((ret >= 0), "H5Pclose succeeded");

Expand Down

0 comments on commit 6bf3647

Please sign in to comment.