diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/CMakeLists.txt | 26 | ||||
-rw-r--r-- | test/CMakeTests.cmake | 1 | ||||
-rw-r--r-- | test/Makefile.am | 5 | ||||
-rw-r--r-- | test/accum.c | 2 | ||||
-rw-r--r-- | test/btree2.c | 287 | ||||
-rw-r--r-- | test/cache_common.h | 3 | ||||
-rw-r--r-- | test/cache_tagging.c | 54 | ||||
-rw-r--r-- | test/chunk_info.c | 2 | ||||
-rw-r--r-- | test/cmpd_dtransform.c | 146 | ||||
-rw-r--r-- | test/dsets.c | 8 | ||||
-rw-r--r-- | test/error_test.c | 109 | ||||
-rw-r--r-- | test/event_set.c | 132 | ||||
-rw-r--r-- | test/fheap.c | 53 | ||||
-rw-r--r-- | test/h5test.c | 2 | ||||
-rw-r--r-- | test/hdfs.c | 3 | ||||
-rw-r--r-- | test/links.c | 10 | ||||
-rw-r--r-- | test/s3comms.c | 2 | ||||
-rw-r--r-- | test/swmr_generator.c | 2 | ||||
-rw-r--r-- | test/swmr_sparse_writer.c | 4 | ||||
-rw-r--r-- | test/tattr.c | 8 | ||||
-rw-r--r-- | test/testfiles/err_compat_1 | 49 | ||||
-rw-r--r-- | test/testfiles/error_test_1 | 31 | ||||
-rw-r--r-- | test/th5o.c | 4 | ||||
-rw-r--r-- | test/th5s.c | 4 | ||||
-rw-r--r-- | test/tid.c | 540 | ||||
-rw-r--r-- | test/tmisc.c | 42 | ||||
-rw-r--r-- | test/tsohm.c | 8 | ||||
-rw-r--r-- | test/ttsafe_error.c | 25 | ||||
-rw-r--r-- | test/use_disable_mdc_flushes.c | 6 | ||||
-rw-r--r-- | test/vfd.c | 12 | ||||
-rw-r--r-- | test/vol.c | 19 |
31 files changed, 1313 insertions, 286 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 697ce8d..dbc7e55 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -260,6 +260,10 @@ set (ttsafe_SOURCES ${HDF5_TEST_SOURCE_DIR}/ttsafe_attr_vlen.c ) +set (event_set_SOURCES + ${HDF5_TEST_SOURCE_DIR}/event_set.c +) + set (H5_TESTS testhdf5 # multiple source cache @@ -333,6 +337,7 @@ set (H5_TESTS vol timer cmpd_dtransform + event_set # multiple source ) macro (ADD_H5_EXE file) @@ -364,6 +369,7 @@ set (H5_TESTS_MULTIPLE ttsafe thread_id # special link mirror_vfd + event_set ) # Only build single source tests here foreach (h5_test ${H5_TESTS}) @@ -527,6 +533,26 @@ if (HDF5_ENABLE_FORMATTERS) clang_format (HDF5_TEST_mirror_vfd_FORMAT mirror_vfd) endif () +#-- Adding test for event_set +add_executable (event_set ${event_set_SOURCES}) +target_compile_options(event_set PRIVATE "${HDF5_CMAKE_C_FLAGS}") +target_include_directories (event_set PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") +if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (event_set STATIC) + target_link_libraries (event_set PRIVATE ${HDF5_TEST_LIB_TARGET}) +else () + TARGET_C_PROPERTIES (event_set SHARED) + target_link_libraries (event_set PRIVATE ${HDF5_TEST_LIBSH_TARGET}) +endif () +set_target_properties (event_set PROPERTIES FOLDER test) + +#----------------------------------------------------------------------------- +# Add Target to clang-format +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TEST_event_set_FORMAT event_set) +endif () + ############################################################################## ### A D D I T I O N A L T E S T S ### ############################################################################## diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index 013189c..b7f3e80 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -409,6 +409,7 @@ set (test_CLEANFILES splitter.log mirror_rw/* mirror_wo/* + event_set_*.h5 ) # Remove any output file left over from previous test run diff --git a/test/Makefile.am b/test/Makefile.am index 6bc340a..2301a7a 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -66,7 +66,7 @@ TEST_PROG= testhdf5 \ flush1 flush2 app_ref enum set_extent ttsafe enc_dec_plist \ enc_dec_plist_cross_platform getname vfd ros3 s3comms hdfs ntypes \ dangle dtransform reserved cross_read freespace mf vds file_image \ - unregister cache_logging cork swmr thread_id vol timer + unregister cache_logging cork swmr thread_id vol timer event_set # List programs to be built when testing here. # error_test and err_compat are built at the same time as the other tests, but executed by testerror.sh. @@ -150,6 +150,7 @@ ttsafe_SOURCES=ttsafe.c ttsafe_dcreate.c ttsafe_error.c ttsafe_cancel.c \ ttsafe_acreate.c ttsafe_attr_vlen.c cache_image_SOURCES=cache_image.c genall5.c mirror_vfd_SOURCES=mirror_vfd.c genall5.c +event_set_SOURCES=event_set.c # Additional target for running timing test timings _timings: testmeta @@ -211,7 +212,7 @@ CHECK_CLEANFILES+=accum.h5 cmpd_dset.h5 compact_dataset.h5 dataset.h5 dset_offse test_swmr*.h5 cache_logging.h5 cache_logging.out vds_swmr.h5 vds_swmr_src_*.h5 \ swmr[0-2].h5 swmr_writer.out swmr_writer.log.* swmr_reader.out.* swmr_reader.log.* \ tbogus.h5.copy cache_image_test.h5 direct_chunk.h5 native_vol_test.h5 \ - splitter*.h5 splitter.log mirror_rw mirror_ro + splitter*.h5 splitter.log mirror_rw mirror_ro event_set_[0-9].h5 # Sources for testhdf5 executable testhdf5_SOURCES=testhdf5.c tarray.c tattr.c tchecksum.c tconfig.c tfile.c \ diff --git a/test/accum.c b/test/accum.c index 7561cd0..b1e4baa 100644 --- a/test/accum.c +++ b/test/accum.c @@ -2100,7 +2100,7 @@ test_swmr_write_big(hbool_t newest_format) uint8_t wbuf[1024]; /* Buffer for reading & writing */ unsigned u; /* Local index variable */ #ifdef H5_HAVE_UNISTD_H - pid_t pid; /* Process ID */ + pid_t pid; /* Process ID */ #endif /* H5_HAVE_UNISTD_H */ int status; /* Status returned from child process */ char * driver = NULL; /* VFD string (from env variable) */ diff --git a/test/btree2.c b/test/btree2.c index 613d8d5..21b821b 100644 --- a/test/btree2.c +++ b/test/btree2.c @@ -631,6 +631,7 @@ test_insert_basic(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ hsize_t idx; /* Index within B-tree, for iterator */ + hbool_t found; /* Whether record was found */ herr_t ret; /* Generic error return value */ /* @@ -666,8 +667,11 @@ test_insert_basic(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_ TEST_ERROR /* Attempt to find record in B-tree with no records */ - idx = 0; - if (H5B2_find(bt2, &idx, find_cb, NULL) != FALSE) + idx = 0; + found = FALSE; + if (H5B2_find(bt2, &idx, &found, find_cb, NULL) < 0) + TEST_ERROR + if (found) TEST_ERROR /* Attempt to index record in B-tree with no records */ @@ -695,22 +699,34 @@ test_insert_basic(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_ /* Attempt to find non-existant record in B-tree with 1 record */ /* (Should not be found, but not fail) */ - idx = 41; - if (H5B2_find(bt2, &idx, find_cb, &idx) != FALSE) + idx = 41; + found = FALSE; + if (H5B2_find(bt2, &idx, &found, find_cb, &idx) < 0) + TEST_ERROR + if (found) TEST_ERROR /* Try again with NULL 'op' */ /* (Should not be found, but not fail) */ - if (H5B2_find(bt2, &idx, NULL, NULL) != FALSE) + found = FALSE; + if (H5B2_find(bt2, &idx, &found, NULL, NULL) < 0) + TEST_ERROR + if (found) TEST_ERROR /* Attempt to find existant record in B-tree with 1 record */ - idx = 42; - if (H5B2_find(bt2, &idx, find_cb, &idx) != TRUE) + idx = 42; + found = FALSE; + if (H5B2_find(bt2, &idx, &found, find_cb, &idx) < 0) + TEST_ERROR + if (!found) TEST_ERROR /* Try again with NULL 'op' */ - if (H5B2_find(bt2, &idx, NULL, NULL) != TRUE) + found = FALSE; + if (H5B2_find(bt2, &idx, &found, NULL, NULL) < 0) + TEST_ERROR + if (!found) TEST_ERROR /* Attempt to index non-existant record in B-tree with 1 record */ @@ -760,13 +776,19 @@ test_insert_basic(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_ /* Attempt to find non-existant record in level-0 B-tree with several records */ /* (Should not be found, but not fail) */ - idx = 41; - if (H5B2_find(bt2, &idx, find_cb, &idx) != FALSE) + idx = 41; + found = FALSE; + if (H5B2_find(bt2, &idx, &found, find_cb, &idx) < 0) + TEST_ERROR + if (found) TEST_ERROR /* Attempt to find existant record in level-0 B-tree with several record */ - idx = 56; - if (H5B2_find(bt2, &idx, find_cb, &idx) != TRUE) + idx = 56; + found = FALSE; + if (H5B2_find(bt2, &idx, &found, find_cb, &idx) < 0) + TEST_ERROR + if (!found) TEST_ERROR /* Attempt to index non-existant record in B-tree with several records */ @@ -843,6 +865,7 @@ test_insert_split_root(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_p hsize_t idx; /* Index within B-tree, for iterator */ H5B2_stat_t bt2_stat; /* Statistics about B-tree created */ unsigned u; /* Local index variable */ + hbool_t found; /* Whether record was found */ herr_t ret; /* Generic error return value */ /* @@ -928,19 +951,28 @@ test_insert_split_root(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_p /* Attempt to find non-existant record in level-1 B-tree */ /* (Should not be found, but not fail) */ - idx = INSERT_SPLIT_ROOT_NREC + 10; - if (H5B2_find(bt2, &idx, find_cb, &idx) != FALSE) + idx = INSERT_SPLIT_ROOT_NREC + 10; + found = FALSE; + if (H5B2_find(bt2, &idx, &found, find_cb, &idx) < 0) + TEST_ERROR + if (found) TEST_ERROR /* Attempt to find existant record in root of level-1 B-tree */ - idx = 33; - if (H5B2_find(bt2, &idx, find_cb, &idx) != TRUE) + idx = 33; + found = FALSE; + if (H5B2_find(bt2, &idx, &found, find_cb, &idx) < 0) FAIL_STACK_ERROR + if (!found) + TEST_ERROR /* Attempt to find existant record in leaf of level-1 B-tree */ - idx = 56; - if (H5B2_find(bt2, &idx, find_cb, &idx) != TRUE) + idx = 56; + found = FALSE; + if (H5B2_find(bt2, &idx, &found, find_cb, &idx) < 0) FAIL_STACK_ERROR + if (!found) + TEST_ERROR /* Attempt to index non-existant record in level-1 B-tree */ idx = 0; @@ -1593,6 +1625,7 @@ test_insert_make_level2(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_ H5B2_stat_t bt2_stat; /* Statistics about B-tree created */ hsize_t idx; /* Index within B-tree, for iterator */ unsigned u; /* Local index variable */ + hbool_t found; /* Whether record was found */ herr_t ret; /* Generic error return value */ /* @@ -1664,14 +1697,20 @@ test_insert_make_level2(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_ /* Attempt to find non-existant record in level-2 B-tree */ /* (Should not be found, but not fail) */ - idx = INSERT_SPLIT_ROOT_NREC * 30; - if (H5B2_find(bt2, &idx, find_cb, &idx) != FALSE) + idx = INSERT_SPLIT_ROOT_NREC * 30; + found = FALSE; + if (H5B2_find(bt2, &idx, &found, find_cb, &idx) < 0) + TEST_ERROR + if (found) TEST_ERROR /* Attempt to find existant record in root of level-2 B-tree */ - idx = 948; - if (H5B2_find(bt2, &idx, find_cb, &idx) != TRUE) + idx = 948; + found = FALSE; + if (H5B2_find(bt2, &idx, &found, find_cb, &idx) < 0) FAIL_STACK_ERROR + if (!found) + TEST_ERROR /* Check with B-tree */ record = 948; @@ -1679,9 +1718,12 @@ test_insert_make_level2(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_ TEST_ERROR /* Attempt to find existant record in internal node of level-2 B-tree */ - idx = 505; - if (H5B2_find(bt2, &idx, find_cb, &idx) != TRUE) + idx = 505; + found = FALSE; + if (H5B2_find(bt2, &idx, &found, find_cb, &idx) < 0) FAIL_STACK_ERROR + if (!found) + TEST_ERROR /* Check with B-tree */ record = 505; @@ -1689,9 +1731,12 @@ test_insert_make_level2(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_ TEST_ERROR /* Attempt to find existant record in leaf of level-2 B-tree */ - idx = 555; - if (H5B2_find(bt2, &idx, find_cb, &idx) != TRUE) + idx = 555; + found = FALSE; + if (H5B2_find(bt2, &idx, &found, find_cb, &idx) < 0) FAIL_STACK_ERROR + if (!found) + TEST_ERROR /* Check with B-tree */ record = 555; @@ -2948,6 +2993,7 @@ test_insert_lots(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t hsize_t temp_rec; /* Temporary record */ H5B2_stat_t bt2_stat; /* Statistics about B-tree created */ hsize_t nrec; /* Number of records in B-tree */ + hbool_t found; /* Whether record was found */ herr_t ret; /* Generic error return value */ /* Initialize random number seed */ @@ -3053,8 +3099,11 @@ HDfprintf(stderr,"curr_time=%lu\n",(unsigned long)curr_time); /* Attempt to find non-existant record in level-4 B-tree */ /* (Should not be found, but not fail) */ - idx = INSERT_MANY * 2; - if (H5B2_find(bt2, &idx, find_cb, &idx) != FALSE) + idx = INSERT_MANY * 2; + found = FALSE; + if (H5B2_find(bt2, &idx, &found, find_cb, &idx) < 0) + TEST_ERROR + if (found) TEST_ERROR /* Find random records */ @@ -3063,8 +3112,11 @@ HDfprintf(stderr,"curr_time=%lu\n",(unsigned long)curr_time); idx = (hsize_t)(HDrandom() % INSERT_MANY); /* Attempt to find existant record in root of level-4 B-tree */ - if (H5B2_find(bt2, &idx, find_cb, &idx) != TRUE) + found = FALSE; + if (H5B2_find(bt2, &idx, &found, find_cb, &idx) < 0) FAIL_STACK_ERROR + if (!found) + TEST_ERROR } /* end for */ /* Attempt to index non-existant record in level-4 B-tree, in increasing & decreasing order */ @@ -3168,6 +3220,7 @@ test_update_basic(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_ H5B2_test_rec_t record; /* Record to insert into tree */ H5B2_test_rec_t modify; /* Modified value */ H5B2_test_rec_t find; /* Record to find */ + hbool_t found; /* Whether record was found */ herr_t ret; /* Generic error return value */ /* Create the file for the test */ @@ -3196,31 +3249,43 @@ test_update_basic(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_ /* (Should not be found, but not fail) */ find.key = 10; find.val = (hsize_t)-1; - if (H5B2_find(bt2, &find, find_rec_cb, &find) != FALSE) + found = FALSE; + if (H5B2_find(bt2, &find, &found, find_rec_cb, &find) < 0) FAIL_STACK_ERROR if (find.val != (hsize_t)-1) TEST_ERROR + if (found) + TEST_ERROR /* Try again with NULL 'op' */ /* (Should not be found, but not fail) */ - if (H5B2_find(bt2, &find, NULL, NULL) != FALSE) + found = FALSE; + if (H5B2_find(bt2, &find, &found, NULL, NULL) < 0) FAIL_STACK_ERROR if (find.val != (hsize_t)-1) TEST_ERROR + if (found) + TEST_ERROR /* Attempt to find existant record in B-tree with 1 record */ find.key = 42; - if (H5B2_find(bt2, &find, find_rec_cb, &find) != TRUE) + found = FALSE; + if (H5B2_find(bt2, &find, &found, find_rec_cb, &find) < 0) FAIL_STACK_ERROR if (find.val != 72) TEST_ERROR + if (!found) + TEST_ERROR /* Try again with NULL 'op' */ find.val = (hsize_t)-1; - if (H5B2_find(bt2, &find, NULL, NULL) != TRUE) + found = FALSE; + if (H5B2_find(bt2, &find, &found, NULL, NULL) < 0) FAIL_STACK_ERROR if (find.val != (hsize_t)-1) TEST_ERROR + if (!found) + TEST_ERROR /* Attempt to index non-existant record in B-tree with 1 record */ H5E_BEGIN_TRY { ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)1, index_rec_cb, NULL); } @@ -3258,31 +3323,43 @@ test_update_basic(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_ /* (Should not be found, but not fail) */ find.key = 10; find.val = (hsize_t)-1; - if (H5B2_find(bt2, &find, find_rec_cb, &find) != FALSE) + found = FALSE; + if (H5B2_find(bt2, &find, &found, find_rec_cb, &find) < 0) FAIL_STACK_ERROR if (find.val != (hsize_t)-1) TEST_ERROR + if (found) + TEST_ERROR /* Try again with NULL 'op' */ /* (Should not be found, but not fail) */ - if (H5B2_find(bt2, &find, NULL, NULL) != FALSE) + found = FALSE; + if (H5B2_find(bt2, &find, &found, NULL, NULL) < 0) FAIL_STACK_ERROR if (find.val != (hsize_t)-1) TEST_ERROR + if (found) + TEST_ERROR /* Attempt to find modified record in B-tree with 1 record */ find.key = 42; - if (H5B2_find(bt2, &find, find_rec_cb, &find) != TRUE) + found = FALSE; + if (H5B2_find(bt2, &find, &found, find_rec_cb, &find) < 0) FAIL_STACK_ERROR if (find.val != 43) TEST_ERROR + if (!found) + TEST_ERROR /* Try again with NULL 'op' */ find.val = (hsize_t)-1; - if (H5B2_find(bt2, &find, NULL, NULL) != TRUE) + found = FALSE; + if (H5B2_find(bt2, &find, &found, NULL, NULL) < 0) FAIL_STACK_ERROR if (find.val != (hsize_t)-1) TEST_ERROR + if (!found) + TEST_ERROR /* Attempt to index non-existant record in B-tree with 1 record */ H5E_BEGIN_TRY { ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)1, index_rec_cb, NULL); } @@ -3340,17 +3417,23 @@ test_update_basic(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_ /* (Should not be found, but not fail) */ find.key = 10; find.val = (hsize_t)-1; - if (H5B2_find(bt2, &find, find_rec_cb, &find) != FALSE) + found = FALSE; + if (H5B2_find(bt2, &find, &found, find_rec_cb, &find) < 0) TEST_ERROR if (find.val != (hsize_t)-1) TEST_ERROR + if (found) + TEST_ERROR /* Attempt to find existant record in level-0 B-tree with several records */ find.key = 56; - if (H5B2_find(bt2, &find, find_rec_cb, &find) != TRUE) + found = FALSE; + if (H5B2_find(bt2, &find, &found, find_rec_cb, &find) < 0) TEST_ERROR if (find.val != 12) TEST_ERROR + if (!found) + TEST_ERROR /* Attempt to index non-existant record in B-tree with several records */ H5E_BEGIN_TRY { ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)4, index_rec_cb, NULL); } @@ -3425,17 +3508,23 @@ test_update_basic(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_ /* (Should not be found, but not fail) */ find.key = 41; find.val = (hsize_t)-1; - if (H5B2_find(bt2, &find, find_rec_cb, &find) != FALSE) + found = FALSE; + if (H5B2_find(bt2, &find, &found, find_rec_cb, &find) < 0) TEST_ERROR if (find.val != (hsize_t)-1) TEST_ERROR + if (found) + TEST_ERROR /* Attempt to find existant record in level-0 B-tree with several record */ find.key = 56; - if (H5B2_find(bt2, &find, find_rec_cb, &find) != TRUE) + found = FALSE; + if (H5B2_find(bt2, &find, &found, find_rec_cb, &find) < 0) TEST_ERROR if (find.val != 22) TEST_ERROR + if (!found) + TEST_ERROR /* Attempt to index non-existant record in B-tree with several records */ H5E_BEGIN_TRY { ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)4, index_rec_cb, NULL); } @@ -3532,6 +3621,7 @@ test_update_split_root(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_p H5B2_test_rec_t idx; /* Index within B-tree, for iterator */ H5B2_stat_t bt2_stat; /* Statistics about B-tree created */ unsigned u; /* Local index variable */ + hbool_t found; /* Whether record was found */ herr_t ret; /* Generic error return value */ /* @@ -3666,30 +3756,39 @@ test_update_split_root(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_p /* (Should not be found, but not fail) */ find.key = 800; find.val = (hsize_t)-1; - if (H5B2_find(bt2, &find, find_rec_cb, &find) != FALSE) + found = FALSE; + if (H5B2_find(bt2, &find, &found, find_rec_cb, &find) < 0) TEST_ERROR if (find.val != (hsize_t)-1) TEST_ERROR + if (found) + TEST_ERROR /* Attempt to find existant record in root of level-1 B-tree */ find.key = 33; find.val = (hsize_t)-1; - if (H5B2_find(bt2, &find, find_rec_cb, &find) != TRUE) + found = FALSE; + if (H5B2_find(bt2, &find, &found, find_rec_cb, &find) < 0) FAIL_STACK_ERROR if (find.key != 33) TEST_ERROR if (find.val != 67) TEST_ERROR + if (!found) + TEST_ERROR /* Attempt to find existant record in leaf of level-1 B-tree */ find.key = 56; find.val = (hsize_t)-1; - if (H5B2_find(bt2, &find, find_rec_cb, &find) != TRUE) + found = FALSE; + if (H5B2_find(bt2, &find, &found, find_rec_cb, &find) < 0) FAIL_STACK_ERROR if (find.key != 56) TEST_ERROR if (find.val != 113) TEST_ERROR + if (!found) + TEST_ERROR /* Attempt to index non-existant record in level-1 B-tree */ H5E_BEGIN_TRY @@ -4372,6 +4471,7 @@ test_update_make_level2(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_ H5B2_test_rec_t idx; /* Index within B-tree, for iterator */ H5B2_stat_t bt2_stat; /* Statistics about B-tree created */ unsigned u; /* Local index variable */ + hbool_t found; /* Whether record was found */ herr_t ret; /* Generic error return value */ /* @@ -4452,18 +4552,24 @@ test_update_make_level2(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_ /* (Should not be found, but not fail) */ find.key = INSERT_SPLIT_ROOT_NREC_REC * 42; find.val = (hsize_t)-1; - if (H5B2_find(bt2, &find, find_rec_cb, &find) != FALSE) + found = FALSE; + if (H5B2_find(bt2, &find, &found, find_rec_cb, &find) < 0) TEST_ERROR if (find.val != (hsize_t)-1) TEST_ERROR + if (found) + TEST_ERROR /* Attempt to find existant record in root of level-2 B-tree */ find.key = 1347; find.val = (hsize_t)-1; - if (H5B2_find(bt2, &find, find_rec_cb, &find) != TRUE) + found = FALSE; + if (H5B2_find(bt2, &find, &found, find_rec_cb, &find) < 0) FAIL_STACK_ERROR if (find.val != (1347 * 2)) TEST_ERROR + if (!found) + TEST_ERROR /* Check with B-tree */ record.key = 1347; @@ -4473,10 +4579,13 @@ test_update_make_level2(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_ /* Attempt to find existant record in internal node of level-2 B-tree */ find.key = 513; find.val = (hsize_t)-1; - if (H5B2_find(bt2, &find, find_rec_cb, &find) != TRUE) + found = FALSE; + if (H5B2_find(bt2, &find, &found, find_rec_cb, &find) < 0) FAIL_STACK_ERROR if (find.val != (513 * 2)) TEST_ERROR + if (!found) + TEST_ERROR /* Check with B-tree */ record.key = 513; @@ -4486,10 +4595,13 @@ test_update_make_level2(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_ /* Attempt to find existant record in leaf of level-2 B-tree */ find.key = 555; find.val = (hsize_t)-1; - if (H5B2_find(bt2, &find, find_rec_cb, &find) != TRUE) + found = FALSE; + if (H5B2_find(bt2, &find, &found, find_rec_cb, &find) < 0) FAIL_STACK_ERROR if (find.val != (555 * 2)) TEST_ERROR + if (!found) + TEST_ERROR /* Check with B-tree */ record.key = 555; @@ -4617,18 +4729,24 @@ test_update_make_level2(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_ /* (Should not be found, but not fail) */ find.key = INSERT_SPLIT_ROOT_NREC_REC * 42; find.val = (hsize_t)-1; - if (H5B2_find(bt2, &find, find_rec_cb, &find) != FALSE) + found = FALSE; + if (H5B2_find(bt2, &find, &found, find_rec_cb, &find) < 0) TEST_ERROR if (find.val != (hsize_t)-1) TEST_ERROR + if (found) + TEST_ERROR /* Attempt to find existant record in root of level-2 B-tree */ find.key = 1344; find.val = (hsize_t)-1; - if (H5B2_find(bt2, &find, find_rec_cb, &find) != TRUE) + found = FALSE; + if (H5B2_find(bt2, &find, &found, find_rec_cb, &find) < 0) FAIL_STACK_ERROR if (find.val != (1344 * 2)) TEST_ERROR + if (!found) + TEST_ERROR /* Check with B-tree */ record.key = 1344; @@ -4638,10 +4756,13 @@ test_update_make_level2(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_ /* Attempt to find existant record in internal node of level-2 B-tree */ find.key = 512; find.val = (hsize_t)-1; - if (H5B2_find(bt2, &find, find_rec_cb, &find) != TRUE) + found = FALSE; + if (H5B2_find(bt2, &find, &found, find_rec_cb, &find) < 0) FAIL_STACK_ERROR if (find.val != (512 * 2)) TEST_ERROR + if (!found) + TEST_ERROR /* Check with B-tree */ record.key = 512; @@ -4651,10 +4772,13 @@ test_update_make_level2(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_ /* Attempt to find existant record in leaf of level-2 B-tree */ find.key = 555; find.val = (hsize_t)-1; - if (H5B2_find(bt2, &find, find_rec_cb, &find) != TRUE) + found = FALSE; + if (H5B2_find(bt2, &find, &found, find_rec_cb, &find) < 0) FAIL_STACK_ERROR if (find.val != (555 * 2)) TEST_ERROR + if (!found) + TEST_ERROR /* Check with B-tree */ record.key = 555; @@ -4792,18 +4916,24 @@ test_update_make_level2(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_ /* (Should not be found, but not fail) */ find.key = INSERT_SPLIT_ROOT_NREC_REC * 42; find.val = (hsize_t)-1; - if (H5B2_find(bt2, &find, find_rec_cb, &find) != FALSE) + found = FALSE; + if (H5B2_find(bt2, &find, &found, find_rec_cb, &find) < 0) TEST_ERROR if (find.val != (hsize_t)-1) TEST_ERROR + if (found) + TEST_ERROR /* Attempt to find existant record in root of level-2 B-tree */ find.key = 1345; find.val = (hsize_t)-1; - if (H5B2_find(bt2, &find, find_rec_cb, &find) != TRUE) + found = FALSE; + if (H5B2_find(bt2, &find, &found, find_rec_cb, &find) < 0) FAIL_STACK_ERROR if (find.val != (1345 * 2)) TEST_ERROR + if (!found) + TEST_ERROR /* Check with B-tree */ record.key = 1345; @@ -4813,10 +4943,13 @@ test_update_make_level2(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_ /* Attempt to find existant record in internal node of level-2 B-tree */ find.key = 513; find.val = (hsize_t)-1; - if (H5B2_find(bt2, &find, find_rec_cb, &find) != TRUE) + found = FALSE; + if (H5B2_find(bt2, &find, &found, find_rec_cb, &find) < 0) FAIL_STACK_ERROR if (find.val != (513 * 2)) TEST_ERROR + if (!found) + TEST_ERROR /* Check with B-tree */ record.key = 513; @@ -4826,10 +4959,13 @@ test_update_make_level2(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_ /* Attempt to find existant record in leaf of level-2 B-tree */ find.key = 555; find.val = (hsize_t)-1; - if (H5B2_find(bt2, &find, find_rec_cb, &find) != TRUE) + found = FALSE; + if (H5B2_find(bt2, &find, &found, find_rec_cb, &find) < 0) FAIL_STACK_ERROR if (find.val != (555 * 2)) TEST_ERROR + if (!found) + TEST_ERROR /* Check with B-tree */ record.key = 555; @@ -4930,6 +5066,7 @@ test_update_lots(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t H5B2_stat_t bt2_stat; /* Statistics about B-tree created */ hsize_t nrec; /* Number of records in B-tree */ unsigned u; /* Local index variable */ + hbool_t found; /* Whether record was found */ herr_t ret; /* Generic error return value */ /* Initialize random number seed */ @@ -5025,10 +5162,13 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time); /* (Should not be found, but not fail) */ find.key = INSERT_MANY_REC * 2; find.val = (hsize_t)-1; - if (H5B2_find(bt2, &find, find_rec_cb, &find) != FALSE) + found = FALSE; + if (H5B2_find(bt2, &find, &found, find_rec_cb, &find) < 0) TEST_ERROR if (find.val != (hsize_t)-1) TEST_ERROR + if (found) + TEST_ERROR /* Find random records */ for (u = 0; u < FIND_MANY_REC; u++) { @@ -5037,10 +5177,13 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time); find.val = (hsize_t)-1; /* Attempt to find existant record in level-4 B-tree */ - if (H5B2_find(bt2, &find, find_rec_cb, &find) != TRUE) + found = FALSE; + if (H5B2_find(bt2, &find, &found, find_rec_cb, &find) < 0) FAIL_STACK_ERROR if (find.val != (find.key * 2)) TEST_ERROR + if (!found) + TEST_ERROR } /* end for */ /* Attempt to index non-existant record in level-4 B-tree, in increasing & decreasing order */ @@ -9546,6 +9689,7 @@ test_modify(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tpa H5B2_stat_t bt2_stat; /* Statistics about B-tree created */ H5B2_node_info_test_t ninfo; /* B-tree node info */ unsigned u; /* Local index variable */ + hbool_t rec_found; /* Whether record was found */ herr_t ret; /* Generic error return value */ /* @@ -9612,12 +9756,15 @@ test_modify(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tpa TEST_ERROR /* Attempt to find modified record */ - record = 4331; - found = 4331; - if (H5B2_find(bt2, &record, find_cb, &found) != TRUE) + record = 4331; + found = 4331; + rec_found = FALSE; + if (H5B2_find(bt2, &record, &rec_found, find_cb, &found) < 0) FAIL_STACK_ERROR if (found != 4331) TEST_ERROR + if (!rec_found) + TEST_ERROR /* Attempt to find original record */ record = 4330; @@ -9657,12 +9804,15 @@ test_modify(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tpa TEST_ERROR /* Attempt to find modified record */ - record = 5352; - found = 5352; - if (H5B2_find(bt2, &record, find_cb, &found) != TRUE) + record = 5352; + found = 5352; + rec_found = FALSE; + if (H5B2_find(bt2, &record, &rec_found, find_cb, &found) < 0) STACK_ERROR if (found != 5352) TEST_ERROR + if (!rec_found) + TEST_ERROR /* Attempt to find original record */ record = 5350; @@ -9702,12 +9852,15 @@ test_modify(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tpa TEST_ERROR /* Attempt to find modified record */ - record = 9448; - found = 9448; - if (H5B2_find(bt2, &record, find_cb, &found) != TRUE) + record = 9448; + found = 9448; + rec_found = FALSE; + if (H5B2_find(bt2, &record, &rec_found, find_cb, &found) < 0) STACK_ERROR if (found != 9448) TEST_ERROR + if (!rec_found) + TEST_ERROR /* Attempt to find original record */ record = 9445; diff --git a/test/cache_common.h b/test/cache_common.h index 87fab72..455acfb 100644 --- a/test/cache_common.h +++ b/test/cache_common.h @@ -392,7 +392,8 @@ typedef struct test_entry_t { int flush_dep_par_idx[MAX_FLUSH_DEP_PARS]; /* Indices of flush dependency parents */ unsigned flush_dep_npar; /* Number of flush dependency parents */ unsigned flush_dep_nchd; /* Number of flush dependency children */ - unsigned flush_dep_ndirty_chd; /* Number of dirty flush dependency children (including granchildren, etc.) */ + unsigned + flush_dep_ndirty_chd; /* Number of dirty flush dependency children (including granchildren, etc.) */ hbool_t pinned_from_client; /* entry was pinned by client call */ hbool_t pinned_from_cache; /* entry was pinned by cache internally */ unsigned flush_order; /* Order that entry was flushed in */ diff --git a/test/cache_tagging.c b/test/cache_tagging.c index 5f94f8a..eab5d18 100644 --- a/test/cache_tagging.c +++ b/test/cache_tagging.c @@ -443,7 +443,7 @@ check_file_creation_tags(hid_t fcpl_id, int type) /* Variable Declarations */ hid_t fid = -1; /* File Identifier */ #ifndef NDEBUG - int verbose = FALSE; /* verbose test outout */ + int verbose = FALSE; /* verbose test outout */ #endif /* NDEBUG */ hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = 0; @@ -549,9 +549,9 @@ check_file_open_tags(hid_t fcpl, int type) #ifndef NDEBUG int verbose = FALSE; /* verbose file outout */ #endif /* NDEBUG */ - hid_t fapl = -1; /* File access prop list */ - haddr_t root_tag; /* Root Group Tag */ - haddr_t sbe_tag; /* Sblock Extension Tag */ + hid_t fapl = -1; /* File access prop list */ + haddr_t root_tag; /* Root Group Tag */ + haddr_t sbe_tag; /* Sblock Extension Tag */ /* Testing Macro */ TESTING("tag application during file open"); @@ -677,7 +677,7 @@ check_group_creation_tags(void) hid_t fid = -1; /* File Identifier */ hid_t gid = -1; /* Group Identifier */ #ifndef NDEBUG - int verbose = FALSE; /* verbose file outout */ + int verbose = FALSE; /* verbose file outout */ #endif /* NDEBUG */ hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = HADDR_UNDEF; /* Root Group Tag */ @@ -800,7 +800,7 @@ check_multi_group_creation_tags(void) hid_t fid = -1; /* File Identifier */ hid_t gid = -1; /* Group Identifier */ #ifndef NDEBUG - int verbose = FALSE; /* verbose file outout */ + int verbose = FALSE; /* verbose file outout */ #endif /* NDEBUG */ char gname[16]; /* group name buffer */ int i = 0; /* iterator */ @@ -952,7 +952,7 @@ check_link_iteration_tags(void) hid_t sid = -1; /* Group Identifier */ hid_t did = -1; /* Group Identifier */ #ifndef NDEBUG - int verbose = FALSE; /* verbose file outout */ + int verbose = FALSE; /* verbose file outout */ #endif /* NDEBUG */ int i = 0; /* iterator */ haddr_t root_tag = 0; /* Root Group Tag Value */ @@ -1094,7 +1094,7 @@ check_dense_attribute_tags(void) hid_t did = -1; /* Group Identifier */ hid_t dcpl = -1; /* Group Identifier */ #ifndef NDEBUG - int verbose = FALSE; /* verbose file outout */ + int verbose = FALSE; /* verbose file outout */ #endif /* NDEBUG */ int i = 0; /* iterator */ hid_t fapl = -1; /* File access property list */ @@ -1324,7 +1324,7 @@ check_group_open_tags(void) hid_t fid = -1; /* File Identifier */ hid_t gid = -1; /* Group Identifier */ #ifndef NDEBUG - int verbose = FALSE; /* verbose file output */ + int verbose = FALSE; /* verbose file output */ #endif /* NDEBUG */ hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = HADDR_UNDEF; @@ -1455,7 +1455,7 @@ check_attribute_creation_tags(hid_t fcpl, int type) hid_t gid = -1; /* Group Identifier */ hid_t sid = -1; /* Dataspace Identifier */ #ifndef NDEBUG - int verbose = FALSE; /* verbose file outout */ + int verbose = FALSE; /* verbose file outout */ #endif /* NDEBUG */ hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = 0; /* Root group tag */ @@ -1620,7 +1620,7 @@ check_attribute_open_tags(hid_t fcpl, int type) hid_t gid = -1; /* Group Identifier */ hid_t sid = -1; /* Dataspace Identifier */ #ifndef NDEBUG - int verbose = FALSE; /* verbose file outout */ + int verbose = FALSE; /* verbose file outout */ #endif /* NDEBUG */ hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = 0; @@ -1787,7 +1787,7 @@ check_attribute_rename_tags(hid_t fcpl, int type) hid_t aid = -1; /* Attribute Identifier */ hid_t sid = -1; /* Dataset Identifier */ #ifndef NDEBUG - int verbose = FALSE; /* verbose file outout */ + int verbose = FALSE; /* verbose file outout */ #endif /* NDEBUG */ int * data = NULL; /* data buffer */ int i, j, k = 0; /* iterators */ @@ -2000,7 +2000,7 @@ check_attribute_delete_tags(hid_t fcpl, int type) hid_t aid = -1; /* Attribute Identifier */ hid_t sid = -1; /* Dataset Identifier */ #ifndef NDEBUG - int verbose = FALSE; /* verbose file outout */ + int verbose = FALSE; /* verbose file outout */ #endif /* NDEBUG */ int * data = NULL; /* data buffer */ int i, j, k = 0; /* iterators */ @@ -2191,7 +2191,7 @@ check_dataset_creation_tags(hid_t fcpl, int type) hid_t did = -1; /* Dataset Identifier */ hid_t sid = -1; /* Dataspace Identifier */ #ifndef NDEBUG - int verbose = FALSE; /* verbose file outout */ + int verbose = FALSE; /* verbose file outout */ #endif /* NDEBUG */ hid_t dcpl = -1; /* dataset creation pl */ hsize_t cdims[2] = {1, 1}; /* chunk dimensions */ @@ -2351,7 +2351,7 @@ check_dataset_creation_earlyalloc_tags(hid_t fcpl, int type) hid_t did = -1; /* Dataset Identifier */ hid_t sid = -1; /* Dataspace Identifier */ #ifndef NDEBUG - int verbose = FALSE; /* verbose file outout */ + int verbose = FALSE; /* verbose file outout */ #endif /* NDEBUG */ hid_t dcpl = -1; /* dataset creation pl */ hsize_t cdims[2] = {1, 1}; /* chunk dimensions */ @@ -2517,7 +2517,7 @@ check_dataset_open_tags(void) hid_t did = -1; /* Dataset Identifier */ hid_t sid = -1; /* Dataspace Identifier */ #ifndef NDEBUG - int verbose = FALSE; /* verbose file outout */ + int verbose = FALSE; /* verbose file outout */ #endif /* NDEBUG */ hid_t dcpl = -1; /* dataset creation pl */ hsize_t cdims[2] = {1, 1}; /* chunk dimensions */ @@ -2669,7 +2669,7 @@ check_dataset_write_tags(void) hid_t did = -1; /* Dataset Identifier */ hid_t sid = -1; /* Dataspace Identifier */ #ifndef NDEBUG - int verbose = FALSE; /* verbose file outout */ + int verbose = FALSE; /* verbose file outout */ #endif /* NDEBUG */ hid_t dcpl = -1; /* dataset creation pl */ hsize_t cdims[2] = {1, 1}; /* chunk dimensions */ @@ -2836,7 +2836,7 @@ check_attribute_write_tags(hid_t fcpl, int type) hid_t aid = -1; /* Attribute Identifier */ hid_t sid = -1; /* Dataset Identifier */ #ifndef NDEBUG - int verbose = FALSE; /* verbose file outout */ + int verbose = FALSE; /* verbose file outout */ #endif /* NDEBUG */ int * data = NULL; /* data buffer */ int i, j, k = 0; /* iterators */ @@ -3022,7 +3022,7 @@ check_dataset_read_tags(void) hid_t did = -1; /* Dataset Identifier */ hid_t sid = -1; /* Dataspace Identifier */ #ifndef NDEBUG - int verbose = FALSE; /* verbose file outout */ + int verbose = FALSE; /* verbose file outout */ #endif /* NDEBUG */ hid_t dcpl = -1; /* dataset creation pl */ hsize_t cdims[2] = {1, 1}; /* chunk dimensions */ @@ -3184,7 +3184,7 @@ check_dataset_size_retrieval(void) hid_t did = -1; /* Dataset Identifier */ hid_t sid = -1; /* Dataspace Identifier */ #ifndef NDEBUG - int verbose = FALSE; /* verbose file outout */ + int verbose = FALSE; /* verbose file outout */ #endif /* NDEBUG */ hid_t dcpl = -1; /* dataset creation pl */ hsize_t cdims[2] = {1, 1}; /* chunk dimensions */ @@ -3348,7 +3348,7 @@ check_dataset_extend_tags(void) hid_t did = -1; /* Dataset Identifier */ hid_t sid = -1; /* Dataspace Identifier */ #ifndef NDEBUG - int verbose = FALSE; /* verbose file outout */ + int verbose = FALSE; /* verbose file outout */ #endif /* NDEBUG */ hid_t dcpl = -1; /* dataset creation pl */ hsize_t cdims[2] = {1, 1}; /* chunk dimensions */ @@ -3510,7 +3510,7 @@ check_object_info_tags(void) hid_t fid = -1; /* File Identifier */ hid_t gid = -1; /* Group Identifier */ #ifndef NDEBUG - int verbose = FALSE; /* verbose file output */ + int verbose = FALSE; /* verbose file output */ #endif /* NDEBUG */ hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = HADDR_UNDEF; @@ -3645,7 +3645,7 @@ check_object_copy_tags(void) hid_t fid = -1; /* File Identifier */ hid_t gid = -1; /* Group Identifier */ #ifndef NDEBUG - int verbose = FALSE; /* verbose file output */ + int verbose = FALSE; /* verbose file output */ #endif /* NDEBUG */ hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = HADDR_UNDEF; @@ -3795,7 +3795,7 @@ check_link_removal_tags(hid_t fcpl, int type) hid_t sid = -1; /* Dataspace Identifier */ hid_t gid = -1; /* Dataspace Identifier */ #ifndef NDEBUG - int verbose = FALSE; /* verbose file outout */ + int verbose = FALSE; /* verbose file outout */ #endif /* NDEBUG */ hid_t dcpl = -1; /* dataset creation pl */ hsize_t cdims[2] = {1, 1}; /* chunk dimensions */ @@ -3984,7 +3984,7 @@ check_link_getname_tags(void) hid_t sid = -1; /* Dataspace Identifier */ hid_t gid = -1; /* Dataspace Identifier */ #ifndef NDEBUG - int verbose = FALSE; /* verbose file outout */ + int verbose = FALSE; /* verbose file outout */ #endif /* NDEBUG */ hid_t dcpl = -1; /* dataset creation pl */ hsize_t cdims[2] = {1, 1}; /* chunk dimensions */ @@ -4161,7 +4161,7 @@ check_external_link_creation_tags(void) hid_t fid2 = -1; /* File Identifier */ hid_t gid = -1; /* Dataspace Identifier */ #ifndef NDEBUG - int verbose = FALSE; /* verbose file outout */ + int verbose = FALSE; /* verbose file outout */ #endif /* NDEBUG */ hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = 0; @@ -4288,7 +4288,7 @@ check_external_link_open_tags(void) hid_t gid = -1; /* Dataspace Identifier */ hid_t xid = -1; /* Dataspace Identifier */ #ifndef NDEBUG - int verbose = FALSE; /* verbose file outout */ + int verbose = FALSE; /* verbose file outout */ #endif /* NDEBUG */ H5O_native_info_t ninfo; /* Native object info struct */ hid_t fapl = -1; /* File access prop list */ diff --git a/test/chunk_info.c b/test/chunk_info.c index 37fbe60..04b3ad0 100644 --- a/test/chunk_info.c +++ b/test/chunk_info.c @@ -67,7 +67,7 @@ const char *FILENAME[] = {"tchunk_info_earliest", "tchunk_info_v18", "tchunk_in #define V2_BTREE_INDEX_DSET_NAME "Version 2 B-Tree Index Dataset" #define SKIP_FILTER_DSET_NAME "Dataset with Skipping One Filter" #define FILENAME_BUF_SIZE 256 /* Size for file names */ -#define RANK 2 /* Rank for datasets */ +#define RANK 2 /* Rank for datasets */ /* Dimension of the dataset */ #define NX 24 diff --git a/test/cmpd_dtransform.c b/test/cmpd_dtransform.c index 2e1acaa..76ff287 100644 --- a/test/cmpd_dtransform.c +++ b/test/cmpd_dtransform.c @@ -24,95 +24,111 @@ #define LENGTH 11 typedef struct { - char name[64]; - char unit[64]; + char name[64]; + char unit[64]; } att_t; int main(void) { - hsize_t dima[] = { 1 }; - hsize_t dims[] = { LENGTH }; - hid_t str_dtyp_id, att_dtyp_id, file_id, fspace_id, dset_id, att_dspc_id, att_attr_id, dxpl_id; + hsize_t dima[] = {1}; + hsize_t dims[] = {LENGTH}; + hid_t str_dtyp_id = H5I_INVALID_HID, att_dtyp_id = H5I_INVALID_HID; + hid_t file_id = H5I_INVALID_HID; + hid_t fspace_id = H5I_INVALID_HID; + hid_t dset_id = H5I_INVALID_HID; + hid_t att_dspc_id = H5I_INVALID_HID; + hid_t att_attr_id = H5I_INVALID_HID; + hid_t dxpl_id = H5I_INVALID_HID; + const char *expr = "2*x"; + int * data = NULL; + int * data_res = NULL; + att_t * atts = NULL; + att_t * atts_res = NULL; /* Compound datatype */ - att_t *atts = HDmalloc(sizeof(att_t)); + if (NULL == (atts = HDmalloc(sizeof(att_t)))) + TEST_ERROR; HDstrcpy(atts[0].name, "Name"); HDstrcpy(atts[0].unit, "Unit"); /* String type */ if ((str_dtyp_id = H5Tcopy(H5T_C_S1)) < 0) - TEST_ERROR; - H5Tset_size(str_dtyp_id, 64); + FAIL_STACK_ERROR + if (H5Tset_size(str_dtyp_id, 64) < 0) + FAIL_STACK_ERROR /* Attribute type */ if ((att_dtyp_id = H5Tcreate(H5T_COMPOUND, sizeof(att_t))) < 0) - TEST_ERROR; - H5Tinsert(att_dtyp_id, "NAME", HOFFSET(att_t, name), str_dtyp_id); - H5Tinsert(att_dtyp_id, "UNIT", HOFFSET(att_t, unit), str_dtyp_id); + FAIL_STACK_ERROR + if (H5Tinsert(att_dtyp_id, "NAME", HOFFSET(att_t, name), str_dtyp_id) < 0) + FAIL_STACK_ERROR + if (H5Tinsert(att_dtyp_id, "UNIT", HOFFSET(att_t, unit), str_dtyp_id) < 0) + FAIL_STACK_ERROR /* Create file. */ if ((file_id = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) - TEST_ERROR; + FAIL_STACK_ERROR /* Create file dataspace. */ if ((fspace_id = H5Screate_simple(1, dims, NULL)) < 0) - TEST_ERROR; + FAIL_STACK_ERROR /* Create dataset. */ - if ((dset_id = H5Dcreate2(file_id, "test_dset", H5T_NATIVE_INT, fspace_id, - H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - TEST_ERROR; + if ((dset_id = H5Dcreate2(file_id, "test_dset", H5T_NATIVE_INT, fspace_id, H5P_DEFAULT, H5P_DEFAULT, + H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR /* Write the attribute (compound) to the dataset */ if ((att_dspc_id = H5Screate_simple(1, dima, NULL)) < 0) - TEST_ERROR; - if ((att_attr_id = H5Acreate2(dset_id, "ATTRIBUTES", att_dtyp_id, att_dspc_id, - H5P_DEFAULT, H5P_DEFAULT)) < 0) - TEST_ERROR; + FAIL_STACK_ERROR + if ((att_attr_id = + H5Acreate2(dset_id, "ATTRIBUTES", att_dtyp_id, att_dspc_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR if (H5Awrite(att_attr_id, att_dtyp_id, atts) < 0) - TEST_ERROR; + FAIL_STACK_ERROR /* Create dataset transfer property list */ - const char *expr = "2*x"; if ((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) - TEST_ERROR; + FAIL_STACK_ERROR if (H5Pset_data_transform(dxpl_id, expr) < 0) { - HDprintf("**** ERROR: H5Pset_data_transform (expression: %s) ****\n", expr); - TEST_ERROR; + HDprintf("**** ERROR: H5Pset_data_transform (expression: %s) ****\n", expr); + FAIL_STACK_ERROR } - int *data = HDmalloc(LENGTH * sizeof(int)); - int *data_res = HDmalloc(LENGTH * sizeof(int)); + if (NULL == (data = HDmalloc(LENGTH * sizeof(int)))) + TEST_ERROR; + if (NULL == (data_res = HDmalloc(LENGTH * sizeof(int)))) + TEST_ERROR; for (unsigned i = 0; i < LENGTH; i++) { - data[i] = 10; - data_res[i] = 2 * data[i]; + data[i] = 10; + data_res[i] = 2 * data[i]; } /* Write the data */ if (H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id, data) < 0) - TEST_ERROR; - + FAIL_STACK_ERROR + /* Read attribute */ - att_t *atts_res =HDmalloc(sizeof(att_t)); + if (NULL == (atts_res = HDmalloc(sizeof(att_t)))) + TEST_ERROR; if (H5Aread(att_attr_id, att_dtyp_id, atts_res) < 0) - TEST_ERROR; - + FAIL_STACK_ERROR + /* Verify attribute */ if (HDstrcmp(atts_res[0].name, atts[0].name) != 0) - TEST_ERROR; + TEST_ERROR; if (HDstrcmp(atts_res[0].unit, atts[0].unit) != 0) - TEST_ERROR; + TEST_ERROR; /* Read the data */ if (H5Dread(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0) - TEST_ERROR; + FAIL_STACK_ERROR /* Verify data */ - for (unsigned idx = 0; idx < LENGTH; idx++) { - if (data[idx] != data_res[idx]) - TEST_ERROR; - } + for (unsigned idx = 0; idx < LENGTH; idx++) + if (data[idx] != data_res[idx]) + TEST_ERROR; HDfree(atts); HDfree(atts_res); @@ -120,17 +136,47 @@ main(void) HDfree(data_res); /* Close all identifiers. */ - H5Pclose(dxpl_id); - H5Aclose(att_attr_id); - H5Sclose(att_dspc_id); - H5Dclose(dset_id); - H5Sclose(fspace_id); - H5Fclose(file_id); - H5Tclose(att_dtyp_id); - H5Tclose(str_dtyp_id); + if (H5Pclose(dxpl_id) < 0) + FAIL_STACK_ERROR + if (H5Aclose(att_attr_id) < 0) + FAIL_STACK_ERROR + if (H5Sclose(att_dspc_id) < 0) + FAIL_STACK_ERROR + if (H5Dclose(dset_id) < 0) + FAIL_STACK_ERROR + if (H5Sclose(fspace_id) < 0) + FAIL_STACK_ERROR + if (H5Fclose(file_id) < 0) + FAIL_STACK_ERROR + if (H5Tclose(att_dtyp_id) < 0) + FAIL_STACK_ERROR + if (H5Tclose(str_dtyp_id) < 0) + FAIL_STACK_ERROR return 0; - error: +error: + H5E_BEGIN_TRY + { + H5Pclose(dxpl_id); + H5Aclose(att_attr_id); + H5Sclose(att_dspc_id); + H5Dclose(dset_id); + H5Sclose(fspace_id); + H5Fclose(file_id); + H5Tclose(att_dtyp_id); + H5Tclose(str_dtyp_id); + } + H5E_END_TRY + + if (atts) + HDfree(atts); + if (atts_res) + HDfree(atts_res); + if (data) + HDfree(data); + if (data_res) + HDfree(data_res); + return 1; } diff --git a/test/dsets.c b/test/dsets.c index 9efc151..4f2f75a 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -193,15 +193,15 @@ const char *FILENAME[] = {"dataset", /* 0 */ #define DATA_NOT_CORRUPTED 0 /* Parameters for the "set local" test */ -#define BOGUS2_PERM_NPARMS 2 /* Number of "permanent" parameters */ +#define BOGUS2_PERM_NPARMS 2 /* Number of "permanent" parameters */ #define BOGUS2_PARAM_1 13 /* (No particular meaning, just for checking value) */ #define BOGUS2_PARAM_2 35 /* (No particular meaning, just for checking value) */ -#define BOGUS2_ALL_NPARMS 4 /* Total number of parameter = permanent + "local" parameters */ +#define BOGUS2_ALL_NPARMS 4 /* Total number of parameter = permanent + "local" parameters */ /* Dimensionality for conversion buffer test */ -#define DIM1 100 /* Dim. Size of data member # 1 */ +#define DIM1 100 /* Dim. Size of data member # 1 */ #define DIM2 5000 /* Dim. Size of data member # 2 */ -#define DIM3 10 /* Dim. Size of data member # 3 */ +#define DIM3 10 /* Dim. Size of data member # 3 */ /* Parameters for internal filter test */ #define FILTER_CHUNK_DIM1 2 diff --git a/test/error_test.c b/test/error_test.c index a47fa85..ba5a917 100644 --- a/test/error_test.c +++ b/test/error_test.c @@ -575,6 +575,111 @@ error: } /* end test_copy() */ /*------------------------------------------------------------------------- + * Function: test_append + * + * Purpose: Test appending one error stack to another + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +test_append(void) +{ + const char *err_func = "test_append"; /* Function name for pushing error */ + const char *err_msg1 = "Error message #1"; /* Error message #1 for pushing error */ + const char *err_msg2 = "Error message #2"; /* Error message #2 for pushing error */ + ssize_t err_num; /* Number of errors on stack */ + hid_t estack_id1 = -1; /* Error stack ID */ + hid_t estack_id2 = -1; /* Error stack ID */ + herr_t ret; /* Generic return value */ + + /* Push an error */ + if (H5Epush(H5E_DEFAULT, __FILE__, err_func, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_SUBROUTINE, "%s", + err_msg1) < 0) + TEST_ERROR; + + /* Copy error stack, which clears the original */ + if ((estack_id1 = H5Eget_current_stack()) < 0) + TEST_ERROR + + /* Check the number of errors on stack #1 */ + err_num = H5Eget_num(estack_id1); + if (err_num != 1) + TEST_ERROR + + /* Create another stack, from scratch */ + if ((estack_id2 = H5Ecreate_stack()) < 0) + TEST_ERROR + + /* Check the number of errors on stack #2 */ + err_num = H5Eget_num(estack_id2); + if (err_num != 0) + TEST_ERROR + + /* Push an error on stack #2 */ + if (H5Epush(estack_id2, __FILE__, err_func, __LINE__, ERR_CLS, ERR_MAJ_IO, ERR_MIN_CREATE, "%s", + err_msg2) < 0) + TEST_ERROR; + + /* Check the number of errors on stack #2 */ + err_num = H5Eget_num(estack_id2); + if (err_num != 1) + TEST_ERROR + + /* Try to append bad error stack IDs */ + H5E_BEGIN_TRY { ret = H5Eappend_stack(H5E_DEFAULT, H5E_DEFAULT, FALSE); } + H5E_END_TRY + if (ret >= 0) + TEST_ERROR + H5E_BEGIN_TRY { ret = H5Eappend_stack(estack_id1, H5E_DEFAULT, FALSE); } + H5E_END_TRY + if (ret >= 0) + TEST_ERROR + H5E_BEGIN_TRY { ret = H5Eappend_stack(H5E_DEFAULT, estack_id2, FALSE); } + H5E_END_TRY + if (ret >= 0) + TEST_ERROR + + /* Append error stack #2 to error stack #1, without closing stack #2 */ + if (H5Eappend_stack(estack_id1, estack_id2, FALSE) < 0) + TEST_ERROR + + /* Check the number of errors on stack #1 */ + err_num = H5Eget_num(estack_id1); + if (err_num != 2) + TEST_ERROR + + /* Check the number of errors on stack #2 */ + err_num = H5Eget_num(estack_id2); + if (err_num != 1) + TEST_ERROR + + /* Append error stack #2 to error stack #1, and close stack #2 */ + if (H5Eappend_stack(estack_id1, estack_id2, TRUE) < 0) + TEST_ERROR + + /* Try to close error stack #2. Should fail because H5Eappend_stack + * should have already closed it. + */ + H5E_BEGIN_TRY { ret = H5Eclose_stack(estack_id2); } + H5E_END_TRY + if (ret >= 0) + TEST_ERROR + + /* Check the number of errors on stack #1 */ + err_num = H5Eget_num(estack_id1); + if (err_num != 3) + TEST_ERROR + + return 0; + +error: + return -1; +} /* end test_append() */ + +/*------------------------------------------------------------------------- * Function: close_error * * Purpose: Closes error information. @@ -749,6 +854,10 @@ main(void) if (H5Fclose(file) < 0) TEST_ERROR; + /* Test appending error stacks */ + if (test_append() < 0) + TEST_ERROR; + /* Close error information */ if (close_error() < 0) TEST_ERROR; diff --git a/test/event_set.c b/test/event_set.c new file mode 100644 index 0000000..91080b8 --- /dev/null +++ b/test/event_set.c @@ -0,0 +1,132 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol + * Wednesday, April 8, 2020 + * + * Purpose: Tests event sets. + */ +#include "h5test.h" +#include "H5srcdir.h" + +const char *FILENAME[] = {"event_set_1", NULL}; + +/*------------------------------------------------------------------------- + * Function: test_es_create + * + * Purpose: Tests creating event sets. + * + * Return: Success: 0 + * Failure: number of errors + * + * Programmer: Quincey Koziol + * Thursday, April 9, 2020 + * + *------------------------------------------------------------------------- + */ +static int +test_es_create(void) +{ + hid_t es_id; /* Event set ID */ + size_t count; /* # of events in set */ + size_t num_errs; /* # of failed events in set */ + uint64_t num_ops; /* # of events inserted into set */ + hbool_t err_occurred; /* Whether an error has occurred */ + + TESTING("event set creation"); + + /* Create an event set */ + if ((es_id = H5EScreate()) < 0) + TEST_ERROR; + + /* Query the # of events in empty event set */ + count = 0; + if (H5ESget_count(es_id, &count) < 0) + TEST_ERROR; + if (count > 0) + FAIL_PUTS_ERROR("should be empty event set"); + + /* Check for errors */ + err_occurred = FALSE; + if (H5ESget_err_status(es_id, &err_occurred) < 0) + TEST_ERROR; + if (err_occurred) + FAIL_PUTS_ERROR("should not be an error for the event set"); + + /* Check errors count */ + num_errs = 0; + if (H5ESget_err_count(es_id, &num_errs) < 0) + TEST_ERROR; + if (num_errs) + FAIL_PUTS_ERROR("should not be any errors for the event set"); + + /* Check errors count */ + num_ops = 0; + if (H5ESget_op_counter(es_id, &num_ops) < 0) + TEST_ERROR; + if (num_ops) + FAIL_PUTS_ERROR("should not be any operations for the event set yet"); + + /* Close the event set */ + if (H5ESclose(es_id) < 0) + TEST_ERROR; + + PASSED(); + return 0; + +error: + H5E_BEGIN_TRY { H5ESclose(es_id); } + H5E_END_TRY; + return 1; +} + +/*------------------------------------------------------------------------- + * Function: main + * + * Purpose: Tests event sets + * + * Return: Success: EXIT_SUCCESS + * Failure: EXIT_FAILURE + * + * Programmer: Quincey Koziol + * Wednesday, April 8, 2020 + * + *------------------------------------------------------------------------- + */ +int +main(void) +{ + hid_t fapl_id = H5I_INVALID_HID; /* File access property list */ + int nerrors = 0; /* Error count */ + + /* Setup */ + h5_reset(); + fapl_id = h5_fileaccess(); + + /* Tests */ + nerrors += test_es_create(); + + /* Cleanup */ + h5_cleanup(FILENAME, fapl_id); + + /* Check for any errors */ + if (nerrors) { + HDputs("***** EVENT SET TESTS FAILED *****"); + HDexit(EXIT_FAILURE); + } /* end if */ + + /* Report status */ + HDputs("All event set tests passed."); + + HDexit(EXIT_SUCCESS); +} /* end main() */ diff --git a/test/fheap.c b/test/fheap.c index e29551e..b0b2233 100644 --- a/test/fheap.c +++ b/test/fheap.c @@ -9423,8 +9423,9 @@ test_man_fill_direct_skip_2nd_indirect_start_block_add_skipped(hid_t fapl, H5HF_ H5HF_t * fh = NULL; /* Fractal heap wrapper */ haddr_t fh_addr; /* Address of fractal heap */ fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */ - unsigned num_first_indirect_rows; /* Number of rows (of direct blocks) in each of the first indirect blocks */ - unsigned row; /* Current row in indirect block */ + unsigned + num_first_indirect_rows; /* Number of rows (of direct blocks) in each of the first indirect blocks */ + unsigned row; /* Current row in indirect block */ h5_stat_size_t empty_size; /* Size of a file with an empty heap */ size_t obj_size; /* Size of object */ size_t fill_size; /* Size of objects for "bulk" filled blocks */ @@ -9554,7 +9555,8 @@ test_man_fill_2nd_direct_less_one_wrap_start_block_add_skipped(hid_t fapl, H5HF_ H5HF_t * fh = NULL; /* Fractal heap wrapper */ haddr_t fh_addr; /* Address of fractal heap */ fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */ - unsigned num_first_indirect_rows; /* Number of rows (of direct blocks) in each of the first indirect blocks */ + unsigned + num_first_indirect_rows; /* Number of rows (of direct blocks) in each of the first indirect blocks */ h5_stat_size_t empty_size; /* Size of a file with an empty heap */ size_t obj_size; /* Size of object */ size_t fill_size; /* Size of objects for "bulk" filled blocks */ @@ -9699,8 +9701,9 @@ test_man_fill_direct_skip_2nd_indirect_skip_2nd_block_add_skipped(hid_t fapl, H5 H5HF_t * fh = NULL; /* Fractal heap wrapper */ haddr_t fh_addr; /* Address of fractal heap */ fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */ - unsigned num_first_indirect_rows; /* Number of rows (of direct blocks) in each of the first indirect blocks */ - unsigned row; /* Current row in indirect block */ + unsigned + num_first_indirect_rows; /* Number of rows (of direct blocks) in each of the first indirect blocks */ + unsigned row; /* Current row in indirect block */ h5_stat_size_t empty_size; /* Size of a file with an empty heap */ size_t obj_size; /* Size of object */ size_t fill_size; /* Size of objects for "bulk" filled blocks */ @@ -9861,7 +9864,8 @@ test_man_fill_direct_skip_indirect_two_rows_add_skipped(hid_t fapl, H5HF_create_ H5HF_t * fh = NULL; /* Fractal heap wrapper */ haddr_t fh_addr; /* Address of fractal heap */ fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */ - unsigned num_first_indirect_rows; /* Number of rows (of direct blocks) in each of the first indirect blocks */ + unsigned + num_first_indirect_rows; /* Number of rows (of direct blocks) in each of the first indirect blocks */ unsigned max_dblock_rows; /* Max. # of rows (of direct blocks) in the root indirect block */ h5_stat_size_t empty_size; /* Size of a file with an empty heap */ size_t obj_size; /* Size of object */ @@ -10016,7 +10020,8 @@ test_man_fill_direct_skip_indirect_two_rows_skip_indirect_row_add_skipped(hid_t H5HF_t * fh = NULL; /* Fractal heap wrapper */ haddr_t fh_addr; /* Address of fractal heap */ fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */ - unsigned num_first_indirect_rows; /* Number of rows (of direct blocks) in each of the first indirect blocks */ + unsigned + num_first_indirect_rows; /* Number of rows (of direct blocks) in each of the first indirect blocks */ unsigned max_dblock_rows; /* Max. # of rows (of direct blocks) in the root indirect block */ h5_stat_size_t empty_size; /* Size of a file with an empty heap */ size_t obj_size; /* Size of object */ @@ -10472,7 +10477,8 @@ test_man_fill_2nd_direct_fill_direct_skip_3rd_indirect_start_block_add_skipped(h H5HF_t * fh = NULL; /* Fractal heap wrapper */ haddr_t fh_addr; /* Address of fractal heap */ fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */ - unsigned num_first_indirect_rows; /* Number of rows (of direct blocks) in each of the first indirect blocks */ + unsigned + num_first_indirect_rows; /* Number of rows (of direct blocks) in each of the first indirect blocks */ h5_stat_size_t empty_size; /* Size of a file with an empty heap */ size_t obj_size; /* Size of object */ size_t fill_size; /* Size of objects for "bulk" filled blocks */ @@ -10624,7 +10630,8 @@ test_man_fill_2nd_direct_fill_direct_skip2_3rd_indirect_start_block_add_skipped( H5HF_t * fh = NULL; /* Fractal heap wrapper */ haddr_t fh_addr; /* Address of fractal heap */ fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */ - unsigned num_first_indirect_rows; /* Number of rows (of direct blocks) in each of the first indirect blocks */ + unsigned + num_first_indirect_rows; /* Number of rows (of direct blocks) in each of the first indirect blocks */ h5_stat_size_t empty_size; /* Size of a file with an empty heap */ size_t obj_size; /* Size of object */ size_t fill_size; /* Size of objects for "bulk" filled blocks */ @@ -10780,7 +10787,8 @@ test_man_fill_3rd_direct_less_one_fill_direct_wrap_start_block_add_skipped(hid_t H5HF_t * fh = NULL; /* Fractal heap wrapper */ haddr_t fh_addr; /* Address of fractal heap */ fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */ - unsigned num_first_indirect_rows; /* Number of rows (of direct blocks) in each of the first indirect blocks */ + unsigned + num_first_indirect_rows; /* Number of rows (of direct blocks) in each of the first indirect blocks */ h5_stat_size_t empty_size; /* Size of a file with an empty heap */ size_t obj_size; /* Size of object */ size_t fill_size; /* Size of objects for "bulk" filled blocks */ @@ -10943,7 +10951,8 @@ test_man_fill_1st_row_3rd_direct_fill_2nd_direct_less_one_wrap_start_block_add_s H5HF_t * fh = NULL; /* Fractal heap wrapper */ haddr_t fh_addr; /* Address of fractal heap */ fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */ - unsigned num_first_indirect_rows; /* Number of rows (of direct blocks) in each of the first indirect blocks */ + unsigned + num_first_indirect_rows; /* Number of rows (of direct blocks) in each of the first indirect blocks */ h5_stat_size_t empty_size; /* Size of a file with an empty heap */ size_t obj_size; /* Size of object */ size_t fill_size; /* Size of objects for "bulk" filled blocks */ @@ -11110,7 +11119,8 @@ test_man_fill_3rd_direct_fill_direct_skip_start_block_add_skipped(hid_t fapl, H5 H5HF_t * fh = NULL; /* Fractal heap wrapper */ haddr_t fh_addr; /* Address of fractal heap */ fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */ - unsigned num_first_indirect_rows; /* Number of rows (of direct blocks) in each of the first indirect blocks */ + unsigned + num_first_indirect_rows; /* Number of rows (of direct blocks) in each of the first indirect blocks */ h5_stat_size_t empty_size; /* Size of a file with an empty heap */ size_t obj_size; /* Size of object */ size_t fill_size; /* Size of objects for "bulk" filled blocks */ @@ -11272,7 +11282,8 @@ test_man_fill_3rd_direct_fill_2nd_direct_fill_direct_skip_3rd_indirect_start_blo H5HF_t * fh = NULL; /* Fractal heap wrapper */ haddr_t fh_addr; /* Address of fractal heap */ fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */ - unsigned num_first_indirect_rows; /* Number of rows (of direct blocks) in each of the first indirect blocks */ + unsigned + num_first_indirect_rows; /* Number of rows (of direct blocks) in each of the first indirect blocks */ h5_stat_size_t empty_size; /* Size of a file with an empty heap */ size_t obj_size; /* Size of object */ size_t fill_size; /* Size of objects for "bulk" filled blocks */ @@ -11454,7 +11465,8 @@ test_man_fill_3rd_direct_fill_2nd_direct_fill_direct_skip_3rd_indirect_two_rows_ H5HF_t * fh = NULL; /* Fractal heap wrapper */ haddr_t fh_addr; /* Address of fractal heap */ fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */ - unsigned num_first_indirect_rows; /* Number of rows (of direct blocks) in each of the first indirect blocks */ + unsigned + num_first_indirect_rows; /* Number of rows (of direct blocks) in each of the first indirect blocks */ h5_stat_size_t empty_size; /* Size of a file with an empty heap */ size_t obj_size; /* Size of object */ size_t fill_size; /* Size of objects for "bulk" filled blocks */ @@ -11673,7 +11685,8 @@ test_man_fill_3rd_direct_fill_2nd_direct_fill_direct_skip_3rd_indirect_wrap_star H5HF_t * fh = NULL; /* Fractal heap wrapper */ haddr_t fh_addr; /* Address of fractal heap */ fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */ - unsigned num_first_indirect_rows; /* Number of rows (of direct blocks) in each of the first indirect blocks */ + unsigned + num_first_indirect_rows; /* Number of rows (of direct blocks) in each of the first indirect blocks */ h5_stat_size_t empty_size; /* Size of a file with an empty heap */ size_t obj_size; /* Size of object */ size_t fill_size; /* Size of objects for "bulk" filled blocks */ @@ -11872,7 +11885,8 @@ test_man_fill_4th_direct_less_one_fill_2nd_direct_fill_direct_skip_3rd_indirect_ H5HF_t * fh = NULL; /* Fractal heap wrapper */ haddr_t fh_addr; /* Address of fractal heap */ fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */ - unsigned num_first_indirect_rows; /* Number of rows (of direct blocks) in each of the first indirect blocks */ + unsigned + num_first_indirect_rows; /* Number of rows (of direct blocks) in each of the first indirect blocks */ h5_stat_size_t empty_size; /* Size of a file with an empty heap */ size_t obj_size; /* Size of object */ size_t fill_size; /* Size of objects for "bulk" filled blocks */ @@ -12402,7 +12416,8 @@ test_man_frag_2nd_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t * H5HF_t * fh = NULL; /* Fractal heap wrapper */ haddr_t fh_addr; /* Address of fractal heap */ fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */ - unsigned num_first_indirect_rows; /* Number of rows (of direct blocks) in each of the first indirect blocks */ + unsigned + num_first_indirect_rows; /* Number of rows (of direct blocks) in each of the first indirect blocks */ h5_stat_size_t empty_size; /* Size of a file with an empty heap */ size_t obj_size; /* Size of object */ size_t fill_size; /* Size of objects for "bulk" filled blocks */ @@ -14936,7 +14951,7 @@ test_filtered_man_root_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_para fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */ h5_stat_size_t empty_size; /* Size of a file with an empty heap */ #ifdef NOT_YET - h5_stat_size_t file_size; /* Size of file currently */ + h5_stat_size_t file_size; /* Size of file currently */ #endif /* NOT_YET */ unsigned char heap_id[HEAP_ID_LEN]; /* Heap ID for object */ size_t obj_size; /* Size of object */ @@ -15109,7 +15124,7 @@ test_filtered_man_root_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_pa fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */ h5_stat_size_t empty_size; /* Size of a file with an empty heap */ #ifdef NOT_YET - h5_stat_size_t file_size; /* Size of file currently */ + h5_stat_size_t file_size; /* Size of file currently */ #endif /* NOT_YET */ unsigned char heap_id1[HEAP_ID_LEN]; /* Heap ID for object #1 */ unsigned char heap_id2[HEAP_ID_LEN]; /* Heap ID for object #2 */ diff --git a/test/h5test.c b/test/h5test.c index 9c59e77..48dbb6c 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -2041,7 +2041,7 @@ h5_get_dummy_vol_class(void) * can be registered. */ vol_class->version = H5VL_VERSION; - vol_class->name = "dummy"; + vol_class->name = "dummy"; return vol_class; diff --git a/test/hdfs.c b/test/hdfs.c index a59cdb6..4121f15 100644 --- a/test/hdfs.c +++ b/test/hdfs.c @@ -566,7 +566,8 @@ test_fapl_config_validation(void) JSVERIFY(config.stream_buffer_size, fa_fetch.stream_buffer_size, "streambuffer size mismatch") JSVERIFY_STR(config.namenode_name, fa_fetch.namenode_name, "node name mismatch") JSVERIFY_STR(config.user_name, fa_fetch.user_name, "user name mismatch") - JSVERIFY_STR(config.kerberos_ticket_cache, fa_fetch.kerberos_ticket_cache, "kerberos ticket cache mismatch") + JSVERIFY_STR(config.kerberos_ticket_cache, fa_fetch.kerberos_ticket_cache, + "kerberos ticket cache mismatch") } /*----------------------------- diff --git a/test/links.c b/test/links.c index 055e1dc..11b760c 100644 --- a/test/links.c +++ b/test/links.c @@ -9800,8 +9800,8 @@ external_set_elink_cb(hid_t fapl, hbool_t new_format) base_driver == H5FD_MPIO || base_driver == H5FD_CORE) ? H5P_DEFAULT : fapl; - op_data.fam_size = ELINK_CB_FAM_SIZE; - op_data.code = 0; + op_data.fam_size = ELINK_CB_FAM_SIZE; + op_data.code = 0; /* Create family fapl */ if ((fam_fapl = H5Pcopy(fapl)) < 0) @@ -19182,7 +19182,7 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, u unsigned v; /* Local index variable */ hsize_t skip; /* # of links to skip in group */ #ifndef H5_NO_DEPRECATED_SYMBOLS - int gskip; /* # of links to skip in group, with H5Giterate */ + int gskip; /* # of links to skip in group, with H5Giterate */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ herr_t ret; /* Generic return value */ @@ -19670,7 +19670,7 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, unsigned max_links unsigned v; /* Local index variable */ hsize_t skip; /* # of links to skip in group */ #ifndef H5_NO_DEPRECATED_SYMBOLS - int gskip; /* # of links to skip in group, with H5Giterate */ + int gskip; /* # of links to skip in group, with H5Giterate */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ herr_t ret; /* Generic return value */ @@ -22503,7 +22503,7 @@ main(void) #ifndef H5_NO_DEPRECATED_SYMBOLS nerrors += ud_hard_links_deprec(fapl2) < 0 ? 1 : 0; /* requires new format groups */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ - nerrors += ud_link_reregister(fapl2) < 0 ? 1 : 0; /* requires new format groups */ + nerrors += ud_link_reregister(fapl2) < 0 ? 1 : 0; /* requires new format groups */ #ifndef H5_NO_DEPRECATED_SYMBOLS nerrors += ud_link_reregister_deprec(fapl2) < 0 ? 1 : 0; /* requires new format groups */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ diff --git a/test/s3comms.c b/test/s3comms.c index f3e96b5..36f6f49 100644 --- a/test/s3comms.c +++ b/test/s3comms.c @@ -372,7 +372,7 @@ jserr_str(const char *expected, const char *actual, const char *reason) #define S3_TEST_RESOURCE_TEXT_PUBLIC "Poe_Raven.txt" #define S3_TEST_RESOURCE_MISSING "missing.csv" -#define S3_TEST_RUN_TIMEOUT 0 /* run tests that might hang */ +#define S3_TEST_RUN_TIMEOUT 0 /* run tests that might hang */ #define S3_TEST_MAX_URL_SIZE 256 /* char array size */ /* Global variables for aws test profile. diff --git a/test/swmr_generator.c b/test/swmr_generator.c index 931da94..9e7c050 100644 --- a/test/swmr_generator.c +++ b/test/swmr_generator.c @@ -96,7 +96,7 @@ gen_skeleton(const char *filename, hbool_t verbose, hbool_t swmr_write, int comp #ifdef FILLVAL_WORKS symbol_t fillval; /* Dataset fill value */ #endif /* FILLVAL_WORKS */ - unsigned u, v; /* Local index variable */ + unsigned u, v; /* Local index variable */ HDassert(filename); HDassert(index_type); diff --git a/test/swmr_sparse_writer.c b/test/swmr_sparse_writer.c index 14eef3d..a253de5 100644 --- a/test/swmr_sparse_writer.c +++ b/test/swmr_sparse_writer.c @@ -149,8 +149,8 @@ add_records(hid_t fid, unsigned verbose, unsigned long nrecords, unsigned long f symbol_t record; /* The record to add to the dataset */ unsigned long rec_to_flush; /* # of records left to write before flush */ #ifdef OUT - volatile int dummy; /* Dummy varialbe for busy sleep */ -#endif /* OUT */ + volatile int dummy; /* Dummy varialbe for busy sleep */ +#endif /* OUT */ hsize_t dim[2] = {1, 0}; /* Dataspace dimensions */ unsigned long u, v; /* Local index variables */ diff --git a/test/tattr.c b/test/tattr.c index ad669a1..346c1b9 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -5437,9 +5437,9 @@ test_attr_corder_delete(hid_t fcpl, hid_t fapl) h5_stat_size_t empty_size; /* Size of empty file */ h5_stat_size_t file_size; /* Size of file after operating on it */ #endif /* LATER */ - unsigned curr_dset; /* Current dataset to work on */ - unsigned u; /* Local index variable */ - herr_t ret; /* Generic return value */ + unsigned curr_dset; /* Current dataset to work on */ + unsigned u; /* Local index variable */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Deleting Object w/Dense Attribute Storage and Creation Order Info\n")); @@ -6861,7 +6861,7 @@ attr_iterate_check(hid_t fid, const char *dsetname, hid_t obj_id, H5_index_t idx unsigned v; /* Local index variable */ hsize_t skip; /* # of attributes to skip on object */ #ifndef H5_NO_DEPRECATED_SYMBOLS - unsigned oskip; /* # of attributes to skip on object, with H5Aiterate1 */ + unsigned oskip; /* # of attributes to skip on object, with H5Aiterate1 */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ int old_nerrs; /* Number of errors when entering this check */ herr_t ret; /* Generic return value */ diff --git a/test/testfiles/err_compat_1 b/test/testfiles/err_compat_1 index fc99f77..c797ebb 100644 --- a/test/testfiles/err_compat_1 +++ b/test/testfiles/err_compat_1 @@ -12,14 +12,32 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): minor: Bad value HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): - #000: (file name) line (number) in H5Dcreate2(): invalid location identifier + #000: (file name) line (number) in H5Dcreate2(): unable to synchronously create dataset + major: Dataset + minor: Unable to create file + #001: (file name) line (number) in H5D__create_api_common(): can't set object access arguments + major: Dataset + minor: Can't set value + #002: (file name) line (number) in H5VL_setup_acc_args(): invalid location identifier + major: Invalid arguments to routine + minor: Inappropriate type + #003: (file name) line (number) in H5VL_vol_object(): invalid identifier type to function major: Invalid arguments to routine minor: Inappropriate type ********* Print error stack in customized way ********* - error #000: (file name) in H5Dcreate2(): line (number) + error #000: (file name) in H5VL_vol_object(): line (number) major: Invalid arguments to routine minor: Inappropriate type + error #001: (file name) in H5VL_setup_acc_args(): line (number) + major: Invalid arguments to routine + minor: Inappropriate type + error #002: (file name) in H5D__create_api_common(): line (number) + major: Dataset + minor: Can't set value + error #003: (file name) in H5Dcreate2(): line (number) + major: Dataset + minor: Unable to create file ********* Print error stack in customized way ********* error #000: (file name) in H5Eget_auto(1 or 2)(): line (number) @@ -27,11 +45,29 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): minor: Can't get value ********* Print error stack in customized way ********* - error #000: (file name) in H5Dcreate2(): line (number) + error #000: (file name) in H5VL_vol_object(): line (number) major: Invalid arguments to routine minor: Inappropriate type + error #001: (file name) in H5VL_setup_acc_args(): line (number) + major: Invalid arguments to routine + minor: Inappropriate type + error #002: (file name) in H5D__create_api_common(): line (number) + major: Dataset + minor: Can't set value + error #003: (file name) in H5Dcreate2(): line (number) + major: Dataset + minor: Unable to create file HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): - #000: (file name) line (number) in H5Dcreate2(): invalid location identifier + #000: (file name) line (number) in H5Dcreate2(): unable to synchronously create dataset + major: Dataset + minor: Unable to create file + #001: (file name) line (number) in H5D__create_api_common(): can't set object access arguments + major: Dataset + minor: Can't set value + #002: (file name) line (number) in H5VL_setup_acc_args(): invalid location identifier + major: Invalid arguments to routine + minor: Inappropriate type + #003: (file name) line (number) in H5VL_vol_object(): invalid identifier type to function major: Invalid arguments to routine minor: Inappropriate type @@ -42,6 +78,9 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #001: (file name) line (number) in test_error2(): H5Dwrite shouldn't succeed major: Error API minor: Write failed - #002: (file name) line (number) in H5Dwrite(): dset_id is not a dataset ID + #002: (file name) line (number) in H5Dwrite(): can't synchronously write data + major: Dataset + minor: Write failed + #003: (file name) line (number) in H5D__write_api_common(): dset_id is not a dataset ID major: Invalid arguments to routine minor: Inappropriate type diff --git a/test/testfiles/error_test_1 b/test/testfiles/error_test_1 index f0e4a62..070869e 100644 --- a/test/testfiles/error_test_1 +++ b/test/testfiles/error_test_1 @@ -21,7 +21,10 @@ Error Test-DIAG: Error detected in Error Program (1.0) thread (IDs): Testing error API based on data I/O HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): - #000: (file name) line (number) in H5Dwrite(): dset_id is not a dataset ID + #000: (file name) line (number) in H5Dwrite(): can't synchronously write data + major: Dataset + minor: Write failed + #001: (file name) line (number) in H5D__write_api_common(): dset_id is not a dataset ID major: Invalid arguments to routine minor: Inappropriate type Error Test-DIAG: Error detected in Error Program (1.0) thread (IDs): @@ -32,37 +35,43 @@ Error Test-DIAG: Error detected in Error Program (1.0) thread (IDs): major: Error in IO minor: Error in H5Dwrite HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): - #002: (file name) line (number) in H5Dwrite(): dset_id is not a dataset ID + #002: (file name) line (number) in H5Dwrite(): can't synchronously write data + major: Dataset + minor: Write failed + #003: (file name) line (number) in H5D__write_api_common(): dset_id is not a dataset ID major: Invalid arguments to routine minor: Inappropriate type Testing error message during data reading when filter isn't registered HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): - #000: (file name) line (number) in H5Dread(): can't read data + #000: (file name) line (number) in H5Dread(): can't synchronously read data + major: Dataset + minor: Read failed + #001: (file name) line (number) in H5D__read_api_common(): can't read data major: Dataset minor: Read failed - #001: (file name) line (number) in H5VL_dataset_read(): dataset read failed + #002: (file name) line (number) in H5VL_dataset_read(): dataset read failed major: Virtual Object Layer minor: Read failed - #002: (file name) line (number) in H5VL__dataset_read(): dataset read failed + #003: (file name) line (number) in H5VL__dataset_read(): dataset read failed major: Virtual Object Layer minor: Read failed - #003: (file name) line (number) in H5VL__native_dataset_read(): can't read data + #004: (file name) line (number) in H5VL__native_dataset_read(): can't read data major: Dataset minor: Read failed - #004: (file name) line (number) in H5D__read(): can't read data + #005: (file name) line (number) in H5D__read(): can't read data major: Dataset minor: Read failed - #005: (file name) line (number) in H5D__chunk_read(): unable to read raw data chunk + #006: (file name) line (number) in H5D__chunk_read(): unable to read raw data chunk major: Low-level I/O minor: Read failed - #006: (file name) line (number) in H5D__chunk_lock(): data pipeline read failed + #007: (file name) line (number) in H5D__chunk_lock(): data pipeline read failed major: Dataset minor: Filter operation failed - #007: (file name) line (number) in H5Z_pipeline(): required filter 'bogus' is not registered + #008: (file name) line (number) in H5Z_pipeline(): required filter 'bogus' is not registered major: Data filters minor: Read failed - #008: (file name) line (number) in H5PL_load(): filter plugins disabled + #009: (file name) line (number) in H5PL_load(): filter plugins disabled major: Plugin for dynamically loaded library minor: Unable to load metadata into cache diff --git a/test/th5o.c b/test/th5o.c index c2409c1..a1849f0 100644 --- a/test/th5o.c +++ b/test/th5o.c @@ -1736,8 +1736,8 @@ test_h5o(void) test_h5o_open(); /* Test generic open function */ #ifndef H5_NO_DEPRECATED_SYMBOLS - test_h5o_open_by_addr(); /* Test opening objects by address */ -#endif /* H5_NO_DEPRECATED_SYMBOLS */ + test_h5o_open_by_addr(); /* Test opening objects by address */ +#endif /* H5_NO_DEPRECATED_SYMBOLS */ test_h5o_open_by_token(); /* Test opening objects by token */ test_h5o_close(); /* Test generic close function */ test_h5o_refcount(); /* Test incrementing and decrementing reference count */ diff --git a/test/th5s.c b/test/th5s.c index 04ac2e6..6eeec1c 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -102,8 +102,8 @@ struct space4_struct { #define CONFIG_8 1 #define CONFIG_16 2 #define CONFIG_32 3 -#define POWER8 256 /* 2^8 */ -#define POWER16 65536 /* 2^16 */ +#define POWER8 256 /* 2^8 */ +#define POWER16 65536 /* 2^16 */ #define POWER32 4294967296 /* 2^32 */ /**************************************************************** @@ -20,7 +20,7 @@ #include "H5Ipkg.h" static herr_t -free_wrapper(void *p, void **_ctx) +free_wrapper(void *p, void H5_ATTR_UNUSED **_ctx) { HDfree(p); return SUCCEED; @@ -575,9 +575,9 @@ out: */ /* Macro definitions */ -#define RCT_MAX_NOBJS 25 /* Maximum number of objects in the list */ +#define RCT_MAX_NOBJS 25 /* Maximum number of objects in the list */ #define RCT_MIN_NOBJS 5 -#define RCT_NITER 50 /* Number of times we cycle through object creation and deletion */ +#define RCT_NITER 50 /* Number of times we cycle through object creation and deletion */ /* Structure to hold the master list of objects */ typedef struct rct_obj_list_t { @@ -595,10 +595,10 @@ typedef struct rct_obj_list_t { /* Structure for an object */ typedef struct rct_obj_t { /* The ID for this object */ - hid_t id; + hid_t id; /* The number of times this object has been freed */ - int nfrees; + int nfrees; /* Whether we are currently freeing this object directly * through H5Idec_ref(). @@ -615,12 +615,12 @@ typedef struct rct_obj_t { * master list of objects. */ static herr_t -rct_free_cb(void *_obj, void **_ctx) +rct_free_cb(void *_obj, void H5_ATTR_UNUSED **_ctx) { - rct_obj_t * obj = (rct_obj_t *)_obj; - long remove_nth; - long i; - herr_t ret; + rct_obj_t *obj = (rct_obj_t *)_obj; + long remove_nth; + long i; + herr_t ret; /* Mark this object as freed */ obj->nfrees++; @@ -689,12 +689,12 @@ error: static int test_remove_clear_type(void) { - H5I_type_t obj_type; - rct_obj_list_t obj_list; - rct_obj_t * objects = NULL; /* Convenience pointer to objects stored in master list */ - size_t list_size; - long i, j; - herr_t ret; /* return value */ + H5I_type_t obj_type; + rct_obj_list_t obj_list; + rct_obj_t * objects = NULL; /* Convenience pointer to objects stored in master list */ + size_t list_size; + long i, j; + herr_t ret; /* return value */ /* Register a user-defined type with our custom ID-deleting callback */ obj_type = H5Iregister_type((size_t)8, 0, rct_free_cb); @@ -703,7 +703,7 @@ test_remove_clear_type(void) goto error; /* Create an array to hold the objects in the master list */ - list_size = RCT_MAX_NOBJS * sizeof(rct_obj_t); + list_size = RCT_MAX_NOBJS * sizeof(rct_obj_t); obj_list.objects = HDmalloc(list_size); CHECK(obj_list.objects, NULL, "HDcalloc"); if (NULL == obj_list.objects) @@ -734,9 +734,9 @@ test_remove_clear_type(void) for (j = 0; j < obj_list.count; j++) { /* Object setup */ - objects[j].nfrees = 0; - objects[j].freeing = FALSE; - objects[j].list = &obj_list; + objects[j].nfrees = 0; + objects[j].freeing = FALSE; + objects[j].list = &obj_list; /* Register an ID for it */ objects[j].id = H5Iregister(obj_type, &objects[j]); @@ -790,7 +790,7 @@ test_remove_clear_type(void) /* Verify the number of unfreed objects we found during our scan * matches the number stored in the list - */ + */ VERIFY(obj_list.remaining, found, "incorrect number of objects remaining"); if (obj_list.remaining != found) goto error; @@ -856,15 +856,505 @@ test_remove_clear_type(void) error: /* Cleanup. For simplicity, just destroy the types and ignore errors. */ - H5E_BEGIN_TRY { - H5Idestroy_type(obj_type); - } H5E_END_TRY + H5E_BEGIN_TRY { H5Idestroy_type(obj_type); } + H5E_END_TRY HDfree(obj_list.objects); return -1; } /* end test_remove_clear_type() */ +/* Typedef for future objects */ +typedef struct { + H5I_type_t obj_type; /* ID type for actual object */ +} future_obj_t; + +/* Global (static) future ID object type */ +H5I_type_t future_obj_type_g = H5I_BADID; + +/* Callback to free the actual object for future object test */ +static herr_t +free_actual_object(void *_p, void H5_ATTR_UNUSED **_ctx) +{ + int *p = (int *)_p; + + if (7 != *p) + return FAIL; + + HDfree(p); + + return SUCCEED; +} + +/* Callback to realize a future object */ +static herr_t +realize_future_cb(void *_future_obj, hid_t *actual_id) +{ + future_obj_t *future_obj = (future_obj_t *)_future_obj; /* Future object */ + int * actual_obj; /* Pointer to the actual object */ + + /* Check for bad future object */ + if (NULL == future_obj) + return FAIL; + + /* Determine type of object to realize */ + if (H5I_DATASPACE == future_obj->obj_type) { + hsize_t dims = 13; + + if ((*actual_id = H5Screate_simple(1, &dims, NULL)) < 0) + return FAIL; + } + else if (H5I_DATATYPE == future_obj->obj_type) { + if ((*actual_id = H5Tcopy(H5T_NATIVE_INT)) < 0) + return FAIL; + } + else if (H5I_GENPROP_LST == future_obj->obj_type) { + if ((*actual_id = H5Pcreate(H5P_DATASET_XFER)) < 0) + return FAIL; + } + else { + /* Create a new object (the 'actual object') of the correct type */ + if (NULL == (actual_obj = HDmalloc(sizeof(int)))) + return FAIL; + *actual_obj = 7; + + /* Register actual object of the user-defined type */ + *actual_id = H5Iregister(future_obj->obj_type, actual_obj); + CHECK(*actual_id, FAIL, "H5Iregister"); + if (*actual_id == FAIL) + return FAIL; + } + + return SUCCEED; +} + +/* Callback to discard a future object */ +static herr_t +discard_future_cb(void *future_obj) +{ + if (NULL == future_obj) + return FAIL; + + HDfree(future_obj); + + return SUCCEED; +} + +/* Callback to realize a future object when future objects are NULL*/ +static herr_t +realize_future_generate_cb(void *_future_obj, hid_t *actual_id) +{ + future_obj_t *future_obj = (future_obj_t *)_future_obj; /* Future object */ + int * actual_obj; /* Pointer to the actual object */ + + if (NULL != future_obj) + return FAIL; + /* Create a new object (the 'actual object') of the correct type */ + if (NULL == (actual_obj = HDmalloc(sizeof(int)))) + return FAIL; + *actual_obj = 7; + + /* Register actual object without using future object info */ + *actual_id = H5Iregister(future_obj_type_g, actual_obj); + CHECK(*actual_id, FAIL, "H5Iregister"); + if (*actual_id == FAIL) + return FAIL; + + return SUCCEED; +} + +/* Callback to discard a future object when future objects are NULL */ +static herr_t +discard_future_generate_cb(void *future_obj) +{ + if (NULL != future_obj) + return FAIL; + + return SUCCEED; +} + +/* Test function */ +static int +test_future_ids(void) +{ + H5I_type_t obj_type; /* New user-defined ID type */ + hid_t future_id; /* ID for future object */ + int fake_future_obj; /* "Fake" future object for tests */ + future_obj_t *future_obj; /* Future object */ + int * actual_obj; /* Actual object */ + int * actual_obj2; /* Another actual object */ + H5I_type_t id_type; /* Type of ID */ + H5T_class_t type_class; /* Datatype class */ + herr_t ret; /* Return value */ + + /* Register a user-defined type with our custom ID-deleting callback */ + obj_type = H5Iregister_type((size_t)15, 0, free_actual_object); + CHECK(obj_type, H5I_BADID, "H5Iregister_type"); + if (H5I_BADID == obj_type) + goto error; + + /* Test basic error conditions */ + fake_future_obj = 0; + H5E_BEGIN_TRY { future_id = H5Iregister_future(obj_type, &fake_future_obj, NULL, NULL); } + H5E_END_TRY + VERIFY(future_id, H5I_INVALID_HID, "H5Iregister_future"); + if (H5I_INVALID_HID != future_id) + goto error; + + H5E_BEGIN_TRY { future_id = H5Iregister_future(obj_type, &fake_future_obj, realize_future_cb, NULL); } + H5E_END_TRY + VERIFY(future_id, H5I_INVALID_HID, "H5Iregister_future"); + if (H5I_INVALID_HID != future_id) + goto error; + + H5E_BEGIN_TRY { future_id = H5Iregister_future(obj_type, &fake_future_obj, NULL, discard_future_cb); } + H5E_END_TRY + VERIFY(future_id, H5I_INVALID_HID, "H5Iregister_future"); + if (H5I_INVALID_HID != future_id) + goto error; + + H5E_BEGIN_TRY + { + future_id = H5Iregister_future(H5I_BADID, &fake_future_obj, realize_future_cb, discard_future_cb); + } + H5E_END_TRY + VERIFY(future_id, H5I_INVALID_HID, "H5Iregister_future"); + if (H5I_INVALID_HID != future_id) + goto error; + + /* Test base use-case: create a future object and destroy type without + * realizing the future object. + */ + future_obj = HDmalloc(sizeof(future_obj_t)); + future_obj->obj_type = obj_type; + future_id = H5Iregister_future(obj_type, future_obj, realize_future_cb, discard_future_cb); + CHECK(future_id, H5I_INVALID_HID, "H5Iregister_future"); + if (H5I_INVALID_HID == future_id) + goto error; + + /* Destroy the type */ + ret = H5Idestroy_type(obj_type); + CHECK(ret, FAIL, "H5Idestroy_type"); + if (FAIL == ret) + goto error; + + /* Re-register a user-defined type with our custom ID-deleting callback */ + obj_type = H5Iregister_type((size_t)15, 0, free_actual_object); + CHECK(obj_type, H5I_BADID, "H5Iregister_type"); + if (H5I_BADID == obj_type) + goto error; + + /* Test base use-case: create a future object and realize the actual object. */ + future_obj = HDmalloc(sizeof(future_obj_t)); + future_obj->obj_type = obj_type; + future_id = H5Iregister_future(obj_type, future_obj, realize_future_cb, discard_future_cb); + CHECK(future_id, H5I_INVALID_HID, "H5Iregister_future"); + if (H5I_INVALID_HID == future_id) + goto error; + + actual_obj = H5Iobject_verify(future_id, obj_type); + CHECK_PTR(actual_obj, "H5Iobject_verify"); + if (NULL == actual_obj) + goto error; + VERIFY(*actual_obj, 7, "H5Iobject_verify"); + if (7 != *actual_obj) + goto error; + + /* Retrieve the object again and verify that it's the same actual object */ + actual_obj2 = H5Iobject_verify(future_id, obj_type); + CHECK_PTR(actual_obj2, "H5Iobject_verify"); + if (NULL == actual_obj2) + goto error; + VERIFY(*actual_obj2, 7, "H5Iobject_verify"); + if (7 != *actual_obj2) + goto error; + VERIFY(actual_obj, actual_obj2, "H5Iobject_verify"); + if (actual_obj != actual_obj2) + goto error; + + /* Destroy the type */ + ret = H5Idestroy_type(obj_type); + CHECK(ret, FAIL, "H5Idestroy_type"); + if (FAIL == ret) + goto error; + + /* Re-register a user-defined type with our custom ID-deleting callback */ + obj_type = H5Iregister_type((size_t)15, 0, free_actual_object); + CHECK(obj_type, H5I_BADID, "H5Iregister_type"); + if (H5I_BADID == obj_type) + goto error; + + /* Set the global future object type */ + future_obj_type_g = obj_type; + + /* Test "actual object generator" use-case: create a future object with + * NULL object pointer, to create new object of predefined type when + * future object is realized. + */ + future_id = H5Iregister_future(obj_type, NULL, realize_future_generate_cb, discard_future_generate_cb); + CHECK(future_id, H5I_INVALID_HID, "H5Iregister_future"); + if (H5I_INVALID_HID == future_id) + goto error; + + /* Realize the actual object, with will be dynamically allocated within + * the 'realize' callback. + */ + actual_obj = H5Iobject_verify(future_id, obj_type); + CHECK_PTR(actual_obj, "H5Iobject_verify"); + if (NULL == actual_obj) + goto error; + VERIFY(*actual_obj, 7, "H5Iobject_verify"); + if (7 != *actual_obj) + goto error; + + /* Reset the global future object type */ + future_obj_type_g = H5I_BADID; + + /* Retrieve the object again and verify that it's the same actual object */ + /* (Will fail if global future object type used) */ + actual_obj2 = H5Iobject_verify(future_id, obj_type); + CHECK_PTR(actual_obj2, "H5Iobject_verify"); + if (NULL == actual_obj2) + goto error; + VERIFY(*actual_obj2, 7, "H5Iobject_verify"); + if (7 != *actual_obj2) + goto error; + VERIFY(actual_obj, actual_obj2, "H5Iobject_verify"); + if (actual_obj != actual_obj2) + goto error; + + /* Destroy the type */ + ret = H5Idestroy_type(obj_type); + CHECK(ret, FAIL, "H5Idestroy_type"); + if (FAIL == ret) + goto error; + + /* Test base use-case: create a future object for a pre-defined type */ + /* (DATASPACE) */ + future_obj = HDmalloc(sizeof(future_obj_t)); + future_obj->obj_type = H5I_DATASPACE; + future_id = H5Iregister_future(H5I_DATASPACE, future_obj, realize_future_cb, discard_future_cb); + CHECK(future_id, H5I_INVALID_HID, "H5Iregister_future"); + if (H5I_INVALID_HID == future_id) + goto error; + + /* (Can't verify the type of the future ID, because the library's current + * implementation realizes the object during sanity checks on the ID) + */ + + /* Close future object for pre-defined type without realizing it */ + ret = H5Idec_ref(future_id); + CHECK(ret, FAIL, "H5Idec_ref"); + if (FAIL == ret) + goto error; + + /* Test base use-case: create a future object for a pre-defined type */ + future_obj = HDmalloc(sizeof(future_obj_t)); + future_obj->obj_type = H5I_DATASPACE; + future_id = H5Iregister_future(H5I_DATASPACE, future_obj, realize_future_cb, discard_future_cb); + CHECK(future_id, H5I_INVALID_HID, "H5Iregister_future"); + if (H5I_INVALID_HID == future_id) + goto error; + + /* Verify that the application believes the future ID is a dataspace */ + /* (Currently realizes the object "implicitly" during a sanity check) */ + id_type = H5Iget_type(future_id); + CHECK(id_type, H5I_BADID, "H5Iget_type"); + if (H5I_BADID == id_type) + goto error; + if (H5I_DATASPACE != id_type) + goto error; + + /* Close future object for pre-defined type without realizing it */ + ret = H5Idec_ref(future_id); + CHECK(ret, FAIL, "H5Idec_ref"); + if (FAIL == ret) + goto error; + + /* Test base use-case: create a future object for a pre-defined type */ + future_obj = HDmalloc(sizeof(future_obj_t)); + future_obj->obj_type = H5I_DATASPACE; + future_id = H5Iregister_future(H5I_DATASPACE, future_obj, realize_future_cb, discard_future_cb); + CHECK(future_id, H5I_INVALID_HID, "H5Iregister_future"); + if (H5I_INVALID_HID == future_id) + goto error; + + /* Realize future dataspace by requesting its rank */ + ret = H5Sget_simple_extent_ndims(future_id); + CHECK(ret, FAIL, "H5Sget_simple_extent_ndims"); + if (FAIL == ret) + goto error; + if (1 != ret) + goto error; + + /* Verify that the application believes the ID is still a dataspace */ + id_type = H5Iget_type(future_id); + CHECK(id_type, H5I_BADID, "H5Iget_type"); + if (H5I_BADID == id_type) + goto error; + if (H5I_DATASPACE != id_type) + goto error; + + /* Close future object for pre-defined type after realizing it */ + ret = H5Idec_ref(future_id); + CHECK(ret, FAIL, "H5Idec_ref"); + if (FAIL == ret) + goto error; + + /* Test base use-case: create a future object for a pre-defined type */ + /* (DATATYPE) */ + future_obj = HDmalloc(sizeof(future_obj_t)); + future_obj->obj_type = H5I_DATATYPE; + future_id = H5Iregister_future(H5I_DATATYPE, future_obj, realize_future_cb, discard_future_cb); + CHECK(future_id, H5I_INVALID_HID, "H5Iregister_future"); + if (H5I_INVALID_HID == future_id) + goto error; + + /* (Can't verify the type of the future ID, because the library's current + * implementation realizes the object during sanity checks on the ID) + */ + + /* Close future object for pre-defined type without realizing it */ + ret = H5Idec_ref(future_id); + CHECK(ret, FAIL, "H5Idec_ref"); + if (FAIL == ret) + goto error; + + /* Test base use-case: create a future object for a pre-defined type */ + future_obj = HDmalloc(sizeof(future_obj_t)); + future_obj->obj_type = H5I_DATATYPE; + future_id = H5Iregister_future(H5I_DATATYPE, future_obj, realize_future_cb, discard_future_cb); + CHECK(future_id, H5I_INVALID_HID, "H5Iregister_future"); + if (H5I_INVALID_HID == future_id) + goto error; + + /* Verify that the application believes the future ID is a datatype */ + /* (Currently realizes the object "implicitly" during a sanity check) */ + id_type = H5Iget_type(future_id); + CHECK(id_type, H5I_BADID, "H5Iget_type"); + if (H5I_BADID == id_type) + goto error; + if (H5I_DATATYPE != id_type) + goto error; + + /* Close future object for pre-defined type without realizing it */ + ret = H5Idec_ref(future_id); + CHECK(ret, FAIL, "H5Idec_ref"); + if (FAIL == ret) + goto error; + + /* Test base use-case: create a future object for a pre-defined type */ + future_obj = HDmalloc(sizeof(future_obj_t)); + future_obj->obj_type = H5I_DATATYPE; + future_id = H5Iregister_future(H5I_DATATYPE, future_obj, realize_future_cb, discard_future_cb); + CHECK(future_id, H5I_INVALID_HID, "H5Iregister_future"); + if (H5I_INVALID_HID == future_id) + goto error; + + /* Realize future datatype by requesting its class */ + type_class = H5Tget_class(future_id); + CHECK(ret, FAIL, "H5Tget_class"); + if (FAIL == ret) + goto error; + if (H5T_INTEGER != type_class) + goto error; + + /* Verify that the application believes the ID is still a datatype */ + id_type = H5Iget_type(future_id); + CHECK(id_type, H5I_BADID, "H5Iget_type"); + if (H5I_BADID == id_type) + goto error; + if (H5I_DATATYPE != id_type) + goto error; + + /* Close future object for pre-defined type after realizing it */ + ret = H5Idec_ref(future_id); + CHECK(ret, FAIL, "H5Idec_ref"); + if (FAIL == ret) + goto error; + + /* Test base use-case: create a future object for a pre-defined type */ + /* (PROPERTY LIST) */ + future_obj = HDmalloc(sizeof(future_obj_t)); + future_obj->obj_type = H5I_GENPROP_LST; + future_id = H5Iregister_future(H5I_GENPROP_LST, future_obj, realize_future_cb, discard_future_cb); + CHECK(future_id, H5I_INVALID_HID, "H5Iregister_future"); + if (H5I_INVALID_HID == future_id) + goto error; + + /* (Can't verify the type of the future ID, because the library's current + * implementation realizes the object during sanity checks on the ID) + */ + + /* Close future object for pre-defined type without realizing it */ + ret = H5Idec_ref(future_id); + CHECK(ret, FAIL, "H5Idec_ref"); + if (FAIL == ret) + goto error; + + /* Test base use-case: create a future object for a pre-defined type */ + future_obj = HDmalloc(sizeof(future_obj_t)); + future_obj->obj_type = H5I_GENPROP_LST; + future_id = H5Iregister_future(H5I_GENPROP_LST, future_obj, realize_future_cb, discard_future_cb); + CHECK(future_id, H5I_INVALID_HID, "H5Iregister_future"); + if (H5I_INVALID_HID == future_id) + goto error; + + /* Verify that the application believes the future ID is a property list */ + /* (Currently realizes the object "implicitly" during a sanity check) */ + id_type = H5Iget_type(future_id); + CHECK(id_type, H5I_BADID, "H5Iget_type"); + if (H5I_BADID == id_type) + goto error; + if (H5I_GENPROP_LST != id_type) + goto error; + + /* Close future object for pre-defined type without realizing it */ + ret = H5Idec_ref(future_id); + CHECK(ret, FAIL, "H5Idec_ref"); + if (FAIL == ret) + goto error; + + /* Test base use-case: create a future object for a pre-defined type */ + future_obj = HDmalloc(sizeof(future_obj_t)); + future_obj->obj_type = H5I_GENPROP_LST; + future_id = H5Iregister_future(H5I_GENPROP_LST, future_obj, realize_future_cb, discard_future_cb); + CHECK(future_id, H5I_INVALID_HID, "H5Iregister_future"); + if (H5I_INVALID_HID == future_id) + goto error; + + /* Realize future property list by verifying its class */ + ret = H5Pisa_class(future_id, H5P_DATASET_XFER); + CHECK(ret, FAIL, "H5Pisa_class"); + if (FAIL == ret) + goto error; + if (TRUE != ret) + goto error; + + /* Verify that the application believes the ID is still a property list */ + id_type = H5Iget_type(future_id); + CHECK(id_type, H5I_BADID, "H5Iget_type"); + if (H5I_BADID == id_type) + goto error; + if (H5I_GENPROP_LST != id_type) + goto error; + + /* Close future object for pre-defined type after realizing it */ + ret = H5Idec_ref(future_id); + CHECK(ret, FAIL, "H5Idec_ref"); + if (FAIL == ret) + goto error; + + return 0; + +error: + /* Cleanup. For simplicity, just destroy the types and ignore errors. */ + H5E_BEGIN_TRY { H5Idestroy_type(obj_type); } + H5E_END_TRY + + return -1; +} /* end test_future_ids() */ + void test_ids(void) { @@ -883,4 +1373,6 @@ test_ids(void) TestErrPrintf("ID type list test failed\n"); if (test_remove_clear_type() < 0) TestErrPrintf("ID remove during H5Iclear_type test failed\n"); + if (test_future_ids() < 0) + TestErrPrintf("Future ID test failed\n"); } diff --git a/test/tmisc.c b/test/tmisc.c index 51b2e89..304564c 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -1254,8 +1254,8 @@ test_misc8(void) int * wdata; /* Data to write */ int * tdata; /* Temporary pointer to data write */ #ifdef VERIFY_DATA - int *rdata; /* Data to read */ - int *tdata2; /* Temporary pointer to data to read */ + int *rdata; /* Data to read */ + int *tdata2; /* Temporary pointer to data to read */ #endif /* VERIFY_DATA */ unsigned u, v; /* Local index variables */ int mdc_nelmts; /* Metadata number of elements */ @@ -2962,7 +2962,7 @@ test_misc18(void) hid_t did1, did2; /* Dataset IDs */ hid_t aid; /* Attribute ID */ #ifndef H5_NO_DEPRECATED_SYMBOLS - H5O_info1_t old_oinfo; /* (deprecated) information about object */ + H5O_info1_t old_oinfo; /* (deprecated) information about object */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ H5O_info2_t oinfo; /* Data model information about object */ H5O_native_info_t ninfo; /* Native file format information about object */ @@ -5759,18 +5759,18 @@ static int test_misc36_context; static void test_misc36_cb1(void *_ctx) { - int *ctx = (int *)_ctx; /* Set up context pointer */ - hbool_t is_terminating; /* Flag indicating the library is terminating */ - herr_t ret; /* Return value */ + int * ctx = (int *)_ctx; /* Set up context pointer */ + hbool_t is_terminating; /* Flag indicating the library is terminating */ + herr_t ret; /* Return value */ /* Check whether the library thinks it's terminating */ is_terminating = FALSE; - ret = H5is_library_terminating(&is_terminating); + ret = H5is_library_terminating(&is_terminating); CHECK(ret, FAIL, "H5is_library_terminating"); VERIFY(is_terminating, TRUE, "H5is_library_terminating"); /* Verify correct ordering for 'atclose' callbacks */ - if(0 != *ctx) + if (0 != *ctx) HDabort(); /* Update context value */ @@ -5780,18 +5780,18 @@ test_misc36_cb1(void *_ctx) static void test_misc36_cb2(void *_ctx) { - int *ctx = (int *)_ctx; /* Set up context pointer */ - hbool_t is_terminating; /* Flag indicating the library is terminating */ - herr_t ret; /* Return value */ + int * ctx = (int *)_ctx; /* Set up context pointer */ + hbool_t is_terminating; /* Flag indicating the library is terminating */ + herr_t ret; /* Return value */ /* Check whether the library thinks it's terminating */ is_terminating = FALSE; - ret = H5is_library_terminating(&is_terminating); + ret = H5is_library_terminating(&is_terminating); CHECK(ret, FAIL, "H5is_library_terminating"); VERIFY(is_terminating, TRUE, "H5is_library_terminating"); /* Verify correct ordering for 'atclose' callbacks */ - if(1 != *ctx) + if (1 != *ctx) HDabort(); /* Update context value */ @@ -5806,15 +5806,15 @@ test_misc36_cb2(void *_ctx) static void test_misc36(void) { - hbool_t is_terminating; /* Flag indicating the library is terminating */ - herr_t ret; /* Return value */ + hbool_t is_terminating; /* Flag indicating the library is terminating */ + herr_t ret; /* Return value */ /* Output message about test being performed */ MESSAGE(5, ("H5atclose and H5is_library_terminating API calls")); /* Check whether the library thinks it's terminating */ is_terminating = TRUE; - ret = H5is_library_terminating(&is_terminating); + ret = H5is_library_terminating(&is_terminating); CHECK(ret, FAIL, "H5is_library_terminating"); VERIFY(is_terminating, FALSE, "H5is_library_terminating"); @@ -5824,7 +5824,7 @@ test_misc36(void) /* Check whether the library thinks it's terminating */ is_terminating = TRUE; - ret = H5is_library_terminating(&is_terminating); + ret = H5is_library_terminating(&is_terminating); CHECK(ret, FAIL, "H5is_library_terminating"); VERIFY(is_terminating, FALSE, "H5is_library_terminating"); @@ -5836,7 +5836,7 @@ test_misc36(void) /* Check whether the library thinks it's terminating */ is_terminating = TRUE; - ret = H5is_library_terminating(&is_terminating); + ret = H5is_library_terminating(&is_terminating); CHECK(ret, FAIL, "H5is_library_terminating"); VERIFY(is_terminating, FALSE, "H5is_library_terminating"); @@ -5897,9 +5897,9 @@ test_misc(void) test_misc19(); /* Test incrementing & decrementing ref count on IDs */ test_misc20(); /* Test problems with truncated dimensions in version 2 of storage layout message */ #ifdef H5_HAVE_FILTER_SZIP - test_misc21(); /* Test that "late" allocation time is treated the same as "incremental", for chunked - datasets w/a filters */ - test_misc22(); /* check szip bits per pixel */ + test_misc21(); /* Test that "late" allocation time is treated the same as "incremental", for chunked + datasets w/a filters */ + test_misc22(); /* check szip bits per pixel */ #endif /* H5_HAVE_FILTER_SZIP */ test_misc23(); /* Test intermediate group creation */ test_misc24(); /* Test inappropriate API opens of objects */ diff --git a/test/tsohm.c b/test/tsohm.c index 872875d..1e68628 100644 --- a/test/tsohm.c +++ b/test/tsohm.c @@ -3817,10 +3817,10 @@ test_sohm(void) { MESSAGE(5, ("Testing Shared Object Header Messages\n")); - test_sohm_fcpl(); /* Test SOHMs and file creation plists */ - test_sohm_fcpl_errors(); /* Bogus H5P* calls for SOHMs */ - test_sohm_size1(); /* Tests the sizes of files with one SOHM */ -#if 0 /* TODO: REVEALS BUG TO BE FIXED - SEE JIRA HDFFV-10645 */ + test_sohm_fcpl(); /* Test SOHMs and file creation plists */ + test_sohm_fcpl_errors(); /* Bogus H5P* calls for SOHMs */ + test_sohm_size1(); /* Tests the sizes of files with one SOHM */ +#if 0 /* TODO: REVEALS BUG TO BE FIXED - SEE JIRA HDFFV-10645 */ test_sohm_size_consistency_open_create(); #endif /* Jira HDFFV-10645 */ test_sohm_attrs(); /* Tests shared messages in attributes */ diff --git a/test/ttsafe_error.c b/test/ttsafe_error.c index 0b44958..86f0722 100644 --- a/test/ttsafe_error.c +++ b/test/ttsafe_error.c @@ -38,7 +38,7 @@ /* Having a common dataset name is an error */ #define DATASETNAME "commonname" -#define EXPECTED_ERROR_DEPTH 10 +#define EXPECTED_ERROR_DEPTH 11 #define WRITE_NUMBER 37 /* Typedefs */ @@ -74,32 +74,35 @@ tts_error(void) expected_g[0].maj_num = H5E_DATASET; expected_g[0].min_num = H5E_CANTCREATE; - expected_g[1].maj_num = H5E_VOL; + expected_g[1].maj_num = H5E_DATASET; expected_g[1].min_num = H5E_CANTCREATE; expected_g[2].maj_num = H5E_VOL; expected_g[2].min_num = H5E_CANTCREATE; - expected_g[3].maj_num = H5E_DATASET; - expected_g[3].min_num = H5E_CANTINIT; + expected_g[3].maj_num = H5E_VOL; + expected_g[3].min_num = H5E_CANTCREATE; expected_g[4].maj_num = H5E_DATASET; expected_g[4].min_num = H5E_CANTINIT; - expected_g[5].maj_num = H5E_LINK; + expected_g[5].maj_num = H5E_DATASET; expected_g[5].min_num = H5E_CANTINIT; expected_g[6].maj_num = H5E_LINK; - expected_g[6].min_num = H5E_CANTINSERT; + expected_g[6].min_num = H5E_CANTINIT; - expected_g[7].maj_num = H5E_SYM; - expected_g[7].min_num = H5E_NOTFOUND; + expected_g[7].maj_num = H5E_LINK; + expected_g[7].min_num = H5E_CANTINSERT; expected_g[8].maj_num = H5E_SYM; - expected_g[8].min_num = H5E_CALLBACK; + expected_g[8].min_num = H5E_NOTFOUND; - expected_g[9].maj_num = H5E_LINK; - expected_g[9].min_num = H5E_EXISTS; + expected_g[9].maj_num = H5E_SYM; + expected_g[9].min_num = H5E_CALLBACK; + + expected_g[10].maj_num = H5E_LINK; + expected_g[10].min_num = H5E_EXISTS; /* set up mutex for global count of errors */ H5TS_mutex_init(&error_mutex_g); diff --git a/test/use_disable_mdc_flushes.c b/test/use_disable_mdc_flushes.c index 1f0e3d4..a12ea31 100644 --- a/test/use_disable_mdc_flushes.c +++ b/test/use_disable_mdc_flushes.c @@ -33,9 +33,9 @@ const char *progname_g = "use_disable_mdc_flushes"; /* program name */ /* these two definitions must match each other */ #define UC_DATATYPE H5T_NATIVE_SHORT /* use case HDF5 data type */ -#define UC_CTYPE short /* use case C data type */ -#define UC_RANK 3 /* use case dataset rank */ -#define Chunksize_DFT 256 /* chunksize default */ +#define UC_CTYPE short /* use case C data type */ +#define UC_RANK 3 /* use case dataset rank */ +#define Chunksize_DFT 256 /* chunksize default */ #define Hgoto_error(val) \ { \ ret_value = val; \ @@ -2162,12 +2162,12 @@ static herr_t test_ros3(void) { #ifdef H5_HAVE_ROS3_VFD - hid_t fid = -1; /* file ID */ - hid_t fapl_id = -1; /* file access property list ID */ - hid_t fapl_id_out = -1; /* from H5Fget_access_plist */ - hid_t driver_id = -1; /* ID for this VFD */ - unsigned long driver_flags = 0; /* VFD feature flags */ - char filename[1024]; /* filename */ + hid_t fid = -1; /* file ID */ + hid_t fapl_id = -1; /* file access property list ID */ + hid_t fapl_id_out = -1; /* from H5Fget_access_plist */ + hid_t driver_id = -1; /* ID for this VFD */ + unsigned long driver_flags = 0; /* VFD feature flags */ + char filename[1024]; /* filename */ H5FD_ros3_fapl_t test_ros3_fa; H5FD_ros3_fapl_t ros3_fa_0 = { /* version = */ H5FD_CURR_ROS3_FAPL_T_VERSION, @@ -175,13 +175,13 @@ static const H5VL_class_t fake_vol_g = { static herr_t test_vol_registration(void) { - hid_t native_id = H5I_INVALID_HID; - hid_t lapl_id = H5I_INVALID_HID; - hid_t vipl_id = H5I_INVALID_HID; - herr_t ret = SUCCEED; - htri_t is_registered = FAIL; - hid_t vol_id = H5I_INVALID_HID; - hid_t vol_id2 = H5I_INVALID_HID; + hid_t native_id = H5I_INVALID_HID; + hid_t lapl_id = H5I_INVALID_HID; + hid_t vipl_id = H5I_INVALID_HID; + herr_t ret = SUCCEED; + htri_t is_registered = FAIL; + hid_t vol_id = H5I_INVALID_HID; + hid_t vol_id2 = H5I_INVALID_HID; H5VL_class_t *bad_fake_vol_class = NULL; TESTING("VOL registration"); @@ -211,9 +211,8 @@ test_vol_registration(void) TEST_ERROR; HDmemcpy(bad_fake_vol_class, &fake_vol_g, sizeof(H5VL_class_t)); bad_fake_vol_class->version = H5VL_VERSION + 1; - H5E_BEGIN_TRY { - vol_id = H5VLregister_connector(bad_fake_vol_class, H5P_DEFAULT); - } H5E_END_TRY; + H5E_BEGIN_TRY { vol_id = H5VLregister_connector(bad_fake_vol_class, H5P_DEFAULT); } + H5E_END_TRY; if (H5I_INVALID_HID != vol_id) FAIL_PUTS_ERROR("should not be able to register a connector with an incompatible version #"); HDfree(bad_fake_vol_class); |