diff options
author | Quincey Koziol <koziol@lbl.gov> | 2017-01-30 16:56:22 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@lbl.gov> | 2017-01-30 16:56:22 (GMT) |
commit | 2d98fd0078aa009467f39877c69e3de2758eef0d (patch) | |
tree | 602ac6b5c2fbea34b896cb44f23009c85ace34b4 /test | |
parent | b118b45d7d298923603a773c1b928715cc14d3bd (diff) | |
parent | a9808853d52b368f9ab7336a261c0555f22526f1 (diff) | |
download | hdf5-2d98fd0078aa009467f39877c69e3de2758eef0d.zip hdf5-2d98fd0078aa009467f39877c69e3de2758eef0d.tar.gz hdf5-2d98fd0078aa009467f39877c69e3de2758eef0d.tar.bz2 |
Merge pull request #272 in HDFFV/hdf5 from develop_merge_cache_image_06 to develop
* commit 'a9808853d52b368f9ab7336a261c0555f22526f1':
Add missing files
Cache image feature and testing
Bring change to use array of metadata cache entry classes for H5C_create instead of array of class names from cache image branch.
Switch list lengths to unsigned integers (to align better w/cache image merge)
Diffstat (limited to 'test')
45 files changed, 10739 insertions, 487 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 1e3ab0f..9e1334e 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -291,6 +291,28 @@ endforeach (test ${H5_VDS_SWMR_TESTS}) ############################################################################## ############################################################################## +#-- Adding test for cache_image +add_executable (cache_image + ${HDF5_TEST_SOURCE_DIR}/cache_image.c + ${HDF5_TEST_SOURCE_DIR}/cache_common.c + ${HDF5_TEST_SOURCE_DIR}/genall5.c +) +TARGET_NAMING (cache_image STATIC) +TARGET_C_PROPERTIES (cache_image STATIC " " " ") +target_link_libraries (cache_image ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) +set_target_properties (cache_image PROPERTIES FOLDER test) +if (BUILD_SHARED_LIBS) + add_executable (cache_image-shared + ${HDF5_TEST_SOURCE_DIR}/cache_image.c + ${HDF5_TEST_SOURCE_DIR}/cache_common.c + ${HDF5_TEST_SOURCE_DIR}/genall5.c + ) + TARGET_NAMING (cache_image-shared SHARED) + TARGET_C_PROPERTIES (cache_image-shared SHARED " " " ") + target_link_libraries (cache_image-shared ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + set_target_properties (cache_image-shared PROPERTIES FOLDER test) +endif (BUILD_SHARED_LIBS) + #-- Adding test for hyperslab add_executable (hyperslab ${HDF5_TEST_SOURCE_DIR}/hyperslab.c) TARGET_NAMING (hyperslab STATIC) diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index 495ea2c..20d615b 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -743,6 +743,22 @@ if (NOT CYGWIN) set_tests_properties (H5TEST-cache PROPERTIES TIMEOUT 1800) endif () +#-- Adding test for cache_image +add_test ( + NAME H5TEST-clear-cache_image-objects + COMMAND ${CMAKE_COMMAND} + -E remove + cache_image_test.h5 + WORKING_DIRECTORY + ${HDF5_TEST_BINARY_DIR}/H5TEST +) +add_test (NAME H5TEST-cache_image COMMAND $<TARGET_FILE:cache_image>) +set_tests_properties (H5TEST-cache_image PROPERTIES + DEPENDS H5TEST-clear-cache_image-objects + ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST +) + #-- Adding test for err_compat if (HDF5_ENABLE_DEPRECATED_SYMBOLS) add_test (NAME H5TEST-clear-err_compat-objects diff --git a/test/Makefile.am b/test/Makefile.am index fee8cb6..98cfc42 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -51,7 +51,8 @@ check_SCRIPTS = $(TEST_SCRIPT) # executed, generally most specific tests to least specific tests. # As an exception, long-running tests should occur earlier in the list. # This gives them more time to run when tests are executing in parallel. -TEST_PROG= testhdf5 cache cache_api cache_tagging lheap ohdr stab gheap \ +TEST_PROG= testhdf5 \ + cache cache_api cache_image cache_tagging lheap ohdr stab gheap \ evict_on_close farray earray btree2 fheap \ pool accum hyperslab istore bittests dt_arith \ dtypes dsets cmpd_dset filter_fail extend external efc objcopy links unlink \ @@ -127,6 +128,7 @@ LDADD=libh5test.la $(LIBHDF5) # List the source files for tests that have more than one ttsafe_SOURCES=ttsafe.c ttsafe_dcreate.c ttsafe_error.c ttsafe_cancel.c \ ttsafe_acreate.c +cache_image_SOURCES=cache_image.c genall5.c VFD_LIST = sec2 stdio core core_paged split multi family if DIRECT_VFD_CONDITIONAL @@ -189,7 +191,7 @@ CHECK_CLEANFILES+=accum.h5 cmpd_dset.h5 compact_dataset.h5 dataset.h5 dset_offse flushrefresh_VERIFICATION_DONE atomic_data accum_swmr_big.h5 ohdr_swmr.h5 \ 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 + tbogus.h5.copy cache_image_test.h5 # Sources for testhdf5 executable testhdf5_SOURCES=testhdf5.c tarray.c tattr.c tchecksum.c tconfig.c tfile.c \ diff --git a/test/cache.c b/test/cache.c index 2209d8f..9ca48e7 100644 --- a/test/cache.c +++ b/test/cache.c @@ -118,12 +118,12 @@ static void check_flush_cache__multi_entry(H5F_t * file_ptr); static void check_flush_cache__multi_entry_test(H5F_t * file_ptr, int test_num, unsigned int flush_flags, - int spec_size, + unsigned int spec_size, struct flush_cache_test_spec spec[]); static void check_flush_cache__pe_multi_entry_test(H5F_t * file_ptr, int test_num, unsigned int flush_flags, - int spec_size, + unsigned int spec_size, struct pe_flush_cache_test_spec spec[]); static void check_flush_cache__single_entry(H5F_t * file_ptr); static void check_flush_cache__single_entry_test(H5F_t * file_ptr, @@ -155,9 +155,9 @@ static void check_flush_cache__flush_op_test(H5F_t * file_ptr, unsigned int flush_flags, int spec_size, const struct fo_flush_cache_test_spec spec[], - int init_expected_index_len, + unsigned init_expected_index_len, size_t init_expected_index_size, - int expected_index_len, + unsigned expected_index_len, size_t expected_index_size, int check_size, struct fo_flush_entry_check check[]); @@ -3312,7 +3312,7 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) { int test_num = 1; unsigned int flush_flags = H5C__NO_FLAGS_SET; - int spec_size = 8; + unsigned int spec_size = 8; struct flush_cache_test_spec spec[8] = { { @@ -3406,7 +3406,7 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) { int test_num = 2; unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG; - int spec_size = 8; + unsigned int spec_size = 8; struct flush_cache_test_spec spec[8] = { { @@ -3500,7 +3500,7 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) { int test_num = 3; unsigned int flush_flags = H5C__FLUSH_CLEAR_ONLY_FLAG; - int spec_size = 8; + unsigned int spec_size = 8; struct flush_cache_test_spec spec[8] = { { @@ -3594,7 +3594,7 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) { int test_num = 4; unsigned int flush_flags = H5C__FLUSH_MARKED_ENTRIES_FLAG; - int spec_size = 8; + unsigned int spec_size = 8; struct flush_cache_test_spec spec[8] = { { @@ -3689,7 +3689,7 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) int test_num = 5; unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG; - int spec_size = 8; + unsigned int spec_size = 8; struct flush_cache_test_spec spec[8] = { { @@ -3784,7 +3784,7 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) int test_num = 6; unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_MARKED_ENTRIES_FLAG; - int spec_size = 8; + unsigned int spec_size = 8; struct flush_cache_test_spec spec[8] = { { @@ -3879,7 +3879,7 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) int test_num = 7; unsigned int flush_flags = H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__FLUSH_MARKED_ENTRIES_FLAG; - int spec_size = 8; + unsigned int spec_size = 8; struct flush_cache_test_spec spec[8] = { { @@ -3975,7 +3975,7 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__FLUSH_MARKED_ENTRIES_FLAG; - int spec_size = 8; + unsigned int spec_size = 8; struct flush_cache_test_spec spec[8] = { { @@ -4073,7 +4073,7 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) ~(H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__FLUSH_MARKED_ENTRIES_FLAG); - int spec_size = 8; + unsigned int spec_size = 8; struct flush_cache_test_spec spec[8] = { { @@ -4172,7 +4172,7 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) { int test_num = 1; unsigned int flush_flags = H5C__NO_FLAGS_SET; - int spec_size = 8; + unsigned int spec_size = 8; struct pe_flush_cache_test_spec spec[8] = { { @@ -4318,7 +4318,7 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) { int test_num = 2; unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG; - int spec_size = 8; + unsigned int spec_size = 8; struct pe_flush_cache_test_spec spec[8] = { { @@ -4448,7 +4448,7 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) int test_num = 3; unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG; - int spec_size = 8; + unsigned int spec_size = 8; struct pe_flush_cache_test_spec spec[8] = { { @@ -4570,7 +4570,7 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) int test_num = 4; unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_MARKED_ENTRIES_FLAG; - int spec_size = 8; + unsigned int spec_size = 8; struct pe_flush_cache_test_spec spec[8] = { { @@ -4701,7 +4701,7 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__FLUSH_MARKED_ENTRIES_FLAG; - int spec_size = 8; + unsigned int spec_size = 8; struct pe_flush_cache_test_spec spec[8] = { { @@ -4845,13 +4845,13 @@ static void check_flush_cache__multi_entry_test(H5F_t * file_ptr, int test_num, unsigned int flush_flags, - int spec_size, + unsigned int spec_size, struct flush_cache_test_spec spec[]) { H5C_t * cache_ptr = file_ptr->shared->cache; static char msg[128]; herr_t result; - int i; + unsigned u; size_t total_entry_size = 0; test_entry_t * base_addr; test_entry_t * entry_ptr; @@ -4890,43 +4890,43 @@ check_flush_cache__multi_entry_test(H5F_t * file_ptr, failure_mssg = msg; } - i = 0; - while(pass && (i < spec_size)) + u = 0; + while(pass && (u < spec_size)) { - if((spec[i].entry_num != i) || - (spec[i].entry_type < 0) || - (spec[i].entry_type >= NUMBER_OF_ENTRY_TYPES) || - (spec[i].entry_index < 0) || - (spec[i].entry_index > max_indices[spec[i].entry_type])) { + if(((unsigned)spec[u].entry_num != u) || + (spec[u].entry_type < 0) || + (spec[u].entry_type >= NUMBER_OF_ENTRY_TYPES) || + (spec[u].entry_index < 0) || + (spec[u].entry_index > max_indices[spec[u].entry_type])) { pass = FALSE; HDsnprintf(msg, (size_t)128, - "bad data in spec[%d] on entry to multi entry test #%d.", - i, test_num); + "bad data in spec[%u] on entry to multi entry test #%d.", + u, test_num); failure_mssg = msg; } - i++; + u++; } - i = 0; - while(pass && (i < spec_size)) + u = 0; + while(pass && (u < spec_size)) { - if(spec[i].insert_flag) { + if(spec[u].insert_flag) { - insert_entry(file_ptr, spec[i].entry_type, spec[i].entry_index, - spec[i].flags); + insert_entry(file_ptr, spec[u].entry_type, spec[u].entry_index, + spec[u].flags); } else { - protect_entry(file_ptr, spec[i].entry_type, spec[i].entry_index); + protect_entry(file_ptr, spec[u].entry_type, spec[u].entry_index); - unprotect_entry(file_ptr, spec[i].entry_type, spec[i].entry_index, - spec[i].flags); + unprotect_entry(file_ptr, spec[u].entry_type, spec[u].entry_index, + spec[u].flags); } - total_entry_size += entry_sizes[spec[i].entry_type]; + total_entry_size += entry_sizes[spec[u].entry_type]; - i++; + u++; } if(pass) { @@ -4943,36 +4943,36 @@ check_flush_cache__multi_entry_test(H5F_t * file_ptr, } } - i = 0; - while(pass && (i < spec_size)) + u = 0; + while(pass && (u < spec_size)) { - base_addr = entries[spec[i].entry_type]; - entry_ptr = &(base_addr[spec[i].entry_index]); + base_addr = entries[spec[u].entry_type]; + entry_ptr = &(base_addr[spec[u].entry_index]); - if((entry_ptr->deserialized != spec[i].expected_deserialized) || - (entry_ptr->serialized != spec[i].expected_serialized) || - (entry_ptr->destroyed != spec[i].expected_destroyed)) { + if((entry_ptr->deserialized != spec[u].expected_deserialized) || + (entry_ptr->serialized != spec[u].expected_serialized) || + (entry_ptr->destroyed != spec[u].expected_destroyed)) { #if 0 /* This is useful debugging code. Lets keep it around. */ HDfprintf(stdout, "deslzd = %d(%d), slzd = %d(%d), dest = %d(%d)\n", (int)(entry_ptr->deserialized), - (int)(spec[i].expected_deserialized), + (int)(spec[u].expected_deserialized), (int)(entry_ptr->serialized), - (int)(spec[i].expected_serialized), + (int)(spec[u].expected_serialized), (int)(entry_ptr->destroyed), - (int)(spec[i].expected_destroyed)); + (int)(spec[u].expected_destroyed)); #endif pass = FALSE; HDsnprintf(msg, (size_t)128, - "Bad status on entry %d after flush in multi entry test #%d.", - i, test_num); + "Bad status on entry %u after flush in multi entry test #%d.", + u, test_num); failure_mssg = msg; } - i++; + u++; } if(pass) { @@ -5027,17 +5027,17 @@ check_flush_cache__multi_entry_test(H5F_t * file_ptr, } } - i = 0; - while(pass && (i < spec_size)) + u = 0; + while(pass && (u < spec_size)) { - base_addr = entries[spec[i].entry_type]; - entry_ptr = &(base_addr[spec[i].entry_index]); + base_addr = entries[spec[u].entry_type]; + entry_ptr = &(base_addr[spec[u].entry_index]); entry_ptr->deserialized = FALSE; entry_ptr->serialized = FALSE; entry_ptr->destroyed = FALSE; - i++; + u++; } return; @@ -5064,13 +5064,13 @@ static void check_flush_cache__pe_multi_entry_test(H5F_t * file_ptr, int test_num, unsigned int flush_flags, - int spec_size, + unsigned int spec_size, struct pe_flush_cache_test_spec spec[]) { H5C_t *cache_ptr = file_ptr->shared->cache; static char msg[128]; herr_t result; - int i; + unsigned u; int j; size_t total_entry_size = 0; test_entry_t * base_addr; @@ -5110,54 +5110,54 @@ check_flush_cache__pe_multi_entry_test(H5F_t * file_ptr, failure_mssg = msg; } - i = 0; - while(pass && (i < spec_size)) + u = 0; + while(pass && (u < spec_size)) { - if((spec[i].entry_num != i) || - (spec[i].entry_type < 0) || - (spec[i].entry_type >= NUMBER_OF_ENTRY_TYPES) || - (spec[i].entry_index < 0) || - (spec[i].entry_index > max_indices[spec[i].entry_type]) || - (spec[i].num_pins < 0) || - (spec[i].num_pins > MAX_PINS)) { + if(((unsigned)spec[u].entry_num != u) || + (spec[u].entry_type < 0) || + (spec[u].entry_type >= NUMBER_OF_ENTRY_TYPES) || + (spec[u].entry_index < 0) || + (spec[u].entry_index > max_indices[spec[u].entry_type]) || + (spec[u].num_pins < 0) || + (spec[u].num_pins > MAX_PINS)) { pass = FALSE; HDsnprintf(msg, (size_t)128, - "bad data in spec[%d] on entry to pe multi entry test #%d.", - i, test_num); + "bad data in spec[%u] on entry to pe multi entry test #%d.", + u, test_num); failure_mssg = msg; } - i++; + u++; } - i = 0; - while(pass && (i < spec_size)) + u = 0; + while(pass && (u < spec_size)) { - if(spec[i].insert_flag) { + if(spec[u].insert_flag) { - insert_entry(file_ptr, spec[i].entry_type, spec[i].entry_index, - spec[i].flags); + insert_entry(file_ptr, spec[u].entry_type, spec[u].entry_index, + spec[u].flags); } else { - protect_entry(file_ptr, spec[i].entry_type, spec[i].entry_index); + protect_entry(file_ptr, spec[u].entry_type, spec[u].entry_index); - unprotect_entry(file_ptr, spec[i].entry_type, spec[i].entry_index, - spec[i].flags); + unprotect_entry(file_ptr, spec[u].entry_type, spec[u].entry_index, + spec[u].flags); } - total_entry_size += entry_sizes[spec[i].entry_type]; + total_entry_size += entry_sizes[spec[u].entry_type]; - for (j = 0; j < spec[i].num_pins; j++) + for (j = 0; j < spec[u].num_pins; j++) { create_pinned_entry_dependency(file_ptr, - spec[i].entry_type, - spec[i].entry_index, - spec[i].pin_type[j], - spec[i].pin_idx[j]); + spec[u].entry_type, + spec[u].entry_index, + spec[u].pin_type[j], + spec[u].pin_idx[j]); } - i++; + u++; } if(pass) { @@ -5174,36 +5174,36 @@ check_flush_cache__pe_multi_entry_test(H5F_t * file_ptr, } } - i = 0; - while(pass && (i < spec_size)) + u = 0; + while(pass && (u < spec_size)) { - base_addr = entries[spec[i].entry_type]; - entry_ptr = &(base_addr[spec[i].entry_index]); + base_addr = entries[spec[u].entry_type]; + entry_ptr = &(base_addr[spec[u].entry_index]); - if((entry_ptr->deserialized != spec[i].expected_deserialized) || - (entry_ptr->serialized != spec[i].expected_serialized) || - (entry_ptr->destroyed != spec[i].expected_destroyed)) { + if((entry_ptr->deserialized != spec[u].expected_deserialized) || + (entry_ptr->serialized != spec[u].expected_serialized) || + (entry_ptr->destroyed != spec[u].expected_destroyed)) { #if 0 /* This is useful debugging code. Lets keep it around. */ HDfprintf(stdout, "desrlzd = %d(%d), srlzd = %d(%d), dest = %d(%d)\n", (int)(entry_ptr->deserialized), - (int)(spec[i].expected_deserialized), + (int)(spec[u].expected_deserialized), (int)(entry_ptr->serialized), - (int)(spec[i].expected_serialized), + (int)(spec[u].expected_serialized), (int)(entry_ptr->destroyed), - (int)(spec[i].expected_destroyed)); + (int)(spec[u].expected_destroyed)); #endif pass = FALSE; HDsnprintf(msg, (size_t)128, - "Bad status on entry %d after flush in pe multi entry test #%d.", - i, test_num); + "Bad status on entry %u after flush in pe multi entry test #%d.", + u, test_num); failure_mssg = msg; } - i++; + u++; } if(pass) { @@ -5258,17 +5258,17 @@ check_flush_cache__pe_multi_entry_test(H5F_t * file_ptr, } } - i = 0; - while(pass && (i < spec_size)) + u = 0; + while(pass && (u < spec_size)) { - base_addr = entries[spec[i].entry_type]; - entry_ptr = &(base_addr[spec[i].entry_index]); + base_addr = entries[spec[u].entry_type]; + entry_ptr = &(base_addr[spec[u].entry_index]); entry_ptr->deserialized = FALSE; entry_ptr->serialized = FALSE; entry_ptr->destroyed = FALSE; - i++; + u++; } return; @@ -5323,9 +5323,9 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) int test_num = 1; unsigned int flush_flags = H5C__NO_FLAGS_SET; int spec_size = 2; - int init_expected_index_len = 2; + unsigned init_expected_index_len = 2; size_t init_expected_index_size = 2 * PICO_ENTRY_SIZE; - int expected_index_len = 2; + unsigned expected_index_len = 2; size_t expected_index_size = 2 * PICO_ENTRY_SIZE; struct fo_flush_cache_test_spec spec[2] = { @@ -5430,9 +5430,9 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) int test_num = 2; unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG; int spec_size = 2; - int init_expected_index_len = 2; + unsigned init_expected_index_len = 2; size_t init_expected_index_size = 2 * PICO_ENTRY_SIZE; - int expected_index_len = 0; + unsigned expected_index_len = 0; size_t expected_index_size = 0; struct fo_flush_cache_test_spec spec[2] = { @@ -5534,9 +5534,9 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) int test_num = 3; unsigned int flush_flags = H5C__NO_FLAGS_SET; int spec_size = 1; - int init_expected_index_len = 1; + unsigned init_expected_index_len = 1; size_t init_expected_index_size = VARIABLE_ENTRY_SIZE / 4; - int expected_index_len = 1; + unsigned expected_index_len = 1; size_t expected_index_size = VARIABLE_ENTRY_SIZE / 2; struct fo_flush_cache_test_spec spec[1] = { @@ -5612,9 +5612,9 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) int test_num = 4; unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG; int spec_size = 1; - int init_expected_index_len = 1; + unsigned init_expected_index_len = 1; size_t init_expected_index_size = VARIABLE_ENTRY_SIZE / 4; - int expected_index_len = 0; + unsigned expected_index_len = 0; size_t expected_index_size = 0; struct fo_flush_cache_test_spec spec[1] = { @@ -5697,9 +5697,9 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) int test_num = 5; /* and 6 */ unsigned int flush_flags = H5C__NO_FLAGS_SET; int spec_size = 1; - int init_expected_index_len = 1; + unsigned init_expected_index_len = 1; size_t init_expected_index_size = VARIABLE_ENTRY_SIZE; - int expected_index_len = 1; + unsigned expected_index_len = 1; size_t expected_index_size = VARIABLE_ENTRY_SIZE / 2; struct fo_flush_cache_test_spec spec[1] = { @@ -5814,9 +5814,9 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) int test_num = 7; /* and 8 */ unsigned int flush_flags = H5C__NO_FLAGS_SET; int spec_size = 1; - int init_expected_index_len = 1; + unsigned init_expected_index_len = 1; size_t init_expected_index_size = VARIABLE_ENTRY_SIZE; - int expected_index_len = 1; + unsigned expected_index_len = 1; size_t expected_index_size = VARIABLE_ENTRY_SIZE / 2; struct fo_flush_cache_test_spec spec[1] = { @@ -5927,9 +5927,9 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) int test_num = 9; /* and 10 */ unsigned int flush_flags = H5C__NO_FLAGS_SET; int spec_size = 1; - int init_expected_index_len = 1; + unsigned init_expected_index_len = 1; size_t init_expected_index_size = VARIABLE_ENTRY_SIZE / 2; - int expected_index_len = 1; + unsigned expected_index_len = 1; size_t expected_index_size = VARIABLE_ENTRY_SIZE / 4; struct fo_flush_cache_test_spec spec[1] = { @@ -6038,9 +6038,9 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) int test_num = 11; /* and 12 */ unsigned int flush_flags = H5C__NO_FLAGS_SET; int spec_size = 1; - int init_expected_index_len = 1; + unsigned init_expected_index_len = 1; size_t init_expected_index_size = VARIABLE_ENTRY_SIZE / 2; - int expected_index_len = 1; + unsigned expected_index_len = 1; size_t expected_index_size = VARIABLE_ENTRY_SIZE / 4; struct fo_flush_cache_test_spec spec[1] = { @@ -6152,9 +6152,9 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) int test_num = 13; unsigned int flush_flags = H5C__NO_FLAGS_SET; int spec_size = 1; - int init_expected_index_len = 1; + unsigned init_expected_index_len = 1; size_t init_expected_index_size = 1 * PICO_ENTRY_SIZE; - int expected_index_len = 3; + unsigned expected_index_len = 3; size_t expected_index_size = 3 * PICO_ENTRY_SIZE; struct fo_flush_cache_test_spec spec[1] = { @@ -6248,9 +6248,9 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) int test_num = 14; unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG; int spec_size = 1; - int init_expected_index_len = 1; + unsigned init_expected_index_len = 1; size_t init_expected_index_size = 1 * PICO_ENTRY_SIZE; - int expected_index_len = 0; + unsigned expected_index_len = 0; size_t expected_index_size = (size_t)0; struct fo_flush_cache_test_spec spec[1] = { @@ -6341,9 +6341,9 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) int test_num = 15; unsigned int flush_flags = H5C__NO_FLAGS_SET; int spec_size = 1; - int init_expected_index_len = 1; + unsigned init_expected_index_len = 1; size_t init_expected_index_size = 1 * VARIABLE_ENTRY_SIZE; - int expected_index_len = 3; + unsigned expected_index_len = 3; size_t expected_index_size = VARIABLE_ENTRY_SIZE + (VARIABLE_ENTRY_SIZE / 4) + (VARIABLE_ENTRY_SIZE / 2); @@ -6438,9 +6438,9 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) int test_num = 16; unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG; int spec_size = 1; - int init_expected_index_len = 1; + unsigned init_expected_index_len = 1; size_t init_expected_index_size = 1 * VARIABLE_ENTRY_SIZE; - int expected_index_len = 0; + unsigned expected_index_len = 0; size_t expected_index_size = (size_t)0; struct fo_flush_cache_test_spec spec[1] = { @@ -6531,9 +6531,9 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) int test_num = 17; /* and 18 */ unsigned int flush_flags = H5C__NO_FLAGS_SET; int spec_size = 1; - int init_expected_index_len = 1; + unsigned init_expected_index_len = 1; size_t init_expected_index_size = 1 * VARIABLE_ENTRY_SIZE; - int expected_index_len = 3; + unsigned expected_index_len = 3; size_t expected_index_size = VARIABLE_ENTRY_SIZE + (VARIABLE_ENTRY_SIZE / 4) + (VARIABLE_ENTRY_SIZE / 2); @@ -6658,9 +6658,9 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) int test_num = 19; /* and 20 */ unsigned int flush_flags = H5C__NO_FLAGS_SET; int spec_size = 1; - int init_expected_index_len = 1; + unsigned init_expected_index_len = 1; size_t init_expected_index_size = 1 * VARIABLE_ENTRY_SIZE; - int expected_index_len = 3; + unsigned expected_index_len = 3; size_t expected_index_size = VARIABLE_ENTRY_SIZE + (VARIABLE_ENTRY_SIZE / 4) + (VARIABLE_ENTRY_SIZE / 2); @@ -6796,9 +6796,9 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) int test_num = 21; unsigned int flush_flags = H5C__FLUSH_MARKED_ENTRIES_FLAG; int spec_size = 4; - int init_expected_index_len = 4; + unsigned init_expected_index_len = 4; size_t init_expected_index_size = (2 * VARIABLE_ENTRY_SIZE) + (2 * PICO_ENTRY_SIZE); - int expected_index_len = 6; + unsigned expected_index_len = 6; size_t expected_index_size = (2 * VARIABLE_ENTRY_SIZE) + (VARIABLE_ENTRY_SIZE / 4) + (VARIABLE_ENTRY_SIZE / 2) + @@ -7007,9 +7007,9 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) int test_num = 22; unsigned int flush_flags = H5C__NO_FLAGS_SET; int spec_size = 6; - int init_expected_index_len = 6; + unsigned init_expected_index_len = 6; size_t init_expected_index_size = (2 * VARIABLE_ENTRY_SIZE) + (4 * PICO_ENTRY_SIZE); - int expected_index_len = 10; + unsigned expected_index_len = 10; size_t expected_index_size = (2 * VARIABLE_ENTRY_SIZE) + (2 * (VARIABLE_ENTRY_SIZE / 4)) + (2 * (VARIABLE_ENTRY_SIZE / 2)) + @@ -7276,9 +7276,9 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) int test_num = 23; unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG; int spec_size = 6; - int init_expected_index_len = 6; + unsigned init_expected_index_len = 6; size_t init_expected_index_size = (2 * VARIABLE_ENTRY_SIZE) + (4 * PICO_ENTRY_SIZE); - int expected_index_len = 0; + unsigned expected_index_len = 0; size_t expected_index_size = 0; struct fo_flush_cache_test_spec spec[6] = { @@ -7538,9 +7538,9 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) int test_num = 24; unsigned int flush_flags = H5C__NO_FLAGS_SET; int spec_size = 3; - int init_expected_index_len = 3; + unsigned init_expected_index_len = 3; size_t init_expected_index_size = 3 * PICO_ENTRY_SIZE; - int expected_index_len = 3; + unsigned expected_index_len = 3; size_t expected_index_size = 3 * PICO_ENTRY_SIZE; struct fo_flush_cache_test_spec spec[3] = { @@ -7671,9 +7671,9 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) int test_num = 25; unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG; int spec_size = 3; - int init_expected_index_len = 3; + unsigned init_expected_index_len = 3; size_t init_expected_index_size = 3 * PICO_ENTRY_SIZE; - int expected_index_len = 0; + unsigned expected_index_len = 0; size_t expected_index_size = (size_t)0; struct fo_flush_cache_test_spec spec[3] = { @@ -7874,9 +7874,9 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) int test_num = 26; unsigned int flush_flags = H5C__NO_FLAGS_SET; int spec_size = 10; - int init_expected_index_len = 10; + unsigned init_expected_index_len = 10; size_t init_expected_index_size = 10 * VARIABLE_ENTRY_SIZE; - int expected_index_len = 13; + unsigned expected_index_len = 13; size_t expected_index_size = 9 * VARIABLE_ENTRY_SIZE; struct fo_flush_cache_test_spec spec[10] = { @@ -8308,9 +8308,9 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) int test_num = 27; unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG; int spec_size = 10; - int init_expected_index_len = 10; + unsigned init_expected_index_len = 10; size_t init_expected_index_size = 10 * VARIABLE_ENTRY_SIZE; - int expected_index_len = 0; + unsigned expected_index_len = 0; size_t expected_index_size = (size_t)0; struct fo_flush_cache_test_spec spec[10] = { @@ -8667,9 +8667,9 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) int test_num = 28; unsigned int flush_flags = H5C__NO_FLAGS_SET; int spec_size = 5; - int init_expected_index_len = 5; + unsigned init_expected_index_len = 5; size_t init_expected_index_size = 3 * VARIABLE_ENTRY_SIZE; - int expected_index_len = 5; + unsigned expected_index_len = 5; size_t expected_index_size = 4 * VARIABLE_ENTRY_SIZE; struct fo_flush_cache_test_spec spec[5] = { @@ -8859,9 +8859,9 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) int test_num = 29; unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG; int spec_size = 5; - int init_expected_index_len = 5; + unsigned init_expected_index_len = 5; size_t init_expected_index_size = 3 * VARIABLE_ENTRY_SIZE; - int expected_index_len = 0; + unsigned expected_index_len = 0; size_t expected_index_size = 0; struct fo_flush_cache_test_spec spec[5] = { @@ -9070,9 +9070,9 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr, unsigned int flush_flags, int spec_size, const struct fo_flush_cache_test_spec spec[], - int init_expected_index_len, + unsigned init_expected_index_len, size_t init_expected_index_size, - int expected_index_len, + unsigned expected_index_len, size_t expected_index_size, int check_size, struct fo_flush_entry_check check[]) @@ -16093,7 +16093,7 @@ check_duplicate_insert_err(void) entry_ptr = &(base_addr[0]); result = H5C_insert_entry(file_ptr, H5AC_ind_read_dxpl_id, - &(types[0]), entry_ptr->addr, + types[0], entry_ptr->addr, (void *)entry_ptr, H5C__NO_FLAGS_SET); if(result >= 0) { @@ -16461,7 +16461,7 @@ check_double_protect_err(void) if(pass) { cache_entry_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr, H5AC_ind_read_dxpl_id, - &(types[0]), entry_ptr->addr, + types[0], entry_ptr->addr, &entry_ptr->addr, H5C__NO_FLAGS_SET); if(cache_entry_ptr != NULL) { @@ -16705,7 +16705,7 @@ check_expunge_entry_errs(void) if(pass) { result = H5C_expunge_entry(file_ptr, H5AC_ind_read_dxpl_id, - &(types[0]), entry_ptr->addr, H5C__NO_FLAGS_SET); + types[0], entry_ptr->addr, H5C__NO_FLAGS_SET); if(result > 0) { @@ -16723,7 +16723,7 @@ check_expunge_entry_errs(void) if(pass) { result = H5C_expunge_entry(file_ptr, H5AC_ind_read_dxpl_id, - &(types[0]), entry_ptr->addr, H5C__NO_FLAGS_SET); + types[0], entry_ptr->addr, H5C__NO_FLAGS_SET); if(result > 0) { @@ -16741,7 +16741,7 @@ check_expunge_entry_errs(void) if(pass) { result = H5C_expunge_entry(file_ptr, H5AC_ind_read_dxpl_id, - &(types[0]), entry_ptr->addr, H5C__NO_FLAGS_SET); + types[0], entry_ptr->addr, H5C__NO_FLAGS_SET); if(result < 0) { @@ -16823,7 +16823,7 @@ check_move_entry_errs(void) if(pass) { - result = H5C_move_entry(cache_ptr, &(types[0]), + result = H5C_move_entry(cache_ptr, types[0], entry_0_0_ptr->addr, entry_0_1_ptr->addr); if(result >= 0) { @@ -16835,7 +16835,7 @@ check_move_entry_errs(void) if(pass) { - result = H5C_move_entry(cache_ptr, &(types[0]), + result = H5C_move_entry(cache_ptr, types[0], entry_0_0_ptr->addr, entry_1_0_ptr->addr); if(result >= 0) { @@ -16874,7 +16874,7 @@ check_move_entry_errs(void) if(pass) { - result = H5C_move_entry(cache_ptr, &(types[0]), entry_ptr->header.addr, entry_ptr->header.addr + 10); + result = H5C_move_entry(cache_ptr, types[0], entry_ptr->header.addr, entry_ptr->header.addr + 10); if(result >= 0) { @@ -17179,7 +17179,7 @@ check_protect_ro_rw_err(void) if(pass) { thing_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr, H5AC_ind_read_dxpl_id, - &(types[0]), entry_ptr->addr, + types[0], entry_ptr->addr, &entry_ptr->addr, H5C__NO_FLAGS_SET); if(thing_ptr != NULL) { @@ -17272,13 +17272,13 @@ check_protect_retries(void) entry_ptr->verify_ct = 0; cache_entry_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr, H5AC_ind_read_dxpl_id, - &(types[type]), entry_ptr->addr, &entry_ptr->addr, H5C__READ_ONLY_FLAG); + types[type], entry_ptr->addr, &entry_ptr->addr, H5C__READ_ONLY_FLAG); if((cache_entry_ptr != (void *)entry_ptr) || (!(entry_ptr->header.is_protected)) || (!(entry_ptr->header.is_read_only)) || (entry_ptr->header.ro_ref_count <= 0) || - (entry_ptr->header.type != &(types[type])) || + (entry_ptr->header.type != types[type]) || (entry_ptr->size != entry_ptr->header.size) || (entry_ptr->addr != entry_ptr->header.addr) || (entry_ptr->verify_ct != entry_ptr->max_verify_ct)) { @@ -17317,7 +17317,7 @@ check_protect_retries(void) entry_ptr->verify_ct = 0; cache_entry_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr, H5AC_ind_read_dxpl_id, - &(types[type]), entry_ptr->addr, &entry_ptr->addr, H5C__READ_ONLY_FLAG); + types[type], entry_ptr->addr, &entry_ptr->addr, H5C__READ_ONLY_FLAG); /* H5C_protect() should fail after all retries fail */ if(cache_entry_ptr != NULL) @@ -27433,7 +27433,7 @@ check_auto_cache_resize_aux_fcns(void) size_t max_size; size_t min_clean_size; size_t cur_size; - int32_t cur_num_entries; + uint32_t cur_num_entries; H5C_auto_size_ctl_t auto_size_ctl = { /* int32_t version = */ H5C__CURR_AUTO_SIZE_CTL_VER, @@ -34580,7 +34580,7 @@ cedds__expunge_dirty_entry_in_flush_test(H5F_t * file_ptr) /*------------------------------------------------------------------------- * Function: cedds__H5C_make_space_in_cache() * - * Purpose: Verify that H5C_make_space_in_cache() can handle the + * Purpose: Verify that H5C__make_space_in_cache() can handle the * removal from the cache of the next item in its reverse scan * of the LRU list. * @@ -34590,7 +34590,7 @@ cedds__expunge_dirty_entry_in_flush_test(H5F_t * file_ptr) * load an additional entry, triggering the flush of the last * item, and thereby the deletion of the second to last item. * - * H5C_make_space_in_cache() should detect this deletion, and + * H5C__make_space_in_cache() should detect this deletion, and * restart its scan of the LRU from the tail, instead of * examining the now deleted next item up on the LRU. * @@ -34668,7 +34668,7 @@ cedds__H5C_make_space_in_cache(H5F_t * file_ptr) if(cache_ptr == NULL) { pass = FALSE; - failure_mssg = "cache_ptr NULL on entry to cedds for H5C_make_space_in_cache() test."; + failure_mssg = "cache_ptr NULL on entry to cedds for H5C__make_space_in_cache() test."; } else if((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0)) { @@ -34808,7 +34808,7 @@ cedds__H5C_make_space_in_cache(H5F_t * file_ptr) * and HET 0, 2, and 3 will be evicted to make room for the new * monster entry (MET, 31). * - * Verify this. If H5C_make_space_in_cache() chokes, failure will + * Verify this. If H5C__make_space_in_cache() chokes, failure will * be detected in protect_entry(). Thus end the "if(pass)" clause * there so the error message will not be overwritten. */ @@ -34971,7 +34971,7 @@ cedds__H5C_make_space_in_cache(H5F_t * file_ptr) * access the first item in the LRU repeatedly until the * item, and thereby the deletion of the second to last item. * - * H5C_make_space_in_cache() should detect this deletion, and + * H5C__make_space_in_cache() should detect this deletion, and * restart its scan of the LRU from the tail, instead of * examining the now deleted next item up on the LRU. * diff --git a/test/cache_common.c b/test/cache_common.c index 5151d65..59328f7 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -288,27 +288,9 @@ const haddr_t alt_base_addrs[NUMBER_OF_ENTRY_TYPES] = NOTIFY_ALT_BASE_ADDR }; -const char *entry_type_names[NUMBER_OF_ENTRY_TYPES] = -{ - "pico entries -- 1 B", - "nano entries -- 4 B", - "micro entries -- 16 B", - "tiny entries -- 64 B", - "small entries -- 256 B", - "medium entries -- 1 KB", - "large entries -- 4 KB", - "huge entries -- 16 KB", - "monster entries -- 64 KB", - "variable entries -- 1B - 10KB", - "notify entries -- 1B" -}; - -/* callback table declaration */ - -const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] = -{ - { +/* Callback classes */ +static const H5C_class_t pico_class[1] = {{ PICO_ENTRY_TYPE, "pico_entry", H5FD_MEM_DEFAULT, @@ -323,8 +305,9 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] = NULL, pico_free_icr, NULL, - }, - { +}}; + +static const H5C_class_t nano_class[1] = {{ NANO_ENTRY_TYPE, "nano_entry", H5FD_MEM_DEFAULT, @@ -339,8 +322,9 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] = NULL, nano_free_icr, NULL, - }, - { +}}; + +static const H5C_class_t micro_class[1] = {{ MICRO_ENTRY_TYPE, "micro_entry", H5FD_MEM_DEFAULT, @@ -355,8 +339,9 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] = NULL, micro_free_icr, NULL, - }, - { +}}; + +static const H5C_class_t tiny_class[1] = {{ TINY_ENTRY_TYPE, "tiny_entry", H5FD_MEM_DEFAULT, @@ -371,8 +356,9 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] = NULL, tiny_free_icr, NULL, - }, - { +}}; + +static const H5C_class_t small_class[1] = {{ SMALL_ENTRY_TYPE, "small_entry", H5FD_MEM_DEFAULT, @@ -387,8 +373,9 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] = NULL, small_free_icr, NULL, - }, - { +}}; + +static const H5C_class_t medium_class[1] = {{ MEDIUM_ENTRY_TYPE, "medium_entry", H5FD_MEM_DEFAULT, @@ -403,8 +390,9 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] = NULL, medium_free_icr, NULL, - }, - { +}}; + +static const H5C_class_t large_class[1] = {{ LARGE_ENTRY_TYPE, "large_entry", H5FD_MEM_DEFAULT, @@ -419,8 +407,9 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] = NULL, large_free_icr, NULL, - }, - { +}}; + +static const H5C_class_t huge_class[1] = {{ HUGE_ENTRY_TYPE, "huge_entry", H5FD_MEM_DEFAULT, @@ -435,8 +424,9 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] = NULL, huge_free_icr, NULL, - }, - { +}}; + +static const H5C_class_t monster_class[1] = {{ MONSTER_ENTRY_TYPE, "monster_entry", H5FD_MEM_DEFAULT, @@ -451,8 +441,9 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] = NULL, monster_free_icr, NULL, - }, - { +}}; + +static const H5C_class_t variable_class[1] = {{ VARIABLE_ENTRY_TYPE, "variable_entry", H5FD_MEM_DEFAULT, @@ -467,8 +458,9 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] = NULL, variable_free_icr, NULL, - }, - { +}}; + +static const H5C_class_t notify_class[1] = {{ NOTIFY_ENTRY_TYPE, "notify_entry", H5FD_MEM_DEFAULT, @@ -483,7 +475,22 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] = notify_notify, notify_free_icr, NULL, - } +}}; + +/* callback table declaration */ + +const H5C_class_t *types[NUMBER_OF_ENTRY_TYPES] = { + pico_class, + nano_class, + micro_class, + tiny_class, + small_class, + medium_class, + large_class, + huge_class, + monster_class, + variable_class, + notify_class }; /* address translation functions: */ @@ -3300,7 +3307,7 @@ setup_cache(size_t max_cache_size, cache_ptr = H5C_create(max_cache_size, min_clean_size, (NUMBER_OF_ENTRY_TYPES - 1), - (const char **)entry_type_names, + types, check_write_permitted, TRUE, NULL, @@ -3533,7 +3540,7 @@ expunge_entry(H5F_t * file_ptr, HDassert( ! ( entry_ptr->is_pinned ) ); result = H5C_expunge_entry(file_ptr, H5AC_ind_read_dxpl_id, - &(types[type]), entry_ptr->addr, H5C__NO_FLAGS_SET); + types[type], entry_ptr->addr, H5C__NO_FLAGS_SET); if ( result < 0 ) { @@ -3754,11 +3761,11 @@ insert_entry(H5F_t * file_ptr, } result = H5C_insert_entry(file_ptr, xfer, - &(types[type]), entry_ptr->addr, (void *)entry_ptr, flags); + types[type], entry_ptr->addr, (void *)entry_ptr, flags); if ( ( result < 0 ) || ( entry_ptr->header.is_protected ) || - ( entry_ptr->header.type != &(types[type]) ) || + ( entry_ptr->header.type != types[type] ) || ( entry_ptr->size != entry_ptr->header.size ) || ( entry_ptr->addr != entry_ptr->header.addr ) ) { @@ -3771,8 +3778,8 @@ insert_entry(H5F_t * file_ptr, HDfprintf(stdout, "entry_ptr->header.is_protected = %d\n", (int)(entry_ptr->header.is_protected)); HDfprintf(stdout, - "entry_ptr->header.type != &(types[type]) = %d\n", - (int)(entry_ptr->header.type != &(types[type]))); + "entry_ptr->header.type != types[type] = %d\n", + (int)(entry_ptr->header.type != types[type])); HDfprintf(stdout, "entry_ptr->size != entry_ptr->header.size = %d\n", (int)(entry_ptr->size != entry_ptr->header.size)); @@ -3855,7 +3862,7 @@ mark_entry_dirty(int32_t type, ( !entry_ptr->header.is_protected && !entry_ptr->header.is_pinned ) || ( entry_ptr->header.is_protected && !entry_ptr->header.dirtied ) || ( !entry_ptr->header.is_protected && !entry_ptr->header.is_dirty ) || - ( entry_ptr->header.type != &(types[type]) ) || + ( entry_ptr->header.type != types[type] ) || ( entry_ptr->size != entry_ptr->header.size ) || ( entry_ptr->addr != entry_ptr->header.addr ) ) { @@ -3948,7 +3955,7 @@ move_entry(H5C_t * cache_ptr, mark_flush_dep_dirty(entry_ptr); entry_ptr->action = TEST_ENTRY_ACTION_MOVE; - result = H5C_move_entry(cache_ptr, &(types[type]), old_addr, new_addr); + result = H5C_move_entry(cache_ptr, types[type], old_addr, new_addr); entry_ptr->action = TEST_ENTRY_ACTION_NUL; } @@ -4027,12 +4034,12 @@ protect_entry(H5F_t * file_ptr, int32_t type, int32_t idx) } /* end if */ cache_entry_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr, xfer, - &(types[type]), entry_ptr->addr, &entry_ptr->addr, + types[type], entry_ptr->addr, &entry_ptr->addr, H5C__NO_FLAGS_SET); if ( ( cache_entry_ptr != (void *)entry_ptr ) || ( !(entry_ptr->header.is_protected) ) || - ( entry_ptr->header.type != &(types[type]) ) || + ( entry_ptr->header.type != types[type] ) || ( entry_ptr->size != entry_ptr->header.size ) || ( entry_ptr->addr != entry_ptr->header.addr ) ) { @@ -4049,8 +4056,8 @@ protect_entry(H5F_t * file_ptr, int32_t type, int32_t idx) HDfprintf(stdout, "entry_ptr->header.is_protected = %d\n", (int)(entry_ptr->header.is_protected)); HDfprintf(stdout, - "( entry_ptr->header.type != &(types[type]) ) = %d\n", - (int)( entry_ptr->header.type != &(types[type]) )); + "( entry_ptr->header.type != types[type] ) = %d\n", + (int)( entry_ptr->header.type != types[type] )); HDfprintf(stdout, "entry_ptr->size = %d, entry_ptr->header.size = %d\n", (int)(entry_ptr->size), (int)(entry_ptr->header.size)); @@ -4131,13 +4138,13 @@ protect_entry_ro(H5F_t * file_ptr, ( entry_ptr->ro_ref_count > 0 ) ) ); cache_entry_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr, H5AC_ind_read_dxpl_id, - &(types[type]), entry_ptr->addr, &entry_ptr->addr, H5C__READ_ONLY_FLAG); + types[type], entry_ptr->addr, &entry_ptr->addr, H5C__READ_ONLY_FLAG); if ( ( cache_entry_ptr != (void *)entry_ptr ) || ( !(entry_ptr->header.is_protected) ) || ( !(entry_ptr->header.is_read_only) ) || ( entry_ptr->header.ro_ref_count <= 0 ) || - ( entry_ptr->header.type != &(types[type]) ) || + ( entry_ptr->header.type != types[type] ) || ( entry_ptr->size != entry_ptr->header.size ) || ( entry_ptr->addr != entry_ptr->header.addr ) ) { @@ -4268,7 +4275,7 @@ unpin_entry(int32_t type, if ( ( result < 0 ) || ( entry_ptr->header.pinned_from_client ) || ( entry_ptr->header.is_pinned && !entry_ptr->header.pinned_from_cache ) || - ( entry_ptr->header.type != &(types[type]) ) || + ( entry_ptr->header.type != types[type] ) || ( entry_ptr->size != entry_ptr->header.size ) || ( entry_ptr->addr != entry_ptr->header.addr ) ) { @@ -4353,7 +4360,7 @@ unprotect_entry(H5F_t * file_ptr, ( ( entry_ptr->header.is_protected ) && ( ( ! ( entry_ptr->is_read_only ) ) || ( entry_ptr->ro_ref_count <= 0 ) ) ) || - ( entry_ptr->header.type != &(types[type]) ) || + ( entry_ptr->header.type != types[type] ) || ( entry_ptr->size != entry_ptr->header.size ) || ( entry_ptr->addr != entry_ptr->header.addr ) ) { @@ -6128,7 +6135,7 @@ check_and_validate_cache_size(hid_t file_id, size_t min_clean_size; size_t expected_cur_size; size_t cur_size; - int32_t expected_cur_num_entries; + uint32_t expected_cur_num_entries; int cur_num_entries; H5F_t * file_ptr = NULL; H5C_t * cache_ptr = NULL; diff --git a/test/cache_common.h b/test/cache_common.h index befcee4..f003189 100644 --- a/test/cache_common.h +++ b/test/cache_common.h @@ -553,11 +553,10 @@ H5TEST_DLLVAR const int32_t max_indices[NUMBER_OF_ENTRY_TYPES]; H5TEST_DLLVAR const size_t entry_sizes[NUMBER_OF_ENTRY_TYPES]; H5TEST_DLLVAR const haddr_t base_addrs[NUMBER_OF_ENTRY_TYPES]; H5TEST_DLLVAR const haddr_t alt_base_addrs[NUMBER_OF_ENTRY_TYPES]; -H5TEST_DLLVAR const char * entry_type_names[NUMBER_OF_ENTRY_TYPES]; /* callback table extern */ -H5TEST_DLLVAR const H5C_class_t types[NUMBER_OF_ENTRY_TYPES]; +H5TEST_DLLVAR const H5C_class_t *types[NUMBER_OF_ENTRY_TYPES]; #ifdef __cplusplus diff --git a/test/cache_image.c b/test/cache_image.c new file mode 100644 index 0000000..c91914d --- /dev/null +++ b/test/cache_image.c @@ -0,0 +1,6490 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * 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 files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* Programmer: John Mainzer + * 7/13/15 + * + * This file contains tests specific to the cache image + * feature implemented in H5C.c + */ +#include "cache_common.h" +#include "genall5.h" + +/* global variable declarations: */ + + +const char *FILENAMES[] = { + "cache_image_test", + NULL +}; + +/* local utility function declarations */ +static void create_datasets(hid_t file_id, int min_dset, int max_dset); +static void delete_datasets(hid_t file_id, int min_dset, int max_dset); +static void open_hdf5_file(hbool_t create_file, hbool_t mdci_sbem_expected, + hbool_t read_only, hbool_t set_mdci_fapl, hbool_t config_fsm, + const char *hdf_file_name, unsigned cache_image_flags, + hid_t *file_id_ptr, H5F_t **file_ptr_ptr, H5C_t **cache_ptr_ptr); +static void attempt_swmr_open_hdf5_file(hbool_t create_file, + hbool_t set_mdci_fapl, const char *hdf_file_name); +static void verify_datasets(hid_t file_id, int min_dset, int max_dset); + +/* local test function declarations */ +static unsigned check_cache_image_ctl_flow_1(void); +static unsigned check_cache_image_ctl_flow_2(void); +static unsigned check_cache_image_ctl_flow_3(void); +static unsigned check_cache_image_ctl_flow_4(void); +static unsigned check_cache_image_ctl_flow_5(void); +static unsigned check_cache_image_ctl_flow_6(void); + +static unsigned cache_image_smoke_check_1(void); +static unsigned cache_image_smoke_check_2(void); +static unsigned cache_image_smoke_check_3(void); +static unsigned cache_image_smoke_check_4(void); +static unsigned cache_image_smoke_check_5(void); +static unsigned cache_image_smoke_check_6(void); + +static unsigned cache_image_api_error_check_1(void); +static unsigned cache_image_api_error_check_2(void); +static unsigned cache_image_api_error_check_3(void); + + +/****************************************************************************/ +/***************************** Utility Functions ****************************/ +/****************************************************************************/ + +/*------------------------------------------------------------------------- + * Function: create_datasets() + * + * Purpose: If pass is TRUE on entry, create the specified datasets + * in the indicated file. + * + * Datasets and their contents must be well known, as we + * will verify that they contain the expected data later. + * + * On failure, set pass to FALSE, and set failure_mssg + * to point to an appropriate failure message. + * + * Do nothing if pass is FALSE on entry. + * + * Return: void + * + * Programmer: John Mainzer + * 7/15/15 + * + *------------------------------------------------------------------------- + */ + +#define CHUNK_SIZE 10 +#define DSET_SIZE (40 * CHUNK_SIZE) +#define MAX_NUM_DSETS 256 + +static void +create_datasets(hid_t file_id, int min_dset, int max_dset) +{ + const char * fcn_name = "create_datasets()"; + char dset_name[64]; + hbool_t show_progress = FALSE; + hbool_t valid_chunk; + hbool_t verbose = FALSE; + int cp = 0; + int i, j, k, l, m; + int data_chunk[CHUNK_SIZE][CHUNK_SIZE]; + herr_t status; + hid_t dataspace_id = -1; + hid_t filespace_ids[MAX_NUM_DSETS]; + hid_t memspace_id = -1; + hid_t dataset_ids[MAX_NUM_DSETS]; + hid_t properties = -1; + hsize_t dims[2]; + hsize_t a_size[2]; + hsize_t offset[2]; + hsize_t chunk_size[2]; + + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); + + HDassert(0 <= min_dset); + HDassert(min_dset <= max_dset); + HDassert(max_dset < MAX_NUM_DSETS); + + /* create the datasets */ + + if ( pass ) { + + i = min_dset; + + while ( ( pass ) && ( i <= max_dset ) ) + { + /* create a dataspace for the chunked dataset */ + dims[0] = DSET_SIZE; + dims[1] = DSET_SIZE; + dataspace_id = H5Screate_simple(2, dims, NULL); + + if ( dataspace_id < 0 ) { + + pass = FALSE; + failure_mssg = "H5Screate_simple() failed."; + } + + /* set the dataset creation plist to specify that the raw data is + * to be partioned into 10X10 element chunks. + */ + + if ( pass ) { + + chunk_size[0] = CHUNK_SIZE; + chunk_size[1] = CHUNK_SIZE; + properties = H5Pcreate(H5P_DATASET_CREATE); + + if ( properties < 0 ) { + + pass = FALSE; + failure_mssg = "H5Pcreate() failed."; + } + } + + if ( pass ) { + + if ( H5Pset_chunk(properties, 2, chunk_size) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Pset_chunk() failed."; + } + } + + /* create the dataset */ + if ( pass ) { + + sprintf(dset_name, "/dset%03d", i); + dataset_ids[i] = H5Dcreate2(file_id, dset_name, H5T_STD_I32BE, + dataspace_id, H5P_DEFAULT, + properties, H5P_DEFAULT); + + if ( dataset_ids[i] < 0 ) { + + pass = FALSE; + failure_mssg = "H5Dcreate() failed."; + } + } + + /* get the file space ID */ + if ( pass ) { + + filespace_ids[i] = H5Dget_space(dataset_ids[i]); + + if ( filespace_ids[i] < 0 ) { + + pass = FALSE; + failure_mssg = "H5Dget_space() failed."; + } + } + + i++; + } + } + + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); + + /* create the mem space to be used to read and write chunks */ + if ( pass ) { + + dims[0] = CHUNK_SIZE; + dims[1] = CHUNK_SIZE; + memspace_id = H5Screate_simple(2, dims, NULL); + + if ( memspace_id < 0 ) { + + pass = FALSE; + failure_mssg = "H5Screate_simple() failed."; + } + } + + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); + + /* select in memory hyperslab */ + if ( pass ) { + + offset[0] = 0; /*offset of hyperslab in memory*/ + offset[1] = 0; + a_size[0] = CHUNK_SIZE; /*size of hyperslab*/ + a_size[1] = CHUNK_SIZE; + status = H5Sselect_hyperslab(memspace_id, H5S_SELECT_SET, offset, NULL, + a_size, NULL); + + if ( status < 0 ) { + + pass = FALSE; + failure_mssg = "H5Sselect_hyperslab() failed."; + } + } + + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); + + /* initialize all datasets on a round robin basis */ + i = 0; + while ( ( pass ) && ( i < DSET_SIZE ) ) + { + j = 0; + while ( ( pass ) && ( j < DSET_SIZE ) ) + { + m = min_dset; + while ( ( pass ) && ( m <= max_dset ) ) + { + /* initialize the slab */ + for ( k = 0; k < CHUNK_SIZE; k++ ) + { + for ( l = 0; l < CHUNK_SIZE; l++ ) + { + data_chunk[k][l] = (DSET_SIZE * DSET_SIZE * m) + + (DSET_SIZE * (i + k)) + j + l; + } + } + + /* select on disk hyperslab */ + offset[0] = (hsize_t)i; /*offset of hyperslab in file*/ + offset[1] = (hsize_t)j; + a_size[0] = CHUNK_SIZE; /*size of hyperslab*/ + a_size[1] = CHUNK_SIZE; + status = H5Sselect_hyperslab(filespace_ids[m], H5S_SELECT_SET, + offset, NULL, a_size, NULL); + + if ( status < 0 ) { + + pass = FALSE; + failure_mssg = "disk H5Sselect_hyperslab() failed."; + } + + /* write the chunk to file */ + status = H5Dwrite(dataset_ids[m], H5T_NATIVE_INT, memspace_id, + filespace_ids[m], H5P_DEFAULT, data_chunk); + + if ( status < 0 ) { + + pass = FALSE; + failure_mssg = "H5Dwrite() failed."; + } + m++; + } + j += CHUNK_SIZE; + } + + i += CHUNK_SIZE; + } + + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); + + /* read data from datasets and validate it */ + i = 0; + while ( ( pass ) && ( i < DSET_SIZE ) ) + { + j = 0; + while ( ( pass ) && ( j < DSET_SIZE ) ) + { + m = min_dset; + while ( ( pass ) && ( m <= max_dset ) ) + { + + /* select on disk hyperslab */ + offset[0] = (hsize_t)i; /* offset of hyperslab in file */ + offset[1] = (hsize_t)j; + a_size[0] = CHUNK_SIZE; /* size of hyperslab */ + a_size[1] = CHUNK_SIZE; + status = H5Sselect_hyperslab(filespace_ids[m], H5S_SELECT_SET, + offset, NULL, a_size, NULL); + + if ( status < 0 ) { + + pass = FALSE; + failure_mssg = "disk hyperslab create failed."; + } + + /* read the chunk from file */ + if ( pass ) { + + status = H5Dread(dataset_ids[m], H5T_NATIVE_INT, + memspace_id, filespace_ids[m], + H5P_DEFAULT, data_chunk); + + if ( status < 0 ) { + + pass = FALSE; + failure_mssg = "disk hyperslab create failed."; + } + } + + /* validate the slab */ + if ( pass ) { + + valid_chunk = TRUE; + for ( k = 0; k < CHUNK_SIZE; k++ ) + { + for ( l = 0; l < CHUNK_SIZE; l++ ) + { + if ( data_chunk[k][l] + != + ((DSET_SIZE * DSET_SIZE * m) + + (DSET_SIZE * (i + k)) + j + l) ) { + + valid_chunk = FALSE; + + if ( verbose ) { + + HDfprintf(stdout, + "data_chunk[%0d][%0d] = %0d, expect %0d.\n", + k, l, data_chunk[k][l], + ((DSET_SIZE * DSET_SIZE * m) + + (DSET_SIZE * (i + k)) + j + l)); + HDfprintf(stdout, + "m = %d, i = %d, j = %d, k = %d, l = %d\n", + m, i, j, k, l); + } + } + } + } + + if ( ! valid_chunk ) { + + pass = FALSE; + failure_mssg = "slab validation failed."; + + if ( verbose ) { + + fprintf(stdout, + "Chunk (%0d, %0d) in /dset%03d is invalid.\n", + i, j, m); + } + } + } + m++; + } + j += CHUNK_SIZE; + } + i += CHUNK_SIZE; + } + + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); + + /* close the file spaces */ + i = min_dset; + while ( ( pass ) && ( i <= max_dset ) ) + { + if ( H5Sclose(filespace_ids[i]) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Sclose() failed."; + } + i++; + } + + + /* close the datasets */ + i = min_dset; + while ( ( pass ) && ( i <= max_dset ) ) + { + if ( H5Dclose(dataset_ids[i]) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Dclose() failed."; + } + i++; + } + + /* close the mem space */ + if ( pass ) { + + if ( H5Sclose(memspace_id) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Sclose(memspace_id) failed."; + } + } + + return; + +} /* create_datasets() */ + + +/*------------------------------------------------------------------------- + * Function: delete_datasets() + * + * Purpose: If pass is TRUE on entry, verify and then delete the + * dataset(s) indicated by min_dset and max_dset in the + * indicated file. + * + * Datasets and their contents must be well know, as we + * will verify that they contain the expected data later. + * + * On failure, set pass to FALSE, and set failure_mssg + * to point to an appropriate failure message. + * + * Do nothing if pass is FALSE on entry. + * + * Return: void + * + * Programmer: John Mainzer + * 10/31/16 + * + *------------------------------------------------------------------------- + */ + +static void +delete_datasets(hid_t file_id, int min_dset, int max_dset) +{ + const char * fcn_name = "delete_datasets()"; + char dset_name[64]; + hbool_t show_progress = FALSE; + int cp = 0; + int i; + + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); + + HDassert(0 <= min_dset); + HDassert(min_dset <= max_dset); + HDassert(max_dset < MAX_NUM_DSETS); + + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); + + /* first, verify the contents of the target dataset(s) */ + verify_datasets(file_id, min_dset, max_dset); + + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); + + /* now delete the target datasets */ + if ( pass ) { + + i = min_dset; + + while ( ( pass ) && ( i <= max_dset ) ) + { + sprintf(dset_name, "/dset%03d", i); + + if ( H5Ldelete(file_id, dset_name, H5P_DEFAULT) < 0) { + + pass = FALSE; + failure_mssg = "H5Ldelete() failed."; + } + + i++; + } + } + + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); + + return; + +} /* delete_datasets() */ + + +/*------------------------------------------------------------------------- + * Function: open_hdf5_file() + * + * Purpose: If pass is true on entry, create or open the specified HDF5 + * and test to see if it has a metadata cache image superblock + * extension message. + * + * Set pass to FALSE and issue a suitable failure + * message if either the file contains a metadata cache image + * superblock extension and mdci_sbem_expected is TRUE, or + * vise versa. + * + * If mdci_sbem_expected is TRUE, also verify that the metadata + * cache has been advised of this. + * + * If read_only is TRUE, open the file read only. Otherwise + * open the file read/write. + * + * If set_mdci_fapl is TRUE, set the metadata cache image + * FAPL entry when opening the file, and verify that the + * metadata cache is notified. + * + * If config_fsm is TRUE, setup the persistant free space + * manager. Note that this flag may only be set if + * create_file is also TRUE. + * + * Return pointers to the cache data structure and file data + * structures. + * + * On failure, set pass to FALSE, and set failure_mssg + * to point to an appropriate failure message. + * + * Do nothing if pass is FALSE on entry. + * + * Return: void + * + * Programmer: John Mainzer + * 7/14/15 + * + *------------------------------------------------------------------------- + */ + +static void +open_hdf5_file(hbool_t create_file, hbool_t mdci_sbem_expected, + hbool_t read_only, hbool_t set_mdci_fapl, hbool_t config_fsm, + const char *hdf_file_name, unsigned cache_image_flags, + hid_t *file_id_ptr, H5F_t ** file_ptr_ptr, H5C_t ** cache_ptr_ptr) +{ + const char * fcn_name = "open_hdf5_file()"; + hbool_t show_progress = FALSE; + hbool_t verbose = FALSE; + int cp = 0; + hid_t fapl_id = -1; + hid_t fcpl_id = -1; + hid_t file_id = -1; + herr_t result; + H5F_t * file_ptr = NULL; + H5C_t * cache_ptr = NULL; + H5C_cache_image_ctl_t image_ctl; + H5AC_cache_image_config_t cache_image_config = { + H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION, + TRUE, + FALSE, + H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE}; + + if ( pass ) + { + /* opening the file both read only and with a cache image + * requested is a contradiction. We resolve it by ignoring + * the cache image request silently. + */ + if ( ( create_file && mdci_sbem_expected ) || + ( create_file && read_only ) || + ( config_fsm && !create_file ) || + ( hdf_file_name == NULL ) || + ( ( set_mdci_fapl ) && ( cache_image_flags == 0 ) ) || + ( ( set_mdci_fapl ) && + ( (cache_image_flags & ~H5C_CI__ALL_FLAGS) != 0 ) ) || + ( file_id_ptr == NULL ) || + ( file_ptr_ptr == NULL ) || + ( cache_ptr_ptr == NULL ) ) { + + failure_mssg = + "Bad param(s) on entry to open_hdf5_file().\n"; + pass = FALSE; + } else if ( verbose ) { + + HDfprintf(stdout, "%s: HDF file name = \"%s\".\n", + fcn_name, hdf_file_name); + } + } + + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); + + /* create a file access propertly list. */ + if ( pass ) { + + fapl_id = H5Pcreate(H5P_FILE_ACCESS); + + if ( fapl_id < 0 ) { + + pass = FALSE; + failure_mssg = "H5Pcreate() failed.\n"; + } + } + + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); + + /* call H5Pset_libver_bounds() on the fapl_id */ + if ( pass ) { + + if ( H5Pset_libver_bounds(fapl_id, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Pset_libver_bounds() failed.\n"; + } + } + + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); + + /* get metadata cache image config -- verify that it is the default */ + if ( pass ) { + + result = H5Pget_mdc_image_config(fapl_id, &cache_image_config); + + if ( result < 0 ) { + + pass = FALSE; + failure_mssg = "H5Pget_mdc_image_config() failed.\n"; + } + + if ( ( cache_image_config.version != + H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION ) || + ( cache_image_config.generate_image != FALSE ) || + ( cache_image_config.save_resize_status != FALSE ) || + ( cache_image_config.entry_ageout != + H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE ) ) { + + pass = FALSE; + failure_mssg = "Unexpected default cache image config.\n"; + } + } + + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); + + /* set metadata cache image fapl entry if indicated */ + if ( ( pass ) && ( set_mdci_fapl ) ) { + + /* set cache image config fields to taste */ + cache_image_config.generate_image = TRUE; + cache_image_config.save_resize_status = FALSE; + cache_image_config.entry_ageout = H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE; + + result = H5Pset_mdc_image_config(fapl_id, &cache_image_config); + + if ( result < 0 ) { + + pass = FALSE; + failure_mssg = "H5Pset_mdc_image_config() failed.\n"; + } + } + + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); + + /* setup the persistant free space manager if indicated */ + if ( ( pass ) && ( config_fsm ) ) { + + fcpl_id = H5Pcreate(H5P_FILE_CREATE); + + if ( fcpl_id <= 0 ) { + + pass = FALSE; + failure_mssg = "H5Pcreate(H5P_FILE_CREATE) failed."; + } + } + + if ( ( pass ) && ( config_fsm ) ) { + + if ( H5Pset_file_space(fcpl_id, H5F_FILE_SPACE_ALL_PERSIST, 1) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Pset_file_space() failed."; + } + } + + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); + + /* open the file */ + if ( pass ) { + + if ( create_file ) { + + if ( fcpl_id != -1 ) + + file_id = H5Fcreate(hdf_file_name, H5F_ACC_TRUNC, fcpl_id, fapl_id); + else + + file_id = H5Fcreate(hdf_file_name, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id); + + } else { + + if ( read_only ) + + file_id = H5Fopen(hdf_file_name, H5F_ACC_RDONLY, fapl_id); + + else + + file_id = H5Fopen(hdf_file_name, H5F_ACC_RDWR, fapl_id); + } + + if ( file_id < 0 ) { + + pass = FALSE; + failure_mssg = "H5Fcreate() or H5Fopen() failed.\n"; + + } else { + + file_ptr = (struct H5F_t *)H5I_object_verify(file_id, H5I_FILE); + + if ( file_ptr == NULL ) { + + pass = FALSE; + failure_mssg = "Can't get file_ptr."; + + if ( verbose ) { + HDfprintf(stdout, "%s: Can't get file_ptr.\n", fcn_name); + } + } + } + } + + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); + + /* get a pointer to the files internal data structure and then + * to the cache structure + */ + if ( pass ) { + + if ( file_ptr->shared->cache == NULL ) { + + pass = FALSE; + failure_mssg = "can't get cache pointer(1).\n"; + + } else { + + cache_ptr = file_ptr->shared->cache; + } + } + + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); + + /* verify expected metadata cache status */ + + /* get the cache image control structure from the cache, and verify + * that it contains the expected values. + * + * Then set the flags in this structure to the specified value. + */ + if ( pass ) { + + if ( H5C_get_cache_image_config(cache_ptr, &image_ctl) < 0 ) { + + pass = FALSE; + failure_mssg = "error returned by H5C_get_cache_image_config()."; + } + } + + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); + + if ( pass ) { + + if ( set_mdci_fapl ) { + + if ( read_only ) { + + if ( ( image_ctl.version != + H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION ) || + ( image_ctl.generate_image != FALSE ) || + ( image_ctl.save_resize_status != FALSE ) || + ( image_ctl.entry_ageout != + H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE ) || + ( image_ctl.flags != H5C_CI__ALL_FLAGS ) ) { + + pass = FALSE; + failure_mssg = "Unexpected image_ctl values(1).\n"; + } + } else { + + if ( ( image_ctl.version != + H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION ) || + ( image_ctl.generate_image != TRUE ) || + ( image_ctl.save_resize_status != FALSE ) || + ( image_ctl.entry_ageout != + H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE ) || + ( image_ctl.flags != H5C_CI__ALL_FLAGS ) ) { + + pass = FALSE; + failure_mssg = "Unexpected image_ctl values(2).\n"; + } + } + } else { + + if ( ( image_ctl.version != + H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION ) || + ( image_ctl.generate_image != FALSE ) || + ( image_ctl.save_resize_status != FALSE ) || + ( image_ctl.entry_ageout != + H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE ) || + ( image_ctl.flags != H5C_CI__ALL_FLAGS ) ) { + + pass = FALSE; + failure_mssg = "Unexpected image_ctl values(3).\n"; + } + } + } + + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); + + if ( ( pass ) && ( set_mdci_fapl ) ) { + + image_ctl.flags = cache_image_flags; + + if ( H5C_set_cache_image_config(file_ptr, cache_ptr, &image_ctl) < 0 ) { + + pass = FALSE; + failure_mssg = "error returned by H5C_set_cache_image_config()."; + } + } + + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); + + if ( pass ) { + + if ( cache_ptr->close_warning_received == TRUE ) { + + pass = FALSE; + failure_mssg = "Unexpected value of close_warning_received.\n"; + } + + if ( mdci_sbem_expected ) { + + if ( read_only ) { + + if ( ( cache_ptr->load_image != TRUE ) || + ( cache_ptr->delete_image != FALSE ) ) { + + pass = FALSE; + failure_mssg = "mdci sb extension message not present?\n"; + } + } else { + + if ( ( cache_ptr->load_image != TRUE ) || + ( cache_ptr->delete_image != TRUE ) ) { + + pass = FALSE; + failure_mssg = "mdci sb extension message not present?\n"; + } + } + } else { + + if ( ( cache_ptr->load_image == TRUE ) || + ( cache_ptr->delete_image == TRUE ) ) { + + pass = FALSE; + failure_mssg = "mdci sb extension message present?\n"; + } + } + } + + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); + + if ( pass ) { + + *file_id_ptr = file_id; + *file_ptr_ptr = file_ptr; + *cache_ptr_ptr = cache_ptr; + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d -- exiting.\n", fcn_name, cp++); + + return; + +} /* open_hdf5_file() */ + + +/*------------------------------------------------------------------------- + * Function: attempt_swmr_open_hdf5_file() + * + * Purpose: If pass is true on entry, attempt to create or open the + * specified HDF5 file with SWMR, and also with cache image + * creation if requested. + * + * In all cases, the attempted open or create should fail. + * + * Do nothing if pass is FALSE on entry. + * + * Return: void + * + * Programmer: John Mainzer + * 7/14/15 + * + *------------------------------------------------------------------------- + */ + +static void +attempt_swmr_open_hdf5_file(const hbool_t create_file, + const hbool_t set_mdci_fapl, + const char * hdf_file_name) +{ + const char * fcn_name = "attempt_swmr_open_hdf5_file()"; + hbool_t show_progress = FALSE; + int cp = 0; + hid_t fapl_id = -1; + hid_t file_id = -1; + herr_t result; + H5AC_cache_image_config_t cache_image_config = { + H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION, + TRUE, + FALSE, + H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE}; + + /* create a file access propertly list. */ + if ( pass ) { + + fapl_id = H5Pcreate(H5P_FILE_ACCESS); + + if ( fapl_id < 0 ) { + + pass = FALSE; + failure_mssg = "H5Pcreate() failed.\n"; + } + } + + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); + + /* call H5Pset_libver_bounds() on the fapl_id */ + if ( pass ) { + + if ( H5Pset_libver_bounds(fapl_id, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) + < 0 ) { + + pass = FALSE; + failure_mssg = "H5Pset_libver_bounds() failed.\n"; + } + } + + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); + + /* set metadata cache image fapl entry if indicated */ + if ( ( pass ) && ( set_mdci_fapl ) ) { + + /* set cache image config fields to taste */ + cache_image_config.generate_image = TRUE; + cache_image_config.save_resize_status = FALSE; + cache_image_config.entry_ageout = H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE; + + result = H5Pset_mdc_image_config(fapl_id, &cache_image_config); + + if ( result < 0 ) { + + pass = FALSE; + failure_mssg = "H5Pset_mdc_image_config() failed.\n"; + } + } + + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); + + /* open the file */ + if ( pass ) { + + if ( create_file ) { + + H5E_BEGIN_TRY { + file_id = H5Fcreate(hdf_file_name, H5F_ACC_TRUNC | H5F_ACC_SWMR_WRITE, + H5P_DEFAULT, fapl_id); + } H5E_END_TRY; + } else { + + H5E_BEGIN_TRY { + file_id = H5Fopen(hdf_file_name, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl_id); + } H5E_END_TRY; + } + + if ( file_id >= 0 ) { + + pass = FALSE; + failure_mssg = "SWMR H5Fcreate() or H5Fopen() succeeded.\n"; + + } + } + + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); + + return; + +} /* attempt_swmr_open_hdf5_file() */ + + +/*------------------------------------------------------------------------- + * Function: verify_datasets() + * + * Purpose: If pass is TRUE on entry, verify that the datasets in the + * file exist and contain the expected data. + * + * Note that these datasets were created by + * create_datasets() above. Thus any changes in that + * function must be reflected in this function, and + * vise-versa. + * + * On failure, set pass to FALSE, and set failure_mssg + * to point to an appropriate failure message. + * + * Do nothing if pass is FALSE on entry. + * + * Return: void + * + * Programmer: John Mainzer + * 7/15/15 + * + *------------------------------------------------------------------------- + */ + +static void +verify_datasets(hid_t file_id, int min_dset, int max_dset) +{ + const char * fcn_name = "verify_datasets()"; + char dset_name[64]; + hbool_t show_progress = FALSE; + hbool_t valid_chunk; + hbool_t verbose = FALSE; + int cp = 0; + int i, j, k, l, m; + int data_chunk[CHUNK_SIZE][CHUNK_SIZE]; + herr_t status; + hid_t filespace_ids[MAX_NUM_DSETS]; + hid_t memspace_id = -1; + hid_t dataset_ids[MAX_NUM_DSETS]; + hsize_t dims[2]; + hsize_t a_size[2]; + hsize_t offset[2]; + + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); + + HDassert(0 <= min_dset); + HDassert(min_dset <= max_dset); + HDassert(max_dset < MAX_NUM_DSETS); + + /* open the datasets */ + + if ( pass ) { + + i = min_dset; + + while ( ( pass ) && ( i <= max_dset ) ) + { + /* open the dataset */ + if ( pass ) { + + sprintf(dset_name, "/dset%03d", i); + dataset_ids[i] = H5Dopen2(file_id, dset_name, H5P_DEFAULT); + + if ( dataset_ids[i] < 0 ) { + + pass = FALSE; + failure_mssg = "H5Dopen2() failed."; + } + } + + /* get the file space ID */ + if ( pass ) { + + filespace_ids[i] = H5Dget_space(dataset_ids[i]); + + if ( filespace_ids[i] < 0 ) { + + pass = FALSE; + failure_mssg = "H5Dget_space() failed."; + } + } + + i++; + } + } + + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); + + /* create the mem space to be used to read and write chunks */ + if ( pass ) { + + dims[0] = CHUNK_SIZE; + dims[1] = CHUNK_SIZE; + memspace_id = H5Screate_simple(2, dims, NULL); + + if ( memspace_id < 0 ) { + + pass = FALSE; + failure_mssg = "H5Screate_simple() failed."; + } + } + + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); + + /* select in memory hyperslab */ + if ( pass ) { + + offset[0] = 0; /*offset of hyperslab in memory*/ + offset[1] = 0; + a_size[0] = CHUNK_SIZE; /*size of hyperslab*/ + a_size[1] = CHUNK_SIZE; + status = H5Sselect_hyperslab(memspace_id, H5S_SELECT_SET, offset, NULL, + a_size, NULL); + + if ( status < 0 ) { + + pass = FALSE; + failure_mssg = "H5Sselect_hyperslab() failed."; + } + } + + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); + + + /* read data from datasets and validate it */ + i = 0; + while ( ( pass ) && ( i < DSET_SIZE ) ) + { + j = 0; + while ( ( pass ) && ( j < DSET_SIZE ) ) + { + m = min_dset; + while ( ( pass ) && ( m <= max_dset ) ) + { + + /* select on disk hyperslab */ + offset[0] = (hsize_t)i; /* offset of hyperslab in file */ + offset[1] = (hsize_t)j; + a_size[0] = CHUNK_SIZE; /* size of hyperslab */ + a_size[1] = CHUNK_SIZE; + status = H5Sselect_hyperslab(filespace_ids[m], H5S_SELECT_SET, + offset, NULL, a_size, NULL); + + if ( status < 0 ) { + + pass = FALSE; + failure_mssg = "disk hyperslab create failed."; + } + + /* read the chunk from file */ + if ( pass ) { + + status = H5Dread(dataset_ids[m], H5T_NATIVE_INT, + memspace_id, filespace_ids[m], + H5P_DEFAULT, data_chunk); + + if ( status < 0 ) { + + pass = FALSE; + failure_mssg = "disk hyperslab create failed."; + } + } + + /* validate the slab */ + if ( pass ) { + + valid_chunk = TRUE; + for ( k = 0; k < CHUNK_SIZE; k++ ) + { + for ( l = 0; l < CHUNK_SIZE; l++ ) + { + if ( data_chunk[k][l] + != + ((DSET_SIZE * DSET_SIZE * m) + + (DSET_SIZE * (i + k)) + j + l) ) { + + valid_chunk = FALSE; + + if ( verbose ) { + + HDfprintf(stdout, + "data_chunk[%0d][%0d] = %0d, expect %0d.\n", + k, l, data_chunk[k][l], + ((DSET_SIZE * DSET_SIZE * m) + + (DSET_SIZE * (i + k)) + j + l)); + HDfprintf(stdout, + "m = %d, i = %d, j = %d, k = %d, l = %d\n", + m, i, j, k, l); + } + } + } + } + + if ( ! valid_chunk ) { + + pass = FALSE; + failure_mssg = "slab validation failed."; + + if ( verbose ) { + + fprintf(stdout, + "Chunk (%0d, %0d) in /dset%03d is invalid.\n", + i, j, m); + } + } + } + m++; + } + j += CHUNK_SIZE; + } + i += CHUNK_SIZE; + } + + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); + + /* close the file spaces */ + i = min_dset; + while ( ( pass ) && ( i <= max_dset ) ) + { + if ( H5Sclose(filespace_ids[i]) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Sclose() failed."; + } + i++; + } + + + /* close the datasets */ + i = min_dset; + while ( ( pass ) && ( i <= max_dset ) ) + { + if ( H5Dclose(dataset_ids[i]) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Dclose() failed."; + } + i++; + } + + /* close the mem space */ + if ( pass ) { + + if ( H5Sclose(memspace_id) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Sclose(memspace_id) failed."; + } + } + + return; + +} /* verify_datasets() */ + + +/****************************************************************************/ +/******************************* Test Functions *****************************/ +/****************************************************************************/ + +/*------------------------------------------------------------------------- + * Function: check_cache_image_ctl_flow_1() + * + * Purpose: This test is one of a sequence of control flow tests intended + * to verify that control flow for the cache image feature works + * as expected. + * + * This test is an initial smoke check, so the sequence of + * operations is relatively simple. In particular, we are + * testing: + * + * i) Creation of file with cache image FAPL entry set + * and insertion of metadata cache image superblock + * message on file close. + * + * ii) Open of file with metadata cache image superblock + * message, transmission of message to metadata cache, + * and deletion of superblock message prior to close. + * + * Note that in all cases we are performing operations on the + * file. While this is the typical case, we must repeat this + * test without operations on the file. + * + * 1) Create a HDF5 file with the cache image FAPL entry. + * + * Verify that the cache is informed of the cache image + * FAPL entry. + * + * Set flags forcing creation of metadata cache image + * super block extension message only. + * + * 2) Create some datasets in the file. + * + * 3) Close the file. + * + * 4) Open the file. + * + * Verify that the metadata cache is instructed + * to load the metadata cache image, and that the + * supplied address and length are HADDR_UNDEF and + * zero respectively. Note that these values indicate + * that the metadata image block doesn't exist. + * + * 5) Open a dataset. + * + * Verify that the metadata cache image superblock + * extension message has been deleted. + * + * 6) Close the file. + * + * 7) Open the file. + * + * Verify that the file doesn't contain a metadata cache + * image superblock extension message. + * + * 8) Close the file. + * + * 9) Delete the file. + * + * Return: void + * + * Programmer: John Mainzer + * 7/15/15 + * + *------------------------------------------------------------------------- + */ + +static unsigned +check_cache_image_ctl_flow_1(void) +{ + const char * fcn_name = "check_cache_image_ctl_flow_1()"; + char filename[512]; + hbool_t show_progress = FALSE; + hid_t file_id = -1; + H5F_t *file_ptr = NULL; + H5C_t *cache_ptr = NULL; + int cp = 0; + + TESTING("metadata cache image control flow test 1"); + + pass = TRUE; + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* setup the file name */ + if ( pass ) { + + if ( h5_fixname(FILENAMES[0], H5P_DEFAULT, filename, sizeof(filename)) + == NULL ) { + + pass = FALSE; + failure_mssg = "h5_fixname() failed.\n"; + } + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 1) Create a HDF5 file with the cache image FAPL entry. + * + * Verify that the cache is informed of the cache image FAPL entry. + * + * Set flags forcing creation of metadata cache image super block + * extension message only. + */ + + if ( pass ) { + + open_hdf5_file(/* create_file */ TRUE, + /* mdci_sbem_expected */ FALSE, + /* read_only */ FALSE, + /* set_mdci_fapl */ TRUE, + /* config_fsm */ FALSE, + /* hdf_file_name */ filename, + /* cache_image_flags */ H5C_CI__GEN_MDCI_SBE_MESG, + /* file_id_ptr */ &file_id, + /* file_ptr_ptr */ &file_ptr, + /* cache_ptr_ptr */ &cache_ptr); + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 2) Create some datasets in the file. */ + + if ( pass ) { + + create_datasets(file_id, 0, 5); + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 3) Close the file. */ + + if ( pass ) { + + if ( H5Fclose(file_id) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Fclose() failed.\n"; + + } + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 4) Open the file. + * + * Verify that the metadata cache is instructed to load the + * metadata cache image, and that the supplied address and length + * are HADDR_UNDEF and zero respectively. Note that these values + * indicate that the metadata image block doesn't exist. + */ + + if ( pass ) { + + open_hdf5_file(/* create_file */ FALSE, + /* mdci_sbem_expected */ TRUE, + /* read_only */ FALSE, + /* set_mdci_fapl */ FALSE, + /* config_fsm */ FALSE, + /* hdf_file_name */ filename, + /* cache_image_flags */ 0, + /* file_id_ptr */ &file_id, + /* file_ptr_ptr */ &file_ptr, + /* cache_ptr_ptr */ &cache_ptr); + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 5) Open and close a dataset. + * + * Verify that the metadata cache image superblock + * extension message has been deleted. + */ + + if ( pass ) { + + verify_datasets(file_id, 0, 5); + } + + if ( pass ) { + + /* think on how to verify that the superblock extension has been + * deleted, and if it is necessary to verify this directly. + */ + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 6) Close the file. */ + + if ( pass ) { + + if ( H5Fclose(file_id) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Fclose() failed.\n"; + } + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 7) Open the file. + * + * Verify that the file doesn't contain a metadata cache image + * superblock extension message. + */ + + if ( pass ) { + + open_hdf5_file(/* create_file */ FALSE, + /* mdci_sbem_expected */ FALSE, + /* read_only */ FALSE, + /* set_mdci_fapl */ FALSE, + /* config_fsm */ FALSE, + /* hdf_file_name */ filename, + /* cache_image_flags */ 0, + /* file_id_ptr */ &file_id, + /* file_ptr_ptr */ &file_ptr, + /* cache_ptr_ptr */ &cache_ptr); + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 8) Close the file. */ + + if ( pass ) { + + if ( H5Fclose(file_id) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Fclose() failed.\n"; + } + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 9) Delete the file */ + + if ( pass ) { + + if ( HDremove(filename) < 0 ) { + + pass = FALSE; + failure_mssg = "HDremove() failed.\n"; + } + } + + if ( pass ) { PASSED(); } else { H5_FAILED(); } + + if ( ! pass ) + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", + FUNC, failure_mssg); + + return !pass; + +} /* check_cache_image_ctl_flow_1() */ + + +/*------------------------------------------------------------------------- + * Function: check_cache_image_ctl_flow_2() + * + * Purpose: This test is one of a sequence of control flow tests intended + * to verify that control flow for the cache image feature works + * as expected. + * + * This test is an initial smoke check, so the sequence of + * operations is relatively simple. In particular, we are + * testing: + * + * i) Creation of file with cache image FAPL entry set + * and insertion of metadata cache image superblock + * message on file close. + * + * ii) Open of file with metadata cache image superblock + * message, transmission of message to metadata cache, + * and deletion of superblock message prior to close. + * + * Note that unlike the previous test, no operations are performed + * on the file. As a result of this, the metadata cache image + * message is not processed until the metadata cache receives + * the file close warning. (Under normal circumstances, it is + * processed as part of the first protect operation after the + * superblock is loaded.) + * + * In this particular test, we preform the following operations: + * + * 1) Create a HDF5 file with the cache image FAPL entry. + * + * Verify that the cache is informed of the cache image + * FAPL entry. + * + * Set flags forcing creation of metadata cache image + * super block extension message only. + * + * 2) Close the file. + * + * 3) Open the file. + * + * Verify that the metadata cache is instructed + * to load the metadata cache image, and that the + * supplied address and length are HADDR_UNDEF and + * zero respectively. Note that these values indicate + * that the metadata image block doesn't exist. + * + * 6) Close the file. + * + * 7) Open the file. + * + * Verify that the file doesn't contain a metadata cache + * image superblock extension message. + * + * 8) Close the file. + * + * 9) Delete the file. + * + * Return: void + * + * Programmer: John Mainzer + * 7/15/15 + * + *------------------------------------------------------------------------- + */ + +static unsigned +check_cache_image_ctl_flow_2(void) +{ + const char * fcn_name = "check_cache_image_ctl_flow_2()"; + char filename[512]; + hbool_t show_progress = FALSE; + hid_t file_id = -1; + H5F_t *file_ptr = NULL; + H5C_t *cache_ptr = NULL; + int cp = 0; + + TESTING("metadata cache image control flow test 2"); + + pass = TRUE; + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + /* setup the file name */ + if ( pass ) { + + if ( h5_fixname(FILENAMES[0], H5P_DEFAULT, filename, sizeof(filename)) + == NULL ) { + + pass = FALSE; + failure_mssg = "h5_fixname() failed.\n"; + } + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 1) Create a HDF5 file with the cache image FAPL entry. + * + * Verify that the cache is informed of the cache image FAPL entry. + * + * Set flags forcing creation of metadata cache image super block + * extension message only. + */ + + if ( pass ) { + + open_hdf5_file(/* create_file */ TRUE, + /* mdci_sbem_expected */ FALSE, + /* read_only */ FALSE, + /* set_mdci_fapl */ TRUE, + /* config_fsm */ FALSE, + /* hdf_file_name */ filename, + /* cache_image_flags */ H5C_CI__GEN_MDCI_SBE_MESG, + /* file_id_ptr */ &file_id, + /* file_ptr_ptr */ &file_ptr, + /* cache_ptr_ptr */ &cache_ptr); + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 2) Close the file. */ + + if ( pass ) { + + if ( H5Fclose(file_id) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Fclose() failed.\n"; + + } + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 3) Open the file. + * + * Verify that the metadata cache is instructed to load the + * metadata cache image, and that the supplied address and length + * are HADDR_UNDEF and zero respectively. Note that these values + * indicate that the metadata image block doesn't exist. + */ + + if ( pass ) { + + open_hdf5_file(/* create_file */ FALSE, + /* mdci_sbem_expected */ TRUE, + /* read_only */ FALSE, + /* set_mdci_fapl */ FALSE, + /* config_fsm */ FALSE, + /* hdf_file_name */ filename, + /* cache_image_flags */ 0, + /* file_id_ptr */ &file_id, + /* file_ptr_ptr */ &file_ptr, + /* cache_ptr_ptr */ &cache_ptr); + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 4) Close the file. */ + + if ( pass ) { + + if ( H5Fclose(file_id) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Fclose() failed.\n"; + } + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 5) Open the file. + * + * Verify that the file doesn't contain a metadata cache image + * superblock extension message. + */ + + if ( pass ) { + + open_hdf5_file(/* create_file */ FALSE, + /* mdci_sbem_expected */ FALSE, + /* read_only */ FALSE, + /* set_mdci_fapl */ FALSE, + /* config_fsm */ FALSE, + /* hdf_file_name */ filename, + /* cache_image_flags */ 0, + /* file_id_ptr */ &file_id, + /* file_ptr_ptr */ &file_ptr, + /* cache_ptr_ptr */ &cache_ptr); + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 6) Close the file. */ + + if ( pass ) { + + if ( H5Fclose(file_id) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Fclose() failed.\n"; + } + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 7) Delete the file */ + + if ( pass ) { + + if ( HDremove(filename) < 0 ) { + + pass = FALSE; + failure_mssg = "HDremove() failed.\n"; + } + } + + if ( pass ) { PASSED(); } else { H5_FAILED(); } + + if ( ! pass ) + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", + FUNC, failure_mssg); + + return !pass; + +} /* check_cache_image_ctl_flow_2() */ + + +/*------------------------------------------------------------------------- + * Function: check_cache_image_ctl_flow_3() + * + * Purpose: This test is one of a sequence of control flow tests intended + * to verify that control flow for the cache image feature works + * as expected. + * + * The objectives of this test are to: + * + * i) Test operation of the metadata cache image FAPL + * entry set on open of an existing file. This + * should result in the insertion of a metadata + * cache image superblock message on file close. + * + * ii) Test operation of the metadata cache image super + * block extension message when it appears in a file + * that is opened READ ONLY. + * + * Note that in all cases we are performing operations on the + * file between file open and close. While this is the + * typical case, we must repeat this test without operations + * on the file. + * + * 1) Create a HDF5 file WITHOUT the cache image FAPL entry. + * + * Verify that the cache is NOT informed of the cache image + * FAPL entry. + * + * 2) Close the file. + * + * 3) Open the file WITH the cache image FAPL entry. + * + * Verify that the cache is informed of the cache image + * FAPL entry. + * + * Set flags forcing creation of metadata cache image + * super block extension message only. + * + * 4) Create some datasets. + * + * 5) Close the file. + * + * 6) Open the file READ ONLY. + * + * Verify that the metadata cache is instructed + * to load the metadata cache image, and that the + * supplied address and length are HADDR_UNDEF and + * zero respectively. Note that these values indicate + * that the metadata image block doesn't exist. + * + * 7) Verify the contents of the datasets. + * + * 8) Close the file. + * + * 9) Open the file READ/WRITE. + * + * Verify that the metadata cache is instructed + * to load the metadata cache image, and that the + * supplied address and length are HADDR_UNDEF and + * zero respectively. Note that these values indicate + * that the metadata image block doesn't exist. + * + * 10) Verify the contents of the datasets. + * + * 11) Close the file. + * + * 12) Open the file + * + * Verify that the file doesn't contain a metadata cache + * image superblock extension message. + * + * 13) Close the file. + * + * 14) Delete the file. + * + * Return: void + * + * Programmer: John Mainzer + * 7/16/15 + * + *------------------------------------------------------------------------- + */ + +static unsigned +check_cache_image_ctl_flow_3(void) +{ + const char * fcn_name = "check_cache_image_ctl_flow_3()"; + char filename[512]; + hbool_t show_progress = FALSE; + hid_t file_id = -1; + H5F_t *file_ptr = NULL; + H5C_t *cache_ptr = NULL; + int cp = 0; + + TESTING("metadata cache image control flow test 3"); + + pass = TRUE; + + if ( show_progress ) /* 0 */ + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + /* setup the file name */ + if ( pass ) { + + if ( h5_fixname(FILENAMES[0], H5P_DEFAULT, filename, sizeof(filename)) + == NULL ) { + + pass = FALSE; + failure_mssg = "h5_fixname() failed.\n"; + } + } + + if ( show_progress ) /* 1 */ + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + /* 1) Create a HDF5 file WITHOUT the cache image FAPL entry. + * + * Verify that the cache is NOT informed of the cache image + * FAPL entry. + */ + + if ( pass ) { + + open_hdf5_file(/* create_file */ TRUE, + /* mdci_sbem_expected */ FALSE, + /* read_only */ FALSE, + /* set_mdci_fapl */ FALSE, + /* config_fsm */ FALSE, + /* hdf_file_name */ filename, + /* cache_image_flags */ 0, + /* file_id_ptr */ &file_id, + /* file_ptr_ptr */ &file_ptr, + /* cache_ptr_ptr */ &cache_ptr); + } + + if ( show_progress ) /* 2 */ + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 2) Close the file. */ + + if ( pass ) { + + if ( H5Fclose(file_id) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Fclose() failed.\n"; + } + } + + if ( show_progress ) /* 3 */ + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 3) Open the file WITH the cache image FAPL entry. + * + * Verify that the cache is informed of the cache image FAPL entry. + * + * Set flags forcing creation of metadata cache image super block + * extension message only. + */ + + if ( pass ) { + + open_hdf5_file(/* create_file */ FALSE, + /* mdci_sbem_expected */ FALSE, + /* read_only */ FALSE, + /* set_mdci_fapl */ TRUE, + /* config_fsm */ FALSE, + /* hdf_file_name */ filename, + /* cache_image_flags */ H5C_CI__GEN_MDCI_SBE_MESG, + /* file_id_ptr */ &file_id, + /* file_ptr_ptr */ &file_ptr, + /* cache_ptr_ptr */ &cache_ptr); + } + + if ( show_progress ) /* 4 */ + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 4) Create some datasets. */ + + if ( pass ) { + + create_datasets(file_id, 0, 5); + } + + if ( show_progress ) /* 5 */ + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 5) Close the file. */ + + if ( pass ) { + + if ( H5Fclose(file_id) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Fclose() failed.\n"; + } + } + + if ( show_progress ) /* 6 */ + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 6) Open the file READ ONLY. + * + * Verify that the metadata cache is instructed + * to load the metadata cache image, and that the + * supplied address and length are HADDR_UNDEF and + * zero respectively. Note that these values indicate + * that the metadata image block doesn't exist. + */ + + if ( pass ) { + + open_hdf5_file(/* create_file */ FALSE, + /* mdci_sbem_expected */ TRUE, + /* read_only */ TRUE, + /* set_mdci_fapl */ FALSE, + /* config_fsm */ FALSE, + /* hdf_file_name */ filename, + /* cache_image_flags */ 0, + /* file_id_ptr */ &file_id, + /* file_ptr_ptr */ &file_ptr, + /* cache_ptr_ptr */ &cache_ptr); + } + + if ( show_progress ) /* 7 */ + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 7) Verify the contents of the datasets. */ + + if ( pass ) { + + verify_datasets(file_id, 0, 5); + } + + if ( show_progress ) /* 8 */ + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 8) Close the file. */ + + if ( pass ) { + + if ( H5Fclose(file_id) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Fclose() failed.\n"; + } + } + + if ( show_progress ) /* 9 */ + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 9) Open the file READ/WRITE. + * + * Verify that the metadata cache is instructed + * to load the metadata cache image, and that the + * supplied address and length are HADDR_UNDEF and + * zero respectively. Note that these values indicate + * that the metadata image block doesn't exist. + */ + + if ( pass ) { + + open_hdf5_file(/* create_file */ FALSE, + /* mdci_sbem_expected */ TRUE, + /* read_only */ FALSE, + /* set_mdci_fapl */ FALSE, + /* config_fsm */ FALSE, + /* hdf_file_name */ filename, + /* cache_image_flags */ 0, + /* file_id_ptr */ &file_id, + /* file_ptr_ptr */ &file_ptr, + /* cache_ptr_ptr */ &cache_ptr); + } + + if ( show_progress ) /* 10 */ + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 10) Verify the contents of the datasets. */ + + if ( pass ) { + + verify_datasets(file_id, 0, 5); + } + + if ( show_progress ) /* 11 */ + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 11) Close the file. */ + + if ( pass ) { + + if ( H5Fclose(file_id) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Fclose() failed.\n"; + } + } + + if ( show_progress ) /* 12 */ + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 12) Open the file + * + * Verify that the file doesn't contain a metadata cache + * image superblock extension message. + */ + + if ( pass ) { + + open_hdf5_file(/* create_file */ FALSE, + /* mdci_sbem_expected */ FALSE, + /* read_only */ FALSE, + /* set_mdci_fapl */ FALSE, + /* config_fsm */ FALSE, + /* hdf_file_name */ filename, + /* cache_image_flags */ 0, + /* file_id_ptr */ &file_id, + /* file_ptr_ptr */ &file_ptr, + /* cache_ptr_ptr */ &cache_ptr); + } + + if ( show_progress ) /* 13 */ + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 13) Close the file. */ + + if ( pass ) { + + if ( H5Fclose(file_id) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Fclose() failed.\n"; + } + } + + if ( show_progress ) /* 14 */ + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 14) Delete the file. */ + + if ( pass ) { + + if ( HDremove(filename) < 0 ) { + + pass = FALSE; + failure_mssg = "HDremove() failed.\n"; + } + } + + + if ( pass ) { PASSED(); } else { H5_FAILED(); } + + if ( ! pass ) + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", + FUNC, failure_mssg); + + return !pass; + +} /* check_cache_image_ctl_flow_3() */ + + +/*------------------------------------------------------------------------- + * Function: check_cache_image_ctl_flow_4() + * + * Purpose: This test is one of a sequence of control flow tests intended + * to verify that control flow for the cache image feature works + * as expected. + * + * The objectives of this test are to: + * + * i) Test operation of the metadata cache image FAPL + * entry set on open of an existing file. This + * should result in the insertion of a metadata + * cache image superblock message on file close. + * + * ii) Test operation of the metadata cache image super + * block extension message when it appears in a file + * that is opened READ ONLY. + * + * In this test we avoid all file access beyond file open + * and close. + * + * 1) Create a HDF5 file WITHOUT the cache image FAPL entry. + * + * Verify that the cache is NOT informed of the cache image + * FAPL entry. + * + * 2) Close the file. + * + * 3) Open the file WITH the cache image FAPL entry. + * + * Verify that the cache is informed of the cache image + * FAPL entry. + * + * Set flags forcing creation of metadata cache image + * super block extension message only. + * + * 4) Close the file. + * + * 5) Open the file READ ONLY. + * + * Verify that the metadata cache is instructed + * to load the metadata cache image, and that the + * supplied address and length are HADDR_UNDEF and + * zero respectively. Note that these values indicate + * that the metadata image block doesn't exist. + * + * 6) Close the file. + * + * 7) Open the file READ/WRITE. + * + * Verify that the metadata cache is instructed + * to load the metadata cache image, and that the + * supplied address and length are HADDR_UNDEF and + * zero respectively. Note that these values indicate + * that the metadata image block doesn't exist. + * + * 8) Close the file. + * + * 9) Open the file + * + * Verify that the file doesn't contain a metadata cache + * image superblock extension message. + * + * 10) Close the file. + * + * 11) Delete the file. + * + * Return: void + * + * Programmer: John Mainzer + * 7/16/15 + * + *------------------------------------------------------------------------- + */ + +static unsigned +check_cache_image_ctl_flow_4(void) +{ + const char * fcn_name = "check_cache_image_ctl_flow_4()"; + char filename[512]; + hbool_t show_progress = FALSE; + hid_t file_id = -1; + H5F_t *file_ptr = NULL; + H5C_t *cache_ptr = NULL; + int cp = 0; + + TESTING("metadata cache image control flow test 4"); + + pass = TRUE; + + if ( show_progress ) /* 0 */ + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + /* setup the file name */ + if ( pass ) { + + if ( h5_fixname(FILENAMES[0], H5P_DEFAULT, filename, sizeof(filename)) + == NULL ) { + + pass = FALSE; + failure_mssg = "h5_fixname() failed.\n"; + } + } + + if ( show_progress ) /* 1 */ + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + /* 1) Create a HDF5 file WITHOUT the cache image FAPL entry. + * + * Verify that the cache is NOT informed of the cache image + * FAPL entry. + */ + + if ( pass ) { + + open_hdf5_file(/* create_file */ TRUE, + /* mdci_sbem_expected */ FALSE, + /* read_only */ FALSE, + /* set_mdci_fapl */ FALSE, + /* config_fsm */ FALSE, + /* hdf_file_name */ filename, + /* cache_image_flags */ 0, + /* file_id_ptr */ &file_id, + /* file_ptr_ptr */ &file_ptr, + /* cache_ptr_ptr */ &cache_ptr); + } + + if ( show_progress ) /* 2 */ + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 2) Close the file. */ + + if ( pass ) { + + if ( H5Fclose(file_id) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Fclose() failed.\n"; + } + } + + if ( show_progress ) /* 3 */ + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 3) Open the file WITH the cache image FAPL entry. + * + * Verify that the cache is informed of the cache image FAPL entry. + * + * Set flags forcing creation of metadata cache image super block + * extension message only. + */ + + if ( pass ) { + + open_hdf5_file(/* create_file */ FALSE, + /* mdci_sbem_expected */ FALSE, + /* read_only */ FALSE, + /* set_mdci_fapl */ TRUE, + /* config_fsm */ FALSE, + /* hdf_file_name */ filename, + /* cache_image_flags */ H5C_CI__GEN_MDCI_SBE_MESG, + /* file_id_ptr */ &file_id, + /* file_ptr_ptr */ &file_ptr, + /* cache_ptr_ptr */ &cache_ptr); + } + + if ( show_progress ) /* 4 */ + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 4) Close the file. */ + + if ( pass ) { + + if ( H5Fclose(file_id) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Fclose() failed.\n"; + } + } + + if ( show_progress ) /* 5 */ + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 5) Open the file READ ONLY. + * + * Verify that the metadata cache is instructed + * to load the metadata cache image, and that the + * supplied address and length are HADDR_UNDEF and + * zero respectively. Note that these values indicate + * that the metadata image block doesn't exist. + */ + + if ( pass ) { + + open_hdf5_file(/* create_file */ FALSE, + /* mdci_sbem_expected */ TRUE, + /* read_only */ TRUE, + /* set_mdci_fapl */ FALSE, + /* config_fsm */ FALSE, + /* hdf_file_name */ filename, + /* cache_image_flags */ 0, + /* file_id_ptr */ &file_id, + /* file_ptr_ptr */ &file_ptr, + /* cache_ptr_ptr */ &cache_ptr); + } + + if ( show_progress ) /* 6 */ + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 6) Close the file. */ + + if ( pass ) { + + if ( H5Fclose(file_id) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Fclose() failed.\n"; + } + } + + if ( show_progress ) /* 7 */ + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 7) Open the file READ/WRITE. + * + * Verify that the metadata cache is instructed + * to load the metadata cache image, and that the + * supplied address and length are HADDR_UNDEF and + * zero respectively. Note that these values indicate + * that the metadata image block doesn't exist. + */ + + if ( pass ) { + + open_hdf5_file(/* create_file */ FALSE, + /* mdci_sbem_expected */ TRUE, + /* read_only */ FALSE, + /* set_mdci_fapl */ FALSE, + /* config_fsm */ FALSE, + /* hdf_file_name */ filename, + /* cache_image_flags */ 0, + /* file_id_ptr */ &file_id, + /* file_ptr_ptr */ &file_ptr, + /* cache_ptr_ptr */ &cache_ptr); + } + + if ( show_progress ) /* 8 */ + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 8) Close the file. */ + + if ( pass ) { + + if ( H5Fclose(file_id) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Fclose() failed.\n"; + } + } + + if ( show_progress ) /* 9 */ + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 9) Open the file + * + * Verify that the file doesn't contain a metadata cache + * image superblock extension message. + */ + + if ( pass ) { + + open_hdf5_file(/* create_file */ FALSE, + /* mdci_sbem_expected */ FALSE, + /* read_only */ FALSE, + /* set_mdci_fapl */ FALSE, + /* config_fsm */ FALSE, + /* hdf_file_name */ filename, + /* cache_image_flags */ 0, + /* file_id_ptr */ &file_id, + /* file_ptr_ptr */ &file_ptr, + /* cache_ptr_ptr */ &cache_ptr); + } + + if ( show_progress ) /* 10 */ + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 10) Close the file. */ + + if ( pass ) { + + if ( H5Fclose(file_id) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Fclose() failed.\n"; + } + } + + if ( show_progress ) /* 11 */ + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 11) Delete the file. */ + + if ( pass ) { + + if ( HDremove(filename) < 0 ) { + + pass = FALSE; + failure_mssg = "HDremove() failed.\n"; + } + } + + + if ( pass ) { PASSED(); } else { H5_FAILED(); } + + if ( ! pass ) + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", + FUNC, failure_mssg); + + return !pass; + +} /* check_cache_image_ctl_flow_4() */ + + +/*------------------------------------------------------------------------- + * Function: check_cache_image_ctl_flow_5() + * + * Purpose: This test is one of a sequence of control flow tests intended + * to verify that control flow for the cache image feature works + * as expected. + * + * The objective of this test is verify correct control flow + * when a file with a metadata cache image superblock extension + * message is opened with the metadata cache image FAPL entry. + * + * Note that in all cases we are performing operations on the + * file between file open and close. While this is the + * typical case, we must repeat this test without operations + * on the file. + * + * 1) Create a HDF5 file with the cache image FAPL entry. + * + * Verify that the cache is informed of the cache image + * FAPL entry. + * + * Set flags forcing creation of metadata cache image + * super block extension message only. + * + * 2) Create some datasets. + * + * 3) Close the file. + * + * 4) Open the file WITH the cache image FAPL entry. + * + * Verify that the metadata cache is instructed + * to load the metadata cache image, and that the + * supplied address and length are HADDR_UNDEF and + * zero respectively. Note that these values indicate + * that the metadata image block doesn't exist. + * + * Verify that the cache is informed of the cache image + * FAPL entry. + * + * Set flags forcing creation of metadata cache image + * super block extension message only. + * + * 5) Verify the contents of the datasets. + * + * 6) Close the file. + * + * 7) Open the file. + * + * Verify that the metadata cache is instructed + * to load the metadata cache image, and that the + * supplied address and length are HADDR_UNDEF and + * zero respectively. Note that these values indicate + * that the metadata image block doesn't exist. + * + * 8) Verify the contents of the datasets. + * + * 9) Close the file. + * + * 10) Delete the file. + * + * Return: void + * + * Programmer: John Mainzer + * 7/17/15 + * + *------------------------------------------------------------------------- + */ + +static unsigned +check_cache_image_ctl_flow_5(void) +{ + const char * fcn_name = "check_cache_image_ctl_flow_5()"; + char filename[512]; + hbool_t show_progress = FALSE; + hid_t file_id = -1; + H5F_t *file_ptr = NULL; + H5C_t *cache_ptr = NULL; + int cp = 0; + + TESTING("metadata cache image control flow test 5"); + + pass = TRUE; + + if ( show_progress ) /* 0 */ + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + /* setup the file name */ + if ( pass ) { + + if ( h5_fixname(FILENAMES[0], H5P_DEFAULT, filename, sizeof(filename)) + == NULL ) { + + pass = FALSE; + failure_mssg = "h5_fixname() failed.\n"; + } + } + + if ( show_progress ) /* 1 */ + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 1) Create a HDF5 file with the cache image FAPL entry. + * + * Verify that the cache is informed of the cache image FAPL entry. + * + * Set flags forcing creation of metadata cache image + * super block extension message only. + */ + + if ( pass ) { + + open_hdf5_file(/* create_file */ TRUE, + /* mdci_sbem_expected */ FALSE, + /* read_only */ FALSE, + /* set_mdci_fapl */ TRUE, + /* config_fsm */ FALSE, + /* hdf_file_name */ filename, + /* cache_image_flags */ H5C_CI__GEN_MDCI_SBE_MESG, + /* file_id_ptr */ &file_id, + /* file_ptr_ptr */ &file_ptr, + /* cache_ptr_ptr */ &cache_ptr); + } + + if ( show_progress ) /* 2 */ + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 2) Create some datasets. */ + + if ( pass ) { + + create_datasets(file_id, 0, 5); + } + + if ( show_progress ) /* 3 */ + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 3) Close the file. */ + + if ( pass ) { + + if ( H5Fclose(file_id) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Fclose() failed.\n"; + } + } + + if ( show_progress ) /* 4 */ + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 4) Open the file WITH the cache image FAPL entry. + * + * Verify that the metadata cache is instructed + * to load the metadata cache image, and that the + * supplied address and length are HADDR_UNDEF and + * zero respectively. Note that these values indicate + * that the metadata image block doesn't exist. + * + * Verify that the cache is informed of the cache image + * FAPL entry. + * + * Set flags forcing creation of metadata cache image + * super block extension message only. + */ + + if ( pass ) { + + open_hdf5_file(/* create_file */ FALSE, + /* mdci_sbem_expected */ TRUE, + /* read_only */ FALSE, + /* set_mdci_fapl */ TRUE, + /* config_fsm */ FALSE, + /* hdf_file_name */ filename, + /* cache_image_flags */ H5C_CI__GEN_MDCI_SBE_MESG, + /* file_id_ptr */ &file_id, + /* file_ptr_ptr */ &file_ptr, + /* cache_ptr_ptr */ &cache_ptr); + } + + if ( show_progress ) /* 5 */ + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + /* 5) Verify the contents of the datasets. */ + + if ( pass ) { + + verify_datasets(file_id, 0, 5); + } + + if ( show_progress ) /* 6 */ + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 6) Close the file. */ + + if ( pass ) { + + if ( H5Fclose(file_id) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Fclose() failed.\n"; + } + } + + if ( show_progress ) /* 7 */ + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 7) Open the file. + * + * Verify that the metadata cache is instructed + * to load the metadata cache image, and that the + * supplied address and length are HADDR_UNDEF and + * zero respectively. Note that these values indicate + * that the metadata image block doesn't exist. + */ + + if ( pass ) { + + open_hdf5_file(/* create_file */ FALSE, + /* mdci_sbem_expected */ TRUE, + /* read_only */ FALSE, + /* set_mdci_fapl */ FALSE, + /* config_fsm */ FALSE, + /* hdf_file_name */ filename, + /* cache_image_flags */ 0, + /* file_id_ptr */ &file_id, + /* file_ptr_ptr */ &file_ptr, + /* cache_ptr_ptr */ &cache_ptr); + } + + if ( show_progress ) /* 8 */ + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + /* 8) Verify the contents of the datasets. */ + + if ( pass ) { + + verify_datasets(file_id, 0, 5); + } + + if ( show_progress ) /* 9 */ + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 9) Close the file. */ + + if ( pass ) { + + if ( H5Fclose(file_id) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Fclose() failed.\n"; + } + } + + if ( show_progress ) /* 10 */ + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 10) Delete the file. */ + + if ( pass ) { + + if ( HDremove(filename) < 0 ) { + + pass = FALSE; + failure_mssg = "HDremove() failed.\n"; + } + } + + + if ( pass ) { PASSED(); } else { H5_FAILED(); } + + if ( ! pass ) + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", + FUNC, failure_mssg); + + return !pass; + +} /* check_cache_image_ctl_flow_5() */ + + +/*------------------------------------------------------------------------- + * Function: check_cache_image_ctl_flow_6() + * + * Purpose: This test is one of a sequence of control flow tests intended + * to verify that control flow for the cache image feature works + * as expected. + * + * The objective of this test is verify correct control flow + * when a file with a metadata cache image superblock extension + * message is opened with the metadata cache image FAPL entry. + * + * In this test we avoid all file activity other than open + * and close. + * + * 1) Create a HDF5 file with the cache image FAPL entry. + * + * Verify that the cache is informed of the cache image + * FAPL entry. + * + * Set flags forcing creation of metadata cache image + * super block extension message only. + * + * 2) Close the file. + * + * 3) Open the file WITH the cache image FAPL entry. + * + * Verify that the metadata cache is instructed + * to load the metadata cache image, and that the + * supplied address and length are HADDR_UNDEF and + * zero respectively. Note that these values indicate + * that the metadata image block doesn't exist. + * + * Verify that the cache is informed of the cache image + * FAPL entry. + * + * Set flags forcing creation of metadata cache image + * super block extension message only. + * + * 4) Close the file. + * + * 5) Open the file. + * + * Verify that the metadata cache is instructed + * to load the metadata cache image, and that the + * supplied address and length are HADDR_UNDEF and + * zero respectively. Note that these values indicate + * that the metadata image block doesn't exist. + * + * 6) Close the file. + * + * 7) Delete the file. + * + * Return: void + * + * Programmer: John Mainzer + * 7/17/15 + * + *------------------------------------------------------------------------- + */ + +static unsigned +check_cache_image_ctl_flow_6(void) +{ + const char * fcn_name = "check_cache_image_ctl_flow_6()"; + char filename[512]; + hbool_t show_progress = FALSE; + hid_t file_id = -1; + H5F_t *file_ptr = NULL; + H5C_t *cache_ptr = NULL; + int cp = 0; + + TESTING("metadata cache image control flow test 6"); + + pass = TRUE; + + if ( show_progress ) /* 0 */ + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + /* setup the file name */ + if ( pass ) { + + if ( h5_fixname(FILENAMES[0], H5P_DEFAULT, filename, sizeof(filename)) + == NULL ) { + + pass = FALSE; + failure_mssg = "h5_fixname() failed.\n"; + } + } + + if ( show_progress ) /* 1 */ + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 1) Create a HDF5 file with the cache image FAPL entry. + * + * Verify that the cache is informed of the cache image FAPL entry. + * + * Set flags forcing creation of metadata cache image + * super block extension message only. + */ + + if ( pass ) { + + open_hdf5_file(/* create_file */ TRUE, + /* mdci_sbem_expected */ FALSE, + /* read_only */ FALSE, + /* set_mdci_fapl */ TRUE, + /* config_fsm */ FALSE, + /* hdf_file_name */ filename, + /* cache_image_flags */ H5C_CI__GEN_MDCI_SBE_MESG, + /* file_id_ptr */ &file_id, + /* file_ptr_ptr */ &file_ptr, + /* cache_ptr_ptr */ &cache_ptr); + } + + if ( show_progress ) /* 2 */ + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 2) Close the file. */ + + if ( pass ) { + + if ( H5Fclose(file_id) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Fclose() failed.\n"; + } + } + + if ( show_progress ) /* 3 */ + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 4) Open the file WITH the cache image FAPL entry. + * + * Verify that the metadata cache is instructed + * to load the metadata cache image, and that the + * supplied address and length are HADDR_UNDEF and + * zero respectively. Note that these values indicate + * that the metadata image block doesn't exist. + * + * Verify that the cache is informed of the cache image + * FAPL entry. + * + * Set flags forcing creation of metadata cache image + * super block extension message only. + */ + + if ( pass ) { + + open_hdf5_file(/* create_file */ FALSE, + /* mdci_sbem_expected */ TRUE, + /* read_only */ FALSE, + /* set_mdci_fapl */ TRUE, + /* config_fsm */ FALSE, + /* hdf_file_name */ filename, + /* cache_image_flags */ H5C_CI__GEN_MDCI_SBE_MESG, + /* file_id_ptr */ &file_id, + /* file_ptr_ptr */ &file_ptr, + /* cache_ptr_ptr */ &cache_ptr); + } + + if ( show_progress ) /* 4 */ + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 5) Close the file. */ + + if ( pass ) { + + if ( H5Fclose(file_id) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Fclose() failed.\n"; + } + } + + if ( show_progress ) /* 5 */ + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 5) Open the file. + * + * Verify that the metadata cache is instructed + * to load the metadata cache image, and that the + * supplied address and length are HADDR_UNDEF and + * zero respectively. Note that these values indicate + * that the metadata image block doesn't exist. + */ + + if ( pass ) { + + open_hdf5_file(/* create_file */ FALSE, + /* mdci_sbem_expected */ TRUE, + /* read_only */ FALSE, + /* set_mdci_fapl */ FALSE, + /* config_fsm */ FALSE, + /* hdf_file_name */ filename, + /* cache_image_flags */ 0, + /* file_id_ptr */ &file_id, + /* file_ptr_ptr */ &file_ptr, + /* cache_ptr_ptr */ &cache_ptr); + } + + if ( show_progress ) /* 6 */ + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 6) Close the file. */ + + if ( pass ) { + + if ( H5Fclose(file_id) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Fclose() failed.\n"; + } + } + + if ( show_progress ) /* 7 */ + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 7) Delete the file. */ + + if ( pass ) { + + if ( HDremove(filename) < 0 ) { + + pass = FALSE; + failure_mssg = "HDremove() failed.\n"; + } + } + + + if ( pass ) { PASSED(); } else { H5_FAILED(); } + + if ( ! pass ) + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", + FUNC, failure_mssg); + + return !pass; + +} /* check_cache_image_ctl_flow_6() */ + + +/*------------------------------------------------------------------------- + * Function: cache_image_smoke_check_1() + * + * Purpose: This test is one of a sequence of tests intended + * to exercise the cache image feature verifying that it + * works more or less correctly in common cases. + * + * This test is an initial smoke check, so the sequence of + * operations is relatively simple. In particular, we are + * testing: + * + * i) Creation of file with metadata cache image + * superblock extension message and cache image + * block. + * + * ii) Open of file with metadata cache image superblock + * extension message and cache image block. + * Deserialization and removal of both, insertion + * of prefetched cache entries, and deserialization + * of prefetched cache entries as they are protected. + * + * iii) Subsequent write of file without metadata cache + * image. + * + * iv) Open and close of file with metadata cache image + * image requested, but with no operations on the + * file. + * + * To do this: + * + * 1) Create a HDF5 file with the cache image FAPL entry. + * + * Verify that the cache is informed of the cache image + * FAPL entry. + * + * Set all cache image flags, forcing full functionality. + * + * 2) Create some datasets in the file. + * + * 3) Close the file. + * + * 4) Open the file. + * + * Verify that the metadata cache is instructed + * to load the metadata cache image. + * + * 5) Open a dataset. + * + * Verify that it contains the expected data + * + * 6) Close the file. + * + * 7) Open the file. + * + * Verify that the file doesn't contain a metadata cache + * image superblock extension message. + * + * 8) Open a dataset. + * + * Verify that it contains the expected data. + * + * 9) Close the file. + * + * 10) Open the file with the cache image FAPL entry. + * + * Verify that the cache is informed of the cache image + * FAPL entry. + * + * Set all cache image flags, forcing full functionality. + * + * 11) Close the file. Since there has been no access to + * any entries that would be included in the cache image, + * there should be no cache image. + * + * 12) Open the file. + * + * Verify that the file doesn't contain a metadata cache + * image superblock extension message. + * + * 13) Open a dataset. + * + * Verify that it contains the expected data. + * + * 14) Close the file. + * + * 15) Delete the file. + * + * Return: void + * + * Programmer: John Mainzer + * 8/17/15 + * + *------------------------------------------------------------------------- + */ + +static unsigned +cache_image_smoke_check_1(void) +{ + const char * fcn_name = "cache_image_smoke_check_1()"; + char filename[512]; + hbool_t show_progress = FALSE; + hid_t file_id = -1; + H5F_t *file_ptr = NULL; + H5C_t *cache_ptr = NULL; + int cp = 0; + + TESTING("metadata cache image smoke check 1"); + + pass = TRUE; + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* setup the file name */ + if ( pass ) { + + if ( h5_fixname(FILENAMES[0], H5P_DEFAULT, filename, sizeof(filename)) + == NULL ) { + + pass = FALSE; + failure_mssg = "h5_fixname() failed.\n"; + } + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 1) Create a HDF5 file with the cache image FAPL entry. + * + * Verify that the cache is informed of the cache image FAPL entry. + * + * Set flags forcing full function of the cache image feature. + */ + + if ( pass ) { + + open_hdf5_file(/* create_file */ TRUE, + /* mdci_sbem_expected */ FALSE, + /* read_only */ FALSE, + /* set_mdci_fapl */ TRUE, + /* config_fsm */ FALSE, + /* hdf_file_name */ filename, + /* cache_image_flags */ H5C_CI__ALL_FLAGS, + /* file_id_ptr */ &file_id, + /* file_ptr_ptr */ &file_ptr, + /* cache_ptr_ptr */ &cache_ptr); + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 2) Create some datasets in the file. */ + + if ( pass ) { + + create_datasets(file_id, 0, 5); + } + +#if H5C_COLLECT_CACHE_STATS + if ( pass ) { + + if ( cache_ptr->images_loaded != 0 ) { + + pass = FALSE; + failure_mssg = "metadata cache image block loaded(1)."; + } + } +#endif /* H5C_COLLECT_CACHE_STATS */ + + + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 3) Close the file. */ + + if ( pass ) { + + if ( H5Fclose(file_id) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Fclose() failed.\n"; + + } + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 4) Open the file. + * + * Verify that the metadata cache is instructed to load the + * metadata cache image, and that the supplied address and length + * are HADDR_UNDEF and zero respectively. Note that these values + * indicate that the metadata image block doesn't exist. + */ + + if ( pass ) { + + open_hdf5_file(/* create_file */ FALSE, + /* mdci_sbem_expected */ TRUE, + /* read_only */ FALSE, + /* set_mdci_fapl */ FALSE, + /* config_fsm */ FALSE, + /* hdf_file_name */ filename, + /* cache_image_flags */ 0, + /* file_id_ptr */ &file_id, + /* file_ptr_ptr */ &file_ptr, + /* cache_ptr_ptr */ &cache_ptr); + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 5) Open and close a dataset. + * + * Verify that the metadata cache image superblock + * extension message has been deleted. + */ + + if ( pass ) { + + verify_datasets(file_id, 0, 5); + } + +#if H5C_COLLECT_CACHE_STATS + if ( pass ) { + + if ( cache_ptr->images_loaded != 1 ) { + + pass = FALSE; + failure_mssg = "metadata cache image block not loaded(1)."; + } + } +#endif /* H5C_COLLECT_CACHE_STATS */ + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 6) Close the file. */ + + if ( pass ) { + + if ( H5Fclose(file_id) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Fclose() failed.\n"; + } + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 7) Open the file. + * + * Verify that the file doesn't contain a metadata cache image + * superblock extension message. + */ + + if ( pass ) { + + open_hdf5_file(/* create_file */ FALSE, + /* mdci_sbem_expected */ FALSE, + /* read_only */ FALSE, + /* set_mdci_fapl */ FALSE, + /* config_fsm */ FALSE, + /* hdf_file_name */ filename, + /* cache_image_flags */ 0, + /* file_id_ptr */ &file_id, + /* file_ptr_ptr */ &file_ptr, + /* cache_ptr_ptr */ &cache_ptr); + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 8) Open and close a dataset. + * + * Verify that the metadata cache image superblock + * extension message has been deleted. + */ + + if ( pass ) { + + verify_datasets(file_id, 0, 5); + } + +#if H5C_COLLECT_CACHE_STATS + if ( pass ) { + + if ( cache_ptr->images_loaded != 0 ) { + + pass = FALSE; + failure_mssg = "metadata cache image block loaded(2)."; + } + } +#endif /* H5C_COLLECT_CACHE_STATS */ + + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 9) Close the file. */ + + if ( pass ) { + + if ( H5Fclose(file_id) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Fclose() failed.\n"; + } + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 10) Open the file with the cache image FAPL entry. + * + * Verify that the cache is informed of the cache image + * FAPL entry. + */ + + if ( pass ) { + + open_hdf5_file(/* create_file */ FALSE, + /* mdci_sbem_expected */ FALSE, + /* read_only */ FALSE, + /* set_mdci_fapl */ TRUE, + /* config_fsm */ FALSE, + /* hdf_file_name */ filename, + /* cache_image_flags */ H5C_CI__ALL_FLAGS, + /* file_id_ptr */ &file_id, + /* file_ptr_ptr */ &file_ptr, + /* cache_ptr_ptr */ &cache_ptr); + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 11) Close the file. Since there has been no access to + * any entries that would be included in the cache image, + * there should be no cache image. + */ + + if ( pass ) { + + if ( H5Fclose(file_id) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Fclose() failed.\n"; + } + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 12) Open the file. + * + * Verify that the file doesn't contain a metadata cache + * image superblock extension message. + */ + + if ( pass ) { + + open_hdf5_file(/* create_file */ FALSE, + /* mdci_sbem_expected */ FALSE, + /* read_only */ FALSE, + /* set_mdci_fapl */ FALSE, + /* config_fsm */ FALSE, + /* hdf_file_name */ filename, + /* cache_image_flags */ 0, + /* file_id_ptr */ &file_id, + /* file_ptr_ptr */ &file_ptr, + /* cache_ptr_ptr */ &cache_ptr); + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 13) Open a dataset. + * + * Verify that it contains the expected data. + */ + + if ( pass ) { + + verify_datasets(file_id, 0, 5); + } + +#if H5C_COLLECT_CACHE_STATS + if ( pass ) { + + if ( cache_ptr->images_loaded != 0 ) { + + pass = FALSE; + failure_mssg = "metadata cache image block loaded(3)."; + } + } +#endif /* H5C_COLLECT_CACHE_STATS */ + + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 14) Close the file. */ + + if ( pass ) { + + if ( H5Fclose(file_id) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Fclose() failed.\n"; + } + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 15) Delete the file */ + + if ( pass ) { + + if ( HDremove(filename) < 0 ) { + + pass = FALSE; + failure_mssg = "HDremove() failed.\n"; + } + } + + if ( pass ) { PASSED(); } else { H5_FAILED(); } + + if ( ! pass ) + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", + FUNC, failure_mssg); + + return !pass; + +} /* cache_image_smoke_check_1() */ + + +/*------------------------------------------------------------------------- + * Function: cache_image_smoke_check_2() + * + * Purpose: This test is one of a sequence of tests intended + * to exercise the cache image feature verifying that it + * works more or less correctly in common cases. + * + * This test is an initial smoke check, so the sequence of + * operations is relatively simple. In particular, we are + * testing: + * + * i) Creation of file with metadata cache image + * superblock extension message and cache image + * block. + * + * ii) Open of file with metadata cache image superblock + * extension message and cache image block. Write + * of prefetched entries to file on file close. + * + * To do this: + * + * 1) Create a HDF5 file with the cache image FAPL entry. + * + * Verify that the cache is informed of the cache image + * FAPL entry. + * + * Set all cache image flags, forcing full functionality. + * + * 2) Create some datasets in the file. + * + * 3) Close the file. + * + * 4) Open the file. + * + * 5) Close the file. + * + * 6) Open the file. + * + * Verify that the file doesn't contain a metadata cache + * image superblock extension message. + * + * 7) Open a dataset. + * + * Verify that it contains the expected data. + * + * 8) Close the file. + * + * 9) Delete the file. + * + * Return: void + * + * Programmer: John Mainzer + * 8/18/15 + * + *------------------------------------------------------------------------- + */ + +static unsigned +cache_image_smoke_check_2(void) +{ + const char * fcn_name = "cache_image_smoke_check_2()"; + char filename[512]; + hbool_t show_progress = FALSE; + hid_t file_id = -1; + H5F_t *file_ptr = NULL; + H5C_t *cache_ptr = NULL; + int cp = 0; + + TESTING("metadata cache image smoke check 2"); + + pass = TRUE; + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* setup the file name */ + if ( pass ) { + + if ( h5_fixname(FILENAMES[0], H5P_DEFAULT, filename, sizeof(filename)) + == NULL ) { + + pass = FALSE; + failure_mssg = "h5_fixname() failed.\n"; + } + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 1) Create a HDF5 file with the cache image FAPL entry. + * + * Verify that the cache is informed of the cache image FAPL entry. + * + * Set flags forcing full function of the cache image feature. + */ + + if ( pass ) { + + open_hdf5_file(/* create_file */ TRUE, + /* mdci_sbem_expected */ FALSE, + /* read_only */ FALSE, + /* set_mdci_fapl */ TRUE, + /* config_fsm */ TRUE, + /* hdf_file_name */ filename, + /* cache_image_flags */ H5C_CI__ALL_FLAGS, + /* file_id_ptr */ &file_id, + /* file_ptr_ptr */ &file_ptr, + /* cache_ptr_ptr */ &cache_ptr); + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 2) Create some datasets in the file. */ + + if ( pass ) { + + create_datasets(file_id, 0, 5); + } + +#if H5C_COLLECT_CACHE_STATS + if ( pass ) { + + if ( cache_ptr->images_loaded != 0 ) { + + pass = FALSE; + failure_mssg = "metadata cache image block loaded(1)."; + } + } +#endif /* H5C_COLLECT_CACHE_STATS */ + + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 3) Close the file. */ + + if ( pass ) { + + if ( H5Fclose(file_id) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Fclose() failed.\n"; + + } + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 4) Open the file. + * + * Verify that the metadata cache is instructed to load the + * metadata cache image. + */ + + if ( pass ) { + + open_hdf5_file(/* create_file */ FALSE, + /* mdci_sbem_expected */ TRUE, + /* read_only */ FALSE, + /* set_mdci_fapl */ FALSE, + /* config_fsm */ FALSE, + /* hdf_file_name */ filename, + /* cache_image_flags */ 0, + /* file_id_ptr */ &file_id, + /* file_ptr_ptr */ &file_ptr, + /* cache_ptr_ptr */ &cache_ptr); + } + + /* can't verify that metadata cache image has been loaded directly, + * as in this cache, the load will not happen until close, and thus + * the images_created stat will not be readily available as it is + * incremented just before the cache is shut down. + */ + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 5) Close the file. */ + + if ( pass ) { + + if ( H5Fclose(file_id) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Fclose() failed.\n"; + } + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 6) Open the file. + * + * Verify that the file doesn't contain a metadata cache image + * superblock extension message. + */ + + if ( pass ) { + + open_hdf5_file(/* create_file */ FALSE, + /* mdci_sbem_expected */ FALSE, + /* read_only */ FALSE, + /* set_mdci_fapl */ FALSE, + /* config_fsm */ FALSE, + /* hdf_file_name */ filename, + /* cache_image_flags */ 0, + /* file_id_ptr */ &file_id, + /* file_ptr_ptr */ &file_ptr, + /* cache_ptr_ptr */ &cache_ptr); + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 7) Open and close a dataset. + * + * Verify that the metadata cache image superblock + * extension message has been deleted. + */ + + if ( pass ) { + + verify_datasets(file_id, 0, 5); + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 8) Close the file. */ + + if ( pass ) { + + if ( H5Fclose(file_id) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Fclose() failed.\n"; + } + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 9) Delete the file */ + + if ( pass ) { + + if ( HDremove(filename) < 0 ) { + + pass = FALSE; + failure_mssg = "HDremove() failed.\n"; + } + } + + if ( pass ) { PASSED(); } else { H5_FAILED(); } + + if ( ! pass ) + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", + FUNC, failure_mssg); + + return !pass; + +} /* cache_image_smoke_check_2() */ + + +/*------------------------------------------------------------------------- + * Function: cache_image_smoke_check_3() + * + * Purpose: This test is one of a sequence of tests intended + * to exercise the cache image feature verifying that it + * works more or less correctly in common cases. + * + * This test is an initial smoke check, so the sequence of + * operations is relatively simple. In particular, we are + * testing: + * + * i) Creation of file with metadata cache image + * superblock extension message and cache image + * block. + * + * ii) Read only open and close of file with metadata + * cache image superblock extension message and + * cache image block. + * + * iii) Subsequent R/W open and close of file with metadata + * cache image superblock extension message and + * cache image block. + * + * To do this: + * + * 1) Create a HDF5 file with the cache image FAPL entry. + * + * Verify that the cache is informed of the cache image + * FAPL entry. + * + * Set all cache image flags, forcing full functionality. + * + * 2) Create some datasets in the file. + * + * 3) Close the file. + * + * 4) Open the file read only. + * + * Verify that the file contains a metadata cache + * image superblock extension message. + * + * 5 Open a dataset. + * + * Verify that it contains the expected data. + * + * 6) Close the file. + * + * 7) Open the file. + * + * Verify that the file contains a metadata cache + * image superblock extension message. + * + * 8 Open a dataset. + * + * Verify that it contains the expected data. + * + * 9) Close the file. + * + * 10) Open the file. + * + * Verify that the file doesn't contain a metadata cache + * image superblock extension message. + * + * 11) Open a dataset. + * + * Verify that it contains the expected data. + * + * 12) Close the file. + * + * 13) Delete the file. + * + * Return: void + * + * Programmer: John Mainzer + * 8/18/15 + * + *------------------------------------------------------------------------- + */ + +static unsigned +cache_image_smoke_check_3(void) +{ + const char * fcn_name = "cache_image_smoke_check_3()"; + char filename[512]; + hbool_t show_progress = FALSE; + hid_t file_id = -1; + H5F_t *file_ptr = NULL; + H5C_t *cache_ptr = NULL; + int cp = 0; + + TESTING("metadata cache image smoke check 3"); + + pass = TRUE; + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* setup the file name */ + if ( pass ) { + + if ( h5_fixname(FILENAMES[0], H5P_DEFAULT, filename, sizeof(filename)) + == NULL ) { + + pass = FALSE; + failure_mssg = "h5_fixname() failed.\n"; + } + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 1) Create a HDF5 file with the cache image FAPL entry. + * + * Verify that the cache is informed of the cache image FAPL entry. + * + * Set flags forcing full function of the cache image feature. + */ + + if ( pass ) { + + open_hdf5_file(/* create_file */ TRUE, + /* mdci_sbem_expected */ FALSE, + /* read_only */ FALSE, + /* set_mdci_fapl */ TRUE, + /* config_fsm */ TRUE, + /* hdf_file_name */ filename, + /* cache_image_flags */ H5C_CI__ALL_FLAGS, + /* file_id_ptr */ &file_id, + /* file_ptr_ptr */ &file_ptr, + /* cache_ptr_ptr */ &cache_ptr); + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 2) Create some datasets in the file. */ + + if ( pass ) { + + create_datasets(file_id, 0, 5); + } + +#if H5C_COLLECT_CACHE_STATS + if ( pass ) { + + if ( cache_ptr->images_loaded != 0 ) { + + pass = FALSE; + failure_mssg = "metadata cache image block loaded(1)."; + } + } +#endif /* H5C_COLLECT_CACHE_STATS */ + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 3) Close the file. */ + + if ( pass ) { + + if ( H5Fclose(file_id) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Fclose() failed.\n"; + + } + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 4) Open the file read only. + * + * Verify that the metadata cache is instructed to load the + * metadata cache image. + */ + + if ( pass ) { + + open_hdf5_file(/* create_file */ FALSE, + /* mdci_sbem_expected */ TRUE, + /* read_only */ TRUE, + /* set_mdci_fapl */ FALSE, + /* config_fsm */ FALSE, + /* hdf_file_name */ filename, + /* cache_image_flags */ 0, + /* file_id_ptr */ &file_id, + /* file_ptr_ptr */ &file_ptr, + /* cache_ptr_ptr */ &cache_ptr); + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 5) Open and close a dataset. + * + * Verify that the metadata cache image superblock + * extension message has been deleted. + */ + + if ( pass ) { + + verify_datasets(file_id, 0, 5); + } + +#if H5C_COLLECT_CACHE_STATS + if ( pass ) { + + if ( cache_ptr->images_loaded == 0 ) { + + pass = FALSE; + failure_mssg = "metadata cache image block not loaded(1)."; + } + } +#endif /* H5C_COLLECT_CACHE_STATS */ + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 6) Close the file. */ + + if ( pass ) { + + if ( H5Fclose(file_id) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Fclose() failed.\n"; + } + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 7) Open the file. + * + * Verify that the file contains a metadata cache image + * superblock extension message. + */ + + if ( pass ) { + + open_hdf5_file(/* create_file */ FALSE, + /* mdci_sbem_expected */ TRUE, + /* read_only */ FALSE, + /* set_mdci_fapl */ FALSE, + /* config_fsm */ FALSE, + /* hdf_file_name */ filename, + /* cache_image_flags */ 0, + /* file_id_ptr */ &file_id, + /* file_ptr_ptr */ &file_ptr, + /* cache_ptr_ptr */ &cache_ptr); + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 8) Open and close a dataset. + * + * Verify that the metadata cache image superblock + * extension message has been deleted. + */ + + if ( pass ) { + + verify_datasets(file_id, 0, 5); + } + +#if H5C_COLLECT_CACHE_STATS + if ( pass ) { + + if ( cache_ptr->images_loaded == 0 ) { + + pass = FALSE; + failure_mssg = "metadata cache image block not loaded(2)."; + } + } +#endif /* H5C_COLLECT_CACHE_STATS */ + + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 9) Close the file. */ + + if ( pass ) { + + if ( H5Fclose(file_id) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Fclose() failed.\n"; + } + } + + + /* 10) Open the file. + * + * Verify that the file doesn't contain a metadata cache image + * superblock extension message. + */ + + if ( pass ) { + + open_hdf5_file(/* create_file */ FALSE, + /* mdci_sbem_expected */ FALSE, + /* read_only */ FALSE, + /* set_mdci_fapl */ FALSE, + /* config_fsm */ FALSE, + /* hdf_file_name */ filename, + /* cache_image_flags */ 0, + /* file_id_ptr */ &file_id, + /* file_ptr_ptr */ &file_ptr, + /* cache_ptr_ptr */ &cache_ptr); + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 11) Open and close a dataset. + * + * Verify that the metadata cache image superblock + * extension message has been deleted. + */ + + if ( pass ) { + + verify_datasets(file_id, 0, 5); + } + +#if H5C_COLLECT_CACHE_STATS + if ( pass ) { + + if ( cache_ptr->images_loaded != 0 ) { + + pass = FALSE; + failure_mssg = "metadata cache image block loaded(2)."; + } + } +#endif /* H5C_COLLECT_CACHE_STATS */ + + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 12) Close the file. */ + + if ( pass ) { + + if ( H5Fclose(file_id) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Fclose() failed.\n"; + } + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 13) Delete the file */ + + if ( pass ) { + + if ( HDremove(filename) < 0 ) { + + pass = FALSE; + failure_mssg = "HDremove() failed.\n"; + } + } + + if ( pass ) { PASSED(); } else { H5_FAILED(); } + + if ( ! pass ) + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", + FUNC, failure_mssg); + + return !pass; + +} /* cache_image_smoke_check_3() */ + + +/*------------------------------------------------------------------------- + * Function: cache_image_smoke_check_4() + * + * Purpose: This test attempts to mimic the typical "poor man's + * parallel use case in which the file is passed between + * processes, each of which open the file, write some data, + * close the file, and then pass control on to the next + * process. + * + * In this case, we only write one dataset per process. + * + * Cycle of operation + * + * 1) Create a HDF5 file with the cache image FAPL entry. + * + * Verify that the cache is informed of the cache image + * FAPL entry. + * + * Set all cache image flags, forcing full functionality. + * + * 2) Create and write a dataset in the file. + * + * 3) Close the file. + * + * 4) Open the file with the cache image FAPL entry. + * + * Verify that the file contains a metadata cache + * image superblock extension message. + * + * 5 Create and write a new dataset + * + * 6) Close the file. + * + * If sufficient datasets have been created, continue to + * 7). Otherwise goto 4) + * + * 7) Open the file. + * + * Verify that the file contains a metadata cache + * image superblock extension message. + * + * 8) Open all datasets that have been created, and + * verify that they contain the expected data. + * + * 9) Close the file. + * + * 10) Open the file. + * + * Verify that the file doesn't contain a metadata cache + * image superblock extension message. + * + * 11) Open all datasets that have been created, and + * verify that they contain the expected data. + * + * Verify that it contains the expected data. + * + * 12) Close the file. + * + * 13) Delete the file. + * + * Return: void + * + * Programmer: John Mainzer + * 8/18/15 + * + *------------------------------------------------------------------------- + */ + +static unsigned +cache_image_smoke_check_4(void) +{ + const char * fcn_name = "cache_image_smoke_check_4()"; + char filename[512]; + hbool_t show_progress = FALSE; + hid_t file_id = -1; + H5F_t *file_ptr = NULL; + H5C_t *cache_ptr = NULL; + int cp = 0; + int min_dset = 0; + int max_dset = 0; + + TESTING("metadata cache image smoke check 4"); + + pass = TRUE; + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* setup the file name */ + if ( pass ) { + + if ( h5_fixname(FILENAMES[0], H5P_DEFAULT, filename, sizeof(filename)) + == NULL ) { + + pass = FALSE; + failure_mssg = "h5_fixname() failed.\n"; + } + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 1) Create a HDF5 file with the cache image FAPL entry. + * + * Verify that the cache is informed of the cache image FAPL entry. + * + * Set flags forcing full function of the cache image feature. + */ + + if ( pass ) { + + open_hdf5_file(/* create_file */ TRUE, + /* mdci_sbem_expected */ FALSE, + /* read_only */ FALSE, + /* set_mdci_fapl */ TRUE, + /* config_fsm */ TRUE, + /* hdf_file_name */ filename, + /* cache_image_flags */ H5C_CI__ALL_FLAGS, + /* file_id_ptr */ &file_id, + /* file_ptr_ptr */ &file_ptr, + /* cache_ptr_ptr */ &cache_ptr); + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 2) Create a dataset in the file. */ + + if ( pass ) { + + create_datasets(file_id, min_dset++, max_dset++); + } + +#if H5C_COLLECT_CACHE_STATS + if ( pass ) { + + if ( cache_ptr->images_loaded != 0 ) { + + pass = FALSE; + failure_mssg = "metadata cache image block loaded(1)."; + } + } +#endif /* H5C_COLLECT_CACHE_STATS */ + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 3) Close the file. */ + + if ( pass ) { + + if ( H5Fclose(file_id) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Fclose() failed.\n"; + + } + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + while ( ( pass ) && ( max_dset < MAX_NUM_DSETS ) ) + { + + /* 4) Open the file. + * + * Verify that the metadata cache is instructed to load the + * metadata cache image. + */ + + if ( pass ) { + + open_hdf5_file(/* create_file */ FALSE, + /* mdci_sbem_expected */ TRUE, + /* read_only */ FALSE, + /* set_mdci_fapl */ TRUE, + /* config_fsm */ FALSE, + /* hdf_file_name */ filename, + /* cache_image_flags */ H5C_CI__ALL_FLAGS, + /* file_id_ptr */ &file_id, + /* file_ptr_ptr */ &file_ptr, + /* cache_ptr_ptr */ &cache_ptr); + } + + if ( show_progress ) + HDfprintf(stdout, "%s:L1 cp = %d, max_dset = %d, pass = %d.\n", + fcn_name, cp, max_dset, pass); + + + /* 5) Create a dataset in the file. */ + + if ( pass ) { + + create_datasets(file_id, min_dset++, max_dset++); + } + +#if H5C_COLLECT_CACHE_STATS + if ( pass ) { + + if ( cache_ptr->images_loaded == 0 ) { + + pass = FALSE; + failure_mssg = "metadata cache image block not loaded(1)."; + } + } +#endif /* H5C_COLLECT_CACHE_STATS */ + + if ( show_progress ) + HDfprintf(stdout, "%s:L2 cp = %d, max_dset = %d, pass = %d.\n", + fcn_name, cp + 1, max_dset, pass); + + + /* 6) Close the file. */ + + if ( pass ) { + + if ( H5Fclose(file_id) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Fclose() failed.\n"; + + } + } + + if ( show_progress ) + HDfprintf(stdout, "%s:L3 cp = %d, max_dset = %d, pass = %d.\n", + fcn_name, cp + 2, max_dset, pass); + } /* end while */ + cp += 3; + + + /* 7) Open the file. + * + * Verify that the file contains a metadata cache image + * superblock extension message. + */ + + if ( pass ) { + + open_hdf5_file(/* create_file */ FALSE, + /* mdci_sbem_expected */ TRUE, + /* read_only */ FALSE, + /* set_mdci_fapl */ FALSE, + /* config_fsm */ FALSE, + /* hdf_file_name */ filename, + /* cache_image_flags */ 0, + /* file_id_ptr */ &file_id, + /* file_ptr_ptr */ &file_ptr, + /* cache_ptr_ptr */ &cache_ptr); + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 8) Open and close all datasets. + * + * Verify that the metadata cache image superblock + * extension message has been deleted. + */ + + if ( pass ) { + + verify_datasets(file_id, 0, max_dset - 1); + } + +#if H5C_COLLECT_CACHE_STATS + if ( pass ) { + + if ( cache_ptr->images_loaded == 0 ) { + + pass = FALSE; + failure_mssg = "metadata cache image block not loaded(2)."; + } + } +#endif /* H5C_COLLECT_CACHE_STATS */ + + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 9) Close the file. */ + + if ( pass ) { + + if ( H5Fclose(file_id) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Fclose() failed.\n"; + } + } + + + /* 10) Open the file. + * + * Verify that the file doesn't contain a metadata cache image + * superblock extension message. + */ + + if ( pass ) { + + open_hdf5_file(/* create_file */ FALSE, + /* mdci_sbem_expected */ FALSE, + /* read_only */ FALSE, + /* set_mdci_fapl */ FALSE, + /* config_fsm */ FALSE, + /* hdf_file_name */ filename, + /* cache_image_flags */ 0, + /* file_id_ptr */ &file_id, + /* file_ptr_ptr */ &file_ptr, + /* cache_ptr_ptr */ &cache_ptr); + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 11) Open and close all datasets. + * + * Verify that the metadata cache image superblock + * extension message has been deleted. + */ + + if ( pass ) { + + verify_datasets(file_id, 0, max_dset - 1); + } + +#if H5C_COLLECT_CACHE_STATS + if ( pass ) { + + if ( cache_ptr->images_loaded != 0 ) { + + pass = FALSE; + failure_mssg = "metadata cache image block loaded(2)."; + } + } +#endif /* H5C_COLLECT_CACHE_STATS */ + + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 12) Close the file. */ + + if ( pass ) { + + if ( H5Fclose(file_id) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Fclose() failed.\n"; + } + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 13) Delete the file */ + + if ( pass ) { + + if ( HDremove(filename) < 0 ) { + + pass = FALSE; + failure_mssg = "HDremove() failed.\n"; + } + } + + if ( pass ) { PASSED(); } else { H5_FAILED(); } + + if ( ! pass ) + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", + FUNC, failure_mssg); + + return !pass; + +} /* cache_image_smoke_check_4() */ + + +/*------------------------------------------------------------------------- + * Function: cache_image_smoke_check_5() + * + * Purpose: This test attempts to mimic the typical "poor man's + * parallel use case in which the file is passed between + * processes, each of which open the file, write some data, + * close the file, and then pass control on to the next + * process. + * + * In this case, we create one group for each process, and + * populate it with a "zoo" of HDF5 objects selected to + * (ideally) exercise all HDF5 on disk data structures. + * + * Cycle of operation + * + * 1) Create a HDF5 file with the cache image FAPL entry. + * + * Verify that the cache is informed of the cache image + * FAPL entry. + * + * Set all cache image flags, forcing full functionality. + * + * 2) Create a process specific group. + * + * 3) Construct a "zoo" in the above group, and validate it. + * + * 4) Close the file. + * + * 5) Open the file with the cache image FAPL entry. + * + * Verify that the file contains a metadata cache + * image superblock extension message. + * + * 6) Validate the "zoo" created in the previous file open. + * + * 7) Create a process specific group for this file open + * + * 8) Construct a "zoo" in the above group, and validate it. + * + * 9) Close the file. + * + * If sufficient zoos have been created, continue to + * 10). Otherwise goto 5) + * + * 10) Open the file. + * + * Verify that the file contains a metadata cache + * image superblock extension message. + * + * 11) Validate all the zoos. + * + * 12) Close the file. + * + * 13) Open the file. + * + * Verify that the file doesn't contain a metadata cache + * image superblock extension message. + * + * 14) Validate all the zoos. + * + * 15) Close the file. + * + * 16) Delete the file. + * + * Return: void + * + * Programmer: John Mainzer + * 9/15/15 + * + *------------------------------------------------------------------------- + */ + +#define MAX_NUM_GROUPS 128 + +static unsigned +cache_image_smoke_check_5(void) +{ + const char * fcn_name = "cache_image_smoke_check_5()"; + char filename[512]; + char process_group_name[512]; + hbool_t show_progress = FALSE; + hid_t file_id = -1; + hid_t proc_gid = -1; + H5F_t *file_ptr = NULL; + H5C_t *cache_ptr = NULL; + int cp = 0; + int i; + int min_group = 0; + int max_group = 0; + + TESTING("metadata cache image smoke check 5"); + + pass = TRUE; + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* setup the file name */ + if ( pass ) { + + if ( h5_fixname(FILENAMES[0], H5P_DEFAULT, filename, sizeof(filename)) + == NULL ) { + + pass = FALSE; + failure_mssg = "h5_fixname() failed.\n"; + } + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 1) Create a HDF5 file with the cache image FAPL entry. + * + * Verify that the cache is informed of the cache image FAPL entry. + * + * Set flags forcing full function of the cache image feature. + */ + + if ( pass ) { + + open_hdf5_file(/* create_file */ TRUE, + /* mdci_sbem_expected */ FALSE, + /* read_only */ FALSE, + /* set_mdci_fapl */ TRUE, + /* config_fsm */ TRUE, + /* hdf_file_name */ filename, + /* cache_image_flags */ H5C_CI__ALL_FLAGS, + /* file_id_ptr */ &file_id, + /* file_ptr_ptr */ &file_ptr, + /* cache_ptr_ptr */ &cache_ptr); + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 2) Create a process specific group. */ + if ( pass ) { + + sprintf(process_group_name, "/process_%d", min_group); + + proc_gid = H5Gcreate2(file_id, process_group_name, H5P_DEFAULT, + H5P_DEFAULT, H5P_DEFAULT); + + if ( proc_gid < 0 ) { + + pass = FALSE; + failure_mssg = "H5Gcreate2() failed (1).\n"; + } + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 3) Construct a "zoo" in the above group, and validate it. */ + if ( pass ) + create_zoo(file_id, process_group_name, min_group); + +#if H5C_COLLECT_CACHE_STATS + if ( pass ) { + + if ( cache_ptr->images_loaded != 0 ) { + + pass = FALSE; + failure_mssg = "metadata cache image block loaded(1)."; + } + } +#endif /* H5C_COLLECT_CACHE_STATS */ + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 4) Close the file. */ + + if ( pass ) { + + if ( H5Gclose(proc_gid) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Gclose(proc_gid) failed. (1)"; + } + } + + if ( pass ) { + + if ( H5Fclose(file_id) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Fclose() failed.\n"; + + } + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + while ( ( pass ) && ( max_group < MAX_NUM_GROUPS ) ) + { + + /* 5) Open the file. + * + * Verify that the metadata cache is instructed to load the + * metadata cache image. + */ + + if ( pass ) { + + open_hdf5_file(/* create_file */ FALSE, + /* mdci_sbem_expected */ TRUE, + /* read_only */ FALSE, + /* set_mdci_fapl */ TRUE, + /* config_fsm */ FALSE, + /* hdf_file_name */ filename, + /* cache_image_flags */ H5C_CI__ALL_FLAGS, + /* file_id_ptr */ &file_id, + /* file_ptr_ptr */ &file_ptr, + /* cache_ptr_ptr */ &cache_ptr); + } + + if ( show_progress ) + HDfprintf(stdout, "%s:L1 cp = %d, max_group = %d, pass = %d.\n", + fcn_name, cp, max_group, pass); + + + /* 6) Validate the "zoo" created in the previous file open. */ + if ( pass ) + validate_zoo(file_id, process_group_name, max_group); + +#if H5C_COLLECT_CACHE_STATS + if ( pass ) { + + if ( cache_ptr->images_loaded == 0 ) { + + pass = FALSE; + failure_mssg = "metadata cache image block not loaded(1)."; + } + } +#endif /* H5C_COLLECT_CACHE_STATS */ + + if ( show_progress ) + HDfprintf(stdout, "%s:L2 cp = %d, max_group = %d, pass = %d.\n", + fcn_name, cp + 1, max_group, pass); + + + /* 7) Create a process specific group for this file open */ + if ( pass ) { + + max_group++; + sprintf(process_group_name, "/process_%d", max_group); + + proc_gid = H5Gcreate2(file_id, process_group_name, H5P_DEFAULT, + H5P_DEFAULT, H5P_DEFAULT); + + if ( proc_gid < 0 ) { + + pass = FALSE; + failure_mssg = "H5Gcreate2() failed (2).\n"; + } + } + + if ( show_progress ) + HDfprintf(stdout, "%s:L3 cp = %d, max_group = %d, pass = %d.\n", + fcn_name, cp + 2, max_group, pass); + + + /* 8) Construct a "zoo" in the above group, and validate it. */ + if ( pass ) + create_zoo(file_id, process_group_name, max_group); + + if ( show_progress ) + HDfprintf(stdout, "%s:L4 cp = %d, max_group = %d, pass = %d.\n", + fcn_name, cp + 3, max_group, pass); + + + /* 9) Close the file. */ + + if ( pass ) { + + if ( H5Gclose(proc_gid) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Gclose(process_gid) failed. (2)"; + } + } + + if ( pass ) { + + if ( H5Fclose(file_id) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Fclose() failed.\n"; + + } + } + + if ( show_progress ) + HDfprintf(stdout, "%s:L5 cp = %d, max_group = %d, pass = %d.\n", + fcn_name, cp + 4, max_group, pass); + } /* end while */ + cp += 5; + + + + /* 10) Open the file. + * + * Verify that the file contains a metadata cache image + * superblock extension message. + */ + + if ( pass ) { + + open_hdf5_file(/* create_file */ FALSE, + /* mdci_sbem_expected */ TRUE, + /* read_only */ FALSE, + /* set_mdci_fapl */ FALSE, + /* config_fsm */ FALSE, + /* hdf_file_name */ filename, + /* cache_image_flags */ 0, + /* file_id_ptr */ &file_id, + /* file_ptr_ptr */ &file_ptr, + /* cache_ptr_ptr */ &cache_ptr); + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 11) Validate all the zoos. */ + i = min_group; + while ( ( pass ) && ( i <= max_group ) ) { + + sprintf(process_group_name, "/process_%d", i); + validate_zoo(file_id, process_group_name, i++); + } + +#if H5C_COLLECT_CACHE_STATS + if ( pass ) { + + if ( cache_ptr->images_loaded == 0 ) { + + pass = FALSE; + failure_mssg = "metadata cache image block not loaded(2)."; + } + } +#endif /* H5C_COLLECT_CACHE_STATS */ + + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 12) Close the file. */ + + if ( pass ) { + + if ( H5Fclose(file_id) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Fclose() failed.\n"; + } + } + + + /* 13) Open the file. + * + * Verify that the file doesn't contain a metadata cache image + * superblock extension message. + */ + + if ( pass ) { + + open_hdf5_file(/* create_file */ FALSE, + /* mdci_sbem_expected */ FALSE, + /* read_only */ FALSE, + /* set_mdci_fapl */ FALSE, + /* config_fsm */ FALSE, + /* hdf_file_name */ filename, + /* cache_image_flags */ 0, + /* file_id_ptr */ &file_id, + /* file_ptr_ptr */ &file_ptr, + /* cache_ptr_ptr */ &cache_ptr); + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 14) Validate all the zoos. + * + * Verify that the metadata cache image superblock + * extension message has been deleted. + */ + i = min_group; + while ( ( pass ) && ( i <= max_group ) ) { + + sprintf(process_group_name, "/process_%d", i); + validate_zoo(file_id, process_group_name, i++); + } + +#if H5C_COLLECT_CACHE_STATS + if ( pass ) { + + if ( cache_ptr->images_loaded != 0 ) { + + pass = FALSE; + failure_mssg = "metadata cache image block loaded(2)."; + } + } +#endif /* H5C_COLLECT_CACHE_STATS */ + + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 15) Close the file. */ + + if ( pass ) { + + if ( H5Fclose(file_id) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Fclose() failed.\n"; + } + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 16) Delete the file */ + + if ( pass ) { + + if ( HDremove(filename) < 0 ) { + + pass = FALSE; + failure_mssg = "HDremove() failed.\n"; + } + } + + + if ( pass ) { PASSED(); } else { H5_FAILED(); } + + if ( ! pass ) + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", + FUNC, failure_mssg); + + return !pass; + +} /* cache_image_smoke_check_5() */ + + +/*------------------------------------------------------------------------- + * Function: cache_image_smoke_check_6() + * + * Purpose: As the free space manager metadata is now included in the + * cache image, a smoke check to verify generally correct + * behaviour of the persistent free space managers seems + * prudent. + * + * The basic idea of this test is to construct a long + * sequence of dataset creations and deletions, all separated + * by file open/close cycles with cache image enabled. If the + * perisistant free space managers are performing as expected, + * the size of the file should stabilize. + * + * To implement this, proceed as outlined in the cycle of + * operation below: + * + * Cycle of operation + * + * 1) Create a HDF5 file with the cache image FAPL entry. + * + * Verify that the cache is informed of the cache image + * FAPL entry. + * + * Set all cache image flags, forcing full functionality. + * + * 2) Create and write a dataset in the file. + * + * 3) Close the file. + * + * 4) Open the file with the cache image FAPL entry. + * + * Verify that the file contains a metadata cache + * image superblock extension message. + * + * 5) Create and write a new dataset. + * + * 6) Verify and delete the old dataset. + * + * 7) Close the file. + * + * If sufficient datasets have been created, and then + * deleteded continue to 8). Otherwise goto 4) + * + * 8) Open the file. + * + * Verify that the file contains a metadata cache + * image superblock extension message. + * + * 9) Verify the last dataset created. + * + * 10) Close the file. + * + * 11) Open the file. + * + * 12) Verify and delete the last dataset. + * + * Verify that a metadata cache image is not loaded. + * + * 13) Close the file. + * + * 14) Get the size of the file. Verify that it is less + * than 1 KB. Without deletions and persistant free + * space managers, size size is about 167 MB, so this + * is sufficient to verify that the persistant free + * space managers are more or less doing their job. + * + * 15) Delete the file. + * + * Return: void + * + * Programmer: John Mainzer + * 10/31/16 + * + *------------------------------------------------------------------------- + */ + +static unsigned +cache_image_smoke_check_6(void) +{ + const char * fcn_name = "cache_image_smoke_check_6()"; + char filename[512]; + hbool_t show_progress = FALSE; + hid_t file_id = -1; + H5F_t *file_ptr = NULL; + H5C_t *cache_ptr = NULL; + h5_stat_size_t file_size; + int cp = 0; + int min_dset = 0; + int max_dset = 0; + + TESTING("metadata cache image smoke check 6"); + + pass = TRUE; + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* setup the file name */ + if ( pass ) { + + if ( h5_fixname(FILENAMES[0], H5P_DEFAULT, filename, sizeof(filename)) + == NULL ) { + + pass = FALSE; + failure_mssg = "h5_fixname() failed.\n"; + } + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 1) Create a HDF5 file with the cache image FAPL entry. + * + * Verify that the cache is informed of the cache image FAPL entry. + * + * Set flags forcing full function of the cache image feature. + */ + + if ( pass ) { + + open_hdf5_file(/* create_file */ TRUE, + /* mdci_sbem_expected */ FALSE, + /* read_only */ FALSE, + /* set_mdci_fapl */ TRUE, + /* config_fsm */ TRUE, + /* hdf_file_name */ filename, + /* cache_image_flags */ H5C_CI__ALL_FLAGS, + /* file_id_ptr */ &file_id, + /* file_ptr_ptr */ &file_ptr, + /* cache_ptr_ptr */ &cache_ptr); + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 2) Create a dataset in the file. */ + + if ( pass ) { + + create_datasets(file_id, min_dset++, max_dset++); + } + +#if H5C_COLLECT_CACHE_STATS + if ( pass ) { + + if ( cache_ptr->images_loaded != 0 ) { + + pass = FALSE; + failure_mssg = "metadata cache image block loaded(1)."; + } + } +#endif /* H5C_COLLECT_CACHE_STATS */ + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 3) Close the file. */ + + if ( pass ) { + + if ( H5Fclose(file_id) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Fclose() failed.\n"; + + } + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + while ( ( pass ) && ( max_dset < MAX_NUM_DSETS ) ) + { + + /* 4) Open the file. + * + * Verify that the metadata cache is instructed to load the + * metadata cache image. + */ + + if ( pass ) { + + open_hdf5_file(/* create_file */ FALSE, + /* mdci_sbem_expected */ TRUE, + /* read_only */ FALSE, + /* set_mdci_fapl */ TRUE, + /* config_fsm */ FALSE, + /* hdf_file_name */ filename, + /* cache_image_flags */ H5C_CI__ALL_FLAGS, + /* file_id_ptr */ &file_id, + /* file_ptr_ptr */ &file_ptr, + /* cache_ptr_ptr */ &cache_ptr); + } + + if ( show_progress ) + HDfprintf(stdout, "%s:L1 cp = %d, max_dset = %d, pass = %d.\n", + fcn_name, cp, max_dset, pass); + + + /* 5) Create a dataset in the file. */ + + if ( pass ) { + + create_datasets(file_id, min_dset++, max_dset++); + } + +#if H5C_COLLECT_CACHE_STATS + if ( pass ) { + + if ( cache_ptr->images_loaded == 0 ) { + + pass = FALSE; + failure_mssg = "metadata cache image block not loaded(1)."; + } + } +#endif /* H5C_COLLECT_CACHE_STATS */ + + if ( show_progress ) + HDfprintf(stdout, "%s:L2 cp = %d, max_dset = %d, pass = %d.\n", + fcn_name, cp + 1, max_dset, pass); + + + /* 6) Verify and delete the old dataset. */ + if ( pass ) { + + delete_datasets(file_id, min_dset - 2, max_dset - 2); + } + + if ( show_progress ) + HDfprintf(stdout, "%s:L3 cp = %d, max_dset = %d, pass = %d.\n", + fcn_name, cp + 2, max_dset, pass); + + + /* 7) Close the file. */ + + if ( pass ) { + + if ( H5Fclose(file_id) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Fclose() failed.\n"; + + } + } + + if ( show_progress ) + HDfprintf(stdout, "%s:L4 cp = %d, max_dset = %d, pass = %d.\n", + fcn_name, cp + 3, max_dset, pass); + } /* end while */ + cp += 4; + + + /* 8) Open the file. + * + * Verify that the file contains a metadata cache image + * superblock extension message. + */ + + if ( pass ) { + + open_hdf5_file(/* create_file */ FALSE, + /* mdci_sbem_expected */ TRUE, + /* read_only */ FALSE, + /* set_mdci_fapl */ FALSE, + /* config_fsm */ FALSE, + /* hdf_file_name */ filename, + /* cache_image_flags */ 0, + /* file_id_ptr */ &file_id, + /* file_ptr_ptr */ &file_ptr, + /* cache_ptr_ptr */ &cache_ptr); + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 9) Verify the last dataset created. */ + + if ( pass ) { + + verify_datasets(file_id, min_dset - 1, max_dset - 1); + } + +#if H5C_COLLECT_CACHE_STATS + if ( pass ) { + + if ( cache_ptr->images_loaded == 0 ) { + + pass = FALSE; + failure_mssg = "metadata cache image block not loaded(2)."; + } + } +#endif /* H5C_COLLECT_CACHE_STATS */ + + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 10) Close the file. */ + + if ( pass ) { + + if ( H5Fclose(file_id) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Fclose() failed.\n"; + } + } + + + /* 11) Open the file. + * + * Verify that the file doesn't contain a metadata cache image + * superblock extension message. + */ + + if ( pass ) { + + open_hdf5_file(/* create_file */ FALSE, + /* mdci_sbem_expected */ FALSE, + /* read_only */ FALSE, + /* set_mdci_fapl */ FALSE, + /* config_fsm */ FALSE, + /* hdf_file_name */ filename, + /* cache_image_flags */ 0, + /* file_id_ptr */ &file_id, + /* file_ptr_ptr */ &file_ptr, + /* cache_ptr_ptr */ &cache_ptr); + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 12) Verify and delete the last dataset. + * + * Verify that a metadata cache image is not loaded. + */ + + if ( pass ) { + + delete_datasets(file_id, min_dset - 1, max_dset - 1); + } + +#if H5C_COLLECT_CACHE_STATS + if ( pass ) { + + if ( cache_ptr->images_loaded != 0 ) { + + pass = FALSE; + failure_mssg = "metadata cache image block loaded(2)."; + } + } +#endif /* H5C_COLLECT_CACHE_STATS */ + + + + /* 13) Close the file. */ + + if ( pass ) { + + if ( H5Fclose(file_id) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Fclose() failed.\n"; + } + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 14) Get the size of the file. Verify that it is less + * than 1 KB. Without deletions and persistant free + * space managers, size size is about 167 MB, so this + * is sufficient to verify that the persistant free + * space managers are more or less doing their job. + */ + if((file_size = h5_get_file_size(filename, H5P_DEFAULT)) < 0) { + + pass = FALSE; + failure_mssg = "h5_get_file_size() failed.\n"; + + } else if ( file_size > 1024 ) { + + pass = FALSE; + failure_mssg = "unexpectedly large file size.\n"; + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 15) Delete the file */ + if ( pass ) { + + if ( HDremove(filename) < 0 ) { + + pass = FALSE; + failure_mssg = "HDremove() failed.\n"; + } + } + + + if ( pass ) { PASSED(); } else { H5_FAILED(); } + + if ( ! pass ) + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", + FUNC, failure_mssg); + + return !pass; + +} /* cache_image_smoke_check_6() */ + + +/*------------------------------------------------------------------------- + * Function: cache_image_api_error_check_1() + * + * Purpose: This test is one of a sequence of tests intended + * to verify correct management of API errors. + * + * The object of this test is to verify that a file without + * a pre-existing cache image that is opened both read only + * and with a cache image requested is handle correctly + * (the cache image request should be ignored silently). + * + * The test is set up as follows: + * + * 1) Create a HDF5 file. + * + * 2) Create some datasets in the file. + * + * 3) Close the file. + * + * 4) Open the file read only with a cache image FAPL entry + * requested. + * + * 5) Open a dataset. + * + * Verify that it contains the expected data + * + * Verify that the cache image was not loaded. + * + * 6) Close the file. + * + * 7) Open the file read only. + * + * 8) Open a dataset. + * + * Verify that it contains the expected data. + * + * Verify that the cache image was not loaded. + * + * 9) Close the file. + * + * 10) Open the file read write. + * + * 11) Open a dataset. + * + * Verify that it contains the expected data. + * + * 12) Close the file. + * + * 13) Delete the file. + * + * Return: void + * + * Programmer: John Mainzer + * 9/25/15 + * + *------------------------------------------------------------------------- + */ + +static unsigned +cache_image_api_error_check_1(void) +{ + const char * fcn_name = "cache_image_api_error_check_1()"; + char filename[512]; + hbool_t show_progress = FALSE; + hid_t file_id = -1; + H5F_t *file_ptr = NULL; + H5C_t *cache_ptr = NULL; + int cp = 0; + + TESTING("metadata cache image api error check 1"); + + pass = TRUE; + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* setup the file name */ + if ( pass ) { + + if ( h5_fixname(FILENAMES[0], H5P_DEFAULT, filename, sizeof(filename)) + == NULL ) { + + pass = FALSE; + failure_mssg = "h5_fixname() failed.\n"; + } + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 1) Create a HDF5 file. */ + + if ( pass ) { + + open_hdf5_file(/* create_file */ TRUE, + /* mdci_sbem_expected */ FALSE, + /* read_only */ FALSE, + /* set_mdci_fapl */ FALSE, + /* config_fsm */ TRUE, + /* hdf_file_name */ filename, + /* cache_image_flags */ 0, + /* file_id_ptr */ &file_id, + /* file_ptr_ptr */ &file_ptr, + /* cache_ptr_ptr */ &cache_ptr); + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 2) Create some datasets in the file. */ + + if ( pass ) { + + create_datasets(file_id, 0, 5); + } + +#if H5C_COLLECT_CACHE_STATS + if ( pass ) { + + if ( cache_ptr->images_loaded != 0 ) { + + pass = FALSE; + failure_mssg = "metadata cache image block loaded(1)."; + } + } +#endif /* H5C_COLLECT_CACHE_STATS */ + + + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 3) Close the file. */ + + if ( pass ) { + + if ( H5Fclose(file_id) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Fclose() failed.\n"; + + } + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 4) Open the file read only with a cache image FAPL entry requested. */ + + if ( pass ) { + + open_hdf5_file(/* create_file */ FALSE, + /* mdci_sbem_expected */ FALSE, + /* read_only */ TRUE, + /* set_mdci_fapl */ TRUE, + /* config_fsm */ FALSE, + /* hdf_file_name */ filename, + /* cache_image_flags */ H5C_CI__ALL_FLAGS, + /* file_id_ptr */ &file_id, + /* file_ptr_ptr */ &file_ptr, + /* cache_ptr_ptr */ &cache_ptr); + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 5) Open and close a dataset. + * + * Verify that it contains the expected data. + * + * Verify that the cache image was not loaded. + */ + + if ( pass ) { + + verify_datasets(file_id, 0, 5); + } + +#if H5C_COLLECT_CACHE_STATS + if ( pass ) { + + if ( cache_ptr->images_loaded != 0 ) { + + pass = FALSE; + failure_mssg = "metadata cache image block loaded(2)."; + } + } +#endif /* H5C_COLLECT_CACHE_STATS */ + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 6) Close the file. */ + + if ( pass ) { + + if ( H5Fclose(file_id) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Fclose() failed.\n"; + } + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 7) Open the file read only. */ + + if ( pass ) { + + open_hdf5_file(/* create_file */ FALSE, + /* mdci_sbem_expected */ FALSE, + /* read_only */ TRUE, + /* set_mdci_fapl */ FALSE, + /* config_fsm */ FALSE, + /* hdf_file_name */ filename, + /* cache_image_flags */ 0, + /* file_id_ptr */ &file_id, + /* file_ptr_ptr */ &file_ptr, + /* cache_ptr_ptr */ &cache_ptr); + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 8) Open and close a dataset. + * + * Verify that it contains the expected data. + * + * Verify that the cache image was not loaded. + */ + + if ( pass ) { + + verify_datasets(file_id, 0, 5); + } + +#if H5C_COLLECT_CACHE_STATS + if ( pass ) { + + if ( cache_ptr->images_loaded != 0 ) { + + pass = FALSE; + failure_mssg = "metadata cache image block loaded(3)."; + } + } +#endif /* H5C_COLLECT_CACHE_STATS */ + + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 9) Close the file. */ + + if ( pass ) { + + if ( H5Fclose(file_id) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Fclose() failed.\n"; + } + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 10) Open the file read / write. */ + + if ( pass ) { + + open_hdf5_file(/* create_file */ FALSE, + /* mdci_sbem_expected */ FALSE, + /* read_only */ FALSE, + /* set_mdci_fapl */ FALSE, + /* config_fsm */ FALSE, + /* hdf_file_name */ filename, + /* cache_image_flags */ H5C_CI__ALL_FLAGS, + /* file_id_ptr */ &file_id, + /* file_ptr_ptr */ &file_ptr, + /* cache_ptr_ptr */ &cache_ptr); + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + /* 11) Open and close a dataset. + * + * Verify that it contains the expected data. + * + * Verify that the cache image was not loaded. + */ + + if ( pass ) { + + verify_datasets(file_id, 0, 5); + } + +#if H5C_COLLECT_CACHE_STATS + if ( pass ) { + + if ( cache_ptr->images_loaded != 0 ) { + + pass = FALSE; + failure_mssg = "metadata cache image block loaded(4)."; + } + } +#endif /* H5C_COLLECT_CACHE_STATS */ + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 12) Close the file. */ + + if ( pass ) { + + if ( H5Fclose(file_id) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Fclose() failed.\n"; + } + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 13) Delete the file */ + + if ( pass ) { + + if ( HDremove(filename) < 0 ) { + + pass = FALSE; + failure_mssg = "HDremove() failed.\n"; + } + } + + if ( pass ) { PASSED(); } else { H5_FAILED(); } + + if ( ! pass ) + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", + FUNC, failure_mssg); + + return !pass; + +} /* cache_image_api_error_check_1() */ + + +/*------------------------------------------------------------------------- + * Function: cache_image_api_error_check_2() + * + * Purpose: This test is one of a sequence of tests intended + * to verify correct management of API errors. + * + * The object of this test is to verify that a file with + * a pre-existing cache image that is opened both read only + * and with a cache image requested is handled correctly + * (the cache image request should be ignored silently). + * + * The test is set up as follows: + * + * 1) Create a HDF5 file with a cache image requested.. + * + * 2) Create some datasets in the file. + * + * 3) Close the file. + * + * 4) Open the file read only with a cache image FAPL entry + * requested. + * + * 5) Open a dataset. + * + * Verify that it contains the expected data + * + * Verify that the cache image was loaded. + * + * 6) Close the file. + * + * 7) Open the file read only. + * + * 8) Open a dataset. + * + * Verify that it contains the expected data. + * + * Verify that the cache image was loaded. + * + * 9) Close the file. + * + * 10) Open the file read write. + * + * 11) Open a dataset. + * + * Verify that it contains the expected data. + * + * Verify that the cache image was loaded. + * + * 12) Close the file. + * + * 13) Open the file read write. + * + * 14) Open a dataset. + * + * Verify that it contains the expected data. + * + * Verify that the cache image was NOT loaded. + * + * 15) Close the file. + * + * 16) Delete the file. + * + * Return: void + * + * Programmer: John Mainzer + * 9/25/15 + * + *------------------------------------------------------------------------- + */ + +static unsigned +cache_image_api_error_check_2(void) +{ + const char * fcn_name = "cache_image_api_error_check_2()"; + char filename[512]; + hbool_t show_progress = FALSE; + hid_t file_id = -1; + H5F_t *file_ptr = NULL; + H5C_t *cache_ptr = NULL; + int cp = 0; + + TESTING("metadata cache image api error check 2"); + + pass = TRUE; + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* setup the file name */ + if ( pass ) { + + if ( h5_fixname(FILENAMES[0], H5P_DEFAULT, filename, sizeof(filename)) + == NULL ) { + + pass = FALSE; + failure_mssg = "h5_fixname() failed.\n"; + } + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 1) Create a HDF5 file with a cache image requested. */ + + if ( pass ) { + + open_hdf5_file(/* create_file */ TRUE, + /* mdci_sbem_expected */ FALSE, + /* read_only */ FALSE, + /* set_mdci_fapl */ TRUE, + /* config_fsm */ TRUE, + /* hdf_file_name */ filename, + /* cache_image_flags */ H5C_CI__ALL_FLAGS, + /* file_id_ptr */ &file_id, + /* file_ptr_ptr */ &file_ptr, + /* cache_ptr_ptr */ &cache_ptr); + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 2) Create some datasets in the file. */ + + if ( pass ) { + + create_datasets(file_id, 0, 5); + } + +#if H5C_COLLECT_CACHE_STATS + if ( pass ) { + + if ( cache_ptr->images_loaded != 0 ) { + + pass = FALSE; + failure_mssg = "metadata cache image block loaded(1)."; + } + } +#endif /* H5C_COLLECT_CACHE_STATS */ + + + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 3) Close the file. */ + + if ( pass ) { + + if ( H5Fclose(file_id) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Fclose() failed.\n"; + + } + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 4) Open the file read only with a cache image FAPL entry requested. */ + + if ( pass ) { + + open_hdf5_file(/* create_file */ FALSE, + /* mdci_sbem_expected */ TRUE, + /* read_only */ TRUE, + /* set_mdci_fapl */ TRUE, + /* config_fsm */ FALSE, + /* hdf_file_name */ filename, + /* cache_image_flags */ H5C_CI__ALL_FLAGS, + /* file_id_ptr */ &file_id, + /* file_ptr_ptr */ &file_ptr, + /* cache_ptr_ptr */ &cache_ptr); + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 5) Open and close a dataset. + * + * Verify that it contains the expected data. + * + * Verify that the cache image was loaded. + */ + + if ( pass ) { + + verify_datasets(file_id, 0, 5); + } + +#if H5C_COLLECT_CACHE_STATS + if ( pass ) { + + if ( cache_ptr->images_loaded != 1 ) { + + pass = FALSE; + failure_mssg = "metadata cache image block was not loaded(1)."; + } + } +#endif /* H5C_COLLECT_CACHE_STATS */ + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 6) Close the file. */ + + if ( pass ) { + + if ( H5Fclose(file_id) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Fclose() failed.\n"; + } + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 7) Open the file read only. */ + + if ( pass ) { + + open_hdf5_file(/* create_file */ FALSE, + /* mdci_sbem_expected */ TRUE, + /* read_only */ TRUE, + /* set_mdci_fapl */ FALSE, + /* config_fsm */ FALSE, + /* hdf_file_name */ filename, + /* cache_image_flags */ 0, + /* file_id_ptr */ &file_id, + /* file_ptr_ptr */ &file_ptr, + /* cache_ptr_ptr */ &cache_ptr); + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 8) Open and close a dataset. + * + * Verify that it contains the expected data. + * + * Verify that the cache image was loaded. + */ + + if ( pass ) { + + verify_datasets(file_id, 0, 5); + } + +#if H5C_COLLECT_CACHE_STATS + if ( pass ) { + + if ( cache_ptr->images_loaded != 1 ) { + + pass = FALSE; + failure_mssg = "metadata cache image block was not loaded(2)."; + } + } +#endif /* H5C_COLLECT_CACHE_STATS */ + + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 9) Close the file. */ + + if ( pass ) { + + if ( H5Fclose(file_id) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Fclose() failed.\n"; + } + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 10) Open the file read / write. */ + + if ( pass ) { + + open_hdf5_file(/* create_file */ FALSE, + /* mdci_sbem_expected */ TRUE, + /* read_only */ FALSE, + /* set_mdci_fapl */ FALSE, + /* config_fsm */ FALSE, + /* hdf_file_name */ filename, + /* cache_image_flags */ H5C_CI__ALL_FLAGS, + /* file_id_ptr */ &file_id, + /* file_ptr_ptr */ &file_ptr, + /* cache_ptr_ptr */ &cache_ptr); + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + /* 11) Open and close a dataset. + * + * Verify that it contains the expected data. + * + * Verify that the cache image was loaded. + */ + + if ( pass ) { + + verify_datasets(file_id, 0, 5); + } + +#if H5C_COLLECT_CACHE_STATS + if ( pass ) { + + if ( cache_ptr->images_loaded != 1 ) { + + pass = FALSE; + failure_mssg = "metadata cache image block was not loaded(3)."; + } + } +#endif /* H5C_COLLECT_CACHE_STATS */ + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 12) Close the file. */ + + if ( pass ) { + + if ( H5Fclose(file_id) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Fclose() failed.\n"; + } + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 13) Open the file read / write. */ + + if ( pass ) { + + open_hdf5_file(/* create_file */ FALSE, + /* mdci_sbem_expected */ FALSE, + /* read_only */ FALSE, + /* set_mdci_fapl */ FALSE, + /* config_fsm */ FALSE, + /* hdf_file_name */ filename, + /* cache_image_flags */ H5C_CI__ALL_FLAGS, + /* file_id_ptr */ &file_id, + /* file_ptr_ptr */ &file_ptr, + /* cache_ptr_ptr */ &cache_ptr); + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + /* 14) Open and close a dataset. + * + * Verify that it contains the expected data. + * + * Verify that the cache image was not loaded. + */ + + if ( pass ) { + + verify_datasets(file_id, 0, 5); + } + +#if H5C_COLLECT_CACHE_STATS + if ( pass ) { + + if ( cache_ptr->images_loaded != 0 ) { + + pass = FALSE; + failure_mssg = "metadata cache image block was loaded(2)."; + } + } +#endif /* H5C_COLLECT_CACHE_STATS */ + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 15) Close the file. */ + + if ( pass ) { + + if ( H5Fclose(file_id) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Fclose() failed.\n"; + } + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 13) Delete the file */ + + if ( pass ) { + + if ( HDremove(filename) < 0 ) { + + pass = FALSE; + failure_mssg = "HDremove() failed.\n"; + } + } + + if ( pass ) { PASSED(); } else { H5_FAILED(); } + + if ( ! pass ) + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", + FUNC, failure_mssg); + + return !pass; + +} /* cache_image_api_error_check_2() */ + + +/*------------------------------------------------------------------------- + * Function: cache_image_api_error_check_3() + * + * Purpose: This test is one of a sequence of tests intended + * to verify correct management of API errors. + * + * At present, SWMR and cache image may not be active + * at the same time. The purpose of this test is to + * verify that attempts to run SWMR and cache image + * at the same time will fail. + * + * The test is set up as follows: + * + * 1) Create a HDF5 file with a cache image requested.. + * + * 2) Try to start SWMR write -- should fail. + * + * 3) Discard the file if necessary + * + * 4) Attempt to create a HDF5 file with SWMR write + * access and cache image requested -- should fail. + * + * 5) Discard the file if necessary + * + * 6) Create a HDF5 file with a cache image requested. + * + * 7) Create some datasets in the file. + * + * 8) Close the file. + * + * 9) Attempt to open the file with SWMR write access -- + * should fail. + * + * 10) Discard the file if necessary. + * + * Return: void + * + * Programmer: John Mainzer + * 12/29/16 + * + *------------------------------------------------------------------------- + */ + +static unsigned +cache_image_api_error_check_3(void) +{ + const char * fcn_name = "cache_image_api_error_check_3()"; + char filename[512]; + hbool_t show_progress = FALSE; + hid_t file_id = -1; + H5F_t *file_ptr = NULL; + H5C_t *cache_ptr = NULL; + int cp = 0; + + TESTING("metadata cache image api error check 3"); + + pass = TRUE; + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* setup the file name */ + if ( pass ) { + + if ( h5_fixname(FILENAMES[0], H5P_DEFAULT, filename, sizeof(filename)) + == NULL ) { + + pass = FALSE; + failure_mssg = "h5_fixname() failed.\n"; + } + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 1) Create a HDF5 file with a cache image requested. */ + + if ( pass ) { + + open_hdf5_file(/* create_file */ TRUE, + /* mdci_sbem_expected */ FALSE, + /* read_only */ FALSE, + /* set_mdci_fapl */ TRUE, + /* config_fsm */ TRUE, + /* hdf_file_name */ filename, + /* cache_image_flags */ H5C_CI__ALL_FLAGS, + /* file_id_ptr */ &file_id, + /* file_ptr_ptr */ &file_ptr, + /* cache_ptr_ptr */ &cache_ptr); + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 2) Try to start SWMR write -- should fail. */ + + if ( pass ) { + + H5E_BEGIN_TRY { + if ( H5Fstart_swmr_write(file_id) == SUCCEED ) { + + pass = FALSE; + failure_mssg = "metadata cache image block loaded(1)."; + } + } H5E_END_TRY; + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 3) Discard the file if necessary */ + + if ( pass ) { + + if ( HDremove(filename) < 0 ) { + + pass = FALSE; + failure_mssg = "HDremove() failed.\n"; + } + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 4) Attempt to create a HDF5 file with SWMR write + * access and cache image requested -- should fail. + */ + + attempt_swmr_open_hdf5_file(/* create_file */ TRUE, + /* set_mdci_fapl */ TRUE, + /* hdf_file_name */ filename); + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 5) Discard the file if necessary */ + + if ( pass ) { + + /* file probably doesn't exist, so don't + * error check the remove call. + */ + HDremove(filename); + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 6) Create a HDF5 file with a cache image requested. */ + + if ( pass ) { + + open_hdf5_file(/* create_file */ TRUE, + /* mdci_sbem_expected */ FALSE, + /* read_only */ FALSE, + /* set_mdci_fapl */ TRUE, + /* config_fsm */ TRUE, + /* hdf_file_name */ filename, + /* cache_image_flags */ H5C_CI__ALL_FLAGS, + /* file_id_ptr */ &file_id, + /* file_ptr_ptr */ &file_ptr, + /* cache_ptr_ptr */ &cache_ptr); + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 7) Create some datasets in the file. */ + + if ( pass ) { + + create_datasets(file_id, 0, 5); + } + +#if H5C_COLLECT_CACHE_STATS + if ( pass ) { + + if ( cache_ptr->images_loaded != 0 ) { + + pass = FALSE; + failure_mssg = "metadata cache image block loaded(1)."; + } + } +#endif /* H5C_COLLECT_CACHE_STATS */ + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 8) Close the file. */ + + if ( pass ) { + + if ( H5Fclose(file_id) < 0 ) { + + pass = FALSE; + failure_mssg = "H5Fclose() failed.\n"; + + } + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 9) Attempt to open the file with SWMR write access -- should fail. */ + + attempt_swmr_open_hdf5_file(/* create_file */ FALSE, + /* set_mdci_fapl */ TRUE, + /* hdf_file_name */ filename); + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + /* 10) Discard the file if necessary. */ + + if ( pass ) { + + if ( HDremove(filename) < 0 ) { + + pass = FALSE; + failure_mssg = "HDremove() failed.\n"; + } + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); + + + if ( pass ) { PASSED(); } else { H5_FAILED(); } + + if ( ! pass ) + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", + FUNC, failure_mssg); + + return !pass; + +} /* cache_image_api_error_check_3() */ + + +/*------------------------------------------------------------------------- + * Function: main + * + * Purpose: Run tests on the cache code contained in H5C.c + * + * Return: Success: + * + * Failure: + * + * Programmer: John Mainzer + * 6/24/04 + * + *------------------------------------------------------------------------- + */ +int +main(void) +{ + unsigned nerrs = 0; + int express_test; + + H5open(); + + express_test = GetTestExpress(); + + printf("=========================================\n"); + printf("Cache image tests\n"); + printf(" express_test = %d\n", express_test); + printf("=========================================\n"); + + nerrs += check_cache_image_ctl_flow_1(); + nerrs += check_cache_image_ctl_flow_2(); + nerrs += check_cache_image_ctl_flow_3(); + nerrs += check_cache_image_ctl_flow_4(); + nerrs += check_cache_image_ctl_flow_5(); + nerrs += check_cache_image_ctl_flow_6(); + + nerrs += cache_image_smoke_check_1(); + nerrs += cache_image_smoke_check_2(); + nerrs += cache_image_smoke_check_3(); + nerrs += cache_image_smoke_check_4(); + nerrs += cache_image_smoke_check_5(); + nerrs += cache_image_smoke_check_6(); + + nerrs += cache_image_api_error_check_1(); + nerrs += cache_image_api_error_check_2(); + nerrs += cache_image_api_error_check_3(); + + return(nerrs > 0); + +} /* main() */ + + diff --git a/test/earray.c b/test/earray.c index 07acbb5..c6f5986 100644 --- a/test/earray.c +++ b/test/earray.c @@ -159,15 +159,6 @@ typedef struct earray_test_t { /* Local prototypes */ -/* Metadata cache (H5AC) callbacks */ -static herr_t earray_cache_test_get_initial_load_size(void *udata, size_t *image_len); -static void *earray_cache_test_deserialize(const void *image_ptr, size_t len, - void *udata_ptr, hbool_t *dirty_ptr); -static herr_t earray_cache_test_image_len(const void *thing, size_t *image_len_ptr); -static herr_t earray_cache_test_serialize(const H5F_t *f, void *image_ptr, - size_t len, void *thing); -static herr_t earray_cache_test_free_icr(void *thing); - /* Local variables */ const char *FILENAME[] = { @@ -182,24 +173,6 @@ char filename_g[EARRAY_FILENAME_LEN]; /* Empty file size */ h5_stat_size_t empty_size_g; -/* H5EA test object inherits cache-like properties from H5AC */ -const H5AC_class_t H5AC_EARRAY_TEST[1] = {{ - /* id */ H5AC_TEST_ID, - /* name */ "earray test", - /* mem_type */ H5FD_MEM_DEFAULT, - /* flags */ H5AC__CLASS_SKIP_READS | H5AC__CLASS_SKIP_WRITES, - /* get_initial_load_size */ earray_cache_test_get_initial_load_size, - /* get_final_load_size */ NULL, - /* verify_chksum */ NULL, - /* deserialize */ earray_cache_test_deserialize, - /* image_len */ earray_cache_test_image_len, - /* pre_serialize */ NULL, - /* serialize */ earray_cache_test_serialize, - /* notify */ NULL, - /* free_icr */ earray_cache_test_free_icr, - /* fsf_size */ NULL, -}}; - /*------------------------------------------------------------------------- * Function: init_cparam @@ -619,225 +592,6 @@ error: /*------------------------------------------------------------------------- - * Function: earray_cache_test_get_initial_load_size() - * - * Purpose: place holder function -- should never be called - * - * A generic discussion of metadata cache callbacks of this type - * may be found in H5Cprivate.h. - * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: John Mainzer - * 8/2/14 - * - *------------------------------------------------------------------------- - */ -static herr_t -earray_cache_test_get_initial_load_size( void *udata, size_t *image_len) -{ - HDassert(udata); - HDassert(image_len); - - /* Should never be called */ - HDassert(0 && "Can't be called!"); - - *image_len = 0; - - return(SUCCEED); -} /* end earray_cache_test_get_initial_load_size() */ - - -/*------------------------------------------------------------------------- - * Function: earray_cache_test_deserialize - * - * Purpose: place holder function -- should never be called. - * - * - * A generic discussion of metadata cache callbacks of this type - * may be found in H5Cprivate.h: - * - * Return: Success: Pointer to in core representation - * Failure: NULL - * - * Programmer: John Mainzer - * 8/2/14 - * - *------------------------------------------------------------------------- - */ -static void * -earray_cache_test_deserialize(const void *image_ptr, - size_t len, - void *udata_ptr, - hbool_t *dirty_ptr) -{ - HDassert(image_ptr); - HDassert(len > 0 ); - HDassert(udata_ptr); - HDassert(dirty_ptr); - - /* Should never be called */ - HDassert(0 && "Can't be called!"); - - return(NULL); -} /* end earray_cache_test_deserialize() */ - - -/*------------------------------------------------------------------------- - * Function: earray_cache_test_image_len - * - * Purpose: test code place holder function -- just set *image_len_ptr to - * one. - * - * - * A generic discussion of metadata cache callbacks of this type - * may be found in H5Cprivate.h: - * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: John Mainzer - * 8/2/14 - * - *------------------------------------------------------------------------- - */ -static herr_t -earray_cache_test_image_len(const void *thing, size_t *image_len_ptr) -{ - HDassert(thing); - HDassert(image_len_ptr); - - /* Set size value */ - /* (hard-code to 1) */ - *image_len_ptr = 1; - - return(SUCCEED); -} /* end earray_cache_test_image_len() */ - - - -/*------------------------------------------------------------------------- - * Function: earray_cache_test_serialize - * - * Purpose: Validate the contents of the instance of earray_test_t. - * - * - * A generic discussion of metadata cache callbacks of this type - * may be found in H5Cprivate.h: - * - * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: John Mainzer - * 8/2/14 - * - *------------------------------------------------------------------------- - */ -static herr_t -earray_cache_test_serialize(const H5F_t *f, - void *image_ptr, - H5_ATTR_UNUSED size_t len, - void *thing) -{ - earray_test_t *test; - - HDassert(f); - HDassert(image_ptr); - HDassert(thing); - test = (earray_test_t *)thing; - HDassert(test); - HDassert(test->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert((const H5AC_class_t *)(test->cache_info.type) == - &(H5AC_EARRAY_TEST[0])); - - /* Check for out of order flush */ - if(test->fd_info->base_obj) - TEST_ERROR - - /* Check which index this entry corresponds to */ - if((uint64_t)0 == test->idx) { - /* Check for out of order flush */ - if(test->fd_info->idx0_obj || test->fd_info->idx0_elem) - TEST_ERROR - - /* Set flag for object flush */ - test->fd_info->idx0_obj = TRUE; - } /* end if */ - else if((uint64_t)1 == test->idx) { - /* Check for out of order flush */ - if(test->fd_info->idx1_obj || test->fd_info->idx1_elem) - TEST_ERROR - - /* Set flag for object flush */ - test->fd_info->idx1_obj = TRUE; - } /* end if */ - else if((uint64_t)10000 == test->idx) { - /* Check for out of order flush */ - if(test->fd_info->idx10000_obj || test->fd_info->idx10000_elem) - TEST_ERROR - - /* Set flag for object flush */ - test->fd_info->idx10000_obj = TRUE; - } /* end if */ - else if((uint64_t)-1 == test->idx) { - /* Set flag for object flush */ - test->fd_info->base_obj = TRUE; - } /* end if */ - - return(SUCCEED); - -error: - return(FAIL); -} /* end earray_cache_test_serialize() */ - - - -/*------------------------------------------------------------------------- - * Function: earray_cache_test_free_icr - * - * Purpose: Destroy an extensible array test object in memory. - * - * - * A generic discussion of metadata cache callbacks of this type - * may be found in H5Cprivate.h: - * - * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: John Mainzer - * 8/2/14 - * - *------------------------------------------------------------------------- - */ -static herr_t -earray_cache_test_free_icr(void *thing) -{ - earray_test_t *test; - - HDassert(thing); - test = (earray_test_t *)thing; - HDassert(test); - - /* the metadata cache sets cache_info.magic to - * H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC before calling the - * free_icr routine. Hence the following assert: - */ - - HDassert(test->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC); - HDassert((const H5AC_class_t *)(test->cache_info.type) == - &(H5AC_EARRAY_TEST[0])); - - /* Free the shared info itself */ - HDfree(test); - - return(SUCCEED); -} /* end earray_cache_test_free_icr() */ - - -/*------------------------------------------------------------------------- * Function: test_create * * Purpose: Test creating extensible array diff --git a/test/enc_dec_plist.c b/test/enc_dec_plist.c index 4f0147e..5179e8e 100644 --- a/test/enc_dec_plist.c +++ b/test/enc_dec_plist.c @@ -117,6 +117,11 @@ main(void) 0.2f, (256 * 2048), H5AC__DEFAULT_METADATA_WRITE_STRATEGY}; + H5AC_cache_image_config_t my_cache_image_config = { + H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION, + TRUE, + FALSE, + -1}; if(VERBOSE_MED) printf("Encode/Decode DCPLs\n"); @@ -455,6 +460,8 @@ main(void) FAIL_STACK_ERROR if((H5Pset_mdc_config(fapl, &my_cache_config)) < 0) FAIL_STACK_ERROR + if((H5Pset_mdc_image_config(fapl, &my_cache_image_config)) < 0) + FAIL_STACK_ERROR if((H5Pset_core_write_tracking(fapl, TRUE, 1024 * 1024)) < 0) FAIL_STACK_ERROR diff --git a/test/evict_on_close.c b/test/evict_on_close.c index e0a7a73..3986d5a 100644 --- a/test/evict_on_close.c +++ b/test/evict_on_close.c @@ -600,7 +600,7 @@ check_group_layout(hid_t fid, const char *group_name) hid_t gid1 = -1, gid2 = -1; /* group IDs */ H5G_t *grp_ptr = NULL; /* ptr to internal group struct */ haddr_t tag1, tag2; /* MD cache tags for groups */ - int32_t before, during, after; /* cache sizes */ + uint32_t before, during, after; /* cache sizes */ int i; /* iterator */ /* NOTE: The TESTING() macro is called in main() */ @@ -616,7 +616,7 @@ check_group_layout(hid_t fid, const char *group_name) HDprintf("\nCACHE BEFORE GROUP OPEN:\n"); if(H5AC_dump_cache(file_ptr) < 0) TEST_ERROR; - HDprintf("NUMBER OF CACHE ENTRIES: %d\n", before); + HDprintf("NUMBER OF CACHE ENTRIES: %u\n", before); #endif /* Open the main group and get its tag */ @@ -658,7 +658,7 @@ check_group_layout(hid_t fid, const char *group_name) if(H5AC_dump_cache(file_ptr) < 0) TEST_ERROR; HDprintf("MAIN GROUP TAG: %#X\n", tag1); - HDprintf("NUMBER OF CACHE ENTRIES: %d\n", during); + HDprintf("NUMBER OF CACHE ENTRIES: %u\n", during); #endif /* Close the main group */ @@ -672,7 +672,7 @@ check_group_layout(hid_t fid, const char *group_name) HDprintf("\nCACHE AFTER CLOSING GROUPS:\n"); if(H5AC_dump_cache(file_ptr) < 0) TEST_ERROR; - HDprintf("NUMBER OF CACHE ENTRIES: %d\n", after); + HDprintf("NUMBER OF CACHE ENTRIES: %u\n", after); #endif /* Ensure that the cache does not contain entries with the tag */ @@ -718,7 +718,7 @@ check_dset_scheme(hid_t fid, const char *dset_name) H5D_t *dset_ptr = NULL; /* ptr to internal dset struct */ haddr_t tag; /* MD cache tag for dataset */ int *data = NULL; /* buffer for fake data */ - int32_t before, during, after; /* cache sizes */ + uint32_t before, during, after; /* cache sizes */ /* NOTE: The TESTING() macro is called in main() */ @@ -737,7 +737,7 @@ check_dset_scheme(hid_t fid, const char *dset_name) HDprintf("\nCACHE BEFORE DATASET OPEN:\n"); if(H5AC_dump_cache(file_ptr) < 0) TEST_ERROR; - HDprintf("NUMBER OF CACHE ENTRIES: %d\n", before); + HDprintf("NUMBER OF CACHE ENTRIES: %u\n", before); #endif /* Open dataset and get the metadata tag */ @@ -761,7 +761,7 @@ check_dset_scheme(hid_t fid, const char *dset_name) if(H5AC_dump_cache(file_ptr) < 0) TEST_ERROR; HDprintf("TAG: %#X\n", tag); - HDprintf("NUMBER OF CACHE ENTRIES: %d\n", during); + HDprintf("NUMBER OF CACHE ENTRIES: %u\n", during); #endif /* Close the dataset */ @@ -775,7 +775,7 @@ check_dset_scheme(hid_t fid, const char *dset_name) HDprintf("\nCACHE AFTER DATASET CLOSE:\n"); if(H5AC_dump_cache(file_ptr) < 0) TEST_ERROR; - HDprintf("NUMBER OF CACHE ENTRIES: %d\n", after); + HDprintf("NUMBER OF CACHE ENTRIES: %u\n", after); #endif /* Ensure that the cache does not contain entries with the tag */ diff --git a/test/gen_plist.c b/test/gen_plist.c index c617ad0..8cb6c00 100644 --- a/test/gen_plist.c +++ b/test/gen_plist.c @@ -81,6 +81,12 @@ main(void) 0.2f, (256 * 2048), H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY}; + H5AC_cache_image_config_t my_cache_image_config = { + H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION, + TRUE, + FALSE, + -1}; + /* check endianess */ { @@ -356,6 +362,9 @@ main(void) assert(ret > 0); if((ret = H5Pset_mdc_config(fapl1, &my_cache_config)) < 0) assert(ret > 0); + if((ret = H5Pset_mdc_image_config(fapl1, &my_cache_image_config)) < 0) + assert(ret > 0); + if((ret = H5Pset_core_write_tracking(fapl1, TRUE, (size_t)(1024 * 1024))) < 0) assert(ret > 0); diff --git a/test/genall5.c b/test/genall5.c new file mode 100644 index 0000000..1d92e96 --- /dev/null +++ b/test/genall5.c @@ -0,0 +1,3893 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * 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 files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* Programmer: John Mainzer + * 9/23/15 + * + * This file contains a heavily edited and functionaly reduce + * version of the test code first written by Quincey in a file + * of the same name. + */ + +#include <assert.h> +#include <stdbool.h> +#include <stdlib.h> +#include <string.h> +#include "hdf5.h" +#include "cache_common.h" +#include "genall5.h" + +#define DSET_DIMS (1024 * 1024) +#define DSET_SMALL_DIMS (64 * 1024) +#define DSET_CHUNK_DIMS 1024 +#define DSET_COMPACT_DIMS 4096 + + +/*------------------------------------------------------------------------- + * Function: ns_grp_0 + * + * Purpose: Create an empty "new style" group at the specified location + * in the specified file. + * + * If pass is false on entry, do nothing. + * + * If an error is detected, set pass to FALSE, and set + * failure_mssg to point to an appropriate error message. + * + * Return: void + * + * Programmer: John Mainzer + * 9/14/15 + * + *------------------------------------------------------------------------- + */ + +void +ns_grp_0(hid_t fid, const char *group_name) +{ + hid_t gid = -1; + hid_t gcpl = -1; + herr_t ret; + + if ( pass ) { + + gcpl = H5Pcreate(H5P_GROUP_CREATE); + + if ( gcpl <= 0 ) { + + pass = FALSE; + failure_mssg = "ns_grp_0: H5Pcreate() failed"; + } + assert(gcpl > 0); + } + + if ( pass ) { + + ret = H5Pset_link_creation_order(gcpl, H5P_CRT_ORDER_TRACKED); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "ns_grp_0: H5Pset_link_creation_order() failed"; + } + assert(ret >= 0); + } + + if ( pass ) { + + gid = H5Gcreate2(fid, group_name, H5P_DEFAULT, gcpl, H5P_DEFAULT); + + if ( gid <= 0 ) { + + pass = FALSE; + failure_mssg = "ns_grp_0: H5Gcreate2() failed"; + } + assert(gid > 0); + } + + if ( pass ) { + + ret = H5Pclose(gcpl); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "ns_grp_0: H5Pclose(gcpl) failed"; + } + assert(ret >= 0); + } + + if ( pass ) { + + ret = H5Gclose(gid); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "ns_grp_0: H5Gclose(gid) failed"; + } + assert(ret >= 0); + } + + return; + +} /* ns_grp_0 */ + + +/*------------------------------------------------------------------------- + * Function: vrfy_ns_grp_0 + * + * Purpose: verify an empty "new style" group at the specified location + * in the specified file. + * + * If pass is false on entry, do nothing. + * + * If an error is detected, set pass to FALSE, and set + * failure_mssg to point to an appropriate error message. + * + * Return: void + * + * Programmer: John Mainzer + * 9/14/15 + * + *------------------------------------------------------------------------- + */ + +void vrfy_ns_grp_0(hid_t fid, const char *group_name) +{ + hid_t gid = -1; + hid_t gcpl = -1; + H5G_info_t grp_info; + unsigned crt_order_flags = 0; + herr_t ret; + + if ( pass ) { + + gid = H5Gopen2(fid, group_name, H5P_DEFAULT); + + if ( gid <= 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ns_grp_0: H5Gopen2() failed"; + } + HDassert(gid > 0); + } + + if ( pass ) { + + gcpl = H5Gget_create_plist(gid); + + if ( gcpl <= 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ns_grp_0: H5Gget_create_plist() failed"; + } + HDassert(gcpl > 0); + } + + if ( pass ) { + + ret = H5Pget_link_creation_order(gcpl, &crt_order_flags); + + if ( gcpl <= 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ns_grp_0: H5Pget_link_creation_order() failed"; + } + else if ( H5P_CRT_ORDER_TRACKED != crt_order_flags ) { + + pass = FALSE; + failure_mssg = + "vrfy_ns_grp_0: H5P_CRT_ORDER_TRACKED != crt_order_flags"; + } + HDassert(ret >= 0); + HDassert(H5P_CRT_ORDER_TRACKED == crt_order_flags); + } + + if ( pass ) { + + ret = H5Pclose(gcpl); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ns_grp_0: H5Pclose() failed"; + } + HDassert(ret >= 0); + } + + if ( pass ) { + + memset(&grp_info, 0, sizeof(grp_info)); + ret = H5Gget_info(gid, &grp_info); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ns_grp_0: H5Gget_info() failed"; + } + else if ( H5G_STORAGE_TYPE_COMPACT != grp_info.storage_type ) { + + pass = FALSE; + failure_mssg = + "vrfy_ns_grp_0: H5G_STORAGE_TYPE_COMPACT != grp_info.storage_type"; + } + else if ( 0 != grp_info.nlinks ) { + + pass = FALSE; + failure_mssg = "vrfy_ns_grp_0: 0 != grp_info.nlinks"; + } + else if ( 0 != grp_info.max_corder ) { + + pass = FALSE; + failure_mssg = "vrfy_ns_grp_0: 0 != grp_info.max_corder"; + } + else if ( FALSE != grp_info.mounted ) { + + pass = FALSE; + failure_mssg = "vrfy_ns_grp_0: FALSE != grp_info.mounted"; + } + + HDassert(ret >= 0); + HDassert(H5G_STORAGE_TYPE_COMPACT == grp_info.storage_type); + HDassert(0 == grp_info.nlinks); + HDassert(0 == grp_info.max_corder); + HDassert(false == grp_info.mounted); + } + + if ( pass ) { + + ret = H5Gclose(gid); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ns_grp_0: H5Gclose() failed"; + } + HDassert(ret >= 0); + } + + return; + +} /* vrfy_ns_grp_0() */ + + +/*------------------------------------------------------------------------- + * Function: ns_grp_c + * + * Purpose: Create a compact "new style" group, with 'nlinks' + * soft/hard/external links in it in the specified file. + * + * If pass is false on entry, do nothing. + * + * If an error is detected, set pass to FALSE, and set + * failure_mssg to point to an appropriate error message. + * + * Return: void + * + * Programmer: John Mainzer + * 9/14/15 + * + *------------------------------------------------------------------------- + */ + +void +ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) +{ + hid_t gid = -1; + hid_t gcpl = -1; + unsigned max_compact; + unsigned u; + herr_t ret; + + if ( pass ) { + + gcpl = H5Pcreate(H5P_GROUP_CREATE); + + if ( gcpl <= 0 ) { + + pass = FALSE; + failure_mssg = "ns_grp_c: H5Pcreate(H5P_GROUP_CREATE) failed"; + } + HDassert(gcpl > 0); + } + + if ( pass ) { + + ret = H5Pset_link_creation_order(gcpl, H5P_CRT_ORDER_TRACKED); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "ns_grp_c: H5Pset_link_creation_order() failed"; + } + HDassert(ret >= 0); + } + + if ( pass ) { + + gid = H5Gcreate2(fid, group_name, H5P_DEFAULT, gcpl, H5P_DEFAULT); + + if ( gid <= 0 ) { + + pass = FALSE; + failure_mssg = "ns_grp_c: H5Gcreate2() failed"; + } + HDassert(gid > 0); + } + + if ( pass ) { + + max_compact = 0; + ret = H5Pget_link_phase_change(gcpl, &max_compact, NULL); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "ns_grp_c: H5Pget_link_phase_change() failed"; + } + else if ( nlinks <= 0 ) { + + pass = FALSE; + failure_mssg = "ns_grp_c: nlinks <= 0"; + } + else if ( nlinks >= max_compact ) { + + pass = FALSE; + failure_mssg = "ns_grp_c: nlinks >= max_compact"; + } + + HDassert(ret >= 0); + HDassert(nlinks > 0); + HDassert(nlinks < max_compact); + } + + u = 0; + while ( ( pass ) && ( u < nlinks ) ) { + + char linkname[16]; + + sprintf(linkname, "%u", u); + + if(0 == (u % 3)) { + + ret = H5Lcreate_soft(group_name, gid, linkname, H5P_DEFAULT, + H5P_DEFAULT); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "ns_grp_c: H5Lcreate_soft() failed"; + } + HDassert(ret >= 0); + } /* end if */ + else if(1 == (u % 3)) { + + ret = H5Lcreate_hard(fid, "/", gid, linkname, H5P_DEFAULT, + H5P_DEFAULT); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "ns_grp_c: H5Lcreate_hard() failed"; + } + HDassert(ret >= 0); + } /* end else-if */ + else { + + HDassert(2 == (u % 3)); + ret = H5Lcreate_external("external.h5", "/ext", gid, linkname, + H5P_DEFAULT, H5P_DEFAULT); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "ns_grp_c: H5Lcreate_external() failed"; + } + HDassert(ret >= 0); + } /* end else */ + + u++; + + } /* end while() */ + + if ( pass ) { + + ret = H5Pclose(gcpl); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "ns_grp_c: H5Pclose(gcpl) failed"; + } + HDassert(ret >= 0); + } + + if ( pass ) { + + ret = H5Gclose(gid); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "ns_grp_c: H5Gclose(gid) failed"; + } + HDassert(ret >= 0); + } + + return; + +} /* ns_grp_c() */ + + +/*------------------------------------------------------------------------- + * Function: vrfy_ns_grp_c + * + * Purpose: Verify a compact "new style" group, with 'nlinks' + * soft/hard/external links in it in the specified file. + * + * If pass is false on entry, do nothing. + * + * If an error is detected, set pass to FALSE, and set + * failure_mssg to point to an appropriate error message. + * + * Return: void + * + * Programmer: John Mainzer + * 9/14/15 + * + *------------------------------------------------------------------------- + */ + +void +vrfy_ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) +{ + hid_t gid = -1; + hid_t gcpl = -1; + H5G_info_t grp_info; + unsigned crt_order_flags = 0; + unsigned u; + herr_t ret; + + if ( pass ) { + + gid = H5Gopen2(fid, group_name, H5P_DEFAULT); + + if ( gid <= 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ns_grp_c: H5Gopen2() failed"; + } + HDassert(gid > 0); + } + + if ( pass ) { + + gcpl = H5Gget_create_plist(gid); + + if ( gcpl <= 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ns_grp_c: H5Gget_create_plist(gid) failed"; + } + assert(gcpl > 0); + } + + if ( pass ) { + + ret = H5Pget_link_creation_order(gcpl, &crt_order_flags); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ns_grp_c: H5Pget_link_creation_order() failed"; + } + else if ( H5P_CRT_ORDER_TRACKED != crt_order_flags ) { + + pass = FALSE; + failure_mssg = + "vrfy_ns_grp_c: H5P_CRT_ORDER_TRACKED != crt_order_flags"; + } + HDassert(ret >= 0); + HDassert(H5P_CRT_ORDER_TRACKED == crt_order_flags); + } + + if ( pass ) { + + ret = H5Pclose(gcpl); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ns_grp_c: H5Pclose() failed"; + } + HDassert(ret >= 0); + } + + if ( pass ) { + + memset(&grp_info, 0, sizeof(grp_info)); + ret = H5Gget_info(gid, &grp_info); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ns_grp_c: H5Gget_info() failed"; + } + else if ( H5G_STORAGE_TYPE_COMPACT != grp_info.storage_type ) { + + pass = FALSE; + failure_mssg = + "vrfy_ns_grp_c: H5G_STORAGE_TYPE_COMPACT != grp_info.storage_type"; + } + else if ( nlinks != grp_info.nlinks ) { + + pass = FALSE; + failure_mssg = "vrfy_ns_grp_c: nlinks != grp_info.nlinks"; + } + else if ( nlinks != grp_info.max_corder ) { + + pass = FALSE; + failure_mssg = "vrfy_ns_grp_c: nlinks != grp_info.max_corder"; + } + else if ( FALSE != grp_info.mounted ) { + + pass = FALSE; + failure_mssg = "vrfy_ns_grp_c: FALSE != grp_info.mounted"; + } + + HDassert(ret >= 0); + HDassert(H5G_STORAGE_TYPE_COMPACT == grp_info.storage_type); + HDassert(nlinks == grp_info.nlinks); + HDassert(nlinks == grp_info.max_corder); + HDassert(false == grp_info.mounted); + } + + u = 0; + while ( ( pass ) && ( u < nlinks ) ) { + + H5L_info_t lnk_info; + char linkname[16]; + htri_t link_exists; + + sprintf(linkname, "%u", u); + link_exists = H5Lexists(gid, linkname, H5P_DEFAULT); + + if ( link_exists < 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ns_grp_c: H5Lexists() failed"; + } + HDassert(link_exists >= 0); + + memset(&lnk_info, 0, sizeof(grp_info)); + ret = H5Lget_info(gid, linkname, &lnk_info, H5P_DEFAULT); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ns_grp_c: H5Lget_info() failed"; + } + else if ( TRUE != lnk_info.corder_valid ) { + + pass = FALSE; + failure_mssg = "vrfy_ns_grp_c: TRUE != lnk_info.corder_valid"; + } + else if ( u != lnk_info.corder ) { + + pass = FALSE; + failure_mssg = "vrfy_ns_grp_c: u != lnk_info.corder"; + } + else if ( H5T_CSET_ASCII != lnk_info.cset ) { + + pass = FALSE; + failure_mssg = "vrfy_ns_grp_c: H5T_CSET_ASCII != lnk_info.cset"; + } + HDassert(ret >= 0); + HDassert(true == lnk_info.corder_valid); + HDassert(u == lnk_info.corder); + HDassert(H5T_CSET_ASCII == lnk_info.cset); + + if ( 0 == (u % 3) ) { + + char *slinkval; + + if ( H5L_TYPE_SOFT != lnk_info.type ) { + + pass = FALSE; + failure_mssg = "vrfy_ns_grp_c: H5L_TYPE_SOFT != lnk_info.type"; + } + else if ( (strlen(group_name) + 1) != lnk_info.u.val_size ) { + + pass = FALSE; + failure_mssg = + "vrfy_ns_grp_c: (strlen(group_name) + 1) != lnk_info.u.val_size"; + } + HDassert(H5L_TYPE_SOFT == lnk_info.type); + HDassert((strlen(group_name) + 1) == lnk_info.u.val_size); + + slinkval = (char *)malloc(lnk_info.u.val_size); + + if ( ! slinkval ) { + + pass = FALSE; + failure_mssg = "vrfy_ns_grp_c: malloc of slinkval failed"; + } + HDassert(slinkval); + + ret = H5Lget_val(gid, linkname, slinkval, lnk_info.u.val_size, + H5P_DEFAULT); + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ns_grp_c: H5Lget_val() failed"; + } + else if ( 0 != strcmp(slinkval, group_name) ) { + + pass = FALSE; + failure_mssg = + "vrfy_ns_grp_c: 0 != strcmp(slinkval, group_name)"; + } + HDassert(ret >= 0); + HDassert(0 == strcmp(slinkval, group_name)); + + free(slinkval); + } /* end if */ + else if(1 == (u % 3)) { + + H5O_info_t root_oinfo; + + if ( H5L_TYPE_HARD != lnk_info.type ) { + + pass = FALSE; + failure_mssg = "vrfy_ns_grp_c: H5L_TYPE_HARD != lnk_info.type"; + } + HDassert(H5L_TYPE_HARD == lnk_info.type); + + memset(&root_oinfo, 0, sizeof(root_oinfo)); + ret = H5Oget_info(fid, &root_oinfo); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ns_grp_c: H5Oget_info() failed."; + } + else if ( root_oinfo.addr != lnk_info.u.address ) { + + pass = FALSE; + failure_mssg = + "vrfy_ns_grp_c: root_oinfo.addr != lnk_info.u.address"; + } + HDassert(ret >= 0); + HDassert(root_oinfo.addr == lnk_info.u.address); + } /* end else-if */ + else { + void *elinkval; + const char *file = NULL; + const char *path = NULL; + + HDassert(2 == (u % 3)); + + if ( H5L_TYPE_EXTERNAL != lnk_info.type ) { + + pass = FALSE; + failure_mssg = + "vrfy_ns_grp_c: H5L_TYPE_EXTERNAL != lnk_info.type"; + } + HDassert(H5L_TYPE_EXTERNAL == lnk_info.type); + + elinkval = malloc(lnk_info.u.val_size); + + if ( ! elinkval ) { + + pass = FALSE; + failure_mssg = "vrfy_ns_grp_c: malloc of elinkval failed."; + } + HDassert(elinkval); + + ret = H5Lget_val(gid, linkname, elinkval, lnk_info.u.val_size, + H5P_DEFAULT); + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ns_grp_c: H5Lget_val() failed."; + } + HDassert(ret >= 0); + + ret = H5Lunpack_elink_val(elinkval, lnk_info.u.val_size, + NULL, &file, &path); + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ns_grp_c: H5Lunpack_elink_val() failed."; + } + else if ( 0 != strcmp(file, "external.h5") ) { + + pass = FALSE; + failure_mssg = + "vrfy_ns_grp_c: 0 != strcmp(file, \"external.h5\")"; + } + else if ( 0 != strcmp(path, "/ext") ) { + + pass = FALSE; + failure_mssg = "vrfy_ns_grp_c: 0 != strcmp(path, \"/ext\")"; + } + HDassert(ret >= 0); + HDassert(0 == strcmp(file, "external.h5")); + HDassert(0 == strcmp(path, "/ext")); + + free(elinkval); + } /* end else */ + + u++; + + } /* end while */ + + if ( pass ) { + + ret = H5Gclose(gid); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ns_grp_c: H5Gclose() failed."; + } + assert(ret >= 0); + } + + return; + +} /* vrfy_ns_grp_c() */ + + +/*------------------------------------------------------------------------- + * Function: ns_grp_d + * + * Purpose: Create a dense "new style" group, with 'nlinks' + * (soft/hard/external) links in it in the specified file. + * + * If pass is false on entry, do nothing. + * + * If an error is detected, set pass to FALSE, and set + * failure_mssg to point to an appropriate error message. + * + * Return: void + * + * Programmer: John Mainzer + * 9/14/15 + * + *------------------------------------------------------------------------- + */ + +void +ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) +{ + hid_t gid = -1; + hid_t gcpl = -1; + unsigned max_compact; + unsigned u; + herr_t ret; + + if ( pass ) { + + gcpl = H5Pcreate(H5P_GROUP_CREATE); + + if ( gcpl <= 0 ) { + + pass = FALSE; + failure_mssg = "ns_grp_d: H5Pcreate() failed."; + } + HDassert(gcpl > 0); + } + + if ( pass ) { + + ret = H5Pset_link_creation_order(gcpl, H5P_CRT_ORDER_TRACKED); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "ns_grp_d: H5Pset_link_creation_order() failed."; + } + HDassert(ret >= 0); + } + + if ( pass ) { + + gid = H5Gcreate2(fid, group_name, H5P_DEFAULT, gcpl, H5P_DEFAULT); + + if ( gid <= 0 ) { + + pass = FALSE; + failure_mssg = "ns_grp_d: H5Gcreate2() failed."; + } + HDassert(gid > 0); + } + + if ( pass ) { + + max_compact = 0; + ret = H5Pget_link_phase_change(gcpl, &max_compact, NULL); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "ns_grp_d: H5Pget_link_phase_change() failed."; + } + else if ( nlinks <= max_compact ) { + + pass = FALSE; + failure_mssg = "ns_grp_d: nlinks <= max_compact"; + } + HDassert(ret >= 0); + HDassert(nlinks > max_compact); + } + + u = 0; + while ( ( pass ) && ( u < nlinks ) ) { + + char linkname[16]; + + sprintf(linkname, "%u", u); + + if(0 == (u % 3)) { + + ret = H5Lcreate_soft(group_name, gid, linkname, + H5P_DEFAULT, H5P_DEFAULT); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "ns_grp_d: H5Lcreate_soft() failed."; + } + HDassert(ret >= 0); + } /* end if */ + else if(1 == (u % 3)) { + + ret = H5Lcreate_hard(fid, "/", gid, linkname, + H5P_DEFAULT, H5P_DEFAULT); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "ns_grp_d: H5Lcreate_hard() failed."; + } + HDassert(ret >= 0); + } /* end else-if */ + else { + + HDassert(2 == (u % 3)); + + ret = H5Lcreate_external("external.h5", "/ext", gid, linkname, + H5P_DEFAULT, H5P_DEFAULT); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "ns_grp_d: H5Lcreate_external() failed."; + } + HDassert(ret >= 0); + } /* end else */ + + u++; + + } /* end while */ + + if ( pass ) { + + ret = H5Pclose(gcpl); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "ns_grp_d: H5Pclose() failed."; + } + HDassert(ret >= 0); + } + + if ( pass ) { + + ret = H5Gclose(gid); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "ns_grp_d: H5Gclose() failed."; + } + HDassert(ret >= 0); + } + + return; + +} /* ns_grp_d() */ + + +/*------------------------------------------------------------------------- + * Function: vrfy_ns_grp_d + * + * Purpose: Verify a dense "new style" group, with 'nlinks' + * soft/hard/external links in it in the specified file. + * + * If pass is false on entry, do nothing. + * + * If an error is detected, set pass to FALSE, and set + * failure_mssg to point to an appropriate error message. + * + * Return: void + * + * Programmer: John Mainzer + * 9/14/15 + * + *------------------------------------------------------------------------- + */ + + +void +vrfy_ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) +{ + hid_t gid = -1; + hid_t gcpl = -1; + H5G_info_t grp_info; + unsigned crt_order_flags = 0; + unsigned u; + herr_t ret; + + if ( pass ) { + + gid = H5Gopen2(fid, group_name, H5P_DEFAULT); + + if ( gid <= 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5Gopen2() failed."; + } + HDassert(gid > 0); + } + + if ( pass ) { + + gcpl = H5Gget_create_plist(gid); + + if ( gcpl <= 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5Gget_create_plist() failed."; + } + assert(gcpl > 0); + } + + if ( pass ) { + + ret = H5Pget_link_creation_order(gcpl, &crt_order_flags); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = + "vrfy_ns_grp_d: H5Pget_link_creation_order() failed."; + } + else if ( H5P_CRT_ORDER_TRACKED != crt_order_flags ) { + + pass = FALSE; + failure_mssg = + "vrfy_ns_grp_d: H5P_CRT_ORDER_TRACKED != crt_order_flags"; + } + HDassert(ret >= 0); + HDassert(H5P_CRT_ORDER_TRACKED == crt_order_flags); + } + + if ( pass ) { + + ret = H5Pclose(gcpl); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5Pclose() failed."; + } + HDassert(ret >= 0); + } + + if ( pass ) { + + memset(&grp_info, 0, sizeof(grp_info)); + ret = H5Gget_info(gid, &grp_info); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5Gget_info() failed."; + } + else if ( H5G_STORAGE_TYPE_DENSE != grp_info.storage_type ) { + + pass = FALSE; + failure_mssg = + "vrfy_ns_grp_d: H5G_STORAGE_TYPE_DENSE != grp_info.storage_type"; + } + else if ( nlinks != grp_info.nlinks ) { + + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: nlinks != grp_info.nlinks"; + } + else if ( nlinks != grp_info.max_corder ) { + + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: nlinks != grp_info.max_corder"; + } + else if ( FALSE != grp_info.mounted ) { + + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: FALSE != grp_info.mounted"; + } + HDassert(ret >= 0); + HDassert(H5G_STORAGE_TYPE_DENSE == grp_info.storage_type); + HDassert(nlinks == grp_info.nlinks); + HDassert(nlinks == grp_info.max_corder); + HDassert(false == grp_info.mounted); + } + + u = 0; + while ( ( pass ) && ( u < nlinks ) ) { + + H5L_info_t lnk_info; + char linkname[16]; + htri_t link_exists; + + sprintf(linkname, "%u", u); + link_exists = H5Lexists(gid, linkname, H5P_DEFAULT); + + if ( link_exists < 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5Lexists() failed."; + } + HDassert(link_exists >= 0); + + memset(&lnk_info, 0, sizeof(grp_info)); + ret = H5Lget_info(gid, linkname, &lnk_info, H5P_DEFAULT); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5Lget_info() failed."; + } + else if ( TRUE != lnk_info.corder_valid ) { + + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: TRUE != lnk_info.corder_valid"; + } + else if ( u != lnk_info.corder ) { + + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: u != lnk_info.corder"; + } + else if ( H5T_CSET_ASCII != lnk_info.cset ) { + + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5T_CSET_ASCII != lnk_info.cset"; + } + HDassert(ret >= 0); + HDassert(true == lnk_info.corder_valid); + HDassert(u == lnk_info.corder); + HDassert(H5T_CSET_ASCII == lnk_info.cset); + + if(0 == (u % 3)) { + char *slinkval; + + if ( H5L_TYPE_SOFT != lnk_info.type ) { + + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5L_TYPE_SOFT != lnk_info.type"; + } + else if ( (strlen(group_name) + 1) != lnk_info.u.val_size ) { + + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5L_TYPE_SOFT != lnk_info.type"; + } + HDassert(H5L_TYPE_SOFT == lnk_info.type); + HDassert((strlen(group_name) + 1) == lnk_info.u.val_size); + + slinkval = (char *)malloc(lnk_info.u.val_size); + + if ( ! slinkval ) { + + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: malloc of slinkval failed"; + } + HDassert(slinkval); + + ret = H5Lget_val(gid, linkname, slinkval, lnk_info.u.val_size, + H5P_DEFAULT); + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5Lget_val() failed"; + } + else if ( 0 != strcmp(slinkval, group_name) ) { + + pass = FALSE; + failure_mssg = + "vrfy_ns_grp_d: 0 != strcmp(slinkval, group_name)"; + } + HDassert(ret >= 0); + HDassert(0 == strcmp(slinkval, group_name)); + + free(slinkval); + } /* end if */ + else if(1 == (u % 3)) { + H5O_info_t root_oinfo; + + if ( H5L_TYPE_HARD != lnk_info.type ) { + + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5L_TYPE_HARD != lnk_info.type"; + } + HDassert(H5L_TYPE_HARD == lnk_info.type); + + memset(&root_oinfo, 0, sizeof(root_oinfo)); + ret = H5Oget_info(fid, &root_oinfo); + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5Oget_info() failed."; + } + else if ( root_oinfo.addr != lnk_info.u.address ) { + + pass = FALSE; + failure_mssg = + "vrfy_ns_grp_d: root_oinfo.addr != lnk_info.u.address"; + } + HDassert(ret >= 0); + HDassert(root_oinfo.addr == lnk_info.u.address); + } /* end else-if */ + else { + void *elinkval; + const char *file = NULL; + const char *path = NULL; + + HDassert(2 == (u % 3)); + + if ( H5L_TYPE_EXTERNAL != lnk_info.type ) { + + pass = FALSE; + failure_mssg = + "vrfy_ns_grp_d: H5L_TYPE_EXTERNAL != lnk_info.type"; + } + HDassert(H5L_TYPE_EXTERNAL == lnk_info.type); + + elinkval = malloc(lnk_info.u.val_size); + + if ( ! elinkval ) { + + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: malloc of elinkval failed."; + } + HDassert(elinkval); + + ret = H5Lget_val(gid, linkname, elinkval, lnk_info.u.val_size, + H5P_DEFAULT); + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5Lget_val failed."; + } + HDassert(ret >= 0); + + ret = H5Lunpack_elink_val(elinkval, lnk_info.u.val_size, NULL, + &file, &path); + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5Lunpack_elink_val failed."; + } + else if ( 0 != strcmp(file, "external.h5") ) { + + pass = FALSE; + failure_mssg = + "vrfy_ns_grp_d: 0 != strcmp(file, \"external.h5\")."; + } + else if ( 0 != strcmp(path, "/ext") ) { + + pass = FALSE; + failure_mssg = + "vrfy_ns_grp_d: 0 != strcmp(path, \"/ext\")"; + } + HDassert(ret >= 0); + HDassert(0 == strcmp(file, "external.h5")); + HDassert(0 == strcmp(path, "/ext")); + + free(elinkval); + + } /* end else */ + + u++; + + } /* end while() */ + + if ( pass ) { + + ret = H5Gclose(gid); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5Gclose() failed."; + } + HDassert(ret >= 0); + } + + return; + +} /* vrfy_ns_grp_d() */ + + +/*------------------------------------------------------------------------- + * Function: os_grp_0 + * + * Purpose: Create an empty "old style" group. + * + * If pass is false on entry, do nothing. + * + * If an error is detected, set pass to FALSE, and set + * failure_mssg to point to an appropriate error message. + * + * Return: void + * + * Programmer: John Mainzer + * 9/14/15 + * + *------------------------------------------------------------------------- + */ + +void +os_grp_0(hid_t fid, const char *group_name) +{ + hid_t gid = -1; + herr_t ret; + + if ( pass ) { /* turn file format latest off */ + + ret = H5Fset_latest_format(fid, FALSE); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "os_grp_0: H5Fset_latest_format() failed(1)."; + } + HDassert(ret >= 0); + } + + if ( pass ) { + + gid = H5Gcreate2(fid, group_name, H5P_DEFAULT, H5P_DEFAULT, + H5P_DEFAULT); + if ( gid <= 0 ) { + + pass = FALSE; + failure_mssg = "os_grp_0: H5Gcreate2() failed."; + } + HDassert(gid > 0); + } + + if ( pass ) { + + ret = H5Gclose(gid); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "os_grp_0: H5Gclose() failed."; + } + HDassert(ret >= 0); + } + + if ( pass ) { /* turn file format latest on */ + + ret = H5Fset_latest_format(fid, TRUE); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "os_grp_0: H5Fset_latest_format() failed(2)."; + } + HDassert(ret >= 0); + } + + return; + +} /* os_grp_0() */ + + +/*------------------------------------------------------------------------- + * Function: vrfy_os_grp_0 + * + * Purpose: Validate an empty "old style" group. + * + * If pass is false on entry, do nothing. + * + * If an error is detected, set pass to FALSE, and set + * failure_mssg to point to an appropriate error message. + * + * Return: void + * + * Programmer: John Mainzer + * 9/14/15 + * + *------------------------------------------------------------------------- + */ + +void +vrfy_os_grp_0(hid_t fid, const char *group_name) +{ + hid_t gid = -1; + hid_t gcpl = -1; + H5G_info_t grp_info; + unsigned crt_order_flags = 0; + herr_t ret; + + if ( pass ) { + + gid = H5Gopen2(fid, group_name, H5P_DEFAULT); + + if ( gid <= 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_os_grp_0: H5Gopen2() failed."; + } + HDassert(gid > 0); + } + + if ( pass ) { + + gcpl = H5Gget_create_plist(gid); + + if ( gcpl <= 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_os_grp_0: H5Gget_create_plist() failed."; + } + HDassert(gcpl > 0); + } + + if ( pass ) { + + ret = H5Pget_link_creation_order(gcpl, &crt_order_flags); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_os_grp_0: H5Pget_link_creation_order() failed"; + } + else if ( 0 != crt_order_flags ) { + + pass = FALSE; + failure_mssg = "vrfy_os_grp_0: 0 != crt_order_flags"; + } + HDassert(ret >= 0); + HDassert(0 == crt_order_flags); + } + + if ( pass ) { + + ret = H5Pclose(gcpl); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_os_grp_0: H5Pclose() failed."; + } + HDassert(ret >= 0); + } + + if ( pass ) { + + memset(&grp_info, 0, sizeof(grp_info)); + ret = H5Gget_info(gid, &grp_info); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_os_grp_0: H5Gget_info() failed."; + } + else if ( H5G_STORAGE_TYPE_SYMBOL_TABLE != grp_info.storage_type ) { + + pass = FALSE; + failure_mssg = "vrfy_os_grp_0: H5G_STORAGE_TYPE_SYMBOL_TABLE != grp_info.storage_type"; + } + else if ( 0 != grp_info.nlinks ) { + + pass = FALSE; + failure_mssg = "vrfy_os_grp_0: 0 != grp_info.nlinks"; + } + else if ( 0 != grp_info.max_corder ) { + + pass = FALSE; + failure_mssg = "vrfy_os_grp_0: 0 != grp_info.max_corder"; + } + else if ( FALSE != grp_info.mounted ) { + + pass = FALSE; + failure_mssg = "vrfy_os_grp_0: FALSE != grp_info.mounted"; + } + HDassert(ret >= 0); + HDassert(H5G_STORAGE_TYPE_SYMBOL_TABLE == grp_info.storage_type); + HDassert(0 == grp_info.nlinks); + HDassert(0 == grp_info.max_corder); + HDassert(false == grp_info.mounted); + } + + if ( pass ) { + + ret = H5Gclose(gid); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_os_grp_0: H5Gclose() failed."; + } + HDassert(ret >= 0); + } + + return; + +} /* vrfy_os_grp_0() */ + + +/*------------------------------------------------------------------------- + * Function: os_grp_n + * + * Purpose: Create an "old style" group, with 'nlinks' soft/hard + * links in it. + * + * If pass is false on entry, do nothing. + * + * If an error is detected, set pass to FALSE, and set + * failure_mssg to point to an appropriate error message. + * + * Return: void + * + * Programmer: John Mainzer + * 9/14/15 + * + *------------------------------------------------------------------------- + */ + +void +os_grp_n(hid_t fid, const char *group_name, int proc_num, unsigned nlinks) +{ + hid_t gid = -1; + unsigned u; + herr_t ret; + + if ( pass ) { /* turn file format latest off */ + + ret = H5Fset_latest_format(fid, FALSE); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "os_grp_n: H5Fset_latest_format() failed(1)."; + } + HDassert(ret >= 0); + } + + if ( pass ) { + + gid = H5Gcreate2(fid, group_name, H5P_DEFAULT, H5P_DEFAULT, + H5P_DEFAULT); + if ( gid <= 0 ) { + + pass = FALSE; + failure_mssg = "os_grp_n: H5Gcreate2() failed."; + } + HDassert(gid > 0); + } + + HDassert(nlinks > 0); + + u = 0; + while ( ( pass ) && ( u < nlinks ) ) { + + char linkname[32]; + + sprintf(linkname, "ln%d_%u", proc_num, u); + + if(0 == (u % 2)) { + + ret = H5Lcreate_soft(group_name, gid, linkname, H5P_DEFAULT, + H5P_DEFAULT); + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "os_grp_n: H5Lcreate_soft() failed."; + } + HDassert(ret >= 0); + } /* end if */ + else { + + HDassert(1 == (u % 2)); + + ret = H5Lcreate_hard(fid, "/", gid, linkname, H5P_DEFAULT, + H5P_DEFAULT); + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "os_grp_n: H5Lcreate_hard() failed."; + } + HDassert(ret >= 0); + } /* end else */ + + u++; + + } /* end while */ + + if ( pass ) { + + ret = H5Gclose(gid); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "os_grp_n: H5Gclose() failed."; + } + assert(ret >= 0); + } + + if ( pass ) { /* turn file format latest on */ + + ret = H5Fset_latest_format(fid, TRUE); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "os_grp_n: H5Fset_latest_format() failed(2)."; + } + HDassert(ret >= 0); + } + + return; +} /* os_grp_n() */ + + +/*------------------------------------------------------------------------- + * Function: vrfy_os_grp_n + * + * Purpose: Validate an "old style" group with 'nlinks' soft/hard + * links in it. + * + * If pass is false on entry, do nothing. + * + * If an error is detected, set pass to FALSE, and set + * failure_mssg to point to an appropriate error message. + * + * Return: void + * + * Programmer: John Mainzer + * 9/14/15 + * + *------------------------------------------------------------------------- + */ +void +vrfy_os_grp_n(hid_t fid, const char *group_name, int proc_num, unsigned nlinks) +{ + hid_t gid = -1; + hid_t gcpl = -1; + H5G_info_t grp_info; + unsigned crt_order_flags = 0; + unsigned u; + herr_t ret; + + if ( pass ) { + + gid = H5Gopen2(fid, group_name, H5P_DEFAULT); + + if ( gid <= 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: H5Gopen2() failed"; + } + HDassert(gid > 0); + } + + if ( pass ) { + + gcpl = H5Gget_create_plist(gid); + + if ( gcpl <= 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: H5Gget_create_plist() failed"; + } + HDassert(gcpl > 0); + } + + if ( pass ) { + + ret = H5Pget_link_creation_order(gcpl, &crt_order_flags); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: H5Pget_link_creation_order"; + } + else if ( 0 != crt_order_flags ) { + + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: 0 != crt_order_flags"; + } + HDassert(ret >= 0); + HDassert(0 == crt_order_flags); + } + + if ( pass ) { + + ret = H5Pclose(gcpl); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: H5Pclose() failed"; + } + HDassert(ret >= 0); + } + + if ( pass ) { + + memset(&grp_info, 0, sizeof(grp_info)); + + ret = H5Gget_info(gid, &grp_info); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: H5Gget_info() failed"; + } + else if ( H5G_STORAGE_TYPE_SYMBOL_TABLE != grp_info.storage_type ) { + + pass = FALSE; + failure_mssg = + "vrfy_os_grp_n: H5G_STORAGE_TYPE_SYMBOL_TABLE != grp_info.storage_type"; + } + else if ( nlinks != grp_info.nlinks ) { + + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: nlinks != grp_info.nlinks"; + } + else if ( 0 != grp_info.max_corder ) { + + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: 0 != grp_info.max_corder"; + } + else if ( FALSE != grp_info.mounted ) { + + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: FALSE != grp_info.mounted"; + } + HDassert(ret >= 0); + HDassert(H5G_STORAGE_TYPE_SYMBOL_TABLE == grp_info.storage_type); + HDassert(nlinks == grp_info.nlinks); + HDassert(0 == grp_info.max_corder); + HDassert(false == grp_info.mounted); + } + + u = 0; + while ( ( pass ) && ( u < nlinks ) ) { + + H5L_info_t lnk_info; + char linkname[32]; + htri_t link_exists; + + sprintf(linkname, "ln%d_%u", proc_num, u); + link_exists = H5Lexists(gid, linkname, H5P_DEFAULT); + + if ( link_exists < 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: H5Lexists() failed"; + } + HDassert(link_exists >= 0); + + memset(&lnk_info, 0, sizeof(grp_info)); + ret = H5Lget_info(gid, linkname, &lnk_info, H5P_DEFAULT); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: H5Lget_info() failed"; + } + else if ( FALSE != lnk_info.corder_valid ) { + + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: FALSE != lnk_info.corder_valid"; + } + else if ( H5T_CSET_ASCII != lnk_info.cset ) { + + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: H5T_CSET_ASCII != lnk_info.cset"; + } + HDassert(ret >= 0); + HDassert(false == lnk_info.corder_valid); + HDassert(H5T_CSET_ASCII == lnk_info.cset); + + if(0 == (u % 2)) { + char *slinkval; + + if ( H5L_TYPE_SOFT != lnk_info.type ) { + + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: H5L_TYPE_SOFT != lnk_info.type"; + } + else if ( (strlen(group_name) + 1) != lnk_info.u.val_size ) { + + pass = FALSE; + failure_mssg = + "vrfy_os_grp_n: (strlen(group_name) + 1) != lnk_info.u.val_size"; + } + HDassert(H5L_TYPE_SOFT == lnk_info.type); + HDassert((strlen(group_name) + 1) == lnk_info.u.val_size); + + slinkval = (char *)malloc(lnk_info.u.val_size); + + if ( ! slinkval ) { + + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: malloc of slinkval failed"; + } + HDassert(slinkval); + + ret = H5Lget_val(gid, linkname, slinkval, lnk_info.u.val_size, + H5P_DEFAULT); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: H5Lget_val() failed"; + } + else if ( 0 != strcmp(slinkval, group_name) ) { + + pass = FALSE; + failure_mssg = + "vrfy_os_grp_n: 0 != strcmp(slinkval, group_name)"; + } + HDassert(ret >= 0); + HDassert(0 == strcmp(slinkval, group_name)); + + free(slinkval); + } /* end if */ + else { + H5O_info_t root_oinfo; + + HDassert(1 == (u % 2)); + + if ( H5L_TYPE_HARD != lnk_info.type ) { + + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: H5L_TYPE_HARD != lnk_info.type"; + } + HDassert(H5L_TYPE_HARD == lnk_info.type); + + memset(&root_oinfo, 0, sizeof(root_oinfo)); + ret = H5Oget_info(fid, &root_oinfo); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: H5Oget_info() failed."; + } + else if ( root_oinfo.addr != lnk_info.u.address ) { + + pass = FALSE; + failure_mssg = + "vrfy_os_grp_n: root_oinfo.addr != lnk_info.u.address"; + } + HDassert(ret >= 0); + HDassert(root_oinfo.addr == lnk_info.u.address); + } /* end else */ + + u++; + + } /* end while */ + + if ( pass ) { + + ret = H5Gclose(gid); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: H5Gclose() failed."; + } + HDassert(ret >= 0); + } + + return; + +} /* vrfy_os_grp_n() */ + + +/*------------------------------------------------------------------------- + * Function: ds_ctg_i + * + * Purpose: Create a contiguous dataset w/int datatype. Write data + * to the data set or not as indicated by the write_data + * parameter. + * + * If pass is false on entry, do nothing. + * + * If an error is detected, set pass to FALSE, and set + * failure_mssg to point to an appropriate error message. + * + * Return: void + * + * Programmer: John Mainzer + * 9/14/15 + * + *------------------------------------------------------------------------- + */ +void +ds_ctg_i(hid_t fid, const char *dset_name, hbool_t write_data) +{ + int *wdata = NULL; + unsigned u; + hid_t dsid = -1; + hid_t sid = -1; + hsize_t dims[1] = {DSET_DIMS}; + herr_t ret; + + if ( pass ) { + + sid = H5Screate_simple(1, dims, NULL); + + if ( sid <= 0 ) { + + pass = FALSE; + failure_mssg = "ds_ctg_i: H5Screate_simple() failed"; + } + HDassert(sid > 0); + } + + if ( pass ) { + + dsid = H5Dcreate2(fid, dset_name, H5T_NATIVE_INT, sid, H5P_DEFAULT, + H5P_DEFAULT, H5P_DEFAULT); + + if ( dsid <= 0 ) { + + pass = FALSE; + failure_mssg = "ds_ctg_i: H5Dcreate2() failed"; + } + HDassert(dsid > 0); + } + + if ( pass ) { + + ret = H5Sclose(sid); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "ds_ctg_i: H5Sclose() failed"; + } + HDassert(ret >= 0); + } + + if ( ( pass ) && ( write_data ) ) { + + wdata = (int *)malloc(sizeof(int) * DSET_DIMS); + + if ( ! wdata ) { + + pass = FALSE; + failure_mssg = "ds_ctg_i: malloc of wdata failed."; + } + HDassert(wdata); + } + + if ( ( pass ) && ( write_data ) ) { + + for(u = 0; u < DSET_DIMS; u++) + + wdata[u] = (int)u; + + ret = H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, + H5P_DEFAULT, wdata); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "ds_ctg_i: H5Dwrite() failed."; + } + HDassert(ret >= 0); + + free(wdata); + } + + if ( pass ) { + + ret = H5Dclose(dsid); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "ds_ctg_i: H5Dclose() failed"; + } + HDassert(ret >= 0); + } + + return; + +} /* ds_ctg_i */ + + +/*------------------------------------------------------------------------- + * Function: vrfy_ds_ctg_i + * + * Purpose: Validate a contiguous datasets w/int datatypes. Validate + * data if indicated via the write_data parameter. + * + * If pass is false on entry, do nothing. + * + * If an error is detected, set pass to FALSE, and set + * failure_mssg to point to an appropriate error message. + * + * Return: void + * + * Programmer: John Mainzer + * 9/14/15 + * + *------------------------------------------------------------------------- + */ +void +vrfy_ds_ctg_i(hid_t fid, const char *dset_name, hbool_t write_data) +{ + int *rdata = NULL; + unsigned u; + hid_t dsid = -1; + hid_t sid = -1; + hid_t tid = -1; + hid_t dcpl = -1; + H5D_space_status_t allocation; + H5D_layout_t layout; + int ndims; + hsize_t dims[1], max_dims[1]; + htri_t type_equal; + herr_t ret; + + if ( pass ) { + + dsid = H5Dopen2(fid, dset_name, H5P_DEFAULT); + + if ( dsid <= 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: H5Dopen2() failed."; + } + HDassert(dsid > 0); + } + + if ( pass ) { + + sid = H5Dget_space(dsid); + + if ( sid <= 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: H5Dget_space() failed."; + } + HDassert(sid > 0); + } + + if ( pass ) { + + ndims = H5Sget_simple_extent_ndims(sid); + + if ( 1 != ndims ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: 1 != ndims"; + } + HDassert(1 == ndims); + } + + if ( pass ) { + + ret = H5Sget_simple_extent_dims(sid, dims, max_dims); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: H5Sget_simple_extent_dims() failed"; + } + else if ( DSET_DIMS != dims[0] ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: DSET_DIMS != dims[0]"; + } + else if ( DSET_DIMS != max_dims[0] ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: DSET_DIMS != max_dims[0]"; + } + HDassert(ret >= 0); + HDassert(DSET_DIMS == dims[0]); + HDassert(DSET_DIMS == max_dims[0]); + } + + if ( pass ) { + + ret = H5Sclose(sid); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: H5Sclose() failed."; + } + HDassert(ret >= 0); + } + + if ( pass ) { + + tid = H5Dget_type(dsid); + + if ( tid <= 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: H5Dget_type() failed."; + } + HDassert(tid > 0); + } + + if ( pass ) { + + type_equal = H5Tequal(tid, H5T_NATIVE_INT); + + if ( 1 != type_equal ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: type not H5T_NATIVE_INT"; + } + HDassert(1 == type_equal); + } + + if ( pass ) { + + ret = H5Tclose(tid); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: H5Tclose() failed."; + } + assert(ret >= 0); + } + + if ( pass ) { + + ret = H5Dget_space_status(dsid, &allocation); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: H5Dget_space_status() failed."; + } + else if ( write_data && ( allocation != H5D_SPACE_STATUS_ALLOCATED ) ) { + + pass = FALSE; + failure_mssg = + "vrfy_ds_ctg_i: write_data && allocation != H5D_SPACE_STATUS_ALLOCATED"; + } + else if ( !write_data && + ( allocation != H5D_SPACE_STATUS_NOT_ALLOCATED ) ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: !write_data && allocation != H5D_SPACE_STATUS_NOT_ALLOCATED"; + } + HDassert(ret >= 0); + HDassert((write_data && allocation == H5D_SPACE_STATUS_ALLOCATED) || + (!write_data && allocation == H5D_SPACE_STATUS_NOT_ALLOCATED)); + } + + if ( pass ) { + + dcpl = H5Dget_create_plist(dsid); + + if ( dcpl <= 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: H5Dget_create_plist() failed."; + } + HDassert(dcpl > 0); + } + + if ( pass ) { + + layout = H5Pget_layout(dcpl); + + if ( H5D_CONTIGUOUS != layout ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: H5D_CONTIGUOUS != layout"; + } + HDassert(H5D_CONTIGUOUS == layout); + } + + if ( pass ) { + + ret = H5Pclose(dcpl); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: H5Pclose() failed."; + } + HDassert(ret >= 0); + } + + if ( ( pass ) && ( write_data ) ) { + + rdata = (int *)malloc(sizeof(int) * DSET_DIMS); + + if ( ! rdata ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: malloc of rdata failed."; + } + HDassert(rdata); + } + + if ( ( pass ) && ( write_data ) ) { + + ret = H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, + H5P_DEFAULT, rdata); + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: H5Dread() failed."; + } + HDassert(ret >= 0); + } + + if ( ( pass ) && ( write_data ) ) { + + for(u = 0; u < DSET_DIMS; u++) { + + if ( (int)u != rdata[u] ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: u != rdata[u]."; + break; + } + HDassert((int)u == rdata[u]); + } + + free(rdata); + } /* end if */ + + if ( pass ) { + + ret = H5Dclose(dsid); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: H5Dclose() failed"; + } + HDassert(ret >= 0); + } + + return; + +} /* vrfy_ds_ctg_i() */ + + +/*------------------------------------------------------------------------- + * Function: ds_chk_i + * + * Purpose: Create a chunked dataset w/int datatype. Write data + * to the data set or not as indicated by the write_data + * parameter. + * + * If pass is false on entry, do nothing. + * + * If an error is detected, set pass to FALSE, and set + * failure_mssg to point to an appropriate error message. + * + * Return: void + * + * Programmer: John Mainzer + * 9/14/15 + * + *------------------------------------------------------------------------- + */ +void +ds_chk_i(hid_t fid, const char *dset_name, hbool_t write_data) +{ + int *wdata = NULL; + unsigned u; + hid_t dsid = -1; + hid_t dcpl = -1; + hid_t sid = -1; + hsize_t dims[1] = {DSET_DIMS}; + hsize_t chunk_dims[1] = {DSET_CHUNK_DIMS}; + herr_t ret; + + if ( pass ) { + + sid = H5Screate_simple(1, dims, NULL); + + if ( sid <= 0 ) { + + pass = FALSE; + failure_mssg = "ds_chk_i: H5Screate_simple() failed."; + } + HDassert(sid > 0); + } + + if ( pass ) { + + dcpl = H5Pcreate(H5P_DATASET_CREATE); + + if ( dcpl <= 0 ) { + + pass = FALSE; + failure_mssg = "ds_chk_i: H5Pcreate() failed."; + } + HDassert(dcpl > 0); + } + + if ( pass ) { + + ret = H5Pset_chunk(dcpl, 1, chunk_dims); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "ds_chk_i: H5Pset_chunk() failed."; + } + HDassert(ret >= 0); + } + + if ( pass ) { + + dsid = H5Dcreate2(fid, dset_name, H5T_NATIVE_INT, sid, + H5P_DEFAULT, dcpl, H5P_DEFAULT); + + if ( dsid <= 0 ) { + + pass = FALSE; + failure_mssg = "ds_chk_i: H5Dcreate2() failed"; + } + HDassert(dsid > 0); + } + + if ( pass ) { + + ret = H5Pclose(dcpl); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "ds_chk_i: H5Pclose() failed."; + } + HDassert(ret >= 0); + } + + if ( pass ) { + + ret = H5Sclose(sid); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "ds_chk_i: H5Sclose() failed."; + } + HDassert(ret >= 0); + } + + if ( ( pass ) && ( write_data ) ) { + + wdata = (int *)malloc(sizeof(int) * DSET_DIMS); + + if ( ! wdata ) { + + pass = FALSE; + failure_mssg = "ds_chk_i: malloc of wdata failed."; + } + HDassert(wdata); + } + + if ( ( pass ) && ( write_data ) ) { + + for(u = 0; u < DSET_DIMS; u++) + wdata[u] = (int)u; + + ret = H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, + H5P_DEFAULT, wdata); + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "ds_chk_i: H5Dwrite() failed."; + } + HDassert(ret >= 0); + + free(wdata); + } /* end if */ + + if ( pass ) { + + ret = H5Dclose(dsid); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "ds_chk_i: H5Dclose() failed."; + } + HDassert(ret >= 0); + } + + return; + +} /* ds_chk_i */ + + +/*------------------------------------------------------------------------- + * Function: vrfy_ds_chk_i + * + * Purpose: Validate a chunked datasets w/int datatypes. Validate + * data if indicated via the write_data parameter. + * + * If pass is false on entry, do nothing. + * + * If an error is detected, set pass to FALSE, and set + * failure_mssg to point to an appropriate error message. + * + * Return: void + * + * Programmer: John Mainzer + * 9/14/15 + * + *------------------------------------------------------------------------- + */ +void +vrfy_ds_chk_i(hid_t fid, const char *dset_name, hbool_t write_data) +{ + int *rdata = NULL; + unsigned u; + hid_t dsid = -1; + hid_t sid = -1; + hid_t tid = -1; + hid_t dcpl = -1; + H5D_space_status_t allocation; + H5D_layout_t layout; + int ndims; + hsize_t dims[1], max_dims[1], chunk_dims[1]; + htri_t type_equal; + herr_t ret; + + if ( pass ) { + + dsid = H5Dopen2(fid, dset_name, H5P_DEFAULT); + + if ( dsid <= 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: H5Dopen2() failed."; + } + HDassert(dsid > 0); + } + + if ( pass ) { + + sid = H5Dget_space(dsid); + + if ( sid <= 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: H5Dget_space() failed."; + } + HDassert(sid > 0); + } + + if ( pass ) { + + ndims = H5Sget_simple_extent_ndims(sid); + + if ( 1 != ndims ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: 1 != ndims"; + } + HDassert(1 == ndims); + } + + if ( pass ) { + + ret = H5Sget_simple_extent_dims(sid, dims, max_dims); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: H5Sget_simple_extent_dims() failed"; + } + else if ( DSET_DIMS != dims[0] ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: DSET_DIMS != dims[0]"; + } + else if ( DSET_DIMS != max_dims[0] ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: DSET_DIMS != max_dims[0]"; + } + HDassert(ret >= 0); + HDassert(DSET_DIMS == dims[0]); + HDassert(DSET_DIMS == max_dims[0]); + } + + if ( pass ) { + + ret = H5Sclose(sid); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: H5Sclose() failed."; + } + HDassert(ret >= 0); + } + + if ( pass ) { + + tid = H5Dget_type(dsid); + + if ( tid <= 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: H5Dget_type() failed."; + } + HDassert(tid > 0); + } + + if ( pass ) { + + type_equal = H5Tequal(tid, H5T_NATIVE_INT); + + if ( 1 != type_equal ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: tid != H5T_NATIVE_INT"; + } + HDassert(1 == type_equal); + } + + if ( pass ) { + + ret = H5Tclose(tid); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: H5Tclose() failed."; + } + HDassert(ret >= 0); + } + + if ( pass ) { + + ret = H5Dget_space_status(dsid, &allocation); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: H5Dget_space_status() failed."; + } + else if ( write_data && ( allocation != H5D_SPACE_STATUS_ALLOCATED ) ) { + + pass = FALSE; + failure_mssg = + "vrfy_ds_chk_i: write_data && allocation != H5D_SPACE_STATUS_ALLOCATED"; + } + else if ( !write_data && + ( allocation != H5D_SPACE_STATUS_NOT_ALLOCATED ) ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: !write_data && allocation != H5D_SPACE_STATUS_NOT_ALLOCATED"; + } + HDassert(ret >= 0); + HDassert((write_data && allocation == H5D_SPACE_STATUS_ALLOCATED) || + (!write_data && allocation == H5D_SPACE_STATUS_NOT_ALLOCATED)); + } + + if ( pass ) { + + dcpl = H5Dget_create_plist(dsid); + + if ( dcpl <= 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: H5Dget_create_plist() failed."; + } + HDassert(dcpl > 0); + } + + if ( pass ) { + + layout = H5Pget_layout(dcpl); + + if ( H5D_CHUNKED != layout ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: H5D_CHUNKED != layout"; + } + HDassert(H5D_CHUNKED == layout); + } + + if ( pass ) { + + ret = H5Pget_chunk(dcpl, 1, chunk_dims); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: H5Pget_chunk"; + } + else if ( DSET_CHUNK_DIMS != chunk_dims[0] ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: "; + } + HDassert(ret >= 0); + HDassert(DSET_CHUNK_DIMS == chunk_dims[0]); + } + + if ( pass ) { + + ret = H5Pclose(dcpl); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: H5Pclose() failed."; + } + HDassert(ret >= 0); + } + + if ( ( pass ) && ( write_data ) ) { + + rdata = (int *)malloc(sizeof(int) * DSET_DIMS); + + if ( ! rdata ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: malloc of rdata failed."; + } + HDassert(rdata); + } + + if ( ( pass ) && ( write_data ) ) { + + ret = H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, + rdata); + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: H5Dread() failed."; + } + HDassert(ret >= 0); + } + + if ( ( pass ) && ( write_data ) ) { + + for(u = 0; u < DSET_DIMS; u++) { + + if ( (int)u != rdata[u] ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: u != rdata[u]"; + break; + } + HDassert((int)u == rdata[u]); + } + + free(rdata); + } /* end if */ + + + if ( pass ) { + + ret = H5Dclose(dsid); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: H5Dclose() failed."; + } + HDassert(ret >= 0); + } + + return; + +} /* vrfy_ds_chk_i() */ + + +/*------------------------------------------------------------------------- + * Function: ds_cpt_i + * + * Purpose: Create a compact dataset w/int datatype. Write data + * to the data set or not as indicated by the write_data + * parameter. + * + * If pass is false on entry, do nothing. + * + * If an error is detected, set pass to FALSE, and set + * failure_mssg to point to an appropriate error message. + * + * Return: void + * + * Programmer: John Mainzer + * 9/14/15 + * + *------------------------------------------------------------------------- + */ +void +ds_cpt_i(hid_t fid, const char *dset_name, hbool_t write_data) +{ + int *wdata = NULL; + unsigned u; + hid_t dsid = -1; + hid_t dcpl = -1; + hid_t sid = -1; + hsize_t dims[1] = {DSET_COMPACT_DIMS}; + herr_t ret; + + if ( pass ) { + + sid = H5Screate_simple(1, dims, NULL); + + if ( sid <= 0 ) { + + pass = FALSE; + failure_mssg = "ds_cpt_i: H5Screate_simple() failed."; + } + HDassert(sid > 0); + } + + if ( pass ) { + + dcpl = H5Pcreate(H5P_DATASET_CREATE); + + if ( dcpl <= 0 ) { + + pass = FALSE; + failure_mssg = "ds_cpt_i: H5Pcreate() failed."; + } + HDassert(dcpl > 0); + } + + if ( pass ) { + + ret = H5Pset_layout(dcpl, H5D_COMPACT); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "ds_cpt_i: H5Pset_layout() failed."; + } + HDassert(ret >= 0); + } + + if ( pass ) { + + dsid = H5Dcreate2(fid, dset_name, H5T_NATIVE_INT, sid, + H5P_DEFAULT, dcpl, H5P_DEFAULT); + + if ( dsid <= 0 ) { + + pass = FALSE; + failure_mssg = "ds_cpt_i: H5Dcreate2() failed."; + } + HDassert(dsid > 0); + } + + if ( pass ) { + + ret = H5Pclose(dcpl); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "ds_cpt_i: H5Pclose() failed."; + } + HDassert(ret >= 0); + } + + if ( pass ) { + + ret = H5Sclose(sid); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "ds_cpt_i: H5Sclose() failed."; + } + HDassert(ret >= 0); + } + + if ( ( pass ) && ( write_data ) ) { + + wdata = (int *)malloc(sizeof(int) * DSET_COMPACT_DIMS); + + if ( ! wdata ) { + + pass = FALSE; + failure_mssg = "ds_cpt_i: malloc of wdata failed."; + } + HDassert(wdata); + } + + if ( ( pass ) && ( write_data ) ) { + + for(u = 0; u < DSET_COMPACT_DIMS; u++) + wdata[u] = (int)u; + + ret = H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, + H5P_DEFAULT, wdata); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "ds_cpt_i: H5Dwrite() failed."; + } + HDassert(ret >= 0); + + free(wdata); + } /* end if */ + + if ( pass ) { + + ret = H5Dclose(dsid); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "ds_cpt_i: H5Dclose() failed."; + } + HDassert(ret >= 0); + } + + return; + +} /* ds_cpt_i() */ + + +/*------------------------------------------------------------------------- + * Function: vrfy_ds_cpt_i + * + * Purpose: Validate a compact datasets w/int datatypes. Validate + * data if indicated via the write_data parameter. + * + * If pass is false on entry, do nothing. + * + * If an error is detected, set pass to FALSE, and set + * failure_mssg to point to an appropriate error message. + * + * Return: void + * + * Programmer: John Mainzer + * 9/14/15 + * + *------------------------------------------------------------------------- + */ +void +vrfy_ds_cpt_i(hid_t fid, const char *dset_name, hbool_t write_data) +{ + int *rdata = NULL; + unsigned u; + hid_t dsid = -1; + hid_t sid = -1; + hid_t tid = -1; + hid_t dcpl = -1; + H5D_space_status_t allocation; + H5D_layout_t layout; + int ndims; + hsize_t dims[1], max_dims[1]; + htri_t type_equal; + herr_t ret; + + if ( pass ) { + + dsid = H5Dopen2(fid, dset_name, H5P_DEFAULT); + + if ( dsid <= 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: H5Dopen2() failed."; + } + HDassert(dsid > 0); + } + + if ( pass ) { + + sid = H5Dget_space(dsid); + + if ( sid <= 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: H5Dget_space() failed."; + } + HDassert(sid > 0); + } + + if ( pass ) { + + ndims = H5Sget_simple_extent_ndims(sid); + + if ( 1 != ndims ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: 1 != ndims"; + } + HDassert(1 == ndims); + } + + if ( pass ) { + + ret = H5Sget_simple_extent_dims(sid, dims, max_dims); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: H5Sget_simple_extent_dims() failed"; + } + else if ( DSET_COMPACT_DIMS != dims[0] ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: DSET_COMPACT_DIMS != dims[0]"; + } + else if ( DSET_COMPACT_DIMS != max_dims[0] ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: DSET_COMPACT_DIMS != max_dims[0]"; + } + HDassert(ret >= 0); + HDassert(DSET_COMPACT_DIMS == dims[0]); + HDassert(DSET_COMPACT_DIMS == max_dims[0]); + } + + if ( pass ) { + + ret = H5Sclose(sid); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: H5Sclose() failed."; + } + HDassert(ret >= 0); + } + + if ( pass ) { + + tid = H5Dget_type(dsid); + + if ( tid <= 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: H5Dget_type() failed."; + } + HDassert(tid > 0); + } + + if ( pass ) { + + type_equal = H5Tequal(tid, H5T_NATIVE_INT); + + if ( 1 != type_equal ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: type != H5T_NATIVE_INT"; + } + HDassert(1 == type_equal); + } + + if ( pass ) { + + ret = H5Tclose(tid); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: H5Tclose() failed."; + } + HDassert(ret >= 0); + } + + if ( pass ) { + + ret = H5Dget_space_status(dsid, &allocation); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: H5Dget_space_status() failed."; + } + else if ( H5D_SPACE_STATUS_ALLOCATED != allocation ) { + + pass = FALSE; + failure_mssg = + "vrfy_ds_cpt_i: H5D_SPACE_STATUS_ALLOCATED != allocation"; + } + HDassert(ret >= 0); + HDassert(H5D_SPACE_STATUS_ALLOCATED == allocation); + } + + if ( pass ) { + + dcpl = H5Dget_create_plist(dsid); + + if ( dcpl <= 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: H5Dget_create_plist() failed."; + } + HDassert(dcpl > 0); + } + + if ( pass ) { + + layout = H5Pget_layout(dcpl); + + if ( H5D_COMPACT != layout ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: H5D_COMPACT != layout"; + } + HDassert(H5D_COMPACT == layout); + } + + if ( pass ) { + + ret = H5Pclose(dcpl); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: H5Pclose() failed."; + } + HDassert(ret >= 0); + } + + if ( ( pass ) && ( write_data ) ) { + + rdata = (int *)malloc(sizeof(int) * DSET_COMPACT_DIMS); + + if ( ! rdata ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: malloc of rdata failed."; + } + HDassert(rdata); + } + + if ( ( pass ) && ( write_data ) ) { + + ret = H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, + H5P_DEFAULT, rdata); + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: H5Dread() failed."; + } + HDassert(ret >= 0); + } + + if ( ( pass ) && ( write_data ) ) { + + for(u = 0; u < DSET_COMPACT_DIMS; u++) { + + if ( (int)u != rdata[u] ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: (int)u != rdata[u]"; + break; + } + HDassert((int)u == rdata[u]); + } + + free(rdata); + } /* end if */ + + if ( pass ) { + + ret = H5Dclose(dsid); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: H5Dclose() failed."; + } + HDassert(ret >= 0); + } + + return; + +} /* vrfy_ds_cpt_i() */ + + +/*------------------------------------------------------------------------- + * Function: ds_ctg_v + * + * Purpose: Create a contiguous dataset w/variable-length datatype. + * Write data to the data set or not as indicated by the + * write_data parameter. + * + * If pass is false on entry, do nothing. + * + * If an error is detected, set pass to FALSE, and set + * failure_mssg to point to an appropriate error message. + * + * Return: void + * + * Programmer: John Mainzer + * 9/14/15 + * + *------------------------------------------------------------------------- + */ +void +ds_ctg_v(hid_t fid, const char *dset_name, hbool_t write_data) +{ + hid_t dsid = -1; + hid_t sid = -1; + hid_t tid = -1; + hsize_t dims[1] = {DSET_SMALL_DIMS}; + herr_t ret; + hvl_t *wdata = NULL; + unsigned u; + + if ( pass ) { + + sid = H5Screate_simple(1, dims, NULL); + + if ( sid <= 0 ) { + + pass = FALSE; + failure_mssg = "ds_ctg_v: H5Screate_simple"; + } + HDassert(sid > 0); + } + + if ( pass ) { + + tid = H5Tvlen_create(H5T_NATIVE_INT); + + if ( tid <= 0 ) { + + pass = FALSE; + failure_mssg = "ds_ctg_v: H5Tvlen_create() failed."; + } + HDassert(tid > 0); + } + + if ( pass ) { + + dsid = H5Dcreate2(fid, dset_name, tid, sid, H5P_DEFAULT, + H5P_DEFAULT, H5P_DEFAULT); + + if ( dsid <= 0 ) { + + pass = FALSE; + failure_mssg = "ds_ctg_v: H5Dcreate2() failed."; + } + HDassert(dsid > 0); + } + + if ( ( pass ) && ( write_data ) ) { + + wdata = (hvl_t *)malloc(sizeof(hvl_t) * DSET_SMALL_DIMS); + + if ( ! wdata ) { + + pass = FALSE; + failure_mssg = "ds_ctg_v: malloc of wdata failed."; + } + HDassert(wdata); + } + + if ( ( pass ) && ( write_data ) ) { + + for(u = 0; u < DSET_SMALL_DIMS; u++) { + + int *tdata; + unsigned len; + unsigned v; + + len = (u % 10) + 1; + tdata = (int *)malloc(sizeof(int) * len); + + if ( !tdata ) { + + pass = FALSE; + failure_mssg = "ds_ctg_v: malloc of tdata failed."; + break; + } + HDassert(tdata); + + for(v = 0; v < len; v++) + tdata[v] = (int)(u + v); + + wdata[u].len = len; + wdata[u].p = tdata; + } /* end for */ + } + + if ( ( pass ) && ( write_data ) ) { + + ret = H5Dwrite(dsid, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "ds_ctg_v: H5Dwrite() failed."; + } + HDassert(ret >= 0); + } + + if ( ( pass ) && ( write_data ) ) { + + ret = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, wdata); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "ds_ctg_v: H5Dvlen_reclaim() failed."; + } + HDassert(ret >= 0); + + free(wdata); + + } /* end if */ + + if ( pass ) { + + ret = H5Sclose(sid); + + if ( sid < 0 ) { + + pass = FALSE; + failure_mssg = "ds_ctg_v: H5Sclose() failed."; + } + HDassert(ret >= 0); + } + + if ( pass ) { + + ret = H5Tclose(tid); + + if ( tid < 0 ) { + + pass = FALSE; + failure_mssg = "ds_ctg_v: H5Tclose() failed."; + } + HDassert(ret >= 0); + } + + if ( pass ) { + + ret = H5Dclose(dsid); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "ds_ctg_v: H5Dclose() failed."; + } + HDassert(ret >= 0); + } + + return; + +} /* ds_ctg_v() */ + + +/*------------------------------------------------------------------------- + * Function: vrfy_ds_ctg_v + * + * Purpose: Validate a contiguous datasets w/variable-length datatypes. + * Validate data if indicated via the write_data parameter. + * + * If pass is false on entry, do nothing. + * + * If an error is detected, set pass to FALSE, and set + * failure_mssg to point to an appropriate error message. + * + * Return: void + * + * Programmer: John Mainzer + * 9/14/15 + * + *------------------------------------------------------------------------- + */ +void +vrfy_ds_ctg_v(hid_t fid, const char *dset_name, hbool_t write_data) +{ + hid_t dsid = -1; + hid_t sid = -1; + hid_t tid = -1; + hid_t tmp_tid = -1; + hid_t dcpl = -1; + H5D_space_status_t allocation; + H5D_layout_t layout; + int ndims; + hsize_t dims[1], max_dims[1]; + htri_t type_equal; + hvl_t *rdata = NULL; + unsigned u; + herr_t ret; + + if ( pass ) { + + dsid = H5Dopen2(fid, dset_name, H5P_DEFAULT); + + if ( dsid <= 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: H5Dopen2() failed."; + } + HDassert(dsid > 0); + } + + if ( pass ) { + + sid = H5Dget_space(dsid); + + if ( sid <= 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: H5Dget_space() failed"; + } + HDassert(sid > 0); + } + + if ( pass ) { + + ndims = H5Sget_simple_extent_ndims(sid); + + if ( 1 != ndims ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: 1 != ndims"; + } + HDassert(1 == ndims); + } + + if ( pass ) { + + ret = H5Sget_simple_extent_dims(sid, dims, max_dims); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: H5Sget_simple_extent_dims() failed."; + } + else if ( DSET_SMALL_DIMS != dims[0] ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: DSET_SMALL_DIMS != dims[0]"; + } + else if ( DSET_SMALL_DIMS != max_dims[0] ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: DSET_SMALL_DIMS != max_dims[0]"; + } + HDassert(ret >= 0); + HDassert(DSET_SMALL_DIMS == dims[0]); + HDassert(DSET_SMALL_DIMS == max_dims[0]); + } + + if ( pass ) { + + tid = H5Dget_type(dsid); + + if ( tid <= 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: H5Dget_type() failed."; + } + HDassert(tid > 0); + } + + if ( pass ) { + + tmp_tid = H5Tvlen_create(H5T_NATIVE_INT); + + if ( tmp_tid <= 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: H5Tvlen_create() failed."; + } + HDassert(tmp_tid > 0); + } + + if ( pass ) { + + type_equal = H5Tequal(tid, tmp_tid); + + if ( 1 != type_equal ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: type != vlen H5T_NATIVE_INT"; + } + HDassert(1 == type_equal); + } + + if ( pass ) { + + ret = H5Tclose(tmp_tid); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: H5Tclose() failed."; + } + HDassert(ret >= 0); + } + + if ( pass ) { + + ret = H5Dget_space_status(dsid, &allocation); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: H5Dget_space_status() failed"; + } + else if ( write_data && (allocation != H5D_SPACE_STATUS_ALLOCATED) ) { + + pass = FALSE; + failure_mssg = + "vrfy_ds_ctg_v: write_data && allocation != H5D_SPACE_STATUS_ALLOCATED"; + } + else if ( !write_data && + ( allocation != H5D_SPACE_STATUS_NOT_ALLOCATED ) ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: !write_data && allocation != H5D_SPACE_STATUS_NOT_ALLOCATED"; + } + HDassert(ret >= 0); + HDassert((write_data && allocation == H5D_SPACE_STATUS_ALLOCATED) || + (!write_data && allocation == H5D_SPACE_STATUS_NOT_ALLOCATED)); + } + + if ( pass ) { + + dcpl = H5Dget_create_plist(dsid); + + if ( dcpl <= 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: H5Dget_create_plist() failed."; + } + HDassert(dcpl > 0); + } + + if ( pass ) { + + layout = H5Pget_layout(dcpl); + + if ( H5D_CONTIGUOUS != layout ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: H5D_CONTIGUOUS != layout"; + } + HDassert(H5D_CONTIGUOUS == layout); + } + + if ( pass ) { + + ret = H5Pclose(dcpl); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: H5Pclose() failed."; + } + HDassert(ret >= 0); + } + + if ( ( pass ) && ( write_data ) ) { + + rdata = (hvl_t *)malloc(sizeof(hvl_t) * DSET_SMALL_DIMS); + + if ( !rdata ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: malloc of rdata failed."; + } + HDassert(rdata); + } + + if ( ( pass ) && ( write_data ) ) { + + ret = H5Dread(dsid, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: H5Dread() failed."; + } + HDassert(ret >= 0); + } + + if ( ( pass ) && ( write_data ) ) { + + for(u = 0; u < DSET_SMALL_DIMS; u++) { + unsigned len; + unsigned v; + + len = (unsigned)rdata[u].len; + for(v = 0; v < len; v++) { + int *tdata = (int *)rdata[u].p; + + if ( !tdata ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: !tdata"; + break; + } + else if ( (int)(u + v) != tdata[v] ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: (int)(u + v) != tdata[v]"; + break; + } + HDassert(tdata); + HDassert((int)(u + v) == tdata[v]); + } /* end for */ + } /* end for */ + } + + if ( ( pass ) && ( write_data ) ) { + + ret = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, rdata); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: H5Dvlen_reclaim() failed."; + } + HDassert(ret >= 0); + + free(rdata); + } /* end if */ + + if ( pass ) { + + ret = H5Sclose(sid); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: H5Sclose() failed."; + } + HDassert(ret >= 0); + } + + if ( pass ) { + + ret = H5Tclose(tid); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: H5Tclose() failed."; + } + HDassert(ret >= 0); + } + + if ( pass ) { + + ret = H5Dclose(dsid); + + if ( ret < 0 ) { + + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: H5Dclose() failed."; + } + HDassert(ret >= 0); + } + + return; + +} /* vrfy_ds_ctg_v() */ + + +/*------------------------------------------------------------------------- + * Function: create_zoo + * + * Purpose: Given the path to a group, construct a variety of HDF5 + * data sets, groups, and other objects selected so as to + * include instances of all on disk data structures used + * in the HDF5 library. + * + * If pass is false on entry, do nothing. + * + * If an error is detected, set pass to FALSE, and set + * failure_mssg to point to an appropriate error message. + * + * This function was initially created to assist in testing + * the cache image feature of the metadata cache. Thus, it + * only concerns itself with the version 2 superblock, and + * on disk structures that can occur with this version of + * the superblock. + * + * Note the associated validate_zoo() function. + * + * Return: void + * + * Programmer: John Mainzer + * 9/14/15 + * + *------------------------------------------------------------------------- + */ + +void +create_zoo(hid_t fid, const char *base_path, int proc_num) +{ + char full_path[1024]; + + HDassert(base_path); + + /* Add & verify an empty "new style" group */ + if ( pass ) { + sprintf(full_path, "%s/A", base_path); + HDassert(strlen(full_path) < 1024); + ns_grp_0(fid, full_path); + } + + if ( pass ) { + sprintf(full_path, "%s/A", base_path); + HDassert(strlen(full_path) < 1024); + vrfy_ns_grp_0(fid, full_path); + } + + /* Add & verify a compact "new style" group (3 link messages) */ + if ( pass ) { + sprintf(full_path, "%s/B", base_path); + HDassert(strlen(full_path) < 1024); + ns_grp_c(fid, full_path, 3); + } + + if ( pass ) { + sprintf(full_path, "%s/B", base_path); + HDassert(strlen(full_path) < 1024); + vrfy_ns_grp_c(fid, full_path, 3); + } + + /* Add & verify a dense "new style" group (w/300 links, in v2 B-tree & + * fractal heap) + */ + if ( pass ) { + sprintf(full_path, "%s/C", base_path); + HDassert(strlen(full_path) < 1024); + ns_grp_d(fid, full_path, 300); + } + + if ( pass ) { + sprintf(full_path, "%s/C", base_path); + HDassert(strlen(full_path) < 1024); + vrfy_ns_grp_d(fid, full_path, 300); + } + + /* Add & verify an empty "old style" group to file */ + if ( pass ) { + sprintf(full_path, "%s/D", base_path); + HDassert(strlen(full_path) < 1024); + os_grp_0(fid, full_path); + } + + if ( pass ) { + sprintf(full_path, "%s/D", base_path); + HDassert(strlen(full_path) < 1024); + vrfy_os_grp_0(fid, full_path); + } + + /* Add & verify an "old style" group (w/300 links, in v1 B-tree & + * local heap) to file + */ + if ( pass ) { + sprintf(full_path, "%s/E", base_path); + HDassert(strlen(full_path) < 1024); + os_grp_n(fid, full_path, proc_num, 300); + } + + if ( pass ) { + sprintf(full_path, "%s/E", base_path); + HDassert(strlen(full_path) < 1024); + vrfy_os_grp_n(fid, full_path, proc_num, 300); + } + + /* Add & verify a contiguous dataset w/integer datatype (but no data) + * to file + */ + if ( pass ) { + sprintf(full_path, "%s/F", base_path); + HDassert(strlen(full_path) < 1024); + ds_ctg_i(fid, full_path, FALSE); + } + + if ( pass ) { + sprintf(full_path, "%s/F", base_path); + HDassert(strlen(full_path) < 1024); + vrfy_ds_ctg_i(fid, full_path, FALSE); + } + + /* Add & verify a contiguous dataset w/integer datatype (with data) + * to file + */ + if ( pass ) { + sprintf(full_path, "%s/G", base_path); + HDassert(strlen(full_path) < 1024); + ds_ctg_i(fid, full_path, TRUE); + } + + if ( pass ) { + sprintf(full_path, "%s/G", base_path); + HDassert(strlen(full_path) < 1024); + vrfy_ds_ctg_i(fid, full_path, TRUE); + } + + /* Add & verify a chunked dataset w/integer datatype (but no data) + * to file + */ + if ( pass ) { + sprintf(full_path, "%s/H", base_path); + HDassert(strlen(full_path) < 1024); + ds_chk_i(fid, full_path, FALSE); + } + + if ( pass ) { + sprintf(full_path, "%s/H", base_path); + HDassert(strlen(full_path) < 1024); + vrfy_ds_chk_i(fid, full_path, FALSE); + } + + /* Add & verify a chunked dataset w/integer datatype (and data) + * to file + */ + if ( pass ) { + sprintf(full_path, "%s/I", base_path); + HDassert(strlen(full_path) < 1024); + ds_chk_i(fid, full_path, TRUE); + } + + if ( pass ) { + sprintf(full_path, "%s/I", base_path); + HDassert(strlen(full_path) < 1024); + vrfy_ds_chk_i(fid, full_path, TRUE); + } + + /* Add & verify a compact dataset w/integer datatype (but no data) + * to file + */ + if ( pass ) { + sprintf(full_path, "%s/J", base_path); + HDassert(strlen(full_path) < 1024); + ds_cpt_i(fid, full_path, FALSE); + } + + if ( pass ) { + sprintf(full_path, "%s/J", base_path); + HDassert(strlen(full_path) < 1024); + vrfy_ds_cpt_i(fid, full_path, FALSE); + } + + /* Add & verify a compact dataset w/integer datatype (and data) + * to file + */ + if ( pass ) { + sprintf(full_path, "%s/K", base_path); + HDassert(strlen(full_path) < 1024); + ds_cpt_i(fid, full_path, TRUE); + } + + if ( pass ) { + sprintf(full_path, "%s/K", base_path); + HDassert(strlen(full_path) < 1024); + vrfy_ds_cpt_i(fid, full_path, TRUE); + } + + /* Add & verify a contiguous dataset w/variable-length datatype + * (but no data) to file + */ + if ( pass ) { + sprintf(full_path, "%s/L", base_path); + HDassert(strlen(full_path) < 1024); + ds_ctg_v(fid, full_path, FALSE); + } + + if ( pass ) { + sprintf(full_path, "%s/L", base_path); + HDassert(strlen(full_path) < 1024); + vrfy_ds_ctg_v(fid, full_path, FALSE); + } + + /* Add & verify a contiguous dataset w/variable-length datatype + * (and data) to file + */ + if ( pass ) { + sprintf(full_path, "%s/M", base_path); + HDassert(strlen(full_path) < 1024); + ds_ctg_v(fid, full_path, TRUE); + } + + if ( pass ) { + sprintf(full_path, "%s/M", base_path); + HDassert(strlen(full_path) < 1024); + vrfy_ds_ctg_v(fid, full_path, TRUE); + } + + return; + +} /* create_zoo() */ + + +/*------------------------------------------------------------------------- + * Function: validate_zoo + * + * Purpose: Given the path to a group in which a "zoo" has been + * constructed, validate the objects in the "zoo". + * + * If pass is false on entry, do nothing. + * + * If an error is detected, set pass to FALSE, and set + * failure_mssg to point to an appropriate error message. + * + * This function was initially created to assist in testing + * the cache image feature of the metadata cache. Thus, it + * only concerns itself with the version 2 superblock, and + * on disk structures that can occur with this version of + * the superblock. + * + * Note the associated validate_zoo() function. + * + * Return: void + * + * Programmer: John Mainzer + * 9/14/15 + * + *------------------------------------------------------------------------- + */ + +void +validate_zoo(hid_t fid, const char *base_path, int proc_num) +{ + char full_path[1024]; + + HDassert(base_path); + + /* validate an empty "new style" group */ + if ( pass ) { + sprintf(full_path, "%s/A", base_path); + HDassert(strlen(full_path) < 1024); + vrfy_ns_grp_0(fid, full_path); + } + + /* validate a compact "new style" group (3 link messages) */ + if ( pass ) { + sprintf(full_path, "%s/B", base_path); + HDassert(strlen(full_path) < 1024); + vrfy_ns_grp_c(fid, full_path, 3); + } + + /* validate a dense "new style" group (w/300 links, in v2 B-tree & + * fractal heap) + */ + if ( pass ) { + sprintf(full_path, "%s/C", base_path); + HDassert(strlen(full_path) < 1024); + vrfy_ns_grp_d(fid, full_path, 300); + } + + /* validate an empty "old style" group in file */ + if ( pass ) { + sprintf(full_path, "%s/D", base_path); + HDassert(strlen(full_path) < 1024); + vrfy_os_grp_0(fid, full_path); + } + + /* validate an "old style" group (w/300 links, in v1 B-tree & + * local heap) + */ + if ( pass ) { + sprintf(full_path, "%s/E", base_path); + HDassert(strlen(full_path) < 1024); + vrfy_os_grp_n(fid, full_path, proc_num, 300); + } + + /* validate a contiguous dataset w/integer datatype (but no data) + * in file. + */ + if ( pass ) { + sprintf(full_path, "%s/F", base_path); + HDassert(strlen(full_path) < 1024); + vrfy_ds_ctg_i(fid, full_path, FALSE); + } + + /* validate a contiguous dataset w/integer datatype (with data) + * in file. + */ + if ( pass ) { + sprintf(full_path, "%s/G", base_path); + HDassert(strlen(full_path) < 1024); + vrfy_ds_ctg_i(fid, full_path, TRUE); + } + + /* validate a chunked dataset w/integer datatype (but no data) + * in file + */ + if ( pass ) { + sprintf(full_path, "%s/H", base_path); + HDassert(strlen(full_path) < 1024); + vrfy_ds_chk_i(fid, full_path, FALSE); + } + + /* validate a chunked dataset w/integer datatype (and data) + * in file + */ + if ( pass ) { + sprintf(full_path, "%s/I", base_path); + HDassert(strlen(full_path) < 1024); + vrfy_ds_chk_i(fid, full_path, TRUE); + } + + /* Validate a compact dataset w/integer datatype (but no data) + * in file + */ + if ( pass ) { + sprintf(full_path, "%s/J", base_path); + HDassert(strlen(full_path) < 1024); + vrfy_ds_cpt_i(fid, full_path, FALSE); + } + + /* validate a compact dataset w/integer datatype (and data) + * in file + */ + if ( pass ) { + sprintf(full_path, "%s/K", base_path); + HDassert(strlen(full_path) < 1024); + vrfy_ds_cpt_i(fid, full_path, TRUE); + } + + /* validate a contiguous dataset w/variable-length datatype + * (but no data) to file + */ + if ( pass ) { + sprintf(full_path, "%s/L", base_path); + HDassert(strlen(full_path) < 1024); + vrfy_ds_ctg_v(fid, full_path, FALSE); + } + + /* validate a contiguous dataset w/variable-length datatype + * (and data) to file + */ + if ( pass ) { + sprintf(full_path, "%s/M", base_path); + HDassert(strlen(full_path) < 1024); + vrfy_ds_ctg_v(fid, full_path, TRUE); + } + + return; + +} /* validate_zoo() */ + diff --git a/test/genall5.h b/test/genall5.h new file mode 100644 index 0000000..70b5a6f --- /dev/null +++ b/test/genall5.h @@ -0,0 +1,53 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * 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 files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* Programmer: John Mainzer + * 9/4/15 + * + * This file contains declarations of all functions defined + * in genall5.c + */ + +void create_zoo(hid_t fid, const char *base_path, int proc_num); +void validate_zoo(hid_t fid, const char *base_path, int proc_num); + +void ns_grp_0(hid_t fid, const char *group_name); +void vrfy_ns_grp_0(hid_t fid, const char *group_name); + +void ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks); +void vrfy_ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks); + +void ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks); +void vrfy_ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks); + +void os_grp_0(hid_t fid, const char *group_name); +void vrfy_os_grp_0(hid_t fid, const char *group_name); + +void os_grp_n(hid_t fid, const char *group_name, int proc_num, unsigned nlinks); +void vrfy_os_grp_n(hid_t fid, const char *group_name, int proc_num, + unsigned nlinks); + +void ds_ctg_i(hid_t fid, const char *dset_name, hbool_t write_data); +void vrfy_ds_ctg_i(hid_t fid, const char *dset_name, hbool_t write_data); + +void ds_chk_i(hid_t fid, const char *dset_name, hbool_t write_data); +void vrfy_ds_chk_i(hid_t fid, const char *dset_name, hbool_t write_data); + +void ds_cpt_i(hid_t fid, const char *dset_name, hbool_t write_data); +void vrfy_ds_cpt_i(hid_t fid, const char *dset_name, hbool_t write_data); + +void ds_ctg_v(hid_t fid, const char *dset_name, hbool_t write_data); +void vrfy_ds_ctg_v(hid_t fid, const char *dset_name, hbool_t write_data); + diff --git a/test/testfiles/plist_files/dapl_32be b/test/testfiles/plist_files/dapl_32be Binary files differindex 4df4e7f..4dedda2 100644 --- a/test/testfiles/plist_files/dapl_32be +++ b/test/testfiles/plist_files/dapl_32be diff --git a/test/testfiles/plist_files/dapl_32le b/test/testfiles/plist_files/dapl_32le Binary files differindex 4df4e7f..4dedda2 100644 --- a/test/testfiles/plist_files/dapl_32le +++ b/test/testfiles/plist_files/dapl_32le diff --git a/test/testfiles/plist_files/dapl_64be b/test/testfiles/plist_files/dapl_64be Binary files differindex 4df4e7f..4dedda2 100644 --- a/test/testfiles/plist_files/dapl_64be +++ b/test/testfiles/plist_files/dapl_64be diff --git a/test/testfiles/plist_files/dapl_64le b/test/testfiles/plist_files/dapl_64le Binary files differindex 4df4e7f..4dedda2 100644 --- a/test/testfiles/plist_files/dapl_64le +++ b/test/testfiles/plist_files/dapl_64le diff --git a/test/testfiles/plist_files/def_dapl_32be b/test/testfiles/plist_files/def_dapl_32be Binary files differindex c9b7ea9..3df7289 100644 --- a/test/testfiles/plist_files/def_dapl_32be +++ b/test/testfiles/plist_files/def_dapl_32be diff --git a/test/testfiles/plist_files/def_dapl_32le b/test/testfiles/plist_files/def_dapl_32le Binary files differindex c9b7ea9..3df7289 100644 --- a/test/testfiles/plist_files/def_dapl_32le +++ b/test/testfiles/plist_files/def_dapl_32le diff --git a/test/testfiles/plist_files/def_dapl_64be b/test/testfiles/plist_files/def_dapl_64be Binary files differindex c9b7ea9..3df7289 100644 --- a/test/testfiles/plist_files/def_dapl_64be +++ b/test/testfiles/plist_files/def_dapl_64be diff --git a/test/testfiles/plist_files/def_dapl_64le b/test/testfiles/plist_files/def_dapl_64le Binary files differindex c9b7ea9..3df7289 100644 --- a/test/testfiles/plist_files/def_dapl_64le +++ b/test/testfiles/plist_files/def_dapl_64le diff --git a/test/testfiles/plist_files/def_dxpl_32be b/test/testfiles/plist_files/def_dxpl_32be Binary files differindex b13f456..3b77a32 100644 --- a/test/testfiles/plist_files/def_dxpl_32be +++ b/test/testfiles/plist_files/def_dxpl_32be diff --git a/test/testfiles/plist_files/def_dxpl_32le b/test/testfiles/plist_files/def_dxpl_32le Binary files differindex b13f456..3b77a32 100644 --- a/test/testfiles/plist_files/def_dxpl_32le +++ b/test/testfiles/plist_files/def_dxpl_32le diff --git a/test/testfiles/plist_files/def_dxpl_64be b/test/testfiles/plist_files/def_dxpl_64be Binary files differindex b13f456..3b77a32 100644 --- a/test/testfiles/plist_files/def_dxpl_64be +++ b/test/testfiles/plist_files/def_dxpl_64be diff --git a/test/testfiles/plist_files/def_dxpl_64le b/test/testfiles/plist_files/def_dxpl_64le Binary files differindex b13f456..3b77a32 100644 --- a/test/testfiles/plist_files/def_dxpl_64le +++ b/test/testfiles/plist_files/def_dxpl_64le diff --git a/test/testfiles/plist_files/def_fapl_32be b/test/testfiles/plist_files/def_fapl_32be Binary files differindex 6b6baee..3b35501 100644 --- a/test/testfiles/plist_files/def_fapl_32be +++ b/test/testfiles/plist_files/def_fapl_32be diff --git a/test/testfiles/plist_files/def_fapl_32le b/test/testfiles/plist_files/def_fapl_32le Binary files differindex 6b6baee..3b35501 100644 --- a/test/testfiles/plist_files/def_fapl_32le +++ b/test/testfiles/plist_files/def_fapl_32le diff --git a/test/testfiles/plist_files/def_fapl_64be b/test/testfiles/plist_files/def_fapl_64be Binary files differindex 6b6baee..3b35501 100644 --- a/test/testfiles/plist_files/def_fapl_64be +++ b/test/testfiles/plist_files/def_fapl_64be diff --git a/test/testfiles/plist_files/def_fapl_64le b/test/testfiles/plist_files/def_fapl_64le Binary files differindex 6b6baee..3b35501 100644 --- a/test/testfiles/plist_files/def_fapl_64le +++ b/test/testfiles/plist_files/def_fapl_64le diff --git a/test/testfiles/plist_files/dxpl_32be b/test/testfiles/plist_files/dxpl_32be Binary files differindex 5ff2ea0..22fbdc8 100644 --- a/test/testfiles/plist_files/dxpl_32be +++ b/test/testfiles/plist_files/dxpl_32be diff --git a/test/testfiles/plist_files/dxpl_32le b/test/testfiles/plist_files/dxpl_32le Binary files differindex 5ff2ea0..22fbdc8 100644 --- a/test/testfiles/plist_files/dxpl_32le +++ b/test/testfiles/plist_files/dxpl_32le diff --git a/test/testfiles/plist_files/dxpl_64be b/test/testfiles/plist_files/dxpl_64be Binary files differindex 5ff2ea0..22fbdc8 100644 --- a/test/testfiles/plist_files/dxpl_64be +++ b/test/testfiles/plist_files/dxpl_64be diff --git a/test/testfiles/plist_files/dxpl_64le b/test/testfiles/plist_files/dxpl_64le Binary files differindex 5ff2ea0..22fbdc8 100644 --- a/test/testfiles/plist_files/dxpl_64le +++ b/test/testfiles/plist_files/dxpl_64le diff --git a/test/testfiles/plist_files/fapl_32be b/test/testfiles/plist_files/fapl_32be Binary files differindex 65e2070..43e5e67 100644 --- a/test/testfiles/plist_files/fapl_32be +++ b/test/testfiles/plist_files/fapl_32be diff --git a/test/testfiles/plist_files/fapl_32le b/test/testfiles/plist_files/fapl_32le Binary files differindex 65e2070..43e5e67 100644 --- a/test/testfiles/plist_files/fapl_32le +++ b/test/testfiles/plist_files/fapl_32le diff --git a/test/testfiles/plist_files/fapl_64be b/test/testfiles/plist_files/fapl_64be Binary files differindex 65e2070..43e5e67 100644 --- a/test/testfiles/plist_files/fapl_64be +++ b/test/testfiles/plist_files/fapl_64be diff --git a/test/testfiles/plist_files/fapl_64le b/test/testfiles/plist_files/fapl_64le Binary files differindex 65e2070..43e5e67 100644 --- a/test/testfiles/plist_files/fapl_64le +++ b/test/testfiles/plist_files/fapl_64le diff --git a/test/testfiles/plist_files/fcpl_32be b/test/testfiles/plist_files/fcpl_32be Binary files differindex ffa5242..3ce8bf4 100644 --- a/test/testfiles/plist_files/fcpl_32be +++ b/test/testfiles/plist_files/fcpl_32be diff --git a/test/testfiles/plist_files/fcpl_32le b/test/testfiles/plist_files/fcpl_32le Binary files differindex ffa5242..3ce8bf4 100644 --- a/test/testfiles/plist_files/fcpl_32le +++ b/test/testfiles/plist_files/fcpl_32le diff --git a/test/testfiles/plist_files/fcpl_64be b/test/testfiles/plist_files/fcpl_64be Binary files differindex ffa5242..3ce8bf4 100644 --- a/test/testfiles/plist_files/fcpl_64be +++ b/test/testfiles/plist_files/fcpl_64be diff --git a/test/testfiles/plist_files/fcpl_64le b/test/testfiles/plist_files/fcpl_64le Binary files differindex ffa5242..3ce8bf4 100644 --- a/test/testfiles/plist_files/fcpl_64le +++ b/test/testfiles/plist_files/fcpl_64le diff --git a/test/testfiles/plist_files/lapl_32be b/test/testfiles/plist_files/lapl_32be Binary files differindex e9f43e2..f3e9865 100644 --- a/test/testfiles/plist_files/lapl_32be +++ b/test/testfiles/plist_files/lapl_32be diff --git a/test/testfiles/plist_files/lapl_32le b/test/testfiles/plist_files/lapl_32le Binary files differindex e9f43e2..f3e9865 100644 --- a/test/testfiles/plist_files/lapl_32le +++ b/test/testfiles/plist_files/lapl_32le diff --git a/test/testfiles/plist_files/lapl_64be b/test/testfiles/plist_files/lapl_64be Binary files differindex e9f43e2..f3e9865 100644 --- a/test/testfiles/plist_files/lapl_64be +++ b/test/testfiles/plist_files/lapl_64be diff --git a/test/testfiles/plist_files/lapl_64le b/test/testfiles/plist_files/lapl_64le Binary files differindex e9f43e2..f3e9865 100644 --- a/test/testfiles/plist_files/lapl_64le +++ b/test/testfiles/plist_files/lapl_64le |