diff options
author | kmu <kmu@hdfgroup.org> | 2020-01-23 03:30:36 (GMT) |
---|---|---|
committer | kmu <kmu@hdfgroup.org> | 2020-01-23 03:30:36 (GMT) |
commit | 2de0ce0d8ba2fb58fadefc5d718a3c0fedab25c8 (patch) | |
tree | 795739e979593ab3b0d0d3b4a6124c1f7049ab50 /examples | |
parent | 408b9b1f3b8e84ba090c51e665d38eedef32c7ee (diff) | |
parent | d7414053638316081f11fad78474b2c3cde336c5 (diff) | |
download | hdf5-2de0ce0d8ba2fb58fadefc5d718a3c0fedab25c8.zip hdf5-2de0ce0d8ba2fb58fadefc5d718a3c0fedab25c8.tar.gz hdf5-2de0ce0d8ba2fb58fadefc5d718a3c0fedab25c8.tar.bz2 |
merge and fix conflict
Diffstat (limited to 'examples')
-rw-r--r-- | examples/CMakeLists.txt | 2 | ||||
-rw-r--r-- | examples/CMakeTests.cmake | 60 | ||||
-rw-r--r-- | examples/h5_attribute.c | 4 | ||||
-rw-r--r-- | examples/h5_extlink.c | 48 | ||||
-rw-r--r-- | examples/h5_group.c | 14 | ||||
-rw-r--r-- | examples/testh5cc.sh.in | 5 |
6 files changed, 67 insertions, 66 deletions
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 9f42f95..89cafc8 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -67,6 +67,6 @@ if (H5_HAVE_PARALLEL) set_target_properties (ph5example PROPERTIES FOLDER examples) endif () -if (BUILD_TESTING) +if (BUILD_TESTING AND HDF5_TEST_EXAMPLES) include (CMakeTests.cmake) endif () diff --git a/examples/CMakeTests.cmake b/examples/CMakeTests.cmake index ea3b2c5..fd7f1dc 100644 --- a/examples/CMakeTests.cmake +++ b/examples/CMakeTests.cmake @@ -64,38 +64,40 @@ set (test_ex_CLEANFILES vds-eiger.h5 ) -# Remove any output file left over from previous test run -add_test ( - NAME EXAMPLES-clear-objects - COMMAND ${CMAKE_COMMAND} -E remove ${test_ex_CLEANFILES} -) -set_tests_properties (EXAMPLES-clear-objects PROPERTIES FIXTURES_SETUP clear_EXAMPLES) +if (HDF5_TEST_SERIAL) + # Remove any output file left over from previous test run + add_test ( + NAME EXAMPLES-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove ${test_ex_CLEANFILES} + ) + set_tests_properties (EXAMPLES-clear-objects PROPERTIES FIXTURES_SETUP clear_EXAMPLES) -foreach (example ${examples}) - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME EXAMPLES-${example} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:${example}>) - else () - add_test (NAME EXAMPLES-${example} COMMAND "${CMAKE_COMMAND}" - -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$<TARGET_FILE:${example}>" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=${example}.txt" - #-D "TEST_REFERENCE=${example}.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - endif () - set_tests_properties (EXAMPLES-${example} PROPERTIES FIXTURES_REQUIRED clear_EXAMPLES) - if (last_test) - set_tests_properties (EXAMPLES-${example} PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "EXAMPLES-${example}") -endforeach () + foreach (example ${examples}) + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME EXAMPLES-${example} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:${example}>) + else () + add_test (NAME EXAMPLES-${example} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" + -D "TEST_PROGRAM=$<TARGET_FILE:${example}>" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=${example}.txt" + #-D "TEST_REFERENCE=${example}.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + endif () + set_tests_properties (EXAMPLES-${example} PROPERTIES FIXTURES_REQUIRED clear_EXAMPLES) + if (last_test) + set_tests_properties (EXAMPLES-${example} PROPERTIES DEPENDS ${last_test}) + endif () + set (last_test "EXAMPLES-${example}") + endforeach () +endif () ### Windows pops up a modal permission dialog on this test -if (H5_HAVE_PARALLEL AND NOT WIN32) +if (H5_HAVE_PARALLEL AND HDF5_TEST_PARALLEL AND NOT WIN32) if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME MPI_TEST_EXAMPLES-ph5example COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:ph5example> ${MPIEXEC_POSTFLAGS}) else () diff --git a/examples/h5_attribute.c b/examples/h5_attribute.c index e3b5759..0e275c7 100644 --- a/examples/h5_attribute.c +++ b/examples/h5_attribute.c @@ -60,7 +60,7 @@ main (void) float matrix[ADIM1][ADIM2]; /* Attribute data */ herr_t ret; /* Return value */ - H5O_info_t oinfo; /* Object info */ + H5O_info2_t oinfo; /* Object info */ unsigned i, j; /* Counters */ char string_out[80]; /* Buffer to read string attribute back */ int point_out; /* Buffer to read scalar attribute back */ @@ -189,7 +189,7 @@ main (void) /* * Find string attribute by iterating through all attributes */ - ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_ALL); + ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS); for(i = 0; i < (unsigned)oinfo.num_attrs; i++) { attr = H5Aopen_by_idx(dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)i, H5P_DEFAULT, H5P_DEFAULT); atype = H5Aget_type(attr); diff --git a/examples/h5_extlink.c b/examples/h5_extlink.c index 229e465..fea1fa2 100644 --- a/examples/h5_extlink.c +++ b/examples/h5_extlink.c @@ -316,7 +316,7 @@ static void hard_link_example(void) { hid_t file_id; hid_t group_id; - H5L_info_t li; + H5L_info2_t li; /* Define the link class that we'll use to register "user-defined hard * links" using the callbacks we defined above. * A link class can have NULL for any callback except its traverse @@ -361,13 +361,13 @@ static void hard_link_example(void) * the target group's address. We do this by calling H5Lget_info * on a hard link to the object. */ - H5Lget_info(file_id, TARGET_GROUP, &li, H5P_DEFAULT); + H5Lget_info2(file_id, TARGET_GROUP, &li, H5P_DEFAULT); /* Now create a user-defined link. We give it the group's address * as its udata. */ - H5Lcreate_ud(file_id, UD_HARD_LINK_NAME, (H5L_type_t)UD_HARD_CLASS, &(li.u.address), - sizeof(li.u.address), H5P_DEFAULT, H5P_DEFAULT); + H5Lcreate_ud(file_id, UD_HARD_LINK_NAME, (H5L_type_t)UD_HARD_CLASS, &(li.u.token), + sizeof(H5O_token_t), H5P_DEFAULT, H5P_DEFAULT); /* The UD hard link has now incremented the group's reference count * like a normal hard link would. This means that we can unlink the @@ -404,23 +404,23 @@ static void hard_link_example(void) static herr_t UD_hard_create(const char *link_name, hid_t loc_group, const void *udata, size_t udata_size, hid_t lcpl_id) { - haddr_t addr; - hid_t target_obj = -1; + H5O_token_t token; + hid_t target_obj = H5I_INVALID_HID; herr_t ret_value = 0; /* Make sure that the address passed in looks valid */ - if(udata_size != sizeof(haddr_t)) + if(udata_size != sizeof(H5O_token_t)) { ret_value = -1; goto done; } - addr = *((const haddr_t *) udata); + token = *((H5O_token_t *) udata); /* Open the object this link points to so that we can increment - * its reference count. This also ensures that the address passed + * its reference count. This also ensures that the token passed * in points to a real object (although this check is not perfect!) */ - target_obj= H5Oopen_by_addr(loc_group, addr); + target_obj = H5Oopen_by_token(loc_group, token); if(target_obj < 0) { ret_value = -1; @@ -448,23 +448,23 @@ done: static herr_t UD_hard_delete(const char *link_name, hid_t loc_group, const void *udata, size_t udata_size) { - haddr_t addr; - hid_t target_obj = -1; + H5O_token_t token; + hid_t target_obj = H5I_INVALID_HID; herr_t ret_value = 0; /* Sanity check; we have already verified the udata's size in the creation * callback. */ - if(udata_size != sizeof(haddr_t)) + if(udata_size != sizeof(H5O_token_t)) { ret_value = -1; goto done; } - addr = *((const haddr_t *) udata); + token = *((H5O_token_t *) udata); /* Open the object this link points to */ - target_obj= H5Oopen_by_addr(loc_group, addr); + target_obj = H5Oopen_by_token(loc_group, token); if(target_obj < 0) { ret_value = -1; @@ -492,21 +492,21 @@ done: static hid_t UD_hard_traverse(const char *link_name, hid_t cur_group, const void *udata, size_t udata_size, hid_t lapl_id, hid_t dxpl_id) { - haddr_t addr; - hid_t ret_value = -1; + H5O_token_t token; + hid_t ret_value = H5I_INVALID_HID; /* Sanity check; we have already verified the udata's size in the creation * callback. */ - if(udata_size != sizeof(haddr_t)) - return -1; + if(udata_size != sizeof(H5O_token_t)) + return H5I_INVALID_HID; - addr = *((const haddr_t *) udata); + token = *((H5O_token_t *) udata); - /* Open the object by address. If H5Oopen_by_addr fails, ret_value will + /* Open the object by token. If H5Oopen_by_token fails, ret_value will * be negative to indicate that the traversal function failed. */ - ret_value = H5Oopen_by_addr(cur_group, addr); + ret_value = H5Oopen_by_token(cur_group, token); return ret_value; } @@ -621,7 +621,7 @@ static hid_t UD_plist_traverse(const char *link_name, hid_t cur_group, const void *udata, size_t udata_size, hid_t lapl_id, hid_t dxpl_id) { char * path; - hid_t ret_value = -1; + hid_t ret_value = H5I_INVALID_HID; /* If the link property isn't set or can't be found, traversal fails. */ if(H5Pexist(lapl_id, PLIST_LINK_PROP) < 0) @@ -638,7 +638,7 @@ static hid_t UD_plist_traverse(const char *link_name, hid_t cur_group, return ret_value; error: - return -1; + return H5I_INVALID_HID; } diff --git a/examples/h5_group.c b/examples/h5_group.c index 8e89165..75bed91 100644 --- a/examples/h5_group.c +++ b/examples/h5_group.c @@ -26,9 +26,9 @@ #define H5FILE_NAME "group.h5" #define RANK 2 -static herr_t file_info(hid_t loc_id, const char *name, const H5L_info_t *linfo, +static herr_t file_info(hid_t loc_id, const char *name, const H5L_info2_t *linfo, void *opdata); /* Link iteration operator function */ -static herr_t group_info(hid_t loc_id, const char *name, const H5L_info_t *linfo, +static herr_t group_info(hid_t loc_id, const char *name, const H5L_info2_t *linfo, void *opdata); /* Link iteration operator function */ int main(void) @@ -135,7 +135,7 @@ main(void) /* * Use iterator to see the names of the objects in the root group. */ - idx_f = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, NULL, file_info, NULL); + idx_f = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, NULL, file_info, NULL); /* * Unlink name "Data" and use iterator to see the names @@ -146,13 +146,13 @@ main(void) else printf("\"Data\" is unlinked \n"); - idx_f = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, NULL, file_info, NULL); + idx_f = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, NULL, file_info, NULL); /* * Use iterator to see the names of the objects in the group * /Data_new. */ - idx_g = H5Literate_by_name(grp, "/Data_new", H5_INDEX_NAME, H5_ITER_INC, NULL, group_info, NULL, H5P_DEFAULT); + idx_g = H5Literate_by_name2(grp, "/Data_new", H5_INDEX_NAME, H5_ITER_INC, NULL, group_info, NULL, H5P_DEFAULT); /* * Close the file. @@ -168,7 +168,7 @@ main(void) * Operator function. */ static herr_t -file_info(hid_t loc_id, const char *name, const H5L_info_t *linfo, void *opdata) +file_info(hid_t loc_id, const char *name, const H5L_info2_t *linfo, void *opdata) { /* avoid compiler warnings */ loc_id = loc_id; @@ -189,7 +189,7 @@ file_info(hid_t loc_id, const char *name, const H5L_info_t *linfo, void *opdata) * Operator function. */ static herr_t -group_info(hid_t loc_id, const char *name, const H5L_info_t *linfo, void *opdata) +group_info(hid_t loc_id, const char *name, const H5L_info2_t *linfo, void *opdata) { hid_t did; /* dataset identifier */ hid_t tid; /* datatype identifier */ diff --git a/examples/testh5cc.sh.in b/examples/testh5cc.sh.in index 800d4d4..40ca466 100644 --- a/examples/testh5cc.sh.in +++ b/examples/testh5cc.sh.in @@ -308,8 +308,8 @@ echo "***"Version compatibility tests. # If H5_NO_DEPRECATED_SYMBOLS; # then only v18main works. # else if H5_USE_16_API_DEFAULT; -# then v16main works and -DH5_NO_DEPRECATED_SYMBOLS v18main also works. -# else v18main works and -DH5_USE_16_API_DEFAULT v16main also works. +# then v16main works. +# else v18main works and -DH5_USE_16_API_DEFAULT v16main also works. # if [ -n "$H5_USE_16_API_DEFAULT" ]; then echo "H5_USE_16_API_DEFAULT is defined." @@ -326,7 +326,6 @@ if [ -n "$H5_NO_DEPRECATED_SYMBOLS" ]; then TOOLTEST $v18main elif [ -n "$H5_USE_16_API_DEFAULT" ]; then TOOLTEST $v16main - TOOLTEST -DH5_NO_DEPRECATED_SYMBOLS $v18main else TOOLTEST -DH5_USE_16_API_DEFAULT $v16main TOOLTEST $v18main |