diff options
Diffstat (limited to 'test')
74 files changed, 2382 insertions, 759 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 73d0617..4cfe8c9 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -690,6 +690,26 @@ if (HDF5_ENABLE_FORMATTERS) clang_format (HDF5_TEST_use_append_chunk_FORMAT use_append_chunk) endif () +set (use_append_chunk_mirror_SOURCES ${HDF5_TEST_SOURCE_DIR}/use_append_chunk_mirror.c ${HDF5_TEST_SOURCE_DIR}/use_common.c ${HDF5_TEST_SOURCE_DIR}/use.h) +add_executable (use_append_chunk_mirror ${use_append_chunk_mirror_SOURCES}) +target_compile_options(use_append_chunk_mirror PRIVATE "${HDF5_CMAKE_C_FLAGS}") +target_include_directories (use_append_chunk_mirror PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") +if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (use_append_chunk_mirror STATIC) + target_link_libraries (use_append_chunk_mirror PRIVATE ${HDF5_TEST_LIB_TARGET}) +else () + TARGET_C_PROPERTIES (use_append_chunk_mirror SHARED) + target_link_libraries (use_append_chunk_mirror PRIVATE ${HDF5_TEST_LIBSH_TARGET}) +endif () +set_target_properties (use_append_chunk_mirror PROPERTIES FOLDER test) + +#----------------------------------------------------------------------------- +# Add Target to clang-format +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TEST_use_append_chunk_mirror_FORMAT use_append_chunk_mirror) +endif () + set (use_append_mchunks_SOURCES ${HDF5_TEST_SOURCE_DIR}/use_append_mchunks.c ${HDF5_TEST_SOURCE_DIR}/use_common.c ${HDF5_TEST_SOURCE_DIR}/use.h) add_executable (use_append_mchunks ${use_append_mchunks_SOURCES}) target_compile_options(use_append_mchunks PRIVATE "${HDF5_CMAKE_C_FLAGS}") diff --git a/test/accum.c b/test/accum.c index 183f955..0b9fbad 100644 --- a/test/accum.c +++ b/test/accum.c @@ -2243,7 +2243,7 @@ test_swmr_write_big(hbool_t newest_format) char *const new_argv[] = {swmr_reader, NULL}; /* Run the reader */ status = HDexecv(SWMR_READER, new_argv); - HDprintf("errno from execv = %s\n", strerror(errno)); + HDprintf("errno from execv = %s\n", HDstrerror(errno)); FAIL_STACK_ERROR; } /* end if */ diff --git a/test/btree2.c b/test/btree2.c index 4391a3b..42f9a61 100644 --- a/test/btree2.c +++ b/test/btree2.c @@ -10023,14 +10023,14 @@ main(void) if (nerrors) goto error; - puts("All v2 B-tree tests passed."); + HDputs("All v2 B-tree tests passed."); h5_cleanup(FILENAME, fapl); return 0; error: - puts("*** TESTS FAILED ***"); + HDputs("*** TESTS FAILED ***"); H5E_BEGIN_TRY { H5Pclose(fapl); } H5E_END_TRY; diff --git a/test/cache.c b/test/cache.c index 0587aa7..b7269ba 100644 --- a/test/cache.c +++ b/test/cache.c @@ -2785,6 +2785,10 @@ write_permitted_check(int * * Modifications: * + * Updated tests to accommodate the case in which the + * slist is disabled. + * JRM -- 5/14/20 + * *------------------------------------------------------------------------- */ @@ -2982,7 +2986,8 @@ check_insert_entry(unsigned paged) if (pass) { if ((cache_ptr->index_len != 4) || (cache_ptr->index_size != 4 * entry_sizes[entry_type]) || - (cache_ptr->slist_len != 4) || (cache_ptr->slist_size != 4 * entry_sizes[entry_type]) || + ((cache_ptr->slist_enabled) && + ((cache_ptr->slist_len != 4) || (cache_ptr->slist_size != 4 * entry_sizes[entry_type]))) || (cache_ptr->pl_len != 0) || (cache_ptr->pl_size != (size_t)0) || (cache_ptr->pel_len != 2) || (cache_ptr->pel_size != 2 * entry_sizes[entry_type]) || (cache_ptr->LRU_list_len != 2) || (cache_ptr->LRU_list_size != 2 * entry_sizes[entry_type]) @@ -3007,10 +3012,11 @@ check_insert_entry(unsigned paged) if ((cache_ptr->insertions[entry_type] != 4) || (cache_ptr->pinned_insertions[entry_type] != 2) || (cache_ptr->pins[entry_type] != 2) || (cache_ptr->unpins[entry_type] != 0) || (cache_ptr->dirty_pins[entry_type] != 0) || (cache_ptr->max_index_len != 4) || - (cache_ptr->max_index_size != 4 * entry_sizes[entry_type]) || (cache_ptr->max_slist_len != 4) || - (cache_ptr->max_slist_size != 4 * entry_sizes[entry_type]) || (cache_ptr->max_pl_len != 0) || - (cache_ptr->max_pl_size != (size_t)0) || (cache_ptr->max_pel_len != 2) || - (cache_ptr->max_pel_size != 2 * entry_sizes[entry_type])) { + (cache_ptr->max_index_size != 4 * entry_sizes[entry_type]) || + ((cache_ptr->slist_enabled) && + ((cache_ptr->slist_len != 4) || (cache_ptr->slist_size != 4 * entry_sizes[entry_type]))) || + (cache_ptr->max_pl_len != 0) || (cache_ptr->max_pl_size != (size_t)0) || + (cache_ptr->max_pel_len != 2) || (cache_ptr->max_pel_size != 2 * entry_sizes[entry_type])) { pass = FALSE; failure_mssg = "Unexpected insert results 11."; @@ -3150,6 +3156,12 @@ check_flush_cache(unsigned paged) * * Modifications: * + * Added code to setup and take down the skip list before + * and after calls to H5C_flush_cache(). Do this via the + * H5C_FLUSH_CACHE macro. + * + * JRM -- 5/14/20 + * *------------------------------------------------------------------------- */ @@ -3157,7 +3169,6 @@ static void check_flush_cache__empty_cache(H5F_t *file_ptr) { H5C_t *cache_ptr = file_ptr->shared->cache; - herr_t result; if (cache_ptr == NULL) { @@ -3172,52 +3183,35 @@ check_flush_cache__empty_cache(H5F_t *file_ptr) /* Test behaviour on an empty cache. Can't do much sanity * checking in this case, so simply check the return values. + * + * Check of return values is done in the H5C_FLUSH_CACHE() macro. */ if (pass) { - result = H5C_flush_cache(file_ptr, H5C__NO_FLAGS_SET); - - if (result < 0) { - - pass = FALSE; - failure_mssg = "flush with flags = 0x00 failed on empty cache.\n"; - } + H5C_FLUSH_CACHE(file_ptr, H5C__NO_FLAGS_SET, "flush with flags = 0x00 failed on empty cache.\n") } if (pass) { - result = H5C_flush_cache(file_ptr, H5C__FLUSH_INVALIDATE_FLAG); - - if (result < 0) { - - pass = FALSE; - failure_mssg = "flush with flags = 0x04 failed on empty cache.\n"; - } + H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_INVALIDATE_FLAG, + "flush with flags = 0x04 failed on empty cache.\n") } if (pass) { - result = H5C_flush_cache(file_ptr, H5C__FLUSH_CLEAR_ONLY_FLAG); - - if (result < 0) { - - pass = FALSE; - failure_mssg = "flush with flags = 0x08 failed on empty cache.\n"; - } + H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_CLEAR_ONLY_FLAG, + "flush with flags = 0x08 failed on empty cache.\n") } if (pass) { - result = H5C_flush_cache(file_ptr, H5C__FLUSH_MARKED_ENTRIES_FLAG); - - if (result < 0) { - - pass = FALSE; - failure_mssg = "flush with flags = 0x10 failed on empty cache.\n"; - } + H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_MARKED_ENTRIES_FLAG, + "flush with flags = 0x10 failed on empty cache.\n") } + return; + } /* check_flush_cache__empty_cache() */ /*------------------------------------------------------------------------- @@ -4435,6 +4429,12 @@ check_flush_cache__multi_entry(H5F_t *file_ptr) * * Modifications: * + * Added code to setup and take down the skip list before + * and after calls to H5C_flush_cache(). Do this via the + * H5C_FLUSH_CACHE macro. + * + * JRM -- 5/14/20 + * *------------------------------------------------------------------------- */ @@ -4444,7 +4444,6 @@ check_flush_cache__multi_entry_test(H5F_t *file_ptr, int test_num, unsigned int { H5C_t * cache_ptr = file_ptr->shared->cache; static char msg[128]; - herr_t result; unsigned u; size_t total_entry_size = 0; test_entry_t *base_addr; @@ -4513,11 +4512,10 @@ check_flush_cache__multi_entry_test(H5F_t *file_ptr, int test_num, unsigned int if (pass) { - result = H5C_flush_cache(file_ptr, flush_flags); + H5C_FLUSH_CACHE(file_ptr, flush_flags, "dummy failure message.\n") - if (result < 0) { + if (!pass) { - pass = FALSE; HDsnprintf(msg, (size_t)128, "flush with flags 0x%x failed in multi entry test #%d.", flush_flags, test_num); failure_mssg = msg; @@ -4571,9 +4569,9 @@ check_flush_cache__multi_entry_test(H5F_t *file_ptr, int test_num, unsigned int /* clean up the cache to prep for the next test */ if (pass) { - result = H5C_flush_cache(file_ptr, H5C__FLUSH_INVALIDATE_FLAG); + H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_INVALIDATE_FLAG, "dummy mssg.\n") - if (result < 0) { + if (!pass) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Flush failed on cleanup in multi entry test #%d.", test_num); @@ -4618,6 +4616,12 @@ check_flush_cache__multi_entry_test(H5F_t *file_ptr, int test_num, unsigned int * * Modifications: * + * Added code to setup and take down the skip list before + * and after calls to H5C_flush_cache(). Do this via the + * H5C_FLUSH_CACHE macro. + * + * JRM -- 5/16/20 + * *------------------------------------------------------------------------- */ @@ -4627,7 +4631,6 @@ check_flush_cache__pe_multi_entry_test(H5F_t *file_ptr, int test_num, unsigned i { H5C_t * cache_ptr = file_ptr->shared->cache; static char msg[128]; - herr_t result; unsigned u; int j; size_t total_entry_size = 0; @@ -4703,11 +4706,10 @@ check_flush_cache__pe_multi_entry_test(H5F_t *file_ptr, int test_num, unsigned i if (pass) { - result = H5C_flush_cache(file_ptr, flush_flags); + H5C_FLUSH_CACHE(file_ptr, flush_flags, "dummy failure message.\n") - if (result < 0) { + if (!pass) { - pass = FALSE; HDsnprintf(msg, (size_t)128, "flush with flags 0x%x failed in pe multi entry test #%d.", flush_flags, test_num); failure_mssg = msg; @@ -4762,9 +4764,9 @@ check_flush_cache__pe_multi_entry_test(H5F_t *file_ptr, int test_num, unsigned i /* clean up the cache to prep for the next test */ if (pass) { - result = H5C_flush_cache(file_ptr, H5C__FLUSH_INVALIDATE_FLAG); + H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_INVALIDATE_FLAG, "dummy mssg.\n") - if (result < 0) { + if (!pass) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Flush failed on cleanup in pe multi entry test #%d.", test_num); @@ -8006,6 +8008,12 @@ check_flush_cache__flush_ops(H5F_t *file_ptr) * * Modifications: * + * Added code to setup and take down the skip list before + * and after calls to H5C_flush_cache(). Do this via the + * H5C_FLUSH_CACHE macro. + * + * JRM -- 5/16/20 + * *------------------------------------------------------------------------- */ @@ -8018,7 +8026,6 @@ check_flush_cache__flush_op_test(H5F_t *file_ptr, int test_num, unsigned int flu { H5C_t * cache_ptr = file_ptr->shared->cache; static char msg[128]; - herr_t result; int i; int j; test_entry_t *base_addr; @@ -8139,9 +8146,9 @@ check_flush_cache__flush_op_test(H5F_t *file_ptr, int test_num, unsigned int flu if (pass) { - result = H5C_flush_cache(file_ptr, flush_flags); + H5C_FLUSH_CACHE(file_ptr, flush_flags, "dummy failure message") - if (result < 0) { + if (!pass) { pass = FALSE; HDsnprintf(msg, (size_t)128, "flush with flags 0x%x failed in flush op test #%d.", flush_flags, @@ -8214,74 +8221,104 @@ check_flush_cache__flush_op_test(H5F_t *file_ptr, int test_num, unsigned int flu #if 0 /* This is useful debugging code. Lets keep it around for a while. */ - if(entry_ptr->size != check[i].expected_size) { - HDfprintf(stdout, "entry_ptr->size (expected) = %d (%d).\n", - (int)(entry_ptr->size), - (int)(check[i].expected_size)); - } - if((!entry_ptr->header.destroy_in_progress) && - (check[i].in_cache) && - (entry_ptr->header.size != check[i].expected_size)) { - HDfprintf(stdout, + if ( entry_ptr->size != check[i].expected_size ) { + + HDfprintf(stdout, "entry_ptr->size (expected) = %d (%d).\n", + (int)(entry_ptr->size), + (int)(check[i].expected_size)); + } + + if ( ( ! entry_ptr->header.destroy_in_progress ) && + ( check[i].in_cache ) && + ( entry_ptr->header.size != check[i].expected_size ) ) { + + HDfprintf(stdout, "(!destroy in progress and in cache and size (expected) = %d (%d).\n", (int)(entry_ptr->header.size), - (int)(check[i].expected_size)); - } - if(entry_ptr->at_main_addr != check[i].at_main_addr) { - HDfprintf(stdout, "(%d,%d) at main addr (expected) = %d (%d).\n", - (int)(check[i].entry_type), - (int)(check[i].entry_index), + (int)(check[i].expected_size)); + } + + if ( entry_ptr->at_main_addr != check[i].at_main_addr ) { + + HDfprintf(stdout, + "(%d,%d) at main addr (expected) = %d (%d).\n", + (int)(check[i].entry_type), + (int)(check[i].entry_index), (int)(entry_ptr->at_main_addr), - (int)(check[i].at_main_addr)); + (int)(check[i].at_main_addr)); + } + + if ( entry_ptr->is_dirty != check[i].is_dirty ) { + + HDfprintf(stdout, + "entry_ptr->is_dirty (expected) = %d (%d).\n", + (int)(entry_ptr->is_dirty), + (int)(check[i].is_dirty)); + } + + if ( entry_ptr->header.is_dirty != check[i].is_dirty ) { + + HDfprintf(stdout, + "entry_ptr->header.is_dirty (expected) = %d (%d).\n", + (int)(entry_ptr->header.is_dirty), + (int)(check[i].is_dirty)); + } + + if ( entry_ptr->is_protected != check[i].is_protected ) { + + HDfprintf(stdout, + "entry_ptr->is_protected (expected) = %d (%d).\n", + (int)(entry_ptr->is_protected), + (int)(check[i].is_protected)); + } + + if ( entry_ptr->header.is_protected != check[i].is_protected ) { + + HDfprintf(stdout, + "entry_ptr->header.is_protected (expected) = %d (%d).\n", + (int)(entry_ptr->is_protected), + (int)(check[i].is_protected)); + } + + if ( entry_ptr->is_pinned != check[i].is_pinned ) { + + HDfprintf(stdout, + "entry_ptr->is_pinned (expected) = %d (%d).\n", + (int)(entry_ptr->is_pinned), + (int)(check[i].is_pinned)); + } + + if ( entry_ptr->header.is_pinned != check[i].is_pinned ) { + + HDfprintf(stdout, + "entry_ptr->header.is_pinned (expected) = %d (%d).\n", + (int)(entry_ptr->header.is_pinned), + (int)(check[i].is_pinned)); + } + + if ( entry_ptr->deserialized != check[i].expected_deserialized ) { + + HDfprintf(stdout, + "entry_ptr->deserialized (expected) = %d (%d).\n", + (int)(entry_ptr->deserialized), + (int)(check[i].expected_deserialized)); + } + + if ( entry_ptr->serialized != check[i].expected_serialized ) { + + HDfprintf(stdout, + "entry_ptr->serialized (expected) = %d (%d).\n", + (int)(entry_ptr->serialized), + (int)(check[i].expected_serialized)); + } + + if ( entry_ptr->destroyed != check[i].expected_destroyed ) { + + HDfprintf(stdout, \ + "entry_ptr->destroyed (expected) = %d (%d).\n", + (int)(entry_ptr->destroyed), + (int)(check[i].expected_destroyed)); } - if(entry_ptr->is_dirty != check[i].is_dirty) { - HDfprintf(stdout, "entry_ptr->is_dirty (expected) = %d (%d).\n", - (int)(entry_ptr->is_dirty), - (int)(check[i].is_dirty)); - } - if(entry_ptr->header.is_dirty != check[i].is_dirty) { - HDfprintf(stdout, "entry_ptr->header.is_dirty (expected) = %d (%d).\n", - (int)(entry_ptr->header.is_dirty), - (int)(check[i].is_dirty)); - } - if(entry_ptr->is_protected != check[i].is_protected) { - HDfprintf(stdout, "entry_ptr->is_protected (expected) = %d (%d).\n", - (int)(entry_ptr->is_protected), - (int)(check[i].is_protected)); - } - if(entry_ptr->header.is_protected != check[i].is_protected) { - HDfprintf(stdout, "entry_ptr->header.is_protected (expected) = %d (%d).\n", - (int)(entry_ptr->is_protected), - (int)(check[i].is_protected)); - } - if(entry_ptr->is_pinned != check[i].is_pinned) { - HDfprintf(stdout, "entry_ptr->is_pinned (expected) = %d (%d).\n", - (int)(entry_ptr->is_pinned), - (int)(check[i].is_pinned)); - } - if(entry_ptr->header.is_pinned != check[i].is_pinned) { - HDfprintf(stdout, "entry_ptr->header.is_pinned (expected) = %d (%d).\n", - (int)(entry_ptr->header.is_pinned), - (int)(check[i].is_pinned)); - } - if(entry_ptr->deserialized != - check[i].expected_deserialized) { - HDfprintf(stdout, - "entry_ptr->deserialized (expected) = %d (%d).\n", - (int)(entry_ptr->deserialized), - (int)(check[i].expected_deserialized)); - } - if(entry_ptr->serialized != check[i].expected_serialized) { - HDfprintf(stdout, - "entry_ptr->serialized (expected) = %d (%d).\n", - (int)(entry_ptr->serialized), - (int)(check[i].expected_serialized)); - } - if(entry_ptr->destroyed != check[i].expected_destroyed) { - HDfprintf(stdout, "entry_ptr->destroyed (expected) = %d (%d).\n", - (int)(entry_ptr->destroyed), - (int)(check[i].expected_destroyed)); - } #endif pass = FALSE; HDsnprintf(msg, (size_t)128, "Check2 failed on entry %d after flush op test #%d.", i, @@ -8310,11 +8347,10 @@ check_flush_cache__flush_op_test(H5F_t *file_ptr, int test_num, unsigned int flu /* clean up the cache to prep for the next test */ if (pass) { - result = H5C_flush_cache(file_ptr, H5C__FLUSH_INVALIDATE_FLAG); + H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_INVALIDATE_FLAG, "dummy mssg.") - if (result < 0) { + if (!pass) { - pass = FALSE; HDsnprintf(msg, (size_t)128, "Flush failed on cleanup in flush op test #%d.", test_num); failure_mssg = msg; } @@ -8377,10 +8413,16 @@ check_flush_cache__flush_op_test(H5F_t *file_ptr, int test_num, unsigned int flu * * Modifications: * - * Updated test for minor changes in the behaviour - * of H5C__flush_single_entry(). + * Updated test for minor changes in the behaviour + * of H5C__flush_single_entry(). + * + * JRM -- 2/16/15 * - * JRM -- 2/16/15 + * Added code to setup and take down the skip list before + * and after calls to H5C_flush_cache(). Do this via the + * H5C_FLUSH_CACHE macro. + * + * JRM -- 5/16/20 * *------------------------------------------------------------------------- */ @@ -8393,7 +8435,6 @@ check_flush_cache__flush_op_eviction_test(H5F_t *file_ptr) int num_variable_entries = 10; int num_monster_entries = 31; int num_large_entries = 0; - herr_t result; test_entry_t * entry_ptr; test_entry_t * base_addr; struct expected_entry_status expected[10 + 31 + 14] = { @@ -10407,14 +10448,10 @@ check_flush_cache__flush_op_eviction_test(H5F_t *file_ptr) if (pass) { - result = H5C_flush_cache(file_ptr, H5C__FLUSH_INVALIDATE_FLAG); - - if (result < 0) { + H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_INVALIDATE_FLAG, + "Cache flush invalidate failed after flush op eviction test") - pass = FALSE; - failure_mssg = "Cache flush invalidate failed after flush op eviction test"; - } - else if ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0)) { + if ((pass) && ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0))) { pass = FALSE; failure_mssg = "Unexpected cache len/size after cleanup of flush op eviction test"; @@ -12150,6 +12187,12 @@ check_flush_cache__single_entry(H5F_t *file_ptr) * * Modifications: * + * Added code to setup and take down the skip list before + * and after calls to H5C_flush_cache(). Do this via the + * H5C_FLUSH_CACHE macro. + * + * JRM -- 5/14/20 + * *------------------------------------------------------------------------- */ @@ -12161,7 +12204,6 @@ check_flush_cache__single_entry_test(H5F_t *file_ptr, int test_num, int entry_ty { H5C_t * cache_ptr = file_ptr->shared->cache; static char msg[128]; - herr_t result; test_entry_t *base_addr; test_entry_t *entry_ptr = NULL; @@ -12204,11 +12246,10 @@ check_flush_cache__single_entry_test(H5F_t *file_ptr, int test_num, int entry_ty if (pass) { - result = H5C_flush_cache(file_ptr, flush_flags); + H5C_FLUSH_CACHE(file_ptr, flush_flags, "dummy failure mssg.") - if (result < 0) { + if (!pass) { /* construct and set actual failure message */ - pass = FALSE; HDsnprintf(msg, (size_t)128, "flush with flags 0x%x failed in single entry test #%d.", flush_flags, test_num); @@ -12249,11 +12290,10 @@ check_flush_cache__single_entry_test(H5F_t *file_ptr, int test_num, int entry_ty /* clean up the cache to prep for the next test */ if (pass) { - result = H5C_flush_cache(file_ptr, H5C__FLUSH_INVALIDATE_FLAG); + H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_INVALIDATE_FLAG, "dummy failure mssg.") - if (result < 0) { + if (!pass) { /* construct and set actual failure message */ - pass = FALSE; HDsnprintf(msg, (size_t)128, "Flush failed on cleanup in single entry test #%d.", test_num); failure_mssg = msg; } @@ -12288,13 +12328,18 @@ check_flush_cache__single_entry_test(H5F_t *file_ptr, int test_num, int entry_ty * * Modifications: * - * JRM -- 5/17/06 - * Added the pop_mark_dirty_prot and pop_mark_dirty_pinned - * flags and supporting code to allow us to test the - * H5C_mark_entry_dirty() call. Use the - * call to mark the entry dirty while the entry is protected - * if pop_mark_dirty_prot is TRUE, and to mark the entry - * dirty while it is pinned if pop_mark_dirty_pinned is TRUE. + * JRM -- 5/17/06 + * Added the pop_mark_dirty_prot and pop_mark_dirty_pinned + * flags and supporting code to allow us to test the + * H5C_mark_entry_dirty() call. Use the + * call to mark the entry dirty while the entry is protected + * if pop_mark_dirty_prot is TRUE, and to mark the entry + * dirty while it is pinned if pop_mark_dirty_pinned is TRUE. + * + * JRM -- 5/14/20 + * Added code to setup and take down the skip list before + * and after calls to H5C_flush_cache(). Do this via the + * H5C_FLUSH_CACHE macro. * *------------------------------------------------------------------------- */ @@ -12310,7 +12355,6 @@ check_flush_cache__pinned_single_entry_test(H5F_t *file_ptr, int test_num, int e H5C_t * cache_ptr = file_ptr->shared->cache; static char msg[128]; hbool_t expected_deserialized = TRUE; - herr_t result; test_entry_t *base_addr; test_entry_t *entry_ptr = NULL; @@ -12364,11 +12408,10 @@ check_flush_cache__pinned_single_entry_test(H5F_t *file_ptr, int test_num, int e if (pass) { - result = H5C_flush_cache(file_ptr, flush_flags); + H5C_FLUSH_CACHE(file_ptr, flush_flags, "dummy failure message\n") - if (result < 0) { + if (!pass) { /* construct and set the correct failure message */ - pass = FALSE; HDsnprintf(msg, (size_t)128, "flush with flags 0x%x failed in pinned single entry test #%d.", flush_flags, test_num); failure_mssg = msg; @@ -12423,11 +12466,10 @@ check_flush_cache__pinned_single_entry_test(H5F_t *file_ptr, int test_num, int e if (pass) { - result = H5C_flush_cache(file_ptr, H5C__FLUSH_INVALIDATE_FLAG); + H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_INVALIDATE_FLAG, "dummy mssg\n") - if (result < 0) { + if (!pass) { - pass = FALSE; HDsnprintf(msg, (size_t)128, "Flush failed on cleanup in pinned single entry test #%d.", test_num); failure_mssg = msg; @@ -13714,6 +13756,12 @@ check_pin_protected_entry(unsigned paged) * Programmer: John Mainzer * 7/7/06 * + * Modifications: + * + * Updated function to allow for disabling of the slist. + * + * JRM -- 5/18/20 + * *------------------------------------------------------------------------- */ @@ -13878,7 +13926,8 @@ check_resize_entry(unsigned paged) if (pass) { if ((cache_ptr->index_len != 1) || (cache_ptr->index_size != (LARGE_ENTRY_SIZE / 2)) || - (cache_ptr->slist_len != 1) || (cache_ptr->slist_size != (LARGE_ENTRY_SIZE / 2))) { + ((cache_ptr->slist_enabled) && + ((cache_ptr->slist_len != 1) || (cache_ptr->slist_size != (LARGE_ENTRY_SIZE / 2))))) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected cache status 3."); @@ -13952,7 +14001,8 @@ check_resize_entry(unsigned paged) if (pass) { if ((cache_ptr->index_len != 1) || (cache_ptr->index_size != LARGE_ENTRY_SIZE) || - (cache_ptr->slist_len != 1) || (cache_ptr->slist_size != LARGE_ENTRY_SIZE)) { + ((cache_ptr->slist_enabled) && + ((cache_ptr->slist_len != 1) || (cache_ptr->slist_size != LARGE_ENTRY_SIZE)))) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected cache status 4."); @@ -14008,7 +14058,8 @@ check_resize_entry(unsigned paged) if (pass) { if ((cache_ptr->index_len != 1) || (cache_ptr->index_size != (LARGE_ENTRY_SIZE / 4)) || - (cache_ptr->slist_len != 1) || (cache_ptr->slist_size != (LARGE_ENTRY_SIZE / 4))) { + ((cache_ptr->slist_enabled) && + ((cache_ptr->slist_len != 1) || (cache_ptr->slist_size != (LARGE_ENTRY_SIZE / 4))))) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected cache status 5."); @@ -14057,7 +14108,8 @@ check_resize_entry(unsigned paged) if (pass) { if ((cache_ptr->index_len != 1) || (cache_ptr->index_size != LARGE_ENTRY_SIZE) || - (cache_ptr->slist_len != 1) || (cache_ptr->slist_size != LARGE_ENTRY_SIZE)) { + ((cache_ptr->slist_enabled) && + ((cache_ptr->slist_len != 1) || (cache_ptr->slist_size != LARGE_ENTRY_SIZE)))) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected cache status 6."); @@ -14125,8 +14177,8 @@ check_resize_entry(unsigned paged) if (pass) { - if ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0) || (cache_ptr->slist_len != 0) || - (cache_ptr->slist_size != 0)) { + if ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0) || + ((cache_ptr->slist_enabled) && ((cache_ptr->slist_len != 0) || (cache_ptr->slist_size != 0)))) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected cache status 7."); @@ -14138,8 +14190,8 @@ check_resize_entry(unsigned paged) if (pass) { - if ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0) || (cache_ptr->slist_len != 0) || - (cache_ptr->slist_size != 0)) { + if ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0) || + ((cache_ptr->slist_enabled) && ((cache_ptr->slist_len != 0) || (cache_ptr->slist_size != 0)))) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected cache status 8."); @@ -14166,7 +14218,8 @@ check_resize_entry(unsigned paged) if (pass) { if ((cache_ptr->index_len != 3) || (cache_ptr->index_size != 3 * LARGE_ENTRY_SIZE) || - (cache_ptr->slist_len != 1) || (cache_ptr->slist_size != LARGE_ENTRY_SIZE)) { + ((cache_ptr->slist_enabled) && + ((cache_ptr->slist_len != 1) || (cache_ptr->slist_size != LARGE_ENTRY_SIZE)))) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected cache status 9."); @@ -14182,7 +14235,8 @@ check_resize_entry(unsigned paged) if (pass) { if ((cache_ptr->index_len != 4) || (cache_ptr->index_size != 4 * LARGE_ENTRY_SIZE) || - (cache_ptr->slist_len != 1) || (cache_ptr->slist_size != LARGE_ENTRY_SIZE)) { + ((cache_ptr->slist_enabled) && + ((cache_ptr->slist_len != 1) || (cache_ptr->slist_size != LARGE_ENTRY_SIZE)))) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected cache status 10."); @@ -14251,8 +14305,9 @@ check_resize_entry(unsigned paged) if ((cache_ptr->index_len != 4) || (cache_ptr->index_size != ((3 * LARGE_ENTRY_SIZE) + (LARGE_ENTRY_SIZE / 2))) || - (cache_ptr->slist_len != 2) || - (cache_ptr->slist_size != (LARGE_ENTRY_SIZE + (LARGE_ENTRY_SIZE / 2)))) { + ((cache_ptr->slist_enabled) && + ((cache_ptr->slist_len != 2) || + (cache_ptr->slist_size != (LARGE_ENTRY_SIZE + (LARGE_ENTRY_SIZE / 2)))))) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected cache status 11."); @@ -14326,7 +14381,8 @@ check_resize_entry(unsigned paged) if (pass) { if ((cache_ptr->index_len != 4) || (cache_ptr->index_size != 4 * LARGE_ENTRY_SIZE) || - (cache_ptr->slist_len != 2) || (cache_ptr->slist_size != 2 * LARGE_ENTRY_SIZE)) { + ((cache_ptr->slist_enabled) && + ((cache_ptr->slist_len != 2) || (cache_ptr->slist_size != 2 * LARGE_ENTRY_SIZE)))) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected cache status 12."); @@ -14383,8 +14439,9 @@ check_resize_entry(unsigned paged) if ((cache_ptr->index_len != 4) || (cache_ptr->index_size != ((3 * LARGE_ENTRY_SIZE) + (LARGE_ENTRY_SIZE / 4))) || - (cache_ptr->slist_len != 2) || - (cache_ptr->slist_size != (LARGE_ENTRY_SIZE + (LARGE_ENTRY_SIZE / 4)))) { + ((cache_ptr->slist_enabled) && + ((cache_ptr->slist_len != 2) || + (cache_ptr->slist_size != (LARGE_ENTRY_SIZE + (LARGE_ENTRY_SIZE / 4)))))) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected cache status 13."); @@ -14433,7 +14490,8 @@ check_resize_entry(unsigned paged) if (pass) { if ((cache_ptr->index_len != 4) || (cache_ptr->index_size != (4 * LARGE_ENTRY_SIZE)) || - (cache_ptr->slist_len != 2) || (cache_ptr->slist_size != (2 * LARGE_ENTRY_SIZE))) { + ((cache_ptr->slist_enabled) && + ((cache_ptr->slist_len != 2) || (cache_ptr->slist_size != (2 * LARGE_ENTRY_SIZE))))) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected cache status 14."); @@ -14502,7 +14560,8 @@ check_resize_entry(unsigned paged) if (pass) { if ((cache_ptr->index_len != 3) || (cache_ptr->index_size != (3 * LARGE_ENTRY_SIZE)) || - (cache_ptr->slist_len != 1) || (cache_ptr->slist_size != LARGE_ENTRY_SIZE)) { + ((cache_ptr->slist_enabled) && + ((cache_ptr->slist_len != 1) || (cache_ptr->slist_size != LARGE_ENTRY_SIZE)))) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected cache status 15."); @@ -14524,8 +14583,8 @@ check_resize_entry(unsigned paged) if (pass) { - if ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0) || (cache_ptr->slist_len != 0) || - (cache_ptr->slist_size != 0)) { + if ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0) || + ((cache_ptr->slist_enabled) && ((cache_ptr->slist_len != 0) || (cache_ptr->slist_size != 0)))) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected cache status 16."); @@ -14567,6 +14626,9 @@ check_resize_entry(unsigned paged) * * Modifications: * + * Updated function to allow for disabling of the slist. + * + * JRM -- 5/18/20 * *------------------------------------------------------------------------- */ @@ -14656,8 +14718,9 @@ check_evictions_enabled(unsigned paged) /* verify that it is empty */ if (pass) { - if ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0) || (cache_ptr->slist_len != 0) || - (cache_ptr->slist_size != 0) || (cache_ptr->evictions_enabled != TRUE)) { + if ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0) || + ((cache_ptr->slist_enabled) && ((cache_ptr->slist_len != 0) || (cache_ptr->slist_size != 0))) || + (cache_ptr->evictions_enabled != TRUE)) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected cache status 1."); @@ -14700,7 +14763,7 @@ check_evictions_enabled(unsigned paged) if (pass) { if ((cache_ptr->index_len != 16) || (cache_ptr->index_size != 16 * MONSTER_ENTRY_SIZE) || - (cache_ptr->slist_len != 0) || (cache_ptr->slist_size != 0) || + ((cache_ptr->slist_enabled) && ((cache_ptr->slist_len != 0) || (cache_ptr->slist_size != 0))) || (cache_ptr->evictions_enabled != TRUE)) { pass = FALSE; @@ -14726,7 +14789,7 @@ check_evictions_enabled(unsigned paged) if (pass) { if ((cache_ptr->index_len != 16) || (cache_ptr->index_size != 16 * MONSTER_ENTRY_SIZE) || - (cache_ptr->slist_len != 0) || (cache_ptr->slist_size != 0) || + ((cache_ptr->slist_enabled) && ((cache_ptr->slist_len != 0) || (cache_ptr->slist_size != 0))) || (cache_ptr->evictions_enabled != TRUE)) { pass = FALSE; @@ -14781,7 +14844,8 @@ check_evictions_enabled(unsigned paged) if (pass) { if ((cache_ptr->index_len != 16) || (cache_ptr->index_size != 16 * MONSTER_ENTRY_SIZE) || - (cache_ptr->slist_len != 1) || (cache_ptr->slist_size != MONSTER_ENTRY_SIZE) || + ((cache_ptr->slist_enabled) && + ((cache_ptr->slist_len != 1) || (cache_ptr->slist_size != MONSTER_ENTRY_SIZE))) || (cache_ptr->evictions_enabled != TRUE)) { pass = FALSE; @@ -14843,7 +14907,8 @@ check_evictions_enabled(unsigned paged) if (pass) { if ((cache_ptr->index_len != 16) || (cache_ptr->index_size != 16 * MONSTER_ENTRY_SIZE) || - (cache_ptr->slist_len != 1) || (cache_ptr->slist_size != MONSTER_ENTRY_SIZE) || + ((cache_ptr->slist_enabled) && + ((cache_ptr->slist_len != 1) || (cache_ptr->slist_size != MONSTER_ENTRY_SIZE))) || (cache_ptr->evictions_enabled != FALSE)) { pass = FALSE; @@ -14869,7 +14934,8 @@ check_evictions_enabled(unsigned paged) if (pass) { if ((cache_ptr->index_len != 17) || (cache_ptr->index_size != 17 * MONSTER_ENTRY_SIZE) || - (cache_ptr->slist_len != 1) || (cache_ptr->slist_size != MONSTER_ENTRY_SIZE) || + ((cache_ptr->slist_enabled) && + ((cache_ptr->slist_len != 1) || (cache_ptr->slist_size != MONSTER_ENTRY_SIZE))) || (cache_ptr->evictions_enabled != FALSE)) { pass = FALSE; @@ -14894,7 +14960,8 @@ check_evictions_enabled(unsigned paged) if (pass) { if ((cache_ptr->index_len != 18) || (cache_ptr->index_size != 18 * MONSTER_ENTRY_SIZE) || - (cache_ptr->slist_len != 2) || (cache_ptr->slist_size != 2 * MONSTER_ENTRY_SIZE) || + ((cache_ptr->slist_enabled) && + ((cache_ptr->slist_len != 2) || (cache_ptr->slist_size != 2 * MONSTER_ENTRY_SIZE))) || (cache_ptr->evictions_enabled != FALSE)) { pass = FALSE; @@ -14936,7 +15003,8 @@ check_evictions_enabled(unsigned paged) if (pass) { if ((cache_ptr->index_len != 18) || (cache_ptr->index_size != 18 * MONSTER_ENTRY_SIZE) || - (cache_ptr->slist_len != 2) || (cache_ptr->slist_size != 2 * MONSTER_ENTRY_SIZE) || + ((cache_ptr->slist_enabled) && + ((cache_ptr->slist_len != 2) || (cache_ptr->slist_size != 2 * MONSTER_ENTRY_SIZE))) || (cache_ptr->evictions_enabled != TRUE)) { pass = FALSE; @@ -14965,7 +15033,8 @@ check_evictions_enabled(unsigned paged) if (pass) { if ((cache_ptr->index_len != 16) || (cache_ptr->index_size != 16 * MONSTER_ENTRY_SIZE) || - (cache_ptr->slist_len != 2) || (cache_ptr->slist_size != 2 * MONSTER_ENTRY_SIZE) || + ((cache_ptr->slist_enabled) && + ((cache_ptr->slist_len != 2) || (cache_ptr->slist_size != 2 * MONSTER_ENTRY_SIZE))) || (cache_ptr->evictions_enabled != TRUE)) { pass = FALSE; @@ -15069,7 +15138,8 @@ check_evictions_enabled(unsigned paged) if (pass) { if ((cache_ptr->index_len != 17) || (cache_ptr->index_size != 17 * MONSTER_ENTRY_SIZE) || - (cache_ptr->slist_len != 2) || (cache_ptr->slist_size != 2 * MONSTER_ENTRY_SIZE) || + ((cache_ptr->slist_enabled) && + ((cache_ptr->slist_len != 2) || (cache_ptr->slist_size != 2 * MONSTER_ENTRY_SIZE))) || (cache_ptr->evictions_enabled != FALSE)) { pass = FALSE; @@ -15110,7 +15180,8 @@ check_evictions_enabled(unsigned paged) if (pass) { if ((cache_ptr->index_len != 16) || (cache_ptr->index_size != 16 * MONSTER_ENTRY_SIZE) || - (cache_ptr->slist_len != 3) || (cache_ptr->slist_size != 3 * MONSTER_ENTRY_SIZE) || + ((cache_ptr->slist_enabled) && + ((cache_ptr->slist_len != 3) || (cache_ptr->slist_size != 3 * MONSTER_ENTRY_SIZE))) || (cache_ptr->evictions_enabled != TRUE)) { pass = FALSE; @@ -15205,13 +15276,19 @@ check_evictions_enabled(unsigned paged) * * Modifications: * + * Added code to setup and take down the skip list before + * and after calls to H5C_flush_cache(). + * + * JRM -- 5/14/20 + * *------------------------------------------------------------------------- */ static unsigned check_flush_protected_err(unsigned paged) { - H5F_t *file_ptr = NULL; + H5F_t *file_ptr = NULL; + H5C_t *cache_ptr = NULL; if (paged) TESTING("flush cache with protected entry error (paged aggregation)") @@ -15231,27 +15308,41 @@ check_flush_protected_err(unsigned paged) file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged); + if (pass) { + + cache_ptr = file_ptr->shared->cache; + } + protect_entry(file_ptr, 0, 0); - if (H5C_flush_cache(file_ptr, H5C__NO_FLAGS_SET) >= 0) { + /* enable slist prior to flush */ + if ((pass) && (H5C_set_slist_enabled(cache_ptr, TRUE, FALSE) < 0)) { + + pass = FALSE; + failure_mssg = "unable to enable slist prior to flush.\n"; + } + + if ((pass) && (H5C_flush_cache(file_ptr, H5C__NO_FLAGS_SET) >= 0)) { pass = FALSE; failure_mssg = "flush succeeded on cache with protected entry.\n"; } - else { - unprotect_entry(file_ptr, 0, 0, H5C__DIRTIED_FLAG); + /* disable the slist after the flush */ + if ((pass) && (H5C_set_slist_enabled(cache_ptr, FALSE, FALSE) < 0)) { - if (H5C_flush_cache(file_ptr, H5C__NO_FLAGS_SET) < 0) { + pass = FALSE; + failure_mssg = "unable to disable slist after flush.\n"; + } - pass = FALSE; - failure_mssg = "flush failed after unprotect.\n"; - } - else { + unprotect_entry(file_ptr, 0, 0, H5C__DIRTIED_FLAG); - takedown_cache(file_ptr, FALSE, FALSE); - } + if (pass) { + + H5C_FLUSH_CACHE(file_ptr, H5C__NO_FLAGS_SET, "flush failed after unprotect.\n") } + + takedown_cache(file_ptr, FALSE, FALSE); } if (pass) { @@ -29821,10 +29912,18 @@ done: * Purpose: Verify that the order that entries with flush dependencies * is correct * - * Return: 0 on success, non-zero on failure + * Return: 0 on success, non-zero on failure * - * Programmer: Quincey Koziol - * 3/17/09 + * Programmer: Quincey Koziol + * 3/17/09 + * + * Modifications: + * + * Added code to setup and take down the skip list before + * and after calls to H5C_flush_cache(). Do this via the + * H5C_FLUSH_CACHE macro. + * + * JRM -- 5/14/20 * *------------------------------------------------------------------------- */ @@ -29923,8 +30022,6 @@ check_flush_deps_order(unsigned paged) /* Flush the cache and verify that the entries were flushed in correct order */ { - herr_t result; /* Generic return value */ - add_flush_op(entry_type, 0, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order); add_flush_op(entry_type, 1, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order); @@ -29938,8 +30035,8 @@ check_flush_deps_order(unsigned paged) /* Reset index for tracking flush order */ flush_order = 0; - result = H5C_flush_cache(file_ptr, H5C__NO_FLAGS_SET); - if (result < 0) + H5C_FLUSH_CACHE(file_ptr, H5C__NO_FLAGS_SET, "dummy mssg") + if (!pass) CACHE_ERROR("flushing entries with flush dependendices") /* Change expected values, and verify the status of the entries @@ -30024,8 +30121,6 @@ check_flush_deps_order(unsigned paged) /* Flush the cache and verify that the entries were flushed in correct order */ { - herr_t result; /* Generic return value */ - add_flush_op(entry_type, 0, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order); add_flush_op(entry_type, 1, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order); @@ -30051,8 +30146,8 @@ check_flush_deps_order(unsigned paged) /* Reset index for tracking flush order */ flush_order = 0; - result = H5C_flush_cache(file_ptr, H5C__NO_FLAGS_SET); - if (result < 0) + H5C_FLUSH_CACHE(file_ptr, H5C__NO_FLAGS_SET, "dummy mssg") + if (!pass) CACHE_ERROR("flushing entries with flush dependendices") /* Change expected values, and verify the status of the entries @@ -30139,8 +30234,6 @@ check_flush_deps_order(unsigned paged) /* Flush the cache and verify that the entries were flushed in correct order */ { - herr_t result; /* Generic return value */ - add_flush_op(entry_type, 0, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order); add_flush_op(entry_type, 1, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order); add_flush_op(entry_type, 2, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order); @@ -30170,8 +30263,8 @@ check_flush_deps_order(unsigned paged) /* Reset index for tracking flush order */ flush_order = 0; - result = H5C_flush_cache(file_ptr, H5C__NO_FLAGS_SET); - if (result < 0) + H5C_FLUSH_CACHE(file_ptr, H5C__NO_FLAGS_SET, "dummy mssg") + if (!pass) CACHE_ERROR("flushing entries with flush dependendices") /* Change expected values, and verify the status of the entries @@ -30266,8 +30359,6 @@ check_flush_deps_order(unsigned paged) /* Flush the cache and verify that the entries were flushed in correct order */ { - herr_t result; /* Generic return value */ - add_flush_op(entry_type, 0, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order); add_flush_op(entry_type, 1, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order); add_flush_op(entry_type, 2, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order); @@ -30297,8 +30388,8 @@ check_flush_deps_order(unsigned paged) /* Reset index for tracking flush order */ flush_order = 0; - result = H5C_flush_cache(file_ptr, H5C__NO_FLAGS_SET); - if (result < 0) + H5C_FLUSH_CACHE(file_ptr, H5C__NO_FLAGS_SET, "dummy mssg") + if (!pass) CACHE_ERROR("flushing entries with flush dependendices") /* Change expected values, and verify the status of the entries @@ -30438,8 +30529,6 @@ check_flush_deps_order(unsigned paged) /* Flush the cache and verify that the entries were flushed in correct order */ { - herr_t result; /* Generic return value */ - add_flush_op(entry_type, 0, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order); add_flush_op(entry_type, 1, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order); add_flush_op(entry_type, 2, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order); @@ -30487,8 +30576,8 @@ check_flush_deps_order(unsigned paged) /* Reset index for tracking flush order */ flush_order = 0; - result = H5C_flush_cache(file_ptr, H5C__NO_FLAGS_SET); - if (result < 0) + H5C_FLUSH_CACHE(file_ptr, H5C__NO_FLAGS_SET, "dummy mssg") + if (!pass) CACHE_ERROR("flushing entries with flush dependendices") /* Change expected values, and verify the status of the entries @@ -30665,8 +30754,6 @@ check_flush_deps_order(unsigned paged) /* Flush the cache and verify that the entries were flushed in correct order */ { - herr_t result; /* Generic return value */ - add_flush_op(entry_type, 0, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order); add_flush_op(entry_type, 1, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order); add_flush_op(entry_type, 2, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order); @@ -30714,8 +30801,8 @@ check_flush_deps_order(unsigned paged) /* Reset index for tracking flush order */ flush_order = 0; - result = H5C_flush_cache(file_ptr, H5C__NO_FLAGS_SET); - if (result < 0) + H5C_FLUSH_CACHE(file_ptr, H5C__NO_FLAGS_SET, "dummy mssg") + if (!pass) CACHE_ERROR("flushing entries with flush dependendices") /* Change expected values, and verify the status of the entries @@ -30841,8 +30928,6 @@ check_flush_deps_order(unsigned paged) /* Flush the cache and verify that the entries were flushed in correct order */ { - herr_t result; /* Generic return value */ - add_flush_op(entry_type, 0, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order); add_flush_op(entry_type, 1, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order); add_flush_op(entry_type, 2, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order); @@ -30880,8 +30965,8 @@ check_flush_deps_order(unsigned paged) /* Reset index for tracking flush order */ flush_order = 0; - result = H5C_flush_cache(file_ptr, H5C__NO_FLAGS_SET); - if (result < 0) + H5C_FLUSH_CACHE(file_ptr, H5C__NO_FLAGS_SET, "dummy mssg") + if (!pass) CACHE_ERROR("flushing entries with flush dependendices") /* Change expected values, and verify the status of the entries @@ -30979,8 +31064,6 @@ check_flush_deps_order(unsigned paged) /* Flush the cache and verify that the entries were flushed in correct order */ { - herr_t result; /* Generic return value */ - add_flush_op(entry_type, 0, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order); add_flush_op(entry_type, 1, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order); add_flush_op(entry_type, 2, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order); @@ -31018,8 +31101,8 @@ check_flush_deps_order(unsigned paged) /* Reset index for tracking flush order */ flush_order = 0; - result = H5C_flush_cache(file_ptr, H5C__NO_FLAGS_SET); - if (result < 0) + H5C_FLUSH_CACHE(file_ptr, H5C__NO_FLAGS_SET, "dummy mssg") + if (!pass) CACHE_ERROR("flushing entries with flush dependendices") /* Change expected values, and verify the status of the entries @@ -31171,8 +31254,6 @@ check_flush_deps_order(unsigned paged) /* Flush the cache and verify that the entries were flushed in correct order */ { - herr_t result; /* Generic return value */ - add_flush_op(entry_type, 0, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order); add_flush_op(entry_type, 1, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order); @@ -31223,8 +31304,8 @@ check_flush_deps_order(unsigned paged) /* Reset index for tracking flush order */ flush_order = 0; - result = H5C_flush_cache(file_ptr, H5C__NO_FLAGS_SET); - if (result < 0) + H5C_FLUSH_CACHE(file_ptr, H5C__NO_FLAGS_SET, "dummy mssg") + if (!pass) CACHE_ERROR("flushing entries with flush dependendices") /* Change expected values, and verify the status of the entries @@ -31426,8 +31507,6 @@ check_flush_deps_order(unsigned paged) /* Flush the cache and verify that the entries were flushed in correct order */ { - herr_t result; /* Generic return value */ - add_flush_op(entry_type, 0, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order); add_flush_op(entry_type, 1, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order); add_flush_op(entry_type, 2, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order); @@ -31479,8 +31558,8 @@ check_flush_deps_order(unsigned paged) /* Reset index for tracking flush order */ flush_order = 0; - result = H5C_flush_cache(file_ptr, H5C__NO_FLAGS_SET); - if (result < 0) + H5C_FLUSH_CACHE(file_ptr, H5C__NO_FLAGS_SET, "dummy mssg") + if (!pass) CACHE_ERROR("flushing entries with flush dependendices") /* Change expected values, and verify the status of the entries @@ -31702,8 +31781,6 @@ check_flush_deps_order(unsigned paged) /* Flush the cache and verify that the entries were flushed in correct order */ { - herr_t result; /* Generic return value */ - add_flush_op(entry_type, 0, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order); add_flush_op(entry_type, 1, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order); add_flush_op(entry_type, 2, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order); @@ -31755,8 +31832,8 @@ check_flush_deps_order(unsigned paged) /* Reset index for tracking flush order */ flush_order = 0; - result = H5C_flush_cache(file_ptr, H5C__NO_FLAGS_SET); - if (result < 0) + H5C_FLUSH_CACHE(file_ptr, H5C__NO_FLAGS_SET, "dummy mssg") + if (!pass) CACHE_ERROR("flushing entries with flush dependendices") /* Change expected values, and verify the status of the entries @@ -32017,8 +32094,6 @@ check_flush_deps_order(unsigned paged) /* Flush the cache and verify that the entries were flushed in correct order */ { - herr_t result; /* Generic return value */ - add_flush_op(entry_type, 0, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order); add_flush_op(entry_type, 1, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order); add_flush_op(entry_type, 2, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order); @@ -32066,8 +32141,8 @@ check_flush_deps_order(unsigned paged) /* Reset index for tracking flush order */ flush_order = 0; - result = H5C_flush_cache(file_ptr, H5C__NO_FLAGS_SET); - if (result < 0) + H5C_FLUSH_CACHE(file_ptr, H5C__NO_FLAGS_SET, "dummy mssg") + if (!pass) CACHE_ERROR("flushing entries with flush dependendices") /* Change expected values, and verify the status of the entries @@ -32361,8 +32436,6 @@ check_flush_deps_order(unsigned paged) /* Flush the cache and verify that the entries were flushed in correct order */ { - herr_t result; /* Generic return value */ - add_flush_op(entry_type, 0, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order); add_flush_op(entry_type, 1, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order); add_flush_op(entry_type, 2, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order); @@ -32410,8 +32483,8 @@ check_flush_deps_order(unsigned paged) /* Reset index for tracking flush order */ flush_order = 0; - result = H5C_flush_cache(file_ptr, H5C__NO_FLAGS_SET); - if (result < 0) + H5C_FLUSH_CACHE(file_ptr, H5C__NO_FLAGS_SET, "dummy mssg") + if (!pass) CACHE_ERROR("flushing entries with flush dependendices") /* Change expected values, and verify the status of the entries @@ -33623,7 +33696,11 @@ check_entry_deletions_during_scans(unsigned paged) * * Modifications: * - * None. + * Added code to setup and take down the skip list before + * and after calls to H5C_flush_cache(). Do this via the + * H5C_FLUSH_CACHE macro. + * + * JRM -- 5/14/20 * *------------------------------------------------------------------------- */ @@ -33633,7 +33710,6 @@ cedds__expunge_dirty_entry_in_flush_test(H5F_t *file_ptr) { H5C_t *cache_ptr = file_ptr->shared->cache; int i; - herr_t result; /* clang-format off */ struct expected_entry_status expected[36] = { @@ -33755,14 +33831,10 @@ cedds__expunge_dirty_entry_in_flush_test(H5F_t *file_ptr) if (pass) { - result = H5C_flush_cache(file_ptr, H5C__FLUSH_INVALIDATE_FLAG); + H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_INVALIDATE_FLAG, + "Cache flush inval failed in cedds expunge dirty entry in flush test") - if (result < 0) { - - pass = FALSE; - failure_mssg = "Cache flush invalidate failed in cedds expunge dirty entry in flush test"; - } - else if ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0)) { + if ((pass) && ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0))) { pass = FALSE; failure_mssg = "Unexpected cache len/size after cedds expunge dirty entry in flush test"; @@ -33838,7 +33910,11 @@ cedds__expunge_dirty_entry_in_flush_test(H5F_t *file_ptr) * * Modifications: * - * None. + * Added code to setup and take down the skip list before + * and after calls to H5C_flush_cache(). Do this via the + * H5C_FLUSH_CACHE macro. + * + * JRM -- 5/14/20 * *------------------------------------------------------------------------- */ @@ -33850,7 +33926,6 @@ cedds__H5C_make_space_in_cache(H5F_t *file_ptr) int i; const int num_huge_entries = 4; const int num_monster_entries = 32; - herr_t result; /* clang-format off */ struct expected_entry_status expected[36] = { @@ -34089,14 +34164,10 @@ cedds__H5C_make_space_in_cache(H5F_t *file_ptr) if (pass) { - result = H5C_flush_cache(file_ptr, H5C__FLUSH_INVALIDATE_FLAG); - - if (result < 0) { + H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_INVALIDATE_FLAG, + "Cache flush invalidate failed after flush op eviction test") - pass = FALSE; - failure_mssg = "Cache flush invalidate failed after flush op eviction test"; - } - else if ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0)) { + if ((pass) && ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0))) { pass = FALSE; failure_mssg = "Unexpected cache len/size after cleanup of flush op eviction test"; @@ -34199,7 +34270,11 @@ cedds__H5C_make_space_in_cache(H5F_t *file_ptr) * * Modifications: * - * None. + * Added code to setup and take down the skip list before + * and after calls to H5C_flush_cache(). Do this via the + * H5C_FLUSH_CACHE macro. + * + * JRM -- 5/14/20 * *------------------------------------------------------------------------- */ @@ -34507,14 +34582,10 @@ cedds__H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t *file_ptr) if (pass) { - result = H5C_flush_cache(file_ptr, H5C__FLUSH_INVALIDATE_FLAG); - - if (result < 0) { + H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_INVALIDATE_FLAG, + "Cache flush invalidate failed after flush op eviction test") - pass = FALSE; - failure_mssg = "Cache flush invalidate failed after flush op eviction test"; - } - else if ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0)) { + if ((pass) && ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0))) { pass = FALSE; failure_mssg = "Unexpected cache len/size after cleanup of flush op eviction test"; @@ -34658,7 +34729,11 @@ cedds__H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t *file_ptr) * * Modifications: * - * None. + * Added code to setup and take down the skip list before + * and after calls to H5C_flush_cache(). Do this via the + * H5C_FLUSH_CACHE macro. + * + * JRM -- 5/14/20 * *------------------------------------------------------------------------- */ @@ -34669,7 +34744,6 @@ cedds__H5C_flush_invalidate_cache__bucket_scan(H5F_t *file_ptr) H5C_t * cache_ptr = file_ptr->shared->cache; int i; int expected_hash_bucket = 0; - herr_t result; haddr_t entry_addr; test_entry_t * entry_ptr; test_entry_t * base_addr = NULL; @@ -34883,14 +34957,10 @@ cedds__H5C_flush_invalidate_cache__bucket_scan(H5F_t *file_ptr) if (pass) { - result = H5C_flush_cache(file_ptr, H5C__FLUSH_INVALIDATE_FLAG); - - if (result < 0) { + H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_INVALIDATE_FLAG, + "Cache flush invalidate failed after flush op eviction test") - pass = FALSE; - failure_mssg = "Cache flush invalidate failed after flush op eviction test"; - } - else if ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0)) { + if ((pass) && ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0))) { pass = FALSE; failure_mssg = "Unexpected cache len/size after cleanup of flush op eviction test"; @@ -35050,7 +35120,15 @@ check_stats(unsigned paged) * * Modifications: * - * None. + * Modified slist stats checks to allow for the case that + * the slist is disabled. + * + * Also added code to setup and take down the skip list before + * and after calls to H5C_flush_cache(). Do this via the + * H5C_FLUSH_CACHE macro. + * + * JRM -- 5/14/20 + * * *------------------------------------------------------------------------- */ @@ -35060,7 +35138,6 @@ check_stats__smoke_check_1(H5F_t *file_ptr) { H5C_t *cache_ptr = file_ptr->shared->cache; int i; - herr_t result; if (pass) { if (cache_ptr == NULL) { @@ -35120,13 +35197,15 @@ check_stats__smoke_check_1(H5F_t *file_ptr) failure_mssg = "Unexpected monster size entry stats in check_stats__smoke_check_1(1)."; } /* end if */ - if (pass) + if (pass) { + if ((cache_ptr->total_ht_insertions != 32) || (cache_ptr->total_ht_deletions != 0) || (cache_ptr->successful_ht_searches != 0) || (cache_ptr->total_successful_ht_search_depth != 0) || (cache_ptr->failed_ht_searches != 32) || (cache_ptr->total_failed_ht_search_depth != 48) || (cache_ptr->max_index_len != 32) || (cache_ptr->max_index_size != 2 * 1024 * 1024) || (cache_ptr->max_clean_index_size != 0) || (cache_ptr->max_dirty_index_size != 2 * 1024 * 1024) || - (cache_ptr->max_slist_len != 32) || (cache_ptr->max_slist_size != 2 * 1024 * 1024) || + ((cache_ptr->slist_enabled) && + ((cache_ptr->max_slist_len != 32) || (cache_ptr->max_slist_size != 2 * 1024 * 1024))) || (cache_ptr->max_pl_len != 0) || (cache_ptr->max_pl_size != 0) || (cache_ptr->max_pel_len != 0) || (cache_ptr->max_pel_size != 0) || (cache_ptr->calls_to_msic != 0) || (cache_ptr->total_entries_skipped_in_msic != 0) || @@ -35138,6 +35217,7 @@ check_stats__smoke_check_1(H5F_t *file_ptr) pass = FALSE; failure_mssg = "Unexpected cache stats in check_stats__smoke_check_1(1)."; } /* end if */ + } #if H5C_COLLECT_CACHE_ENTRY_STATS if (pass) @@ -35190,17 +35270,19 @@ check_stats__smoke_check_1(H5F_t *file_ptr) failure_mssg = "Unexpected monster size entry stats in check_stats__smoke_check_1(2)."; } /* end if */ - if (pass) + if (pass) { + if ((cache_ptr->total_ht_insertions != 32) || (cache_ptr->total_ht_deletions != 0) || (cache_ptr->successful_ht_searches != 32) || (cache_ptr->total_successful_ht_search_depth != 96) || (cache_ptr->failed_ht_searches != 32) || (cache_ptr->total_failed_ht_search_depth != 48) || (cache_ptr->max_index_len != 32) || (cache_ptr->max_index_size != 2 * 1024 * 1024) || (cache_ptr->max_clean_index_size != 0) || - (cache_ptr->max_dirty_index_size != 2 * 1024 * 1024) || (cache_ptr->max_slist_len != 32) || - (cache_ptr->max_slist_size != 2 * 1024 * 1024) || (cache_ptr->max_pl_len != 1) || - (cache_ptr->max_pl_size != 64 * 1024) || (cache_ptr->max_pel_len != 0) || - (cache_ptr->max_pel_size != 0) || (cache_ptr->calls_to_msic != 0) || - (cache_ptr->total_entries_skipped_in_msic != 0) || + (cache_ptr->max_dirty_index_size != 2 * 1024 * 1024) || + ((cache_ptr->slist_enabled) && + ((cache_ptr->max_slist_len != 32) || (cache_ptr->max_slist_size != 2 * 1024 * 1024))) || + (cache_ptr->max_pl_len != 1) || (cache_ptr->max_pl_size != 64 * 1024) || + (cache_ptr->max_pel_len != 0) || (cache_ptr->max_pel_size != 0) || + (cache_ptr->calls_to_msic != 0) || (cache_ptr->total_entries_skipped_in_msic != 0) || (cache_ptr->total_entries_scanned_in_msic != 0) || (cache_ptr->max_entries_skipped_in_msic != 0) || (cache_ptr->max_entries_scanned_in_msic != 0) || (cache_ptr->entries_scanned_to_make_space != 0) || (cache_ptr->slist_scan_restarts != 0) || @@ -35209,6 +35291,7 @@ check_stats__smoke_check_1(H5F_t *file_ptr) pass = FALSE; failure_mssg = "Unexpected cache stats in check_stats__smoke_check_1(2)."; } /* end if */ + } #if H5C_COLLECT_CACHE_ENTRY_STATS if (pass) @@ -35261,18 +35344,20 @@ check_stats__smoke_check_1(H5F_t *file_ptr) failure_mssg = "Unexpected monster size entry stats in check_stats__smoke_check_1(3)."; } /* end if */ - if (pass) + if (pass) { + if ((cache_ptr->total_ht_insertions != 33) || (cache_ptr->total_ht_deletions != 1) || (cache_ptr->successful_ht_searches != 32) || (cache_ptr->total_successful_ht_search_depth != 96) || (cache_ptr->failed_ht_searches != 33) || (cache_ptr->total_failed_ht_search_depth != 52) || (cache_ptr->max_index_len != 32) || (cache_ptr->max_index_size != 2 * 1024 * 1024) || (cache_ptr->max_clean_index_size != 2 * 1024 * 1024) || - (cache_ptr->max_dirty_index_size != 2 * 1024 * 1024) || (cache_ptr->max_slist_len != 32) || - (cache_ptr->max_slist_size != 2 * 1024 * 1024) || (cache_ptr->max_pl_len != 1) || - (cache_ptr->max_pl_size != 64 * 1024) || (cache_ptr->max_pel_len != 0) || - (cache_ptr->max_pel_size != 0) || (cache_ptr->calls_to_msic != 1) || - (cache_ptr->total_entries_skipped_in_msic != 0) || + (cache_ptr->max_dirty_index_size != 2 * 1024 * 1024) || + ((cache_ptr->slist_enabled) && + ((cache_ptr->max_slist_len != 32) || (cache_ptr->max_slist_size != 2 * 1024 * 1024))) || + (cache_ptr->max_pl_len != 1) || (cache_ptr->max_pl_size != 64 * 1024) || + (cache_ptr->max_pel_len != 0) || (cache_ptr->max_pel_size != 0) || + (cache_ptr->calls_to_msic != 1) || (cache_ptr->total_entries_skipped_in_msic != 0) || (cache_ptr->total_entries_scanned_in_msic != 33) || (cache_ptr->max_entries_skipped_in_msic != 0) || (cache_ptr->max_entries_scanned_in_msic != 33) || (cache_ptr->entries_scanned_to_make_space != 33) || (cache_ptr->slist_scan_restarts != 0) || @@ -35281,6 +35366,7 @@ check_stats__smoke_check_1(H5F_t *file_ptr) pass = FALSE; failure_mssg = "Unexpected cache stats in check_stats__smoke_check_1(3)."; } /* end if */ + } #if H5C_COLLECT_CACHE_ENTRY_STATS if (pass) @@ -35310,14 +35396,10 @@ check_stats__smoke_check_1(H5F_t *file_ptr) if (pass) { - result = H5C_flush_cache(file_ptr, H5C__FLUSH_INVALIDATE_FLAG); + H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_INVALIDATE_FLAG, + "Cache flush invalidate failed in check_stats__smoke_check_1()") - if (result < 0) { - - pass = FALSE; - failure_mssg = "Cache flush invalidate failed in check_stats__smoke_check_1()"; - } /* end if */ - else if ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0)) { + if ((pass) && ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0))) { pass = FALSE; failure_mssg = "Unexpected cache len/size after check_stats__smoke_check_1()"; @@ -35351,18 +35433,20 @@ check_stats__smoke_check_1(H5F_t *file_ptr) failure_mssg = "Unexpected monster size entry stats in check_stats__smoke_check_1(4)."; } /* end if */ - if (pass) + if (pass) { + if ((cache_ptr->total_ht_insertions != 33) || (cache_ptr->total_ht_deletions != 33) || (cache_ptr->successful_ht_searches != 33) || (cache_ptr->total_successful_ht_search_depth != 99) || (cache_ptr->failed_ht_searches != 33) || (cache_ptr->total_failed_ht_search_depth != 52) || (cache_ptr->max_index_len != 32) || (cache_ptr->max_index_size != 2 * 1024 * 1024) || (cache_ptr->max_clean_index_size != 2 * 1024 * 1024) || - (cache_ptr->max_dirty_index_size != 2 * 1024 * 1024) || (cache_ptr->max_slist_len != 32) || - (cache_ptr->max_slist_size != 2 * 1024 * 1024) || (cache_ptr->max_pl_len != 1) || - (cache_ptr->max_pl_size != 64 * 1024) || (cache_ptr->max_pel_len != 0) || - (cache_ptr->max_pel_size != 0) || (cache_ptr->calls_to_msic != 1) || - (cache_ptr->total_entries_skipped_in_msic != 0) || + (cache_ptr->max_dirty_index_size != 2 * 1024 * 1024) || + ((cache_ptr->slist_enabled) && + ((cache_ptr->max_slist_len != 32) || (cache_ptr->max_slist_size != 2 * 1024 * 1024))) || + (cache_ptr->max_pl_len != 1) || (cache_ptr->max_pl_size != 64 * 1024) || + (cache_ptr->max_pel_len != 0) || (cache_ptr->max_pel_size != 0) || + (cache_ptr->calls_to_msic != 1) || (cache_ptr->total_entries_skipped_in_msic != 0) || (cache_ptr->total_entries_scanned_in_msic != 33) || (cache_ptr->max_entries_skipped_in_msic != 0) || (cache_ptr->max_entries_scanned_in_msic != 33) || (cache_ptr->entries_scanned_to_make_space != 33) || (cache_ptr->slist_scan_restarts != 0) || @@ -35371,6 +35455,7 @@ check_stats__smoke_check_1(H5F_t *file_ptr) pass = FALSE; failure_mssg = "Unexpected cache stats in check_stats__smoke_check_1(4)."; } /* end if */ + } #if H5C_COLLECT_CACHE_ENTRY_STATS if (pass) diff --git a/test/cache_api.c b/test/cache_api.c index acdb4ba..143cc71 100644 --- a/test/cache_api.c +++ b/test/cache_api.c @@ -1216,9 +1216,9 @@ mdc_api_call_smoke_check(int express_test, unsigned paged, hid_t fcpl_id) /* do random reads on all datasets */ n = 0; while ((pass) && (n < NUM_RANDOM_ACCESSES)) { - m = rand() % NUM_DSETS; - i = (rand() % (DSET_SIZE / CHUNK_SIZE)) * CHUNK_SIZE; - j = (rand() % (DSET_SIZE / CHUNK_SIZE)) * CHUNK_SIZE; + m = HDrand() % NUM_DSETS; + i = (HDrand() % (DSET_SIZE / CHUNK_SIZE)) * CHUNK_SIZE; + j = (HDrand() % (DSET_SIZE / CHUNK_SIZE)) * CHUNK_SIZE; /* select on disk hyperslab */ offset[0] = (hsize_t)i; /*offset of hyperslab in file*/ @@ -1328,8 +1328,8 @@ mdc_api_call_smoke_check(int express_test, unsigned paged, hid_t fcpl_id) m = 0; n = 0; while ((pass) && (n < NUM_RANDOM_ACCESSES)) { - i = (rand() % (DSET_SIZE / CHUNK_SIZE)) * CHUNK_SIZE; - j = (rand() % (DSET_SIZE / CHUNK_SIZE)) * CHUNK_SIZE; + i = (HDrand() % (DSET_SIZE / CHUNK_SIZE)) * CHUNK_SIZE; + j = (HDrand() % (DSET_SIZE / CHUNK_SIZE)) * CHUNK_SIZE; /* select on disk hyperslab */ offset[0] = (hsize_t)i; /*offset of hyperslab in file*/ diff --git a/test/cache_common.c b/test/cache_common.c index d0c267f..8fc8303 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -2754,7 +2754,20 @@ expunge_entry(H5F_t *file_ptr, int32_t type, int32_t idx) * Return: void * * Programmer: John Mainzer - * 6/23/04 + * 6/23/04 + * + * Changes: Added code to setup and take down the skip list before + * and after calls to H5C_flush_cache(). Do this via calls + * to the H5C_FLUSH_CACHE macro. + * + * This is necessary, as H5C_flush() is called repeatedly + * during file flush. If we setup and took down the + * skip list on H5C_flush_cache(), we would find ourselves + * doing this repeatedly -- which is contrary to the + * objective of the exercise (avoiding as many skip list + * operations as possible). + * + * JRM -- 5/14/20 * *------------------------------------------------------------------------- */ @@ -2774,22 +2787,23 @@ flush_cache(H5F_t *file_ptr, hbool_t destroy_entries, hbool_t dump_stats, hbool_ cache_ptr = file_ptr->shared->cache; - if (destroy_entries) - result = H5C_flush_cache(file_ptr, H5C__FLUSH_INVALIDATE_FLAG); + if (destroy_entries) { - else - result = H5C_flush_cache(file_ptr, H5C__NO_FLAGS_SET); + H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_INVALIDATE_FLAG, "error in H5C_flush_cache().") + } + else { - if (dump_stats) - H5C_stats(cache_ptr, "test cache", dump_detailed_stats); + H5C_FLUSH_CACHE(file_ptr, H5C__NO_FLAGS_SET, "error in H5C_flush_cache().") + } - if (result < 0) { - pass = FALSE; - failure_mssg = "error in H5C_flush_cache()."; + if (dump_stats) { + + H5C_stats(cache_ptr, "test cache", dump_detailed_stats); } - else if ((destroy_entries) && - ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0) || - (cache_ptr->clean_index_size != 0) || (cache_ptr->dirty_index_size != 0))) { + + if ((pass) && (destroy_entries) && + ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0) || + (cache_ptr->clean_index_size != 0) || (cache_ptr->dirty_index_size != 0))) { if (verbose) { @@ -3544,6 +3558,11 @@ unprotect_entry(H5F_t *file_ptr, int32_t type, int32_t idx, unsigned int flags) * Programmer: John Mainzer * 6/12/04 * + * Changes: Updated slist size == dirty index size checks to + * bypass the test if cache_ptr->slist_enabled is FALSE. + * + * JRM -- 5/8/20 + * *------------------------------------------------------------------------- */ void @@ -3587,7 +3606,9 @@ row_major_scan_forward(H5F_t *file_ptr, int32_t max_index, int32_t lag, hbool_t HDfprintf(stdout, "1(i, %d, %d) ", type, tmp_idx); insert_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET); - HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); + + HDassert((!cache_ptr->slist_enabled) || + (cache_ptr->slist_size == cache_ptr->dirty_index_size)); } /* end if */ tmp_idx--; @@ -3597,7 +3618,9 @@ row_major_scan_forward(H5F_t *file_ptr, int32_t max_index, int32_t lag, hbool_t HDfprintf(stdout, "2(p, %d, %d) ", type, tmp_idx); protect_entry(file_ptr, type, tmp_idx); - HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); + + HDassert((!cache_ptr->slist_enabled) || + (cache_ptr->slist_size == cache_ptr->dirty_index_size)); } /* end if */ tmp_idx--; @@ -3607,7 +3630,9 @@ row_major_scan_forward(H5F_t *file_ptr, int32_t max_index, int32_t lag, hbool_t HDfprintf(stdout, "3(u, %d, %d) ", type, tmp_idx); unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET); - HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); + + HDassert((!cache_ptr->slist_enabled) || + (cache_ptr->slist_size == cache_ptr->dirty_index_size)); } /* end if */ /* (don't decrement tmp_idx) */ @@ -3617,7 +3642,9 @@ row_major_scan_forward(H5F_t *file_ptr, int32_t max_index, int32_t lag, hbool_t HDfprintf(stdout, "4(r, %d, %d, %d) ", type, tmp_idx, (int)move_to_main_addr); move_entry(cache_ptr, type, tmp_idx, move_to_main_addr); - HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); + + HDassert((!cache_ptr->slist_enabled) || + (cache_ptr->slist_size == cache_ptr->dirty_index_size)); } /* end if */ tmp_idx--; @@ -3627,7 +3654,9 @@ row_major_scan_forward(H5F_t *file_ptr, int32_t max_index, int32_t lag, hbool_t HDfprintf(stdout, "5(p, %d, %d) ", type, tmp_idx); protect_entry(file_ptr, type, tmp_idx); - HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); + + HDassert((!cache_ptr->slist_enabled) || + (cache_ptr->slist_size == cache_ptr->dirty_index_size)); } /* end if */ tmp_idx -= 2; @@ -3637,7 +3666,9 @@ row_major_scan_forward(H5F_t *file_ptr, int32_t max_index, int32_t lag, hbool_t HDfprintf(stdout, "6(u, %d, %d) ", type, tmp_idx); unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET); - HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); + + HDassert((!cache_ptr->slist_enabled) || + (cache_ptr->slist_size == cache_ptr->dirty_index_size)); } /* end if */ if (do_mult_ro_protects) { @@ -3648,7 +3679,9 @@ row_major_scan_forward(H5F_t *file_ptr, int32_t max_index, int32_t lag, hbool_t HDfprintf(stdout, "7(p-ro, %d, %d) ", type, tmp_idx); protect_entry_ro(file_ptr, type, tmp_idx); - HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); + + HDassert((!cache_ptr->slist_enabled) || + (cache_ptr->slist_size == cache_ptr->dirty_index_size)); } /* end if */ tmp_idx--; @@ -3658,7 +3691,9 @@ row_major_scan_forward(H5F_t *file_ptr, int32_t max_index, int32_t lag, hbool_t HDfprintf(stdout, "8(p-ro, %d, %d) ", type, tmp_idx); protect_entry_ro(file_ptr, type, tmp_idx); - HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); + + HDassert((!cache_ptr->slist_enabled) || + (cache_ptr->slist_size == cache_ptr->dirty_index_size)); } /* end if */ tmp_idx--; @@ -3668,7 +3703,9 @@ row_major_scan_forward(H5F_t *file_ptr, int32_t max_index, int32_t lag, hbool_t HDfprintf(stdout, "9(p-ro, %d, %d) ", type, tmp_idx); protect_entry_ro(file_ptr, type, tmp_idx); - HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); + + HDassert((!cache_ptr->slist_enabled) || + (cache_ptr->slist_size == cache_ptr->dirty_index_size)); } /* end if */ /* (don't decrement tmp_idx) */ @@ -3678,7 +3715,9 @@ row_major_scan_forward(H5F_t *file_ptr, int32_t max_index, int32_t lag, hbool_t HDfprintf(stdout, "10(u-ro, %d, %d) ", type, tmp_idx); unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET); - HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); + + HDassert((!cache_ptr->slist_enabled) || + (cache_ptr->slist_size == cache_ptr->dirty_index_size)); } /* end if */ tmp_idx--; @@ -3688,7 +3727,9 @@ row_major_scan_forward(H5F_t *file_ptr, int32_t max_index, int32_t lag, hbool_t HDfprintf(stdout, "11(u-ro, %d, %d) ", type, tmp_idx); unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET); - HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); + + HDassert((!cache_ptr->slist_enabled) || + (cache_ptr->slist_size == cache_ptr->dirty_index_size)); } /* end if */ tmp_idx--; @@ -3698,7 +3739,9 @@ row_major_scan_forward(H5F_t *file_ptr, int32_t max_index, int32_t lag, hbool_t HDfprintf(stdout, "12(u-ro, %d, %d) ", type, tmp_idx); unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET); - HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); + + HDassert((!cache_ptr->slist_enabled) || + (cache_ptr->slist_size == cache_ptr->dirty_index_size)); } /* end if */ } /* if ( do_mult_ro_protects ) */ @@ -3707,7 +3750,9 @@ row_major_scan_forward(H5F_t *file_ptr, int32_t max_index, int32_t lag, hbool_t HDfprintf(stdout, "13(p, %d, %d) ", type, idx); protect_entry(file_ptr, type, idx); - HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); + + HDassert((!cache_ptr->slist_enabled) || + (cache_ptr->slist_size == cache_ptr->dirty_index_size)); } /* end if */ tmp_idx = idx - lag + 2; @@ -3717,7 +3762,9 @@ row_major_scan_forward(H5F_t *file_ptr, int32_t max_index, int32_t lag, hbool_t HDfprintf(stdout, "14(u, %d, %d) ", type, tmp_idx); unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET); - HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); + + HDassert((!cache_ptr->slist_enabled) || + (cache_ptr->slist_size == cache_ptr->dirty_index_size)); } /* end if */ tmp_idx--; @@ -3727,7 +3774,9 @@ row_major_scan_forward(H5F_t *file_ptr, int32_t max_index, int32_t lag, hbool_t HDfprintf(stdout, "15(p, %d, %d) ", type, tmp_idx); protect_entry(file_ptr, type, tmp_idx); - HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); + + HDassert((!cache_ptr->slist_enabled) || + (cache_ptr->slist_size == cache_ptr->dirty_index_size)); } /* end if */ if (do_destroys) { @@ -3739,7 +3788,9 @@ row_major_scan_forward(H5F_t *file_ptr, int32_t max_index, int32_t lag, hbool_t HDfprintf(stdout, "16(u, %d, %d) ", type, tmp_idx); unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET); - HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); + + HDassert((!cache_ptr->slist_enabled) || + (cache_ptr->slist_size == cache_ptr->dirty_index_size)); break; case 1: @@ -3748,7 +3799,9 @@ row_major_scan_forward(H5F_t *file_ptr, int32_t max_index, int32_t lag, hbool_t HDfprintf(stdout, "17(u, %d, %d) ", type, tmp_idx); unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET); - HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); + + HDassert((!cache_ptr->slist_enabled) || + (cache_ptr->slist_size == cache_ptr->dirty_index_size)); } /* end if */ else { if (verbose) @@ -3756,7 +3809,9 @@ row_major_scan_forward(H5F_t *file_ptr, int32_t max_index, int32_t lag, hbool_t unprotect_entry(file_ptr, type, tmp_idx, (dirty_unprotects ? H5C__DIRTIED_FLAG : H5C__NO_FLAGS_SET)); - HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); + + HDassert((!cache_ptr->slist_enabled) || + (cache_ptr->slist_size == cache_ptr->dirty_index_size)); } /* end else */ break; @@ -3765,7 +3820,9 @@ row_major_scan_forward(H5F_t *file_ptr, int32_t max_index, int32_t lag, hbool_t HDfprintf(stdout, "19(u-del, %d, %d) ", type, tmp_idx); unprotect_entry(file_ptr, type, tmp_idx, H5C__DELETED_FLAG); - HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); + + HDassert((!cache_ptr->slist_enabled) || + (cache_ptr->slist_size == cache_ptr->dirty_index_size)); break; case 3: @@ -3774,7 +3831,9 @@ row_major_scan_forward(H5F_t *file_ptr, int32_t max_index, int32_t lag, hbool_t HDfprintf(stdout, "20(u-del, %d, %d) ", type, tmp_idx); unprotect_entry(file_ptr, type, tmp_idx, H5C__DELETED_FLAG); - HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); + + HDassert((!cache_ptr->slist_enabled) || + (cache_ptr->slist_size == cache_ptr->dirty_index_size)); } /* end if */ else { if (verbose) @@ -3783,7 +3842,9 @@ row_major_scan_forward(H5F_t *file_ptr, int32_t max_index, int32_t lag, hbool_t unprotect_entry(file_ptr, type, tmp_idx, (dirty_destroys ? H5C__DIRTIED_FLAG : H5C__NO_FLAGS_SET) | H5C__DELETED_FLAG); - HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); + + HDassert((!cache_ptr->slist_enabled) || + (cache_ptr->slist_size == cache_ptr->dirty_index_size)); } /* end else */ break; @@ -3801,7 +3862,9 @@ row_major_scan_forward(H5F_t *file_ptr, int32_t max_index, int32_t lag, hbool_t unprotect_entry(file_ptr, type, tmp_idx, (dirty_unprotects ? H5C__DIRTIED_FLAG : H5C__NO_FLAGS_SET)); - HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); + + HDassert((!cache_ptr->slist_enabled) || + (cache_ptr->slist_size == cache_ptr->dirty_index_size)); } /* end if */ } /* end elsef */ diff --git a/test/cache_common.h b/test/cache_common.h index f466f8e..aa32858 100644 --- a/test/cache_common.h +++ b/test/cache_common.h @@ -116,6 +116,62 @@ #define MAX_ADDR (haddr_t)(NOTIFY_ALT_BASE_ADDR + (NOTIFY_ENTRY_SIZE * NUM_NOTIFY_ENTRIES)) #define ADDR_SPACE_SIZE (haddr_t)(MAX_ADDR - BASE_ADDR) +/*********************************************************************** + * + * Macro: H5C_FLUSH_CACHE + * + * Purpose: Wrap a call to H5C_flush_cache() in calls to + * H5C_set_slist_enabled() to setup and take down the slist. + * + * This is necessary, as H5C_flush_cache() needs the + * slist to be active. Further, since it is called + * repeatedly during file flush, it would be inefficient + * for it to setup the slist on entry, and take it down + * on exit. + * + * Note that the slist need not be empty if the flags + * indicate a partial flush (i.e. + * H5C__FLUSH_MARKED_ENTRIES_FLAG). Compute clear_slist + * and pass it into H5C_set_slist_enabled as appropriate. + * + * On error, set pass to FALSE, and set failure_mssg + * to the supplied error message. + * + * Return: N/A + * + * Programmer: John Mainzer + * 5/14/20 + * + * Changes: None. + * + ***********************************************************************/ + +#define H5C_FLUSH_CACHE(file, flags, fail_mssg) \ + { \ + hbool_t clear_slist; \ + herr_t rslt; \ + \ + clear_slist = ((flags & H5C__FLUSH_MARKED_ENTRIES_FLAG) != 0); \ + \ + rslt = H5C_set_slist_enabled((file)->shared->cache, TRUE, FALSE); \ + \ + if (rslt >= 0) { \ + \ + rslt = H5C_flush_cache((file), (flags)); \ + } \ + \ + if (rslt >= 0) { \ + \ + rslt = H5C_set_slist_enabled((file)->shared->cache, FALSE, clear_slist); \ + } \ + \ + if (rslt < 0) { \ + \ + pass = FALSE; \ + failure_mssg = (fail_mssg); \ + } \ + } /* H5C_FLUSH_CACHE */ + #define MAX_PINS \ 8 /* Maximum number of entries that can be \ * directly pinned by a single entry. \ diff --git a/test/cache_tagging.c b/test/cache_tagging.c index dbb7c81..b2975d1 100644 --- a/test/cache_tagging.c +++ b/test/cache_tagging.c @@ -343,12 +343,20 @@ evict_entries(hid_t fid) /* Mark all entries investigated */ mark_all_entries_investigated(fid); + /* setup the skip list prior to calling H5C_flush_cache() */ + if (H5C_set_slist_enabled(f->shared->cache, TRUE, FALSE) < 0) + TEST_ERROR; + /* Evict all we can from the cache to examine full tag creation tree */ /* This function will likely return failure since the root group * is still protected. Thus, don't check its return value. */ H5C_flush_cache(f, H5C__FLUSH_INVALIDATE_FLAG); + /* shutdown the slist -- allow it to be non-empty */ + if (H5C_set_slist_enabled(f->shared->cache, FALSE, TRUE) < 0) + TEST_ERROR; + return 0; error: diff --git a/test/chunk_info.c b/test/chunk_info.c index 7774873..cc35bfe 100644 --- a/test/chunk_info.c +++ b/test/chunk_info.c @@ -421,7 +421,7 @@ verify_idx_nchunks(hid_t dset, hid_t dspace, H5D_chunk_index_t exp_idx_type, hsi /* Ensure the correct chunk indexing scheme is used */ if (idx_type != exp_idx_type) { char msg[256]; - sprintf(msg, "Should be using %s.\n", index_type_str(idx_type)); + HDsprintf(msg, "Should be using %s.\n", index_type_str(idx_type)); FAIL_PUTS_ERROR(msg); } @@ -542,7 +542,7 @@ test_get_chunk_info_highest_v18(hid_t fapl) #ifdef H5_HAVE_FILTER_DEFLATE /* Allocate input (compressed) buffer */ - inbuf = malloc(z_dst_nbytes); + inbuf = HDmalloc(z_dst_nbytes); /* Set chunk size to the compressed chunk size and the chunk point to the compressed data chunk */ @@ -554,20 +554,20 @@ test_get_chunk_info_highest_v18(hid_t fapl) /* Check for various zlib errors */ if (Z_BUF_ERROR == ret) { - fprintf(stderr, "overflow"); + HDfprintf(stderr, "overflow"); TEST_ERROR } else if (Z_MEM_ERROR == ret) { - fprintf(stderr, "deflate memory error"); + HDfprintf(stderr, "deflate memory error"); TEST_ERROR } else if (Z_OK != ret) { - fprintf(stderr, "other deflate error"); + HDfprintf(stderr, "other deflate error"); TEST_ERROR } #else /* Allocate input (non-compressed) buffer */ - inbuf = malloc(CHK_SIZE); + inbuf = HDmalloc(CHK_SIZE); HDmemcpy(inbuf, direct_buf, CHK_SIZE); #endif /* end H5_HAVE_FILTER_DEFLATE */ @@ -1638,7 +1638,7 @@ test_basic_query(hid_t fapl) TEST_ERROR /* Remove the test file */ - remove(filename); + HDremove(filename); PASSED(); return SUCCEED; @@ -2040,7 +2040,7 @@ test_flt_msk_with_skip_compress(hid_t fapl) TEST_ERROR /* Remove the test file */ - remove(filename); + HDremove(filename); PASSED(); return SUCCEED; diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c index 6e5dd07..37217e7 100644 --- a/test/cmpd_dset.c +++ b/test/cmpd_dset.c @@ -302,7 +302,7 @@ test_compound(char *filename, hid_t fapl) s1[i].c[1] != s2[i].c[1] || s1[i].c[2] != s2[i].c[2] || s1[i].c[3] != s2[i].c[3] || s1[i].d != s2[i].d || s1[i].e != s2[i].e) { H5_FAILED(); - puts(" Incorrect values read from the file"); + HDputs(" Incorrect values read from the file"); goto error; } } @@ -339,7 +339,7 @@ test_compound(char *filename, hid_t fapl) s1[i].c[1] != s3[i].c[1] || s1[i].c[2] != s3[i].c[2] || s1[i].c[3] != s3[i].c[3] || s1[i].d != s3[i].d || s1[i].e != s3[i].e) { H5_FAILED(); - puts(" Incorrect values read from the file"); + HDputs(" Incorrect values read from the file"); goto error; } } @@ -369,7 +369,7 @@ test_compound(char *filename, hid_t fapl) for (i = 0; i < NX * NY; i++) { if (s1[i].b != s4[i].b || s1[i].d != s4[i].d) { H5_FAILED(); - puts(" Incorrect values read from the file"); + HDputs(" Incorrect values read from the file"); goto error; } } @@ -413,7 +413,7 @@ test_compound(char *filename, hid_t fapl) s1[i].c[1] != s5[i].c[1] || s1[i].c[2] != s5[i].c[2] || s1[i].c[3] != s5[i].c[3] || s1[i].d != s5[i].d || s1[i].e != s5[i].e) { H5_FAILED(); - puts(" Incorrect values read from the file"); + HDputs(" Incorrect values read from the file"); goto error; } } @@ -423,7 +423,7 @@ test_compound(char *filename, hid_t fapl) if (s5[i].pre != 1000 + 4 * i || s5[i].mid1 != 1001 + 4 * i || s5[i].mid2 != 1002 + 4 * i || s5[i].post != 1003 + 4 * i) { H5_FAILED(); - puts(" Memory values were clobbered"); + HDputs(" Memory values were clobbered"); goto error; } } @@ -482,7 +482,7 @@ test_compound(char *filename, hid_t fapl) s1[i].c[1] != s6[i].c[1] || s1[i].c[2] != s6[i].c[2] || s1[i].c[3] != s6[i].c[3] || s1[i].d != s6[i].d || s1[i].e != s6[i].e) { H5_FAILED(); - puts(" Incorrect values read from the file"); + HDputs(" Incorrect values read from the file"); goto error; } } @@ -492,7 +492,7 @@ test_compound(char *filename, hid_t fapl) if (s6[i].pre != 1000 + 4 * i || s6[i].mid1 != 1001 + 4 * i || s6[i].mid2 != 1002 + 4 * i || s6[i].post != 1003 + 4 * i) { H5_FAILED(); - puts(" Memory values were clobbered"); + HDputs(" Memory values were clobbered"); goto error; } } @@ -561,7 +561,7 @@ test_compound(char *filename, hid_t fapl) s2[i].c[1] != s1[i].c[1] || s2[i].c[2] != s1[i].c[2] || s2[i].c[3] != s1[i].c[3] || s2[i].d != s1[i].d || s2[i].e != s1[i].e) { H5_FAILED(); - puts(" Incorrect values read from file"); + HDputs(" Incorrect values read from file"); goto error; } } @@ -590,7 +590,7 @@ test_compound(char *filename, hid_t fapl) /* Read the dataset */ s8 = (s1_t *)HDcalloc((size_t)(h_size[0] * h_size[1]), sizeof(s1_t)); - assert(s8); + HDassert(s8); if (H5Dread(dataset, s1_tid, s8_m_sid, s8_f_sid, H5P_DEFAULT, s8) < 0) { goto error; } @@ -604,7 +604,7 @@ test_compound(char *filename, hid_t fapl) if (ps8->a != ps1->a || ps8->b != ps1->b || ps8->c[0] != ps1->c[0] || ps8->c[1] != ps1->c[1] || ps8->c[2] != ps1->c[2] || ps8->c[3] != ps1->c[3] || ps8->d != ps1->d || ps8->e != ps1->e) { H5_FAILED(); - puts(" Incorrect values read from file"); + HDputs(" Incorrect values read from file"); goto error; } } @@ -643,7 +643,7 @@ test_compound(char *filename, hid_t fapl) ps2->c[1] != ps1->c[1] || ps2->c[2] != ps1->c[2] || ps2->c[3] != ps1->c[3] || ps2->d != ps1->d || ps2->e != ps1->e) { H5_FAILED(); - puts(" Memory values clobbered"); + HDputs(" Memory values clobbered"); goto error; } } @@ -652,7 +652,7 @@ test_compound(char *filename, hid_t fapl) ps2->c[1] != (unsigned)(-1) || ps2->c[2] != (unsigned)(-1) || ps2->c[3] != (unsigned)(-1) || ps2->d != (unsigned)(-1) || ps2->e != (unsigned)(-1)) { H5_FAILED(); - puts(" Incorrect values read from file"); + HDputs(" Incorrect values read from file"); goto error; } } @@ -691,7 +691,7 @@ test_compound(char *filename, hid_t fapl) ps5->c[2] != ps1->c[2] || ps5->c[3] != ps1->c[3] || ps5->mid2 != (unsigned)(-1) || ps5->d != ps1->d || ps5->e != ps1->e || ps5->post != (unsigned)(-1)) { H5_FAILED(); - puts(" Memory values clobbered"); + HDputs(" Memory values clobbered"); goto error; } } @@ -702,7 +702,7 @@ test_compound(char *filename, hid_t fapl) ps5->c[3] != (unsigned)(-1) || ps5->mid2 != (unsigned)(-1) || ps5->d != (unsigned)(-1) || ps5->e != (unsigned)(-1) || ps5->post != (unsigned)(-1)) { H5_FAILED(); - puts(" Incorrect values read from file"); + HDputs(" Incorrect values read from file"); goto error; } } @@ -723,7 +723,7 @@ test_compound(char *filename, hid_t fapl) h_size[0] = 2 * NX / 3 - f_offset[0]; h_size[1] = 2 * NY / 3 - f_offset[1]; s11 = (s4_t *)HDmalloc((size_t)h_size[0] * (size_t)h_size[1] * sizeof(s4_t)); - assert(s11); + HDassert(s11); /* Initialize */ for (i = 0; i < h_size[0] * h_size[1]; i++) { @@ -751,7 +751,7 @@ test_compound(char *filename, hid_t fapl) ps1->c[1] != 8 * (i * NY + j) + 3 || ps1->c[2] != 8 * (i * NY + j) + 4 || ps1->c[3] != 8 * (i * NY + j) + 5 || ps1->e != 8 * (i * NY + j) + 7) { H5_FAILED(); - puts(" Write clobbered values"); + HDputs(" Write clobbered values"); goto error; } @@ -759,14 +759,14 @@ test_compound(char *filename, hid_t fapl) j < f_offset[1] + h_size[1]) { if (ps1->b != (unsigned)(-1) || ps1->d != (unsigned)(-1)) { H5_FAILED(); - puts(" Wrong values written or read"); + HDputs(" Wrong values written or read"); goto error; } } else { if (ps1->b != 8 * (i * NY + j) + 1 || ps1->d != 8 * (i * NY + j) + 6) { H5_FAILED(); - puts(" Write clobbered values"); + HDputs(" Write clobbered values"); goto error; } } @@ -792,7 +792,7 @@ test_compound(char *filename, hid_t fapl) return 0; error: - puts("*** DATASET TESTS FAILED ***"); + HDputs("*** DATASET TESTS FAILED ***"); /* Release resources */ if (s1) @@ -1669,7 +1669,7 @@ test_hdf5_dst_subset(char *filename, hid_t fapl) return 0; error: - puts("*** DATASET TESTS FAILED ***"); + HDputs("*** DATASET TESTS FAILED ***"); return 1; } @@ -1684,7 +1684,7 @@ error: for (_i = 0; _i < PACK_NMEMBS; _i++) \ HDprintf(" %d", order[_i]); \ HDprintf("\n Inner compound order = %d, location = %d\n", sub_cmpd_order, order[sub_cmpd_order]); \ - fflush(stdout); \ + HDfflush(stdout); \ goto error; \ } @@ -1719,7 +1719,7 @@ test_pack_ooo(void) * the compound */ unsigned i, j; /* Indices */ - HDsrand((unsigned)time(NULL)); + HDsrand((unsigned)HDtime(NULL)); /* Initialize "free_order" array to indicate that all slots in order are * free */ @@ -2233,7 +2233,7 @@ main(int argc, char *argv[]) /* Turn off optimized compound converter? */ if (argc > 1) { - if (argc > 2 || strcmp("--noopt", argv[1])) { + if (argc > 2 || HDstrcmp("--noopt", argv[1])) { HDfprintf(stderr, "usage: %s [--noopt]\n", argv[0]); HDexit(EXIT_FAILURE); } diff --git a/test/dangle.c b/test/dangle.c index 4728923..d7c7dfc 100644 --- a/test/dangle.c +++ b/test/dangle.c @@ -660,7 +660,7 @@ main(void) int nerrors = 0; /* Run tests w/weak file close */ - puts("Testing dangling objects with weak file close:"); + HDputs("Testing dangling objects with weak file close:"); nerrors += test_dangle_dataset(H5F_CLOSE_WEAK); nerrors += test_dangle_group(H5F_CLOSE_WEAK); nerrors += test_dangle_datatype1(H5F_CLOSE_WEAK); @@ -668,7 +668,7 @@ main(void) nerrors += test_dangle_attribute(H5F_CLOSE_WEAK); /* Run tests w/semi file close */ - puts("Testing dangling objects with semi file close:"); + HDputs("Testing dangling objects with semi file close:"); nerrors += test_dangle_dataset(H5F_CLOSE_SEMI); nerrors += test_dangle_group(H5F_CLOSE_SEMI); nerrors += test_dangle_datatype1(H5F_CLOSE_SEMI); @@ -676,7 +676,7 @@ main(void) nerrors += test_dangle_attribute(H5F_CLOSE_SEMI); /* Run tests w/strong file close */ - puts("Testing dangling objects with strong file close:"); + HDputs("Testing dangling objects with strong file close:"); nerrors += test_dangle_dataset(H5F_CLOSE_STRONG); nerrors += test_dangle_group(H5F_CLOSE_STRONG); nerrors += test_dangle_datatype1(H5F_CLOSE_STRONG); @@ -689,11 +689,11 @@ main(void) /* Check for errors */ if (nerrors) goto error; - puts("All dangling ID tests passed."); + HDputs("All dangling ID tests passed."); return 0; error: - puts("***** DANGLING ID TESTS FAILED *****"); + HDputs("***** DANGLING ID TESTS FAILED *****"); return 1; } diff --git a/test/direct_chunk.c b/test/direct_chunk.c index 388f2cc..00fc06f 100644 --- a/test/direct_chunk.c +++ b/test/direct_chunk.c @@ -2320,7 +2320,7 @@ main(void) need_comma = TRUE; } /* end if */ HDprintf(":\n"); - fflush(stdout); + HDfflush(stdout); nerrors += test_single_chunk(config); } /* end for */ diff --git a/test/dsets.c b/test/dsets.c index e81a33e..a7b67ef 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -110,6 +110,8 @@ const char *FILENAME[] = {"dataset", /* 0 */ #define DSET_FLETCHER32_NAME_3 "fletcher32_3" #define DSET_SHUF_DEF_FLET_NAME "shuffle+deflate+fletcher32" #define DSET_SHUF_DEF_FLET_NAME_2 "shuffle+deflate+fletcher32_2" +#define DSET_OPTIONAL_SCALAR "dataset_with_scalar_space" +#define DSET_OPTIONAL_VLEN "dataset_with_vlen_type" #ifdef H5_HAVE_FILTER_SZIP #define DSET_SZIP_NAME "szip" #define DSET_SHUF_SZIP_FLET_NAME "shuffle+szip+fletcher32" @@ -373,13 +375,13 @@ test_create(hid_t file) dims[0] = 256; dims[1] = 512; space = H5Screate_simple(2, dims, NULL); - assert(space >= 0); + HDassert(space >= 0); /* Create a small data space for compact dataset */ small_dims[0] = 16; small_dims[1] = 8; small_space = H5Screate_simple(2, small_dims, NULL); - assert(space >= 0); + HDassert(space >= 0); /* * Create a dataset using the default dataset creation properties. We're @@ -445,13 +447,13 @@ test_create(hid_t file) * layout. */ create_parms = H5Pcreate(H5P_DATASET_CREATE); - assert(create_parms >= 0); + HDassert(create_parms >= 0); /* Attempt to create a dataset with invalid chunk sizes */ csize[0] = dims[0] * 2; csize[1] = dims[1] * 2; status = H5Pset_chunk(create_parms, 2, csize); - assert(status >= 0); + HDassert(status >= 0); H5E_BEGIN_TRY { dataset = H5Dcreate2(file, DSET_CHUNKED_NAME, H5T_NATIVE_DOUBLE, space, H5P_DEFAULT, create_parms, @@ -467,7 +469,7 @@ test_create(hid_t file) csize[0] = 5; csize[1] = 100; status = H5Pset_chunk(create_parms, 2, csize); - assert(status >= 0); + HDassert(status >= 0); dataset = H5Dcreate2(file, DSET_CHUNKED_NAME, H5T_NATIVE_DOUBLE, space, H5P_DEFAULT, create_parms, H5P_DEFAULT); @@ -489,11 +491,11 @@ test_create(hid_t file) * Create a compact dataset, then close it. */ create_parms = H5Pcreate(H5P_DATASET_CREATE); - assert(create_parms >= 0); + HDassert(create_parms >= 0); status = H5Pset_layout(create_parms, H5D_COMPACT); - assert(status >= 0); + HDassert(status >= 0); status = H5Pset_alloc_time(create_parms, H5D_ALLOC_TIME_EARLY); - assert(status >= 0); + HDassert(status >= 0); dataset = H5Dcreate2(file, DSET_COMPACT_NAME, H5T_NATIVE_DOUBLE, small_space, H5P_DEFAULT, create_parms, H5P_DEFAULT); @@ -565,7 +567,7 @@ test_simple_io(const char *env_h5_drvr, hid_t fapl) /* Create a small conversion buffer to test strip mining */ tconv_buf = HDmalloc((size_t)1000); xfer = H5Pcreate(H5P_DATASET_XFER); - assert(xfer >= 0); + HDassert(xfer >= 0); if (H5Pset_buffer(xfer, (size_t)1000, tconv_buf, NULL) < 0) goto error; @@ -4334,9 +4336,9 @@ test_nbit_compound_3(hid_t file) /* Check that the values read are the same as the values written */ for (i = 0; i < (size_t)size[0]; i++) { - if (new_data[i].i != orig_data[i].i || strcmp(new_data[i].str, orig_data[i].str) != 0 || - strcmp(new_data[i].vl_str, orig_data[i].vl_str) != 0 || new_data[i].v.len != orig_data[i].v.len || - new_data[i].r != orig_data[i].r) { + if (new_data[i].i != orig_data[i].i || HDstrcmp(new_data[i].str, orig_data[i].str) != 0 || + HDstrcmp(new_data[i].vl_str, orig_data[i].vl_str) != 0 || + new_data[i].v.len != orig_data[i].v.len || new_data[i].r != orig_data[i].r) { H5_FAILED(); HDprintf(" Read different values than written.\n"); HDprintf(" At index %lu\n", (unsigned long)i); @@ -6115,6 +6117,115 @@ error: } /* end test_can_apply2() */ /*------------------------------------------------------------------------- + * Function: test_optional_filters + * + * Purpose: Tests that H5Dcreate2 will not fail when a combination of + * type, space, etc... doesn't work for a filter and filter is + * optional. + * + * Return: Success: SUCCEED + * Failure: FAIL + * + * Programmer: Binh-Minh Ribler + * 24 July 2020 + * + *------------------------------------------------------------------------- + */ +static herr_t +test_optional_filters(hid_t file) +{ + unsigned int level = 9; + unsigned int cd_values[1] = {level}; + size_t cd_nelmts = 1; + hsize_t dim1d[1]; /* Dataspace dimensions */ + hid_t dsid = H5I_INVALID_HID; /* Dataset ID */ + hid_t sid = H5I_INVALID_HID; /* Dataspace ID */ + hid_t strtid = H5I_INVALID_HID; /* Datatype ID for string */ + hid_t vlentid = H5I_INVALID_HID; /* Datatype ID for vlen */ + hid_t dcplid = H5I_INVALID_HID; /* Dataspace creation property list ID */ + + TESTING("dataset with optional filters"); + + /* Create dcpl with special filter */ + if ((dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0) + TEST_ERROR; + + /* Create the datatype */ + if ((strtid = H5Tcreate(H5T_STRING, H5T_VARIABLE)) < 0) + TEST_ERROR; + + /* Create the data space */ + if ((sid = H5Screate(H5S_SCALAR)) < 0) + TEST_ERROR; + + /* The filter is optional. */ + if (H5Pset_filter(dcplid, H5Z_FILTER_DEFLATE, H5Z_FLAG_OPTIONAL, cd_nelmts, cd_values) < 0) + TEST_ERROR; + + /* Create dataset with optional filter */ + if ((dsid = H5Dcreate2(file, DSET_OPTIONAL_SCALAR, strtid, sid, H5P_DEFAULT, dcplid, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* Close dataset */ + if (H5Dclose(dsid) < 0) + TEST_ERROR; + + /* Close dataspace */ + if (H5Sclose(sid) < 0) + TEST_ERROR; + + /* Close datatype */ + if (H5Tclose(strtid) < 0) + TEST_ERROR; + + /* Set dataspace dimensions */ + dim1d[0] = DIM1; + + /* Create a non-scalar dataspace */ + if ((sid = H5Screate_simple(1, dim1d, NULL)) < 0) + TEST_ERROR; + + /* Create a vlen datatype */ + if ((vlentid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) + TEST_ERROR; + + /* Create dataset with optional filter */ + if ((dsid = H5Dcreate2(file, DSET_OPTIONAL_VLEN, vlentid, sid, H5P_DEFAULT, dcplid, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* Close dataset */ + if (H5Dclose(dsid) < 0) + TEST_ERROR; + + /* Close dataspace */ + if (H5Sclose(sid) < 0) + TEST_ERROR; + + /* Close datatype */ + if (H5Tclose(vlentid) < 0) + TEST_ERROR; + + /* Close dataset creation property list */ + if (H5Pclose(dcplid) < 0) + TEST_ERROR; + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY + { + H5Dclose(dsid); + H5Sclose(sid); + H5Pclose(dcplid); + H5Tclose(strtid); + H5Tclose(vlentid); + } + H5E_END_TRY; + return FAIL; +} /* end test_optional_filters() */ + +/*------------------------------------------------------------------------- * Function: test_can_apply_szip * * Purpose: Tests library behavior when szip filter indicates it can't @@ -7721,7 +7832,7 @@ test_random_chunks_real(const char *testname, hbool_t early_alloc, hid_t fapl) TESTING(testname); - assert(NPOINTS < 100); + HDassert(NPOINTS < 100); h5_fixname(FILENAME[6], fapl, filename, sizeof filename); @@ -8243,13 +8354,13 @@ test_deprec(hid_t file) dims[0] = 256; dims[1] = 512; space = H5Screate_simple(2, dims, NULL); - assert(space >= 0); + HDassert(space >= 0); /* Create a small data space for compact dataset */ small_dims[0] = 16; small_dims[1] = 8; small_space = H5Screate_simple(2, small_dims, NULL); - assert(space >= 0); + HDassert(space >= 0); /* * Create a dataset using the default dataset creation properties. We're @@ -8302,7 +8413,7 @@ test_deprec(hid_t file) * layout. */ create_parms = H5Pcreate(H5P_DATASET_CREATE); - assert(create_parms >= 0); + HDassert(create_parms >= 0); /* Add the deflate filter, if available */ #if defined H5_HAVE_FILTER_DEFLATE @@ -8338,7 +8449,7 @@ test_deprec(hid_t file) csize[0] = dims[0] * 2; csize[1] = dims[1] * 2; status = H5Pset_chunk(create_parms, 2, csize); - assert(status >= 0); + HDassert(status >= 0); H5E_BEGIN_TRY { dataset = H5Dcreate1(file, DSET_DEPREC_NAME_CHUNKED, H5T_NATIVE_DOUBLE, space, create_parms); @@ -8353,7 +8464,7 @@ test_deprec(hid_t file) csize[0] = 5; csize[1] = 100; status = H5Pset_chunk(create_parms, 2, csize); - assert(status >= 0); + HDassert(status >= 0); if ((dataset = H5Dcreate1(file, DSET_DEPREC_NAME_CHUNKED, H5T_NATIVE_DOUBLE, space, create_parms)) < 0) goto error; @@ -8378,11 +8489,11 @@ test_deprec(hid_t file) * Create a compact dataset, then close it. */ create_parms = H5Pcreate(H5P_DATASET_CREATE); - assert(create_parms >= 0); + HDassert(create_parms >= 0); status = H5Pset_layout(create_parms, H5D_COMPACT); - assert(status >= 0); + HDassert(status >= 0); status = H5Pset_alloc_time(create_parms, H5D_ALLOC_TIME_EARLY); - assert(status >= 0); + HDassert(status >= 0); if ((dataset = H5Dcreate1(file, DSET_DEPREC_NAME_COMPACT, H5T_NATIVE_DOUBLE, small_space, create_parms)) < 0) @@ -15121,6 +15232,7 @@ main(void) nerrors += (test_missing_filter(file) < 0 ? 1 : 0); nerrors += (test_can_apply(file) < 0 ? 1 : 0); nerrors += (test_can_apply2(file) < 0 ? 1 : 0); + nerrors += (test_optional_filters(file) < 0 ? 1 : 0); nerrors += (test_set_local(my_fapl) < 0 ? 1 : 0); nerrors += (test_can_apply_szip(file) < 0 ? 1 : 0); nerrors += (test_compare_dcpl(file) < 0 ? 1 : 0); diff --git a/test/dt_arith.c b/test/dt_arith.c index 466554c..7b2274c 100644 --- a/test/dt_arith.c +++ b/test/dt_arith.c @@ -359,7 +359,7 @@ static int without_hardware_g = 0; \ for (n = 0; n < 2; n++) { \ if (n == 1) { \ - memset(value, 0, SRC_SIZE * sizeof(unsigned char)); \ + HDmemset(value, 0, SRC_SIZE * sizeof(unsigned char)); \ /* -0 */ \ H5T__bit_set(value, (size_t)(SRC_PREC - 1), (size_t)1, TRUE); \ CHANGE_ORDER(value, SRC_ORDR, SRC_SIZE); /*change order for big endian*/ \ @@ -566,7 +566,7 @@ generates_sigfpe(void) HDfflush(stdout); HDfflush(stderr); - if ((pid = fork()) < 0) { + if ((pid = HDfork()) < 0) { HDperror("fork"); HDexit(EXIT_FAILURE); } @@ -580,7 +580,7 @@ generates_sigfpe(void) HDexit(EXIT_SUCCESS); } - while (pid != waitpid(pid, &status, 0)) + while (pid != HDwaitpid(pid, &status, 0)) /*void*/; if (WIFEXITED(status) && 0 == WEXITSTATUS(status)) { HDputs("Floating-point overflow cases will be tested."); @@ -2388,7 +2388,7 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst) } /* Make certain that there isn't some weird number of destination bits */ - assert(dst_nbits % 8 == 0); + HDassert(dst_nbits % 8 == 0); /* Are the two results the same? */ for (k = (dst_size - (dst_nbits / 8)); k < dst_size; k++) @@ -2945,12 +2945,12 @@ test_conv_flt_1(const char *name, int run_test, hid_t src, hid_t dst) */ HDfflush(stdout); HDfflush(stderr); - if ((child_pid = fork()) < 0) { + if ((child_pid = HDfork()) < 0) { HDperror("fork"); return 1; } else if (child_pid > 0) { - while (child_pid != waitpid(child_pid, &status, 0)) /*void*/ + while (child_pid != HDwaitpid(child_pid, &status, 0)) /*void*/ ; if (WIFEXITED(status) && 255 == WEXITSTATUS(status)) { return 0; /*child exit after catching SIGFPE*/ @@ -3019,7 +3019,7 @@ test_conv_flt_1(const char *name, int run_test, hid_t src, hid_t dst) if (sizeof(float) == sizeof(double)) HDputs("Sizeof(float)==sizeof(double) - some tests may not be sensible."); if (OTHER == src_type || OTHER == dst_type) { - if (!strcmp(name, "noop")) + if (!HDstrcmp(name, "noop")) HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, src_type_name, dst_type_name); else if (run_test == TEST_SPECIAL) @@ -3038,7 +3038,7 @@ test_conv_flt_1(const char *name, int run_test, hid_t src, hid_t dst) goto error; } else { - if (!strcmp(name, "noop")) + if (!HDstrcmp(name, "noop")) HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, src_type_name, dst_type_name); else if (run_test == TEST_SPECIAL) @@ -4347,7 +4347,7 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst) } /* Make certain that there isn't some weird number of destination bits */ - assert(dst_nbits % 8 == 0); + HDassert(dst_nbits % 8 == 0); /* For Intel machines, the size of "long double" is 12 bytes, precision * is 80 bits; for AMD processors, the size of "long double" is 16 bytes, @@ -5006,7 +5006,7 @@ run_fp_tests(const char *name) { int nerrors = 0; - if (!strcmp(name, "noop")) { + if (!HDstrcmp(name, "noop")) { nerrors += test_conv_flt_1("noop", TEST_NOOP, H5T_NATIVE_FLOAT, H5T_NATIVE_FLOAT); nerrors += test_conv_flt_1("noop", TEST_NOOP, H5T_NATIVE_DOUBLE, H5T_NATIVE_DOUBLE); #if H5_SIZEOF_LONG_DOUBLE != 0 @@ -5243,7 +5243,7 @@ run_fp_int_conv(const char *name) #endif #if H5_SIZEOF_LONG_LONG != H5_SIZEOF_LONG - if (!strcmp(name, "hw")) { /* Hardware conversion */ + if (!HDstrcmp(name, "hw")) { /* Hardware conversion */ nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_FLOAT, H5T_NATIVE_LLONG); nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_DOUBLE, H5T_NATIVE_LLONG); } diff --git a/test/dtypes.c b/test/dtypes.c index 157e3fa..13cf6e8 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -1891,7 +1891,7 @@ test_compound_9(void) goto error; } /* end if */ - if (rdata.i1 != wdata.i1 || rdata.i2 != wdata.i2 || strcmp(rdata.str, wdata.str)) { + if (rdata.i1 != wdata.i1 || rdata.i2 != wdata.i2 || HDstrcmp(rdata.str, wdata.str)) { H5_FAILED(); AT(); HDprintf("incorrect read data\n"); @@ -2097,7 +2097,7 @@ test_compound_10(void) t1 = rdata[i].text.p; t2 = wdata[i].text.p; - if (strcmp((char *)t1, (char *)t2)) { + if (HDstrcmp((char *)t1, (char *)t2)) { H5_FAILED(); AT(); HDprintf("incorrect VL read data\n"); @@ -2502,7 +2502,7 @@ test_compound_12(void) H5E_END_TRY; if (ret >= 0) { H5_FAILED(); - puts(" Tries to cut off the last member. Should have failed."); + HDputs(" Tries to cut off the last member. Should have failed."); goto error; } @@ -3054,7 +3054,7 @@ test_compound_14(void) goto error; } /* end if */ - if (rdata1.c1 != wdata1.c1 || rdata1.c2 != wdata1.c2 || strcmp(rdata1.str, wdata1.str)) { + if (rdata1.c1 != wdata1.c1 || rdata1.c2 != wdata1.c2 || HDstrcmp(rdata1.str, wdata1.str)) { H5_FAILED(); AT(); HDprintf("incorrect read data\n"); @@ -3885,7 +3885,7 @@ test_query(void) HDprintf("Can't get name for enum member\n"); goto error; } /* end if */ - if (strcmp("YELLOW", enum_name)) { + if (HDstrcmp("YELLOW", enum_name)) { H5_FAILED(); HDprintf("Incorrect name for enum member\n"); goto error; diff --git a/test/earray.c b/test/earray.c index 79bf0f1..4ef79ee 100644 --- a/test/earray.c +++ b/test/earray.c @@ -759,7 +759,7 @@ test_create(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t H5_ATTR_UNUSE } #else /* NDEBUG */ SKIPPED(); - puts(" Not tested when assertions are disabled"); + HDputs(" Not tested when assertions are disabled"); #endif /* NDEBUG */ /* @@ -2427,12 +2427,12 @@ main(void) switch (curr_test) { /* "Normal" testing parameters */ case EARRAY_TEST_NORMAL: - puts("Testing with normal parameters"); + HDputs("Testing with normal parameters"); break; /* "Re-open array" testing parameters */ case EARRAY_TEST_REOPEN: - puts("Testing with reopen array flag set"); + HDputs("Testing with reopen array flag set"); tparam.reopen_array = EARRAY_TEST_REOPEN; break; @@ -2461,31 +2461,31 @@ main(void) switch (curr_iter) { /* "Forward" testing parameters */ case EARRAY_ITER_FW: - puts("Testing with forward iteration"); + HDputs("Testing with forward iteration"); tparam.eiter = &ea_iter_fw; break; /* "Reverse" testing parameters */ case EARRAY_ITER_RV: - puts("Testing with reverse iteration"); + HDputs("Testing with reverse iteration"); tparam.eiter = &ea_iter_rv; break; /* "Random" testing parameters */ case EARRAY_ITER_RND: - puts("Testing with random iteration"); + HDputs("Testing with random iteration"); tparam.eiter = &ea_iter_rnd; break; /* "Random #2" testing parameters */ case EARRAY_ITER_RND2: - puts("Testing with random #2 iteration"); + HDputs("Testing with random #2 iteration"); tparam.eiter = &ea_iter_rnd2; break; /* "Cyclic" testing parameters */ case EARRAY_ITER_CYC: - puts("Testing with cyclic iteration"); + HDputs("Testing with cyclic iteration"); tparam.eiter = &ea_iter_cyc; break; diff --git a/test/enum.c b/test/enum.c index eafce72..4a13358 100644 --- a/test/enum.c +++ b/test/enum.c @@ -768,11 +768,11 @@ main(void) if (nerrors) goto error; - puts("All enum tests passed."); + HDputs("All enum tests passed."); h5_cleanup(FILENAME, fapl); return 0; error: - puts("*** ENUM TESTS FAILED ***"); + HDputs("*** ENUM TESTS FAILED ***"); return 1; } diff --git a/test/external.c b/test/external.c index 376204a..d106555 100644 --- a/test/external.c +++ b/test/external.c @@ -476,12 +476,12 @@ __add_external_files(hid_t dcpl_id, unsigned int n_external_files, off_t offset, for (i = 0; i < n_external_files; i++) { if (HDsnprintf(exname, AEF_EXNAME_MAX_LEN, "ext%d.data", i + 1) > AEF_EXNAME_MAX_LEN) { HDfprintf(stderr, "External file %d overflows name buffer\n", i + 1); - fflush(stderr); + HDfflush(stderr); return -1; } if (H5Pset_external(dcpl_id, exname, offset, max_ext_size) < 0) { HDfprintf(stderr, "Problem adding external file %s\n", exname); - fflush(stderr); + HDfflush(stderr); return -1; } } diff --git a/test/farray.c b/test/farray.c index b6a6c31..46889a3 100644 --- a/test/farray.c +++ b/test/farray.c @@ -483,7 +483,7 @@ test_create(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t H5_ATTR_UNUSE } #else /* NDEBUG */ SKIPPED(); - puts(" Not tested when assertions are disabled"); + HDputs(" Not tested when assertions are disabled"); #endif /* NDEBUG */ /* diff --git a/test/filenotclosed.c b/test/filenotclosed.c index 13ce9fd..330224d 100644 --- a/test/filenotclosed.c +++ b/test/filenotclosed.c @@ -80,7 +80,7 @@ main(void) contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")); if (!contig_addr_vfd) { SKIPPED(); - puts(" Temporary skipped for a spilt/multi driver"); + HDputs(" Temporary skipped for a spilt/multi driver"); HDexit(EXIT_SUCCESS); } diff --git a/test/fillval.c b/test/fillval.c index 05570f0..2decbfa 100644 --- a/test/fillval.c +++ b/test/fillval.c @@ -201,7 +201,7 @@ test_getset(void) H5E_END_TRY; if (fill_i != 0) { H5_FAILED(); - puts(" H5Pget_fill_value() should return default 0"); + HDputs(" H5Pget_fill_value() should return default 0"); goto error; } @@ -220,8 +220,8 @@ test_getset(void) goto error; if (fill_ss.v1 != fill_ss_rd.v1 || fill_ss.v2 != fill_ss_rd.v2) { H5_FAILED(); - puts(" Failed to get fill value using same data type that was "); - puts(" used to set the fill value."); + HDputs(" Failed to get fill value using same data type that was "); + HDputs(" used to set the fill value."); goto error; } @@ -232,8 +232,8 @@ test_getset(void) goto error; if (fill_ss.v1 != fill_si.v1 || fill_ss.v2 != fill_si.v2) { H5_FAILED(); - puts(" Failed to get fill value using a data type other than what"); - puts(" was used to set the fill value."); + HDputs(" Failed to get fill value using a data type other than what"); + HDputs(" was used to set the fill value."); goto error; } @@ -246,7 +246,7 @@ test_getset(void) goto error; if (fill_si.v1 != fill_ss.v1 || fill_si.v2 != fill_ss.v2) { H5_FAILED(); - puts(" Resetting the fill value was unsuccessful."); + HDputs(" Resetting the fill value was unsuccessful."); goto error; } @@ -662,12 +662,12 @@ test_create(hid_t fapl, const char *base_name, H5D_layout_t layout) goto error; if (alloc_time != H5D_ALLOC_TIME_LATE) { H5_FAILED(); - puts(" Got non-H5D_ALLOC_TIME_LATE space allocation time."); + HDputs(" Got non-H5D_ALLOC_TIME_LATE space allocation time."); HDprintf(" Got %d\n", alloc_time); } if (fill_time != H5D_FILL_TIME_ALLOC) { H5_FAILED(); - puts(" Got non-H5D_FILL_TIME_ALLOC fill value write time."); + HDputs(" Got non-H5D_FILL_TIME_ALLOC fill value write time."); HDprintf(" Got %d\n", fill_time); } if (H5Dclose(dset3) < 0) @@ -682,7 +682,7 @@ test_create(hid_t fapl, const char *base_name, H5D_layout_t layout) goto error; if (layout == H5D_CONTIGUOUS && allocation != H5D_SPACE_STATUS_NOT_ALLOCATED) { H5_FAILED(); - puts(" Got allocated space instead of unallocated."); + HDputs(" Got allocated space instead of unallocated."); HDprintf(" Got %d\n", allocation); goto error; } @@ -694,12 +694,12 @@ test_create(hid_t fapl, const char *base_name, H5D_layout_t layout) goto error; if (alloc_time != H5D_ALLOC_TIME_LATE) { H5_FAILED(); - puts(" Got non-H5D_ALLOC_TIME_LATE space allocation time."); + HDputs(" Got non-H5D_ALLOC_TIME_LATE space allocation time."); HDprintf(" Got %d\n", alloc_time); } if (fill_time != H5D_FILL_TIME_NEVER) { H5_FAILED(); - puts(" Got non-H5D_FILL_TIME_NEVER fill value write time."); + HDputs(" Got non-H5D_FILL_TIME_NEVER fill value write time."); HDprintf(" Got %d\n", fill_time); } if (H5Dclose(dset4) < 0) @@ -717,7 +717,7 @@ test_create(hid_t fapl, const char *base_name, H5D_layout_t layout) if (!H5_FLT_ABS_EQUAL(rd_c.a, 0) || !H5_DBL_ABS_EQUAL(rd_c.y, fill_ctype.y) || rd_c.x != 0 || rd_c.z != '\0') { H5_FAILED(); - puts(" Got wrong fill value"); + HDputs(" Got wrong fill value"); HDprintf(" Got rd_c.a=%f, rd_c.y=%f and rd_c.x=%d, rd_c.z=%c\n", (double)rd_c.a, rd_c.y, rd_c.x, rd_c.z); } @@ -746,14 +746,14 @@ test_create(hid_t fapl, const char *base_name, H5D_layout_t layout) goto error; if (alloc_time != H5D_ALLOC_TIME_EARLY) { H5_FAILED(); - puts(" Got non-H5D_ALLOC_TIME_EARLY space allocation time."); + HDputs(" Got non-H5D_ALLOC_TIME_EARLY space allocation time."); HDprintf(" Got %d\n", alloc_time); } if (H5Pget_fill_time(dcpl, &fill_time) < 0) goto error; if (fill_time != H5D_FILL_TIME_NEVER) { H5_FAILED(); - puts(" Got non-H5D_FILL_TIME_NEVER fill value write time."); + HDputs(" Got non-H5D_FILL_TIME_NEVER fill value write time."); HDprintf(" Got %d\n", fill_time); } if (H5Dclose(dset5) < 0) @@ -786,14 +786,14 @@ test_create(hid_t fapl, const char *base_name, H5D_layout_t layout) goto error; if (alloc_time != H5D_ALLOC_TIME_EARLY) { H5_FAILED(); - puts(" Got non-H5D_ALLOC_TIME_EARLY space allocation time."); + HDputs(" Got non-H5D_ALLOC_TIME_EARLY space allocation time."); HDprintf(" Got %d\n", alloc_time); } if (H5Pget_fill_time(dcpl, &fill_time) < 0) goto error; if (fill_time != H5D_FILL_TIME_ALLOC) { H5_FAILED(); - puts(" Got non-H5D_FILL_TIME_ALLOC fill value write time."); + HDputs(" Got non-H5D_FILL_TIME_ALLOC fill value write time."); HDprintf(" Got %d\n", fill_time); } if (H5Dclose(dset6) < 0) @@ -811,7 +811,7 @@ test_create(hid_t fapl, const char *base_name, H5D_layout_t layout) if (!H5_FLT_ABS_EQUAL(rd_c.a, 0) || !H5_DBL_ABS_EQUAL(rd_c.y, fill_ctype.y) || rd_c.x != 0 || rd_c.z != '\0') { H5_FAILED(); - puts(" Got wrong fill value"); + HDputs(" Got wrong fill value"); HDprintf(" Got rd_c.a=%f, rd_c.y=%f and rd_c.x=%d, rd_c.z=%c\n", (double)rd_c.a, rd_c.y, rd_c.x, rd_c.z); } @@ -1649,7 +1649,7 @@ test_extend_cases(hid_t file, hid_t _dcpl, const char *dset_name, hsize_t *ch_si } /* end if */ else { /* Sanity check */ - assert(dtype_class == H5T_COMPOUND); + HDassert(dtype_class == H5T_COMPOUND); /* Initialize specific values for this datatype */ val_size = sizeof(comp_vl_datatype); @@ -1701,7 +1701,7 @@ test_extend_cases(hid_t file, hid_t _dcpl, const char *dset_name, hsize_t *ch_si } /* end for */ /* Check for overflow */ - assert((nelmts * val_size) == (hsize_t)((size_t)(nelmts * val_size))); + HDassert((nelmts * val_size) == (hsize_t)((size_t)(nelmts * val_size))); /* Allocate & initialize buffer */ buf = HDmalloc((size_t)(nelmts * val_size)); @@ -2141,7 +2141,7 @@ test_extend(hid_t fapl, const char *base_name, H5D_layout_t layout) */ if (H5D_CONTIGUOUS == layout) { SKIPPED(); - puts(" Not implemented yet -- needs H5S_SELECT_DIFF operator"); + HDputs(" Not implemented yet -- needs H5S_SELECT_DIFF operator"); goto skip; } #endif @@ -2259,7 +2259,7 @@ test_compatible(void) goto error; if (dims[0] != 8 || dims[1] != 8) { H5_FAILED(); - puts(" Got a different dimension size than what was set."); + HDputs(" Got a different dimension size than what was set."); HDprintf(" Got dims[0]=%ld, dims[1]=%ld, set 8x8\n", (long)dims[0], (long)dims[1]); goto error; } @@ -2271,7 +2271,7 @@ test_compatible(void) goto error; if (val_rd != 0) { H5_FAILED(); - puts(" Got a different value than what was set."); + HDputs(" Got a different value than what was set."); HDprintf(" Got %ld, set 0\n", (long)val_rd); goto error; } @@ -2312,7 +2312,7 @@ test_compatible(void) goto error; if (dims[0] != 8 || dims[1] != 8) { H5_FAILED(); - puts(" Got a different dimension size than what was set."); + HDputs(" Got a different dimension size than what was set."); HDprintf(" Got dims[0]=%ld, dims[1]=%ld, set 8x8\n", (long)dims[0], (long)dims[1]); goto error; } @@ -2324,7 +2324,7 @@ test_compatible(void) goto error; if (val_rd != fill_val) { H5_FAILED(); - puts(" Got a different value than what was set."); + HDputs(" Got a different value than what was set."); HDprintf(" Got %ld, set %ld\n", (long)val_rd, (long)fill_val); goto error; } @@ -2659,11 +2659,11 @@ main(int argc, char *argv[]) if (argc >= 2) { test_contig = test_chunk = test_compact = 0; for (argno = 1; argno < argc; argno++) { - if (!strcmp(argv[argno], "contiguous")) + if (!HDstrcmp(argv[argno], "contiguous")) test_contig = 1; - else if (!strcmp(argv[argno], "chunked")) + else if (!HDstrcmp(argv[argno], "chunked")) test_chunk = 1; - else if (!strcmp(argv[argno], "compact")) + else if (!HDstrcmp(argv[argno], "compact")) test_compact = 1; else { HDfprintf(stderr, "usage: %s [contiguous] [chunked] [compact]\n", argv[0]); @@ -2693,11 +2693,11 @@ main(int argc, char *argv[]) /* Set the FAPL for the type of format */ if (new_format) { - puts("\nTesting with new file format:"); + HDputs("\nTesting with new file format:"); my_fapl = fapl2; } /* end if */ else { - puts("Testing with old file format:"); + HDputs("Testing with old file format:"); my_fapl = fapl; } /* end else */ diff --git a/test/filter_fail.c b/test/filter_fail.c index dca9a20..d7f784c 100644 --- a/test/filter_fail.c +++ b/test/filter_fail.c @@ -171,7 +171,7 @@ test_filter_write(char *file_name, hid_t my_fapl, hbool_t cache_enabled) H5E_END_TRY; if (ret >= 0) { H5_FAILED(); - puts(" Data writing is supposed to fail because the chunk can't be written to file."); + HDputs(" Data writing is supposed to fail because the chunk can't be written to file."); TEST_ERROR } } @@ -189,7 +189,7 @@ test_filter_write(char *file_name, hid_t my_fapl, hbool_t cache_enabled) H5E_END_TRY; if (ret >= 0) { H5_FAILED(); - puts(" Dataset is supposed to fail because the chunk can't be flushed to file."); + HDputs(" Dataset is supposed to fail because the chunk can't be flushed to file."); TEST_ERROR } } diff --git a/test/flushrefreshTest.cmake b/test/flushrefreshTest.cmake index 6faf37b..e280b8b 100644 --- a/test/flushrefreshTest.cmake +++ b/test/flushrefreshTest.cmake @@ -41,7 +41,7 @@ endif () message (STATUS "COMMAND: ${TEST_PROGRAM} ${TEST_ARGS}") if (TEST_LIBRARY_DIRECTORY) - if (WIN32 OR MINGW) + if (WIN32) set (ENV{PATH} "$ENV{PATH};${TEST_LIBRARY_DIRECTORY}") else () set (ENV{LD_LIBRARY_PATH} "$ENV{LD_LIBRARY_PATH}:${TEST_LIBRARY_DIRECTORY}") diff --git a/test/gen_bounds.c b/test/gen_bounds.c index 6933626..d7e9b8c 100644 --- a/test/gen_bounds.c +++ b/test/gen_bounds.c @@ -27,8 +27,60 @@ * that they can or cannot read particular file format. */ +/* + * Add two routines gen_ref_files() and gen_sel_files() to generate the + * following test files: + * + * (1) gen_ref_files(): + * bounds_ref_earliest_latest.h5 + * bounds_ref_latest_latest.h5 + * bounds_ref_v110_v110.h5 + * bounds_ref_v18_v18.h5 + * (1) gen_sel_files(): + * bounds_sel_earliest_latest.h5 + * bounds_sel_latest_latest.h5 + * bounds_sel_v112_v112.h5 + * bounds_sel_v110_v110.h5 + * + * These test files will be copied to 1.12, 1.10 and 1.8 libraries for + * compatibility testing. + */ #include "h5test.h" +/* + * Defines for gen_ref_files() + */ +/* File names used for references */ +#define FILENAME_REF_E_L "bounds_ref_earliest_latest.h5" +#define FILENAME_REF_L_L "bounds_ref_latest_latest.h5" +#define FILENAME_REF_V112_V112 "bounds_ref_v112_v112.h5" +#define FILENAME_REF_V110_V110 "bounds_ref_v110_v110.h5" +#define FILENAME_REF_V18_V18 "bounds_ref_v18_v18.h5" + +/* Dataset names for references */ +#define REVISED_REFS_DSET "Revised_refs_dset" +#define OLD_REF_OBJ_DSET "Old_ref_object_dset" +#define OLD_REF_REG_DSET "Old_ref_region_dset" + +#define GROUP "Group" +#define ATTR "Attr" +#define DATASET "Dataset" +#define POWER32 4294967296 /* 2^32 */ + +/* + * Defines for gen_sel_files() + */ +/* File names for hyperslab/point selections */ +#define FILENAME_SEL_E_L "bounds_sel_earliest_latest.h5" +#define FILENAME_SEL_L_L "bounds_sel_latest_latest.h5" +#define FILENAME_SEL_V112_V112 "bounds_sel_v112_v112.h5" +#define FILENAME_SEL_V110_V110 "bounds_sel_v110_v110.h5" + +/* Dataset names for hyperslab/point selections */ +#define SEL_EX_REG_DSET "Sel_ex32_reg_dset" +#define SEL_EX_IRR_DSET "Sel_ex32_irr_dset" +#define SEL_EX_PT_DSET "Sel_ex32_pt_dset" + /*********************************************************************** * gen_earliest_latest() creates file "bounds_earliest_latest.h5" * @@ -692,6 +744,472 @@ error: return FAIL; } /* gen_v18_v18 */ +/*********************************************************************** + * gen_sel_files() is used to create the following test files: + * bounds_sel_earliest_latest.h5 + * bounds_sel_latest_latest.h5 + * bounds_sel_v112_v112.h5 + * bounds_sel_v110_v110.h5 + * + * File contents for: + * --bounds_sel_earliest_latest.h5 + * --bounds_sel_latest_latest.h5 + * --bounds_sel_v112_v112.h5 + * --each file contains 3 datasets with old region reference type + * (1) Sel_ex32_reg_dset: + * --regular hyperslab selection exceeding 32 bits integer limit + * (2) Sel_ex32_irr_dset: + * --irregular hyperslab selection exceeding 32 bits integer limit + * (3) Sel_ex32_pt_dset: + * --point selection exceeding 32 bits integer limit + * + * File contents for: + * --bounds_ref_v110_v110.h5 + * (1) Sel_ex32_reg_dset: a dataset with old region reference type + * --regular hyperslab selection exceeding 32 bits integer limit + * (2) Sel_ex32_irr_dset: does not exist, cannot be created + * (3) Sel_ex32_pt_dset: does not exist, cannot be created + * + * Return: SUCCEED/FAIL + * + ***********************************************************************/ +static herr_t +gen_sel_files(const char *filename, H5F_libver_t low_bound, H5F_libver_t high_bound) +{ + hid_t fid = H5I_INVALID_HID; /* File ID */ + hid_t fapl = H5I_INVALID_HID; /* File access property list */ + hid_t sid = H5I_INVALID_HID; /* Dataspace ID */ + hid_t did = H5I_INVALID_HID; /* Dataset ID */ + hsize_t numparticles = 8388608; + hsize_t total_particles = numparticles * 513; + hsize_t vdsdims[1] = {total_particles}; /* Dataset dimension size */ + hsize_t coord[4]; /* Point selection */ + hsize_t ref_start; /* Starting location of hyperslab */ + hsize_t ref_stride; /* Stride of hyperslab */ + hsize_t ref_count; /* Element count of hyperslab */ + hsize_t ref_block; /* Block size of hyperslab */ + hid_t ref_sid = H5I_INVALID_HID; /* Dataspace ID for the reference dataset */ + hid_t ref_did = H5I_INVALID_HID; /* Dataset ID for the reference dataset */ + hsize_t ref_dims[1] = {1}; /* Dimension for reference dataset */ + hdset_reg_ref_t ref_wbuf[1]; /* Buffer for dataset region reference */ + + /* + * Create test file, attribute, group and dataset + */ + + /* Create the test file */ + if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* Create a dataset */ + if ((sid = H5Screate_simple(1, vdsdims, NULL)) < 0) + TEST_ERROR; + + if ((did = H5Dcreate2(fid, DATASET, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR; + + if (H5Sclose(sid) < 0) + TEST_ERROR; + + if (H5Dclose(did) < 0) + TEST_ERROR; + + if (H5Fclose(fid) < 0) + TEST_ERROR; + + /* Create file access property list */ + if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) + TEST_ERROR; + + /* Set to use the low/high bounds in fapl */ + if (H5Pset_libver_bounds(fapl, low_bound, high_bound) < 0) + TEST_ERROR; + + /* Open the file with fapl */ + if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) + TEST_ERROR; + + /* Open the dataset */ + if ((did = H5Dopen2(fid, DATASET, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* Get the dataset's dataspace */ + if ((sid = H5Dget_space(did)) < 0) + TEST_ERROR; + + /* Create dataspace for the reference dataset */ + ref_dims[0] = 1; + if ((ref_sid = H5Screate_simple(1, ref_dims, NULL)) < 0) + TEST_ERROR; + + /* Generate regular hyperslab exceeding 32 */ + ref_start = 0; + ref_count = 2; + ref_block = 4; + ref_stride = POWER32; + + if (H5Sselect_hyperslab(sid, H5S_SELECT_SET, &ref_start, &ref_stride, &ref_count, &ref_block) < 0) + TEST_ERROR; + + /* Should succeed for v110 and above */ + if (high_bound >= H5F_LIBVER_V110) { + + /* Create the first reference */ + if (H5Rcreate(&ref_wbuf[0], fid, DATASET, H5R_DATASET_REGION, sid) < 0) + TEST_ERROR; + + /* Create the reference datset */ + if ((ref_did = H5Dcreate2(fid, SEL_EX_REG_DSET, H5T_STD_REF_DSETREG, ref_sid, H5P_DEFAULT, + H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* Write to the reference datset */ + if (H5Dwrite(ref_did, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, ref_wbuf) < 0) + TEST_ERROR; + + if (H5Dclose(ref_did) < 0) + TEST_ERROR; + } + + /* Generate irregular hyperslab exceeding 32 */ + ref_start = 8; + ref_count = 5; + ref_block = 2; + ref_stride = POWER32; + if (H5Sselect_hyperslab(sid, H5S_SELECT_OR, &ref_start, &ref_stride, &ref_count, &ref_block) < 0) + TEST_ERROR; + + /* Should succeed for v112 and above */ + if (high_bound >= H5F_LIBVER_V112) { + + /* Create the second reference */ + if (H5Rcreate(&ref_wbuf[0], fid, DATASET, H5R_DATASET_REGION, sid) < 0) + TEST_ERROR; + + /* Create the reference datset */ + if ((ref_did = H5Dcreate2(fid, SEL_EX_IRR_DSET, H5T_STD_REF_DSETREG, ref_sid, H5P_DEFAULT, + H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* Write to the reference datset */ + if (H5Dwrite(ref_did, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, ref_wbuf) < 0) + TEST_ERROR; + + if (H5Dclose(ref_did) < 0) + TEST_ERROR; + } + + /* Generate point selection exceeding 32 */ + coord[0] = 5; + coord[1] = 15; + coord[2] = POWER32 + 1; + coord[3] = 19; + + if (H5Sselect_elements(sid, H5S_SELECT_SET, (size_t)4, coord) < 0) + TEST_ERROR; + + /* Should succeed for v112 and above */ + if (high_bound >= H5F_LIBVER_V112) { + + /* Create the third reference */ + if (H5Rcreate(&ref_wbuf[0], fid, DATASET, H5R_DATASET_REGION, sid) < 0) + TEST_ERROR; + + /* Create the reference datset */ + if ((ref_did = H5Dcreate2(fid, SEL_EX_PT_DSET, H5T_STD_REF_DSETREG, ref_sid, H5P_DEFAULT, H5P_DEFAULT, + H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* Write to the reference datset */ + if (H5Dwrite(ref_did, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, ref_wbuf) < 0) + TEST_ERROR; + + if (H5Dclose(ref_did) < 0) + TEST_ERROR; + } + + /* Closing */ + if (H5Sclose(ref_sid) < 0) + TEST_ERROR; + + if (H5Dclose(did) < 0) + TEST_ERROR; + + if (H5Sclose(sid) < 0) + TEST_ERROR; + + if (H5Fclose(fid) < 0) + TEST_ERROR; + + return SUCCEED; + +error: + H5E_BEGIN_TRY + { + H5Dclose(ref_did); + H5Sclose(ref_sid); + H5Dclose(did); + H5Sclose(sid); + H5Pclose(fapl); + H5Fclose(fid); + } + H5E_END_TRY; + + return FAIL; + +} /* gen_sel_files() */ + +/*********************************************************************** + * gen_ref_files() is used to create the following test files: + * bounds_ref_earliest_latest.h5 + * bounds_ref_latest_latest.h5 + * bounds_ref_v110_v110.h5 + * bounds_ref_v18_v18.h5 + * + * File contents for: + * --bounds_ref_earliest_latest.h5 + * --bounds_ref_latest_latest.h5 + * --bounds_ref_v112_v112.h5 + * (1) Revised_refs_dset: a dataset created with the revised reference type + * --attribute reference + * --object reference + * --dataset region reference + * (2) Old_ref_object_dset: + * --a dataset created with the old object reference type + * (3) Old_ref_region_dset: + * --a dataset created with the old dataset region reference type + * + * File contents for: + * --bounds_ref_v110_v110.h5 + * --bounds_ref_v18_v18.h5 + * (1) Old_ref_object_dset: + * --a dataset created with the old object reference type + * (2) Old_ref_region_dset: + * --a dataset created with the old dataset region reference type + * + * Return: SUCCEED/FAIL + * + ***********************************************************************/ +static herr_t +gen_ref_files(const char *filename, H5F_libver_t low_bound, H5F_libver_t high_bound) +{ + hid_t fid = H5I_INVALID_HID; /* File ID */ + hid_t gid = H5I_INVALID_HID; /* Group ID */ + hid_t fapl = H5I_INVALID_HID; /* File access property list */ + hid_t aid = H5I_INVALID_HID; /* Attribute ID */ + hid_t asid = H5I_INVALID_HID; /* Dataspace ID for attribute */ + hid_t sid = H5I_INVALID_HID; /* Dataspace ID */ + hid_t did = H5I_INVALID_HID; /* Dataset ID */ + hsize_t dims[1] = {100}; /* Dimension size */ + unsigned * dwbuf = NULL; /* Buffer for writing data */ + hid_t ref_sid = H5I_INVALID_HID; /* Dataspace ID for the reference dataset */ + hid_t ref_did = H5I_INVALID_HID; /* Dataset ID for the reference dataset */ + hsize_t rev_ref_dims[1] = {3}; /* Dimension size for the reference dataset */ + H5R_ref_t rev_ref_wbuf[3]; /* Buffer for storing the revised references */ + hobj_ref_t old_ref_obj_wbuf[1]; /* Buffer for storing the old reference object */ + hdset_reg_ref_t old_ref_reg_wbuf[1]; /* Buffer for storing the old dataset region reference */ + hsize_t old_ref_dims[] = {1}; /* Dimension size for the reference dataset */ + hsize_t start[1]; /* Starting location of hyperslab */ + hsize_t stride[1]; /* Stride of hyperslab */ + hsize_t count[1]; /* Element count of hyperslab */ + hsize_t block[1]; /* Block size of hyperslab */ + unsigned i; /* Local index variable */ + + /* + * Create test file, attribute, group and dataset + */ + + if ((dwbuf = HDcalloc(sizeof(unsigned), 100)) == NULL) + TEST_ERROR; + + /* Create the test file */ + if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* Create dataspace for the attribute */ + if ((asid = H5Screate(H5S_SCALAR)) < 0) + TEST_ERROR; + + /* Create an attribute to the root group */ + if ((aid = H5Acreate2(fid, ATTR, H5T_NATIVE_UINT, asid, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* Create a group */ + if ((gid = H5Gcreate2(fid, GROUP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* Create dataspace for the dataset */ + if ((sid = H5Screate_simple(1, dims, NULL)) < 0) + TEST_ERROR; + + /* Create a dataset in the group */ + if ((did = H5Dcreate2(gid, DATASET, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* Initialize data to write */ + for (i = 0; i < 100; i++) + dwbuf[i] = i * 3; + + /* Write data to disk */ + if (H5Dwrite(did, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dwbuf) < 0) + TEST_ERROR; + + /* Closing */ + if (H5Dclose(did) < 0) + TEST_ERROR; + if (H5Sclose(sid) < 0) + TEST_ERROR; + if (H5Sclose(asid) < 0) + TEST_ERROR; + if (H5Aclose(aid) < 0) + TEST_ERROR; + if (H5Gclose(gid) < 0) + TEST_ERROR; + if (H5Fclose(fid) < 0) + TEST_ERROR; + + if (dwbuf) { + HDfree(dwbuf); + dwbuf = NULL; + } + + /* Create file access property list */ + if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) + TEST_ERROR; + + /* Set to use the low/high bounds in fapl */ + if (H5Pset_libver_bounds(fapl, low_bound, high_bound) < 0) + TEST_ERROR; + + /* Open the file with fapl */ + if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) + TEST_ERROR; + + /* + * Create the revised and old references in the file + */ + + /* Retrieve dataspace for the existing dataset */ + if ((did = H5Dopen2(fid, "/Group/Dataset", H5P_DEFAULT)) < 0) + TEST_ERROR; + if ((sid = H5Dget_space(did)) < 0) + TEST_ERROR; + + /* Select 15 2x1 hyperslabs for the dataset region reference */ + start[0] = 2; + stride[0] = 5; + count[0] = 15; + block[0] = 2; + if (H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, stride, count, block) < 0) + TEST_ERROR; + + if (high_bound >= H5F_LIBVER_V112) { + + /* Create dataspace for the reference dataset */ + if ((ref_sid = H5Screate_simple(1, rev_ref_dims, NULL)) < 0) + TEST_ERROR; + + /* Create a dataset with the revised reference type */ + ref_did = + H5Dcreate2(fid, REVISED_REFS_DSET, H5T_STD_REF, ref_sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + + /* Store the reference to "Attr" */ + if (H5Rcreate_attr(fid, "/", "Attr", H5P_DEFAULT, &rev_ref_wbuf[0]) < 0) + TEST_ERROR; + + /* Store the reference to /Group */ + if (H5Rcreate_object(fid, "/Group", H5P_DEFAULT, &rev_ref_wbuf[1]) < 0) + TEST_ERROR; + + /* Store the dataset region referenced to /Group/Dataset */ + if (H5Rcreate_region(fid, "/Group/Dataset", sid, H5P_DEFAULT, &rev_ref_wbuf[2]) < 0) + TEST_ERROR; + + /* Write to the reference dataset */ + if (H5Dwrite(ref_did, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, rev_ref_wbuf) < 0) + TEST_ERROR; + + /* Destroy references */ + for (i = 0; i < 3; i++) + if (H5Rdestroy(&rev_ref_wbuf[i]) < 0) + TEST_ERROR; + + /* Closing */ + if (H5Dclose(ref_did) < 0) + TEST_ERROR; + + if (H5Sclose(ref_sid) < 0) + TEST_ERROR; + } + + /* Create dataspace for the reference dataset */ + if ((ref_sid = H5Screate_simple(1, old_ref_dims, NULL)) < 0) + TEST_ERROR; + + /* Create a dataset with the old object reference type */ + if ((ref_did = H5Dcreate2(fid, OLD_REF_OBJ_DSET, H5T_STD_REF_OBJ, ref_sid, H5P_DEFAULT, H5P_DEFAULT, + H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* Create reference to /Group */ + if (H5Rcreate(&old_ref_obj_wbuf[0], fid, "/Group", H5R_OBJECT, -1) < 0) + TEST_ERROR; + + /* Write to the reference dataset */ + if (H5Dwrite(ref_did, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, old_ref_obj_wbuf) < 0) + TEST_ERROR; + + /* Close the dataset */ + if (H5Dclose(ref_did) < 0) + TEST_ERROR; + + /* Create a dataset with the old dataset region reference type */ + if ((ref_did = H5Dcreate2(fid, OLD_REF_REG_DSET, H5T_STD_REF_DSETREG, ref_sid, H5P_DEFAULT, H5P_DEFAULT, + H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* Create dataset region reference */ + if (H5Rcreate(&old_ref_reg_wbuf[0], fid, "/Group/Dataset", H5R_DATASET_REGION, sid) < 0) + TEST_ERROR; + + /* Write selection to the reference dataset */ + if (H5Dwrite(ref_did, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, old_ref_reg_wbuf) < 0) + TEST_ERROR; + + /* Closing */ + if (H5Dclose(ref_did) < 0) + TEST_ERROR; + if (H5Sclose(ref_sid) < 0) + TEST_ERROR; + + if (H5Dclose(did) < 0) + TEST_ERROR; + if (H5Sclose(sid) < 0) + TEST_ERROR; + if (H5Pclose(fapl) < 0) + TEST_ERROR; + if (H5Fclose(fid) < 0) + TEST_ERROR; + + return SUCCEED; + +error: + H5E_BEGIN_TRY + { + H5Dclose(ref_did); + H5Sclose(ref_sid); + H5Dclose(did); + H5Sclose(sid); + H5Pclose(fapl); + H5Fclose(fid); + HDfree(dwbuf); + } + H5E_END_TRY; + + return FAIL; + +} /* gen_ref_files() */ + int main(void) { @@ -715,6 +1233,50 @@ main(void) if (gen_v18_v18() < 0) TEST_ERROR; + /* + * Files generated via gen_ref_files() + */ + + /* Generate bounds_ref_earliest_latest.h5 */ + if (gen_ref_files(FILENAME_REF_E_L, H5F_LIBVER_EARLIEST, H5F_LIBVER_LATEST) < 0) + TEST_ERROR; + + /* Generate bounds_ref_latest_latest.h5 */ + if (gen_ref_files(FILENAME_REF_L_L, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) + TEST_ERROR; + + /* Generate bounds_ref_v112_v112.h5 */ + if (gen_ref_files(FILENAME_REF_V112_V112, H5F_LIBVER_V112, H5F_LIBVER_V112) < 0) + TEST_ERROR; + + /* Generate bounds_ref_v110_v110.h5 */ + if (gen_ref_files(FILENAME_REF_V110_V110, H5F_LIBVER_V110, H5F_LIBVER_V110) < 0) + TEST_ERROR; + + /* Generate bounds_ref_v18_v18.h5 */ + if (gen_ref_files(FILENAME_REF_V18_V18, H5F_LIBVER_V18, H5F_LIBVER_V18) < 0) + TEST_ERROR; + + /* + * Files generated via gen_sel_files() + */ + + /* Generate bounds_sel_earliest_latest.h5 */ + if (gen_sel_files(FILENAME_SEL_E_L, H5F_LIBVER_EARLIEST, H5F_LIBVER_LATEST) < 0) + TEST_ERROR; + + /* Generate bounds_sel_latest_latest.h5 */ + if (gen_sel_files(FILENAME_SEL_L_L, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) + TEST_ERROR; + + /* Generate bounds_sel_v112_v112.h5 */ + if (gen_sel_files(FILENAME_SEL_V112_V112, H5F_LIBVER_V112, H5F_LIBVER_V112) < 0) + TEST_ERROR; + + /* Generate bounds_sel_v110_v110.h5 */ + if (gen_sel_files(FILENAME_SEL_V110_V110, H5F_LIBVER_V110, H5F_LIBVER_V110) < 0) + TEST_ERROR; + return EXIT_SUCCESS; error: diff --git a/test/gen_cross.c b/test/gen_cross.c index 37c6dcf..030cc65 100644 --- a/test/gen_cross.c +++ b/test/gen_cross.c @@ -928,7 +928,7 @@ create_deflate_dsets_float(hid_t fid, hid_t fsid, hid_t msid) #else /* H5_HAVE_FILTER_DEFLATE */ const char *not_supported = "Deflate filter is not enabled. Can't create the dataset."; - puts(not_supported); + HDputs(not_supported); #endif /* H5_HAVE_FILTER_DEFLATE */ return 0; diff --git a/test/gen_filters.c b/test/gen_filters.c index 502e041..0d107a9 100644 --- a/test/gen_filters.c +++ b/test/gen_filters.c @@ -243,12 +243,12 @@ main(void) if (nerrors) goto error; - printf("All tests passed.\n"); + HDprintf("All tests passed.\n"); return 0; error: nerrors = MAX(1, nerrors); - printf("***** %d GEN_FILTERS FAILURES *****\n", nerrors); + HDprintf("***** %d GEN_FILTERS FAILURES *****\n", nerrors); return 1; } diff --git a/test/getname.c b/test/getname.c index 61feee6..0cf9768 100644 --- a/test/getname.c +++ b/test/getname.c @@ -3787,7 +3787,7 @@ main(void) if (nerrors) goto error; - puts("All getname tests passed."); + HDputs("All getname tests passed."); h5_cleanup(FILENAME, fapl); @@ -3797,7 +3797,7 @@ error: H5E_BEGIN_TRY { H5Fclose(file_id); } H5E_END_TRY; - puts("***** GET NAME TESTS FAILED *****"); + HDputs("***** GET NAME TESTS FAILED *****"); return 1; } diff --git a/test/gheap.c b/test/gheap.c index 51e1dd2..1a8a4c0 100644 --- a/test/gheap.c +++ b/test/gheap.c @@ -42,9 +42,9 @@ nerrors++; \ if (nerrors <= GHEAP_REPEATED_ERR_LIM) { \ H5_FAILED(); \ - puts(MSG); \ + HDputs(MSG); \ if (nerrors == GHEAP_REPEATED_ERR_LIM) \ - puts(" Suppressing further errors..."); \ + HDputs(" Suppressing further errors..."); \ } /* end if */ \ } /* end GHEAP_REPEATED_ERR */ @@ -226,7 +226,7 @@ test_2(hid_t fapl) HDputs(" Unable to read object"); nerrors++; } - else if (memcmp(in, out, size)) { + else if (HDmemcmp(in, out, size)) { H5_FAILED(); HDputs(" Value read doesn't match value written"); nerrors++; diff --git a/test/h5test.c b/test/h5test.c index 33af30d..dbd1a90 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -2267,3 +2267,61 @@ done: HDfree(dup_buf); return ret_value; } /* end h5_duplicate_file_by_bytes() */ + +/*------------------------------------------------------------------------- + * Function: h5_check_if_file_locking_enabled + * + * Purpose: Checks if file locking is enabled on this file system. + * + * Return: SUCCEED/FAIL + * are_enabled will be FALSE if file locking is disabled on + * the file system of if there were errors. + * + *------------------------------------------------------------------------- + */ +herr_t +h5_check_if_file_locking_enabled(hbool_t *is_enabled) +{ + const char *filename = "locking_test_file"; + int pmode = O_RDWR | O_CREAT | O_TRUNC; + int fd = -1; + + *is_enabled = TRUE; + + if ((fd = HDopen(filename, pmode, H5_POSIX_CREATE_MODE_RW)) < 0) + goto error; + + /* Test HDflock() to see if it works */ + if (HDflock(fd, LOCK_EX | LOCK_NB) < 0) { + if (ENOSYS == errno) { + /* When errno is set to ENOSYS, the file system does not support + * locking, so ignore it. This is most frequently used on + * Lustre. If we also want to check for disabled NFS locks + * we'll need to check for ENOLCK, too. That isn't done by + * default here since that could also represent an actual + * error condition. + */ + errno = 0; + *is_enabled = FALSE; + } + else + goto error; + } + if (HDflock(fd, LOCK_UN) < 0) + goto error; + + if (HDclose(fd) < 0) + goto error; + if (HDremove(filename) < 0) + goto error; + + return SUCCEED; + +error: + *is_enabled = FALSE; + if (fd > -1) { + HDclose(fd); + HDremove(filename); + } + return FAIL; +} /* end h5_check_if_file_locking_enabled() */ diff --git a/test/h5test.h b/test/h5test.h index df996c2..66929cd 100644 --- a/test/h5test.h +++ b/test/h5test.h @@ -258,6 +258,7 @@ H5TEST_DLL H5VL_class_t *h5_get_dummy_vol_class(void); H5TEST_DLL const char * h5_get_version_string(H5F_libver_t libver); H5TEST_DLL int h5_compare_file_bytes(char *fname1, char *fname2); H5TEST_DLL int h5_duplicate_file_by_bytes(const char *orig, const char *dest); +H5TEST_DLL herr_t h5_check_if_file_locking_enabled(hbool_t *are_enabled); /* Functions that will replace components of a FAPL */ H5TEST_DLL herr_t h5_get_vfd_fapl(hid_t fapl_id); diff --git a/test/hdfs.c b/test/hdfs.c index ee66314..a59cdb6 100644 --- a/test/hdfs.c +++ b/test/hdfs.c @@ -303,7 +303,7 @@ *---------------------------------------------------------------------------- */ #define JSVERIFY_STR(expected, actual, reason) \ - if (strcmp((actual), (expected)) != 0) { \ + if (HDstrcmp((actual), (expected)) != 0) { \ JSERR_STR((expected), (actual), (reason)); \ goto error; \ } /* JSVERIFY_STR */ @@ -348,7 +348,7 @@ *---------------------------------------------------------------------------- */ #define JSVERIFY_STR(actual, expected, reason) \ - if (strcmp((actual), (expected)) != 0) { \ + if (HDstrcmp((actual), (expected)) != 0) { \ JSERR_STR((expected), (actual), (reason)); \ goto error; \ } /* JSVERIFY_STR */ @@ -414,8 +414,8 @@ test_fapl_config_validation(void) #ifndef H5_HAVE_LIBHDFS TESTING("HDFS fapl configuration validation"); SKIPPED(); - puts(" HDFS VFD is not enabled"); - fflush(stdout); + HDputs(" HDFS VFD is not enabled"); + HDfflush(stdout); return 0; #else @@ -564,9 +564,9 @@ test_fapl_config_validation(void) JSVERIFY(config.version, fa_fetch.version, "version number mismatch") JSVERIFY(config.namenode_port, fa_fetch.namenode_port, "namenode port mismatch") JSVERIFY(config.stream_buffer_size, fa_fetch.stream_buffer_size, "streambuffer size mismatch") - JSVERIFY_STR(config.namenode_name, fa_fetch.namenode_name, NULL) - JSVERIFY_STR(config.user_name, fa_fetch.user_name, NULL) - JSVERIFY_STR(config.kerberos_ticket_cache, fa_fetch.kerberos_ticket_cache, NULL) + JSVERIFY_STR(config.namenode_name, fa_fetch.namenode_name, "node name mismatch") + JSVERIFY_STR(config.user_name, fa_fetch.user_name, "user name mismatch") + JSVERIFY_STR(config.kerberos_ticket_cache, fa_fetch.kerberos_ticket_cache, "kerberos ticket cache mismatch") } /*----------------------------- @@ -620,8 +620,8 @@ test_hdfs_fapl(void) #ifndef H5_HAVE_LIBHDFS TESTING("HDFS fapl "); SKIPPED(); - puts(" HDFS VFD is not enabled"); - fflush(stdout); + HDputs(" HDFS VFD is not enabled"); + HDfflush(stdout); return 0; #else @@ -703,8 +703,8 @@ test_vfd_open(void) #ifndef H5_HAVE_LIBHDFS TESTING("HDFS VFD-level open"); SKIPPED(); - puts(" HDFS VFD is not enabled"); - fflush(stdout); + HDputs(" HDFS VFD is not enabled"); + HDfflush(stdout); return 0; #else @@ -956,8 +956,8 @@ test_eof_eoa(void) #ifndef H5_HAVE_LIBHDFS TESTING("HDFS eof/eoa gets and sets"); SKIPPED(); - puts(" HDFS VFD is not enabled"); - fflush(stdout); + HDputs(" HDFS VFD is not enabled"); + HDfflush(stdout); return 0; #else @@ -996,7 +996,7 @@ test_eof_eoa(void) /* verify as found */ - JSVERIFY(5458199, H5FDget_eof(fd_shakespeare, H5FD_MEM_DEFAULT), NULL) + JSVERIFY(5458199, H5FDget_eof(fd_shakespeare, H5FD_MEM_DEFAULT), "EOF mismatch") JSVERIFY(H5FDget_eof(fd_shakespeare, H5FD_MEM_DEFAULT), H5FDget_eof(fd_shakespeare, H5FD_MEM_DRAW), "mismatch between DEFAULT and RAW memory types") JSVERIFY(0, H5FDget_eoa(fd_shakespeare, H5FD_MEM_DEFAULT), "EoA should be unset by H5FDopen") @@ -1066,8 +1066,8 @@ test_H5FDread_without_eoa_set_fails(void) #ifndef H5_HAVE_LIBHDFS TESTING("HDFS VFD read-eoa temporal coupling library limitation"); SKIPPED(); - puts(" HDFS VFD is not enabled"); - fflush(stdout); + HDputs(" HDFS VFD is not enabled"); + HDfflush(stdout); return 0; #else @@ -1165,8 +1165,8 @@ test_read(void) #ifndef H5_HAVE_LIBHDFS TESTING("HDFS VFD read/range-gets"); SKIPPED(); - puts(" HDFS VFD is not enabled"); - fflush(stdout); + HDputs(" HDFS VFD is not enabled"); + HDfflush(stdout); return 0; #else @@ -1272,7 +1272,7 @@ test_read(void) HADDR_UNDEF); /* Demonstrate success with "automatic" value */ FAIL_IF(NULL == file_raven) - JSVERIFY(6464, H5FDget_eof(file_raven, H5FD_MEM_DEFAULT), NULL) + JSVERIFY(6464, H5FDget_eof(file_raven, H5FD_MEM_DEFAULT), "EOF mismatch") /********* * TESTS * @@ -1376,8 +1376,8 @@ test_noops_and_autofails(void) #ifndef H5_HAVE_LIBHDFS TESTING("HDFS VFD always-fail and no-op routines"); SKIPPED(); - puts(" HDFS VFD is not enabled"); - fflush(stdout); + HDputs(" HDFS VFD is not enabled"); + HDfflush(stdout); return 0; #else @@ -1432,8 +1432,8 @@ test_noops_and_autofails(void) /* no-op calls to `lock()` and `unlock()` */ JSVERIFY(SUCCEED, H5FDlock(file, TRUE), "lock always succeeds; has no effect") - JSVERIFY(SUCCEED, H5FDlock(file, FALSE), NULL) - JSVERIFY(SUCCEED, H5FDunlock(file), NULL) + JSVERIFY(SUCCEED, H5FDlock(file, FALSE), "lock issue") + JSVERIFY(SUCCEED, H5FDunlock(file), "unlock issue") /* Lock/unlock with null file or similar error crashes tests. * HDassert in calling heirarchy, `H5FD[un]lock()` and `H5FD_[un]lock()` */ @@ -1528,8 +1528,8 @@ test_H5F_integration(void) #ifndef H5_HAVE_LIBHDFS TESTING("HDFS file access through HD5F library (H5F API)"); SKIPPED(); - puts(" HDFS VFD is not enabled"); - fflush(stdout); + HDputs(" HDFS VFD is not enabled"); + HDfflush(stdout); return 0; #else @@ -1597,7 +1597,7 @@ error: #if HDFS_TEST_DEBUG HDprintf("\nerror!"); - fflush(stdout); + HDfflush(stdout); #endif /* HDFS_TEST_DEBUG */ if (fapl_id >= 0) { diff --git a/test/hyperslab.c b/test/hyperslab.c index 43992de..5c7b78f 100644 --- a/test/hyperslab.c +++ b/test/hyperslab.c @@ -177,7 +177,7 @@ test_fill(size_t nx, size_t ny, size_t nz, size_t di, size_t dj, size_t dk, size } /* end else */ HDsprintf(s, "Testing hyperslab fill %-11s variable hyperslab", dim); HDprintf("%-70s", s); - fflush(stdout); + HDfflush(stdout); /* Allocate array */ if (NULL == (dst = (uint8_t *)HDcalloc((size_t)1, nx * ny * nz))) @@ -366,7 +366,7 @@ test_copy(int mode, size_t nx, size_t ny, size_t nz, size_t di, size_t dj, size_ HDsprintf(s, "Testing hyperslab copy %-11s %s", dim, sub); HDprintf("%-70s", s); - fflush(stdout); + HDfflush(stdout); /* * Allocate arrays @@ -575,7 +575,7 @@ test_multifill(size_t nx) hsize_t i, j; HDprintf("%-70s", "Testing multi-byte fill value"); - fflush(stdout); + HDfflush(stdout); /* Initialize the source and destination */ if (NULL == (src = (struct a_struct *)HDmalloc(nx * sizeof(*src)))) @@ -687,7 +687,7 @@ test_endian(size_t nx) hsize_t i, j; HDprintf("%-70s", "Testing endian conversion by stride"); - fflush(stdout); + HDfflush(stdout); /* Initialize arrays */ if (NULL == (src = (uint8_t *)HDmalloc(nx * 4))) @@ -773,7 +773,7 @@ test_transpose(size_t nx, size_t ny) HDsprintf(s, "Testing 2d transpose by stride %4lux%-lud", (unsigned long)nx, (unsigned long)ny); HDprintf("%-70s", s); - fflush(stdout); + HDfflush(stdout); /* Initialize */ if (NULL == (src = (int *)HDmalloc(nx * ny * sizeof(*src)))) @@ -872,7 +872,7 @@ test_sub_super(size_t nx, size_t ny) HDsprintf(s, "Testing image sampling %4lux%-4lu to %4lux%-4lu ", (unsigned long)(2 * nx), (unsigned long)(2 * ny), (unsigned long)nx, (unsigned long)ny); HDprintf("%-70s", s); - fflush(stdout); + HDfflush(stdout); /* Initialize */ if (NULL == (full = (uint8_t *)HDmalloc(4 * nx * ny))) @@ -922,7 +922,7 @@ test_sub_super(size_t nx, size_t ny) HDsprintf(s, "Testing image sampling %4lux%-4lu to %4lux%-4lu ", (unsigned long)nx, (unsigned long)ny, (unsigned long)(2 * nx), (unsigned long)(2 * ny)); HDprintf("%-70s", s); - fflush(stdout); + HDfflush(stdout); /* Setup stride */ size[0] = nx; diff --git a/test/istore.c b/test/istore.c index a724359..c600c31 100644 --- a/test/istore.c +++ b/test/istore.c @@ -619,13 +619,13 @@ main(int argc, char *argv[]) else { int i; for (i = 1, size_of_test = 0; i < argc; i++) { - if (!strcmp(argv[i], "small")) { + if (!HDstrcmp(argv[i], "small")) { size_of_test |= TEST_SMALL; } - else if (!strcmp(argv[i], "medium")) { + else if (!HDstrcmp(argv[i], "medium")) { size_of_test |= TEST_MEDIUM; } - else if (!strcmp(argv[i], "large")) { + else if (!HDstrcmp(argv[i], "large")) { size_of_test |= TEST_LARGE; } else { diff --git a/test/lheap.c b/test/lheap.c index 17e3082..27e025e 100644 --- a/test/lheap.c +++ b/test/lheap.c @@ -103,7 +103,7 @@ main(void) if (j > 4) buf[j] = '\0'; - if (UFAIL == (obj[i] = H5HL_insert(f, heap, strlen(buf) + 1, buf))) { + if (UFAIL == (obj[i] = H5HL_insert(f, heap, HDstrlen(buf) + 1, buf))) { H5_FAILED(); H5Eprint2(H5E_DEFAULT, stdout); goto error; @@ -155,7 +155,7 @@ main(void) goto error; } - if (strcmp(s, buf)) { + if (HDstrcmp(s, buf)) { H5_FAILED(); HDprintf(" i=%d, heap offset=%lu\n", i, (unsigned long)(obj[i])); HDprintf(" got: \"%s\"\n", s); diff --git a/test/links.c b/test/links.c index 43cd83d..f0932dc 100644 --- a/test/links.c +++ b/test/links.c @@ -14138,7 +14138,7 @@ UD_cb_create(const char *link_name, hid_t loc_group, const void *udata, size_t u if (lcpl_id < 0) TEST_ERROR - if (HDstrcmp(link_name, UD_CB_LINK_NAME) && strcmp(link_name, NEW_UD_CB_LINK_NAME)) + if (HDstrcmp(link_name, UD_CB_LINK_NAME) && HDstrcmp(link_name, NEW_UD_CB_LINK_NAME)) TEST_ERROR if (HDstrcmp((const char *)udata, UD_CB_TARGET)) TEST_ERROR @@ -14165,7 +14165,7 @@ UD_cb_traverse(const char *link_name, hid_t cur_group, const void *udata, size_t if (udata_size > 0 && !udata) TEST_ERROR - if (HDstrcmp(link_name, UD_CB_LINK_NAME) && strcmp(link_name, NEW_UD_CB_LINK_NAME)) + if (HDstrcmp(link_name, UD_CB_LINK_NAME) && HDstrcmp(link_name, NEW_UD_CB_LINK_NAME)) TEST_ERROR if (HDstrcmp((const char *)udata, UD_CB_TARGET)) TEST_ERROR @@ -14537,7 +14537,7 @@ lapl_udata(hid_t fapl, hbool_t new_format) TEST_ERROR /* Now use the same ud link to access group_b */ - strcpy(group_b_name, "group_b"); + HDstrcpy(group_b_name, "group_b"); if (H5Pset(plist_id, DEST_PROP_NAME, group_b_name) < 0) TEST_ERROR @@ -14851,7 +14851,7 @@ ud_link_errors(hid_t fapl, hbool_t new_format) H5E_END_TRY; /* Create a user-defined link to the group. */ - strcpy(group_name, "/group"); + HDstrcpy(group_name, "/group"); if (H5Lcreate_ud(fid, "/ud_link", (H5L_type_t)UD_CBFAIL_TYPE, &group_name, HDstrlen(group_name) + 1, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR diff --git a/test/links_env.c b/test/links_env.c index 0e5d1c0..2cfa3fa 100644 --- a/test/links_env.c +++ b/test/links_env.c @@ -112,7 +112,7 @@ external_link_env(hid_t fapl, hbool_t new_format) /* Should be able to find the target file from pathnames set via HDF5_EXT_PREFIX */ if (gid < 0) { H5_FAILED(); - puts(" Should have found the file in tmp_links_env directory."); + HDputs(" Should have found the file in tmp_links_env directory."); goto error; } @@ -6112,7 +6112,7 @@ test_mf_bug1(const char *env_h5_drvr, hid_t fapl) /* Free memb_name */ for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) - free(memb_name[mt]); + HDfree(memb_name[mt]); } /* end else */ /* Close memb_fapl */ @@ -7685,7 +7685,7 @@ set_multi_split(hid_t fapl, hsize_t pagesize, hbool_t is_multi_or_split) /* Free memb_name */ for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) - free(memb_name[mt]); + HDfree(memb_name[mt]); return 0; @@ -8841,7 +8841,7 @@ test_page_alignment(const char *env_h5_drvr, hid_t fapl) /* Free memb_name */ for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) - free(memb_name[mt]); + HDfree(memb_name[mt]); /* Close memb_fapl */ if (H5Pclose(memb_fapl) < 0) diff --git a/test/mirror_vfd.c b/test/mirror_vfd.c index 325999b..43141e0 100644 --- a/test/mirror_vfd.c +++ b/test/mirror_vfd.c @@ -63,8 +63,8 @@ static unsigned int g_verbosity = DEFAULT_VERBOSITY; #define LOGPRINT(lvl, ...) \ do { \ if ((lvl) <= g_verbosity) { \ - fprintf(g_log_stream, __VA_ARGS__); \ - fflush(g_log_stream); \ + HDfprintf(g_log_stream, __VA_ARGS__); \ + HDfflush(g_log_stream); \ } \ } while (0) @@ -150,7 +150,7 @@ _populate_filepath(const char *dirname, const char *_basename, hid_t fapl_id, ch } if (HDsnprintf(_path, H5FD_SPLITTER_PATH_MAX, "%s%s%s", dirname, - (dirname[strlen(dirname)] == '/') ? "" : "/", /* slash iff needed */ + (dirname[HDstrlen(dirname)] == '/') ? "" : "/", /* slash iff needed */ _basename) > H5FD_SPLITTER_PATH_MAX) { TEST_ERROR; } diff --git a/test/mtime.c b/test/mtime.c index c28b81a..a8ad6ae 100644 --- a/test/mtime.c +++ b/test/mtime.c @@ -147,7 +147,7 @@ main(void) H5_FAILED(); /* If this fails, examine H5Omtime.c. Modification time is very * system dependent (e.g., on Windows DST must be hardcoded). */ - puts(" Old modification time incorrect"); + HDputs(" Old modification time incorrect"); goto error; } if (H5Fclose(file) < 0) diff --git a/test/objcopy.c b/test/objcopy.c index 383bd05..876e7de 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -4494,7 +4494,7 @@ test_copy_dataset_compressed(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid #ifndef H5_HAVE_FILTER_DEFLATE SKIPPED(); - puts(" Deflation filter not available"); + HDputs(" Deflation filter not available"); #else /* H5_HAVE_FILTER_DEFLATE */ /* set initial data values */ for (i = 0; i < DIM_SIZE_1; i++) @@ -4919,7 +4919,7 @@ test_copy_dataset_no_edge_filt(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h #ifndef H5_HAVE_FILTER_DEFLATE SKIPPED(); - puts(" Deflation filter not available"); + HDputs(" Deflation filter not available"); #else /* H5_HAVE_FILTER_DEFLATE */ /* set initial data values */ for (i = 0; i < DIM_SIZE_1; i++) @@ -7273,7 +7273,7 @@ test_copy_dataset_compressed_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, #ifndef H5_HAVE_FILTER_DEFLATE SKIPPED(); - puts(" Deflation filter not available"); + HDputs(" Deflation filter not available"); #else /* H5_HAVE_FILTER_DEFLATE */ /* set initial data values */ for (i = 0; i < DIM_SIZE_1; i++) { diff --git a/test/ohdr.c b/test/ohdr.c index 87d394b..14d021b 100644 --- a/test/ohdr.c +++ b/test/ohdr.c @@ -121,8 +121,12 @@ test_cont(char *filename, hid_t fapl) FAIL_STACK_ERROR if (1 != H5O_link(&oh_locB, 1)) FAIL_STACK_ERROR + if (H5AC_prep_for_file_flush(f) < 0) + FAIL_STACK_ERROR if (H5AC_flush(f) < 0) FAIL_STACK_ERROR + if (H5AC_secure_from_file_flush(f) < 0) + FAIL_STACK_ERROR if (H5O__expunge_chunks_test(&oh_locA) < 0) FAIL_STACK_ERROR @@ -1814,8 +1818,12 @@ main(void) FAIL_STACK_ERROR if (1 != H5O_link(&oh_loc, 1)) FAIL_STACK_ERROR + if (H5AC_prep_for_file_flush(f) < 0) + FAIL_STACK_ERROR if (H5AC_flush(f) < 0) FAIL_STACK_ERROR + if (H5AC_secure_from_file_flush(f) < 0) + FAIL_STACK_ERROR if (H5AC_expunge_entry(f, H5AC_OHDR, oh_loc.addr, H5AC__NO_FLAGS_SET) < 0) FAIL_STACK_ERROR if (NULL == H5O_msg_read(&oh_loc, H5O_MTIME_NEW_ID, &ro)) @@ -1831,8 +1839,12 @@ main(void) time_new = 33333333; if (H5O_msg_write(&oh_loc, H5O_MTIME_NEW_ID, 0, 0, &time_new) < 0) FAIL_STACK_ERROR + if (H5AC_prep_for_file_flush(f) < 0) + FAIL_STACK_ERROR if (H5AC_flush(f) < 0) FAIL_STACK_ERROR + if (H5AC_secure_from_file_flush(f) < 0) + FAIL_STACK_ERROR if (H5AC_expunge_entry(f, H5AC_OHDR, oh_loc.addr, H5AC__NO_FLAGS_SET) < 0) FAIL_STACK_ERROR if (NULL == H5O_msg_read(&oh_loc, H5O_MTIME_NEW_ID, &ro)) @@ -1862,8 +1874,12 @@ main(void) if (H5O_msg_create(&oh_loc, H5O_MTIME_ID, 0, 0, &time_new) < 0) FAIL_STACK_ERROR } /* end for */ + if (H5AC_prep_for_file_flush(f) < 0) + FAIL_STACK_ERROR if (H5AC_flush(f) < 0) FAIL_STACK_ERROR + if (H5AC_secure_from_file_flush(f) < 0) + FAIL_STACK_ERROR if (H5AC_expunge_entry(f, H5AC_OHDR, oh_loc.addr, H5AC__NO_FLAGS_SET) < 0) FAIL_STACK_ERROR @@ -1905,8 +1921,12 @@ main(void) time_new = (i + 1) * 1000 + 10; if (H5O_msg_create(&oh_loc, H5O_MTIME_NEW_ID, 0, 0, &time_new) < 0) FAIL_STACK_ERROR + if (H5AC_prep_for_file_flush(f) < 0) + FAIL_STACK_ERROR if (H5AC_flush(f) < 0) FAIL_STACK_ERROR + if (H5AC_secure_from_file_flush(f) < 0) + FAIL_STACK_ERROR if (H5AC_expunge_entry(f, H5AC_OHDR, oh_loc.addr, H5AC__NO_FLAGS_SET) < 0) FAIL_STACK_ERROR } /* end for */ @@ -1934,8 +1954,12 @@ main(void) time_new = 22222222; if (H5O_msg_create(&oh_loc, H5O_MTIME_NEW_ID, H5O_MSG_FLAG_CONSTANT, 0, &time_new) < 0) FAIL_STACK_ERROR + if (H5AC_prep_for_file_flush(f) < 0) + FAIL_STACK_ERROR if (H5AC_flush(f) < 0) FAIL_STACK_ERROR + if (H5AC_secure_from_file_flush(f) < 0) + FAIL_STACK_ERROR if (H5AC_expunge_entry(f, H5AC_OHDR, oh_loc.addr, H5AC__NO_FLAGS_SET) < 0) FAIL_STACK_ERROR if (NULL == H5O_msg_read(&oh_loc, H5O_MTIME_NEW_ID, &ro)) diff --git a/test/page_buffer.c b/test/page_buffer.c index ca33872..abbae32 100644 --- a/test/page_buffer.c +++ b/test/page_buffer.c @@ -349,7 +349,7 @@ set_multi_split(const char *env_h5_drvr, hid_t fapl, hsize_t pagesize) /* Free memb_name */ for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) - free(memb_name[mt]); + HDfree(memb_name[mt]); } /* end if */ diff --git a/test/pool.c b/test/pool.c index 05304e5..ef2a627 100644 --- a/test/pool.c +++ b/test/pool.c @@ -784,11 +784,11 @@ main(void) if (nerrors) goto error; - puts("All memory pool tests passed."); + HDputs("All memory pool tests passed."); return 0; error: - puts("*** TESTS FAILED ***"); + HDputs("*** TESTS FAILED ***"); return 1; } diff --git a/test/ros3.c b/test/ros3.c index 7ecba0e..654082b 100644 --- a/test/ros3.c +++ b/test/ros3.c @@ -318,7 +318,7 @@ jserr_str(const char *expected, const char *actual, const char *reason) *---------------------------------------------------------------------------- */ #define JSVERIFY_STR(expected, actual, reason) \ - if (strcmp((actual), (expected)) != 0) { \ + if (HDstrcmp((actual), (expected)) != 0) { \ JSERR_STR((expected), (actual), (reason)); \ goto error; \ } /* JSVERIFY_STR */ @@ -363,7 +363,7 @@ jserr_str(const char *expected, const char *actual, const char *reason) *---------------------------------------------------------------------------- */ #define JSVERIFY_STR(actual, expected, reason) \ - if (strcmp((actual), (expected)) != 0) { \ + if (HDstrcmp((actual), (expected)) != 0) { \ JSERR_STR((expected), (actual), (reason)); \ goto error; \ } /* JSVERIFY_STR */ @@ -560,8 +560,8 @@ test_fapl_config_validation(void) if (FALSE == s3_test_bucket_defined) { SKIPPED(); - puts(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined"); - fflush(stdout); + HDputs(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined"); + HDfflush(stdout); return 0; } @@ -835,8 +835,8 @@ test_vfd_open(void) if (FALSE == s3_test_bucket_defined) { SKIPPED(); - puts(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined"); - fflush(stdout); + HDputs(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined"); + HDfflush(stdout); return 0; } @@ -969,15 +969,15 @@ test_eof_eoa(void) if (s3_test_credentials_loaded == 0) { SKIPPED(); - puts(" s3 credentials are not loaded"); - fflush(stdout); + HDputs(" s3 credentials are not loaded"); + HDfflush(stdout); return 0; } if (FALSE == s3_test_bucket_defined) { SKIPPED(); - puts(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined"); - fflush(stdout); + HDputs(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined"); + HDfflush(stdout); return 0; } @@ -1077,15 +1077,15 @@ test_H5FDread_without_eoa_set_fails(void) if (s3_test_credentials_loaded == 0) { SKIPPED(); - puts(" s3 credentials are not loaded"); - fflush(stdout); + HDputs(" s3 credentials are not loaded"); + HDfflush(stdout); return 0; } if (FALSE == s3_test_bucket_defined) { SKIPPED(); - puts(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined"); - fflush(stdout); + HDputs(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined"); + HDfflush(stdout); return 0; } @@ -1248,15 +1248,15 @@ test_read(void) if (s3_test_credentials_loaded == 0) { SKIPPED(); - puts(" s3 credentials are not loaded"); - fflush(stdout); + HDputs(" s3 credentials are not loaded"); + HDfflush(stdout); return 0; } if (FALSE == s3_test_bucket_defined) { SKIPPED(); - puts(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined"); - fflush(stdout); + HDputs(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined"); + HDfflush(stdout); return 0; } @@ -1389,8 +1389,8 @@ test_noops_and_autofails(void) if (FALSE == s3_test_bucket_defined) { SKIPPED(); - puts(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined"); - fflush(stdout); + HDputs(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined"); + HDfflush(stdout); return 0; } @@ -1515,15 +1515,15 @@ test_cmp(void) if (s3_test_credentials_loaded == 0) { SKIPPED(); - puts(" s3 credentials are not loaded"); - fflush(stdout); + HDputs(" s3 credentials are not loaded"); + HDfflush(stdout); return 0; } if (FALSE == s3_test_bucket_defined) { SKIPPED(); - puts(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined"); - fflush(stdout); + HDputs(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined"); + HDfflush(stdout); return 0; } @@ -1636,15 +1636,15 @@ test_H5F_integration(void) if (s3_test_credentials_loaded == 0) { SKIPPED(); - puts(" s3 credentials are not loaded"); - fflush(stdout); + HDputs(" s3 credentials are not loaded"); + HDfflush(stdout); return 0; } if (FALSE == s3_test_bucket_defined) { SKIPPED(); - puts(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined"); - fflush(stdout); + HDputs(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined"); + HDfflush(stdout); return 0; } @@ -1691,7 +1691,7 @@ error: * CLEANUP * ***********/ HDprintf("\nerror!"); - fflush(stdout); + HDfflush(stdout); if (fapl_id >= 0) { H5E_BEGIN_TRY { (void)H5Pclose(fapl_id); } diff --git a/test/s3comms.c b/test/s3comms.c index 862914e..c6173fd 100644 --- a/test/s3comms.c +++ b/test/s3comms.c @@ -311,7 +311,7 @@ jserr_str(const char *expected, const char *actual, const char *reason) *---------------------------------------------------------------------------- */ #define JSVERIFY_STR(expected, actual, reason) \ - if (strcmp((actual), (expected)) != 0) { \ + if (HDstrcmp((actual), (expected)) != 0) { \ JSERR_STR((expected), (actual), (reason)); \ goto error; \ } /* JSVERIFY_STR */ @@ -359,7 +359,7 @@ jserr_str(const char *expected, const char *actual, const char *reason) *---------------------------------------------------------------------------- */ #define JSVERIFY_STR(actual, expected, reason) \ - if (strcmp((actual), (expected)) != 0) { \ + if (HDstrcmp((actual), (expected)) != 0) { \ JSERR_STR((expected), (actual), (reason)); \ goto error; \ } /* JSVERIFY_STR */ @@ -1281,10 +1281,10 @@ test_HMAC_SHA256(void) cases[i].msg); if (cases[i].ret == SUCCEED) { #ifdef VERBOSE - if (0 != strncmp(cases[i].exp, dest, HDstrlen(cases[i].exp))) { + if (0 != HDstrncmp(cases[i].exp, dest, HDstrlen(cases[i].exp))) { /* print out how wrong things are, and then fail */ - dest = (char *)realloc(dest, cases[i].dest_size + 1); + dest = (char *)HDrealloc(dest, cases[i].dest_size + 1); HDassert(dest != NULL); dest[cases[i].dest_size] = 0; HDfprintf(stdout, "ERROR:\n!!! \"%s\"\n != \"%s\"\n", cases[i].exp, dest); @@ -1293,17 +1293,17 @@ test_HMAC_SHA256(void) #else /* VERBOSE not defined */ /* simple pass/fail test */ - JSVERIFY(0, strncmp(cases[i].exp, dest, HDstrlen(cases[i].exp)), NULL); + JSVERIFY(0, HDstrncmp(cases[i].exp, dest, HDstrlen(cases[i].exp)), NULL); #endif /* VERBOSE */ } - free(dest); + HDfree(dest); } PASSED(); return 0; error: - free(dest); + HDfree(dest); return -1; } /* end test_HMAC_SHA256() */ @@ -1369,9 +1369,9 @@ test_nlowercase(void) JSVERIFY(SUCCEED, H5FD_s3comms_nlowercase(dest, cases[i].in, cases[i].len), cases[i].in) if (cases[i].len > 0) { - JSVERIFY(0, strncmp(dest, cases[i].exp, cases[i].len), NULL) + JSVERIFY(0, HDstrncmp(dest, cases[i].exp, cases[i].len), NULL) } - free(dest); + HDfree(dest); } /* end for each testcase */ JSVERIFY(FAIL, H5FD_s3comms_nlowercase(NULL, cases[0].in, cases[0].len), "null distination should fail") @@ -1380,7 +1380,7 @@ test_nlowercase(void) return 0; error: - free(dest); + HDfree(dest); return -1; } /* end test_nlowercase() */ @@ -1741,7 +1741,7 @@ test_percent_encode_char(void) JSVERIFY(SUCCEED, H5FD_s3comms_percent_encode_char(dest, (const unsigned char)cases[i].c, &dest_len), NULL) JSVERIFY(cases[i].exp_len, dest_len, NULL) - JSVERIFY(0, strncmp(dest, cases[i].exp, dest_len), NULL) + JSVERIFY(0, HDstrncmp(dest, cases[i].exp, dest_len), NULL) JSVERIFY_STR(cases[i].exp, dest, NULL) } @@ -1780,8 +1780,8 @@ test_s3r_get_filesize(void) */ if (FALSE == s3_test_bucket_defined) { SKIPPED(); - puts(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined"); - fflush(stdout); + HDputs(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined"); + HDfflush(stdout); return 0; } @@ -1840,14 +1840,14 @@ test_s3r_open(void) if (s3_test_credentials_loaded == 0) { SKIPPED(); - puts(" s3 credentials are not loaded"); - fflush(stdout); + HDputs(" s3 credentials are not loaded"); + HDfflush(stdout); return 0; } if (FALSE == s3_test_bucket_defined) { SKIPPED(); - puts(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined"); - fflush(stdout); + HDputs(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined"); + HDfflush(stdout); return 0; } @@ -1873,7 +1873,7 @@ test_s3r_open(void) FAIL_IF(purl->port == NULL); FAIL_IF(5 < HDsnprintf(purl->port, 5, "9000")) } - else if (strcmp(purl->port, "9000") != 0) { + else if (HDstrcmp(purl->port, "9000") != 0) { FAIL_IF(5 < HDsnprintf(purl->port, 5, "9000")) } else { @@ -2044,8 +2044,8 @@ test_s3r_read(void) */ if (FALSE == s3_test_bucket_defined) { SKIPPED(); - puts(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined"); - fflush(stdout); + HDputs(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined"); + HDfflush(stdout); return 0; } @@ -2105,7 +2105,7 @@ test_s3r_read(void) JSVERIFY(SUCCEED, H5FD_s3comms_s3r_read(handle, (haddr_t)6370, (size_t)0, buffer), NULL) JSVERIFY( 0, - strncmp( + HDstrncmp( buffer, "And my soul from out that shadow that lies floating on the floor\nShall be lifted—nevermore!\n", 94), @@ -2122,7 +2122,7 @@ test_s3r_read(void) H5FD_s3comms_s3r_read(handle, (haddr_t)6400, (size_t)100, /* 6400+100 > 6464 */ buffer), NULL) - JSVERIFY(0, strcmp("", buffer), NULL) + JSVERIFY(0, HDstrcmp("", buffer), NULL) /************************ * read starts past eof * @@ -2132,14 +2132,14 @@ test_s3r_read(void) H5FD_s3comms_s3r_read(handle, (haddr_t)1200699, /* 1200699 > 6464 */ (size_t)100, buffer), NULL) - JSVERIFY(0, strcmp("", buffer), NULL) + JSVERIFY(0, HDstrcmp("", buffer), NULL) /********************** * read starts on eof * **********************/ JSVERIFY(FAIL, H5FD_s3comms_s3r_read(handle, (haddr_t)6464, (size_t)0, buffer), NULL) - JSVERIFY(0, strcmp("", buffer), NULL) + JSVERIFY(0, HDstrcmp("", buffer), NULL) /************* * TEAR DOWN * @@ -2229,10 +2229,10 @@ test_signing_key(void) JSVERIFY(SUCCEED, H5FD_s3comms_signing_key(key, cases[i].secret_key, cases[i].region, cases[i].when), NULL) - JSVERIFY(0, strncmp((const char *)cases[i].exp, (const char *)key, SHA256_DIGEST_LENGTH), + JSVERIFY(0, HDstrncmp((const char *)cases[i].exp, (const char *)key, SHA256_DIGEST_LENGTH), (const char *)cases[i].exp) - free(key); + HDfree(key); key = NULL; } @@ -2255,7 +2255,7 @@ test_signing_key(void) JSVERIFY(FAIL, H5FD_s3comms_signing_key(key, cases[0].secret_key, cases[0].region, NULL), "time string cannot be NULL") - free(key); + HDfree(key); key = NULL; PASSED(); @@ -2263,7 +2263,7 @@ test_signing_key(void) error: if (key != NULL) { - free(key); + HDfree(key); } return -1; @@ -2411,9 +2411,9 @@ test_trim(void) JSVERIFY(SUCCEED, H5FD_s3comms_trim(dest, str, cases[i].in_len, &dest_len), NULL) JSVERIFY(cases[i].exp_len, dest_len, cases[i].in) if (dest_len > 0) { - JSVERIFY(0, strncmp(cases[i].exp, dest, dest_len), cases[i].exp) + JSVERIFY(0, HDstrncmp(cases[i].exp, dest, dest_len), cases[i].exp) } - free(str); + HDfree(str); str = NULL; } /* end for each testcase */ @@ -2424,9 +2424,9 @@ test_trim(void) HDassert(str == NULL); str = (char *)HDmalloc(sizeof(char *) * 11); HDassert(str != NULL); - memcpy(str, "some text ", 11); /* string with null terminator */ + HDmemcpy(str, "some text ", 11); /* string with null terminator */ JSVERIFY(FAIL, H5FD_s3comms_trim(NULL, str, 10, &dest_len), "destination for trim cannot be NULL"); - free(str); + HDfree(str); str = NULL; PASSED(); @@ -2434,7 +2434,7 @@ test_trim(void) error: if (str != NULL) { - free(str); + HDfree(str); } return -1; @@ -2525,9 +2525,9 @@ test_uriencode(void) H5FD_s3comms_uriencode(dest, cases[i].str, str_len, cases[i].encode_slash, &dest_written), NULL); JSVERIFY(HDstrlen(cases[i].expected), dest_written, NULL) - JSVERIFY(0, strncmp(dest, cases[i].expected, dest_written), cases[i].expected); + JSVERIFY(0, HDstrncmp(dest, cases[i].expected, dest_written), cases[i].expected); - free(dest); + HDfree(dest); dest = NULL; } /* end for each testcase */ @@ -2543,7 +2543,7 @@ test_uriencode(void) JSVERIFY(FAIL, H5FD_s3comms_uriencode(dest, NULL, 5, false, &dest_written), "source string cannot be NULL"); - free(dest); + HDfree(dest); dest = NULL; PASSED(); @@ -2551,7 +2551,7 @@ test_uriencode(void) error: if (dest != NULL) { - free(dest); + HDfree(dest); } return -1; diff --git a/test/set_extent.c b/test/set_extent.c index 133ba48..2ad4fd5 100644 --- a/test/set_extent.c +++ b/test/set_extent.c @@ -2621,7 +2621,7 @@ test_random_rank4_vl(hid_t fapl, hid_t dcpl, hbool_t do_fillvalue, hbool_t disab TEST_ERROR if (H5Treclaim(type, mspace, H5P_DEFAULT, wbuf) < 0) TEST_ERROR - free(fill_value.p); + HDfree(fill_value.p); if (H5Sclose(mspace) < 0) TEST_ERROR if (H5Pclose(my_dcpl) < 0) diff --git a/test/swmr.c b/test/swmr.c index 44f4277..61d312b 100644 --- a/test/swmr.c +++ b/test/swmr.c @@ -87,7 +87,7 @@ static int test_file_lock_concur(hid_t fapl); static int test_file_lock_swmr_concur(hid_t fapl); /* Test file lock environment variable */ -static int test_file_lock_env_var(hid_t fapl); +static int test_file_locking(hid_t in_fapl, hbool_t turn_locking_on, hbool_t env_var_override); /* Tests for SWMR VFD flag */ static int test_swmr_vfd_flag(void); @@ -4239,8 +4239,11 @@ test_file_lock_same(hid_t in_fapl) /* Output message about test being performed */ TESTING("File open with different combinations of flags--single process access"); + /* Set locking in the fapl */ if ((fapl = H5Pcopy(in_fapl)) < 0) FAIL_STACK_ERROR + if (H5Pset_file_locking(fapl, TRUE, TRUE) < 0) + FAIL_STACK_ERROR /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[1], fapl, filename, sizeof(filename)); @@ -4400,7 +4403,7 @@ test_file_lock_swmr_same(hid_t in_fapl) /* Output message about test being performed */ TESTING("File open with different combinations of flags + SWMR flags--single process access"); - /* Get a copy of the parameter in_fapl */ + /* Set locking in the fapl */ if ((fapl = H5Pcopy(in_fapl)) < 0) FAIL_STACK_ERROR @@ -4702,8 +4705,11 @@ test_file_lock_concur(hid_t in_fapl) /* Output message about test being performed */ TESTING("File open with different combinations of flags--concurrent access"); + /* Set locking in the fapl */ if ((fapl = H5Pcopy(in_fapl)) < 0) FAIL_STACK_ERROR + if (H5Pset_file_locking(fapl, TRUE, TRUE) < 0) + FAIL_STACK_ERROR /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[1], fapl, filename, sizeof(filename)); @@ -5080,8 +5086,11 @@ test_file_lock_swmr_concur(hid_t in_fapl) /* Output message about test being performed */ TESTING("File open with different combintations of flags + SWMR flags--concurrent access"); + /* Set locking in the fapl */ if ((fapl = H5Pcopy(in_fapl)) < 0) FAIL_STACK_ERROR + if (H5Pset_file_locking(fapl, TRUE, TRUE) < 0) + FAIL_STACK_ERROR /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[2], fapl, filename, sizeof(filename)); @@ -6031,38 +6040,61 @@ error: /**************************************************************** ** -** test_file_lock_swmr_concur(): low-level file test routine. -** With the implementation of file locking, this test checks file -** open with different combinations of flags + SWMR flags. -** This is for concurrent access. +** test_file_locking(): +** Tests various combinations of file locking flags and +** and environment variables. ** *****************************************************************/ static int -test_file_lock_env_var(hid_t in_fapl) +test_file_locking(hid_t in_fapl, hbool_t turn_locking_on, hbool_t env_var_override) { #if !(defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID)) SKIPPED(); HDputs(" Test skipped due to fork or waitpid not defined."); return 0; #else - hid_t fid = -1; /* File ID */ - hid_t fapl = -1; /* File access property list */ - char filename[NAME_BUF_SIZE]; /* file name */ - pid_t childpid = 0; /* Child process ID */ - int child_status; /* Status passed to waitpid */ - int child_wait_option = 0; /* Options passed to waitpid */ - int out_pdf[2]; - int notify = 0; - - TESTING("File locking environment variable"); + hid_t fid = -1; /* File ID */ + hid_t fapl = -1; /* File access property list */ + char filename[NAME_BUF_SIZE]; /* file name */ + pid_t childpid = 0; /* Child process ID */ + int child_status; /* Status passed to waitpid */ + int child_wait_option = 0; /* Options passed to waitpid */ + int out_pdf[2]; + int notify = 0; + int exit_status = 0; + herr_t ret; + + if (turn_locking_on && env_var_override) + TESTING("File locking: ON w/ env var override") + else if (turn_locking_on && !env_var_override) + TESTING("File locking: ON") + else if (!turn_locking_on && env_var_override) + TESTING("File locking: OFF w/ env var override") + else + TESTING("File locking: OFF") - /* Set the environment variable */ - if (HDsetenv("HDF5_USE_FILE_LOCKING", "FALSE", TRUE) < 0) + /* Copy the incoming fapl */ + if ((fapl = H5Pcopy(in_fapl)) < 0) TEST_ERROR - if ((fapl = H5Pcopy(in_fapl)) < 0) + /* Set locking in the fapl */ + if (H5Pset_file_locking(fapl, turn_locking_on ? TRUE : FALSE, TRUE) < 0) TEST_ERROR + /* If requested, set the environment variable */ + if (env_var_override) { + if (HDsetenv("HDF5_USE_FILE_LOCKING", turn_locking_on ? "FALSE" : "TRUE", TRUE) < 0) + TEST_ERROR + if (H5F__reparse_file_lock_variable_test() < 0) + TEST_ERROR + } + else { + if (HDsetenv("HDF5_USE_FILE_LOCKING", "", TRUE) < 0) + TEST_ERROR + if (H5F__reparse_file_lock_variable_test() < 0) + TEST_ERROR + } + /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[1], fapl, filename, sizeof(filename)); @@ -6074,10 +6106,8 @@ test_file_lock_env_var(hid_t in_fapl) if (H5Fclose(fid) < 0) TEST_ERROR - /* Open a file for read-only and then read-write. This would - * normally fail due to the file locking scheme but should - * pass when the environment variable is set to disable file - * locking. + /* Open a file for read-only and then read-write. This will fail + * when the locking scheme is turned on. */ /* Create 1 pipe */ @@ -6105,16 +6135,23 @@ test_file_lock_env_var(hid_t in_fapl) HDexit(EXIT_FAILURE); } - /* Open the test file */ - if ((child_fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) - TEST_ERROR + /* Open and close the test file */ + H5E_BEGIN_TRY + { + child_fid = H5Fopen(filename, H5F_ACC_RDWR, fapl); + ret = H5Fclose(child_fid); + } + H5E_END_TRY; /* Close the pipe */ if (HDclose(out_pdf[0]) < 0) HDexit(EXIT_FAILURE); - HDexit(EXIT_SUCCESS); - } /* end if */ + if (H5I_INVALID_HID == child_fid || FAIL == ret) + HDexit(EXIT_FAILURE); + else + HDexit(EXIT_SUCCESS); + } /* end child process work */ /* close unused read end for out_pdf */ if (HDclose(out_pdf[0]) < 0) @@ -6137,15 +6174,28 @@ test_file_lock_env_var(hid_t in_fapl) if (HDwaitpid(childpid, &child_status, child_wait_option) < 0) TEST_ERROR - /* Check if child terminated normally */ - if (WIFEXITED(child_status)) { - /* Check exit status of the child */ - if (WEXITSTATUS(child_status) != 0) - TEST_ERROR - } /* end if */ + /* Check exit status of the child */ + if (WIFEXITED(child_status)) + exit_status = WEXITSTATUS(child_status); else TEST_ERROR + /* The child process should have passed or failed as follows: + * + * locks on: FAIL + * locks off: PASS + * locks on, env var override: PASS + * locks off, env var override: FAIL + */ + if (turn_locking_on && !env_var_override && (0 == exit_status)) + TEST_ERROR + else if (!turn_locking_on && !env_var_override && (0 != exit_status)) + TEST_ERROR + else if (turn_locking_on && env_var_override && (0 != exit_status)) + TEST_ERROR + else if (!turn_locking_on && env_var_override && (0 == exit_status)) + TEST_ERROR + /* Close the file */ if (H5Fclose(fid) < 0) TEST_ERROR @@ -6170,7 +6220,81 @@ error: #endif /* !(defined(H5_HAVE_FORK && defined(H5_HAVE_WAITPID)) */ -} /* end test_file_lock_env_var() */ +} /* end test_file_locking() */ + +/**************************************************************** +** +** test_different_lock_flags(): +** Tests opening a file multiple times with different lock +** flags. +** +*****************************************************************/ +static int +test_different_lock_flags(hid_t in_fapl) +{ + hid_t fid1 = H5I_INVALID_HID; /* File ID */ + hid_t fid2 = H5I_INVALID_HID; /* File ID */ + hid_t fid3 = H5I_INVALID_HID; /* File ID */ + hid_t fapl_id = H5I_INVALID_HID; /* File access property list */ + char filename[NAME_BUF_SIZE]; /* File name */ + + TESTING("Using different lock flags") + + /* Copy the incoming fapl */ + if ((fapl_id = H5Pcopy(in_fapl)) < 0) + TEST_ERROR + + /* Set locking in the fapl */ + if (H5Pset_file_locking(fapl_id, TRUE, TRUE) < 0) + TEST_ERROR + + /* Set the filename to use for this test (dependent on fapl) */ + h5_fixname(FILENAME[1], fapl_id, filename, sizeof(filename)); + + /* Create the test file */ + if ((fid1 = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) + TEST_ERROR + + /* Open the test file with the same flags (should pass) */ + if ((fid2 = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0) + TEST_ERROR + + /* Unset locking in the fapl */ + if (H5Pset_file_locking(fapl_id, FALSE, FALSE) < 0) + TEST_ERROR + + /* Open the test file with different flags (should FAIL) */ + H5E_BEGIN_TRY { fid3 = H5Fopen(filename, H5F_ACC_RDWR, fapl_id); } + H5E_END_TRY; + if (H5I_INVALID_HID != fid3) + FAIL_PUTS_ERROR("Should not have been able to open a file with different locking flags") + + /* Close the files */ + if (H5Fclose(fid1) < 0) + TEST_ERROR + if (H5Fclose(fid2) < 0) + TEST_ERROR + + /* Close the copied property list */ + if (H5Pclose(fapl_id) < 0) + TEST_ERROR + + PASSED(); + + return 0; + +error: + H5E_BEGIN_TRY + { + H5Pclose(fapl_id); + H5Fclose(fid1); + H5Fclose(fid2); + H5Fclose(fid3); + } + H5E_END_TRY; + + return -1; +} /* end test_different_lock_flags() */ static int test_swmr_vfd_flag(void) @@ -7025,11 +7149,12 @@ error: int main(void) { - int nerrors = 0; /* The # of errors */ - hid_t fapl = -1; /* File access property list ID */ - char * driver = NULL; /* VFD string (from env variable) */ - char * lock_env_var = NULL; /* file locking env var pointer */ - hbool_t use_file_locking; /* read from env var */ + int nerrors = 0; /* The # of errors */ + hid_t fapl = -1; /* File access property list ID */ + char * driver = NULL; /* VFD string (from env variable) */ + char * lock_env_var = NULL; /* file locking env var pointer */ + hbool_t use_file_locking; /* read from env var */ + hbool_t file_locking_enabled = FALSE; /* Checks if the file system supports locks */ /* Skip this test if SWMR I/O is not supported for the VFD specified * by the environment variable. @@ -7050,6 +7175,13 @@ main(void) else use_file_locking = TRUE; + /* Check if file locking is enabled on this file system */ + if (use_file_locking) + if (h5_check_if_file_locking_enabled(&file_locking_enabled) < 0) { + HDprintf("Error when determining if file locks are enabled\n"); + return EXIT_FAILURE; + } + /* Set up */ h5_reset(); @@ -7091,7 +7223,7 @@ main(void) nerrors += test_append_flush_dataset_fixed(fapl); nerrors += test_append_flush_dataset_multiple(fapl); - if (use_file_locking) { + if (use_file_locking && file_locking_enabled) { /* * Tests for: * file open flags--single process access @@ -7118,10 +7250,19 @@ main(void) if (NULL == driver || !HDstrcmp(driver, "") || !HDstrcmp(driver, "sec2")) nerrors += test_swmr_vfd_flag(); - /* This test changes the HDF5_USE_FILE_LOCKING environment variable - * so it should be run last. + /* Test multiple opens via different locking flags */ + if (use_file_locking && file_locking_enabled) + nerrors += test_different_lock_flags(fapl); + + /* These tests change the HDF5_USE_FILE_LOCKING environment variable + * so they should be run last. */ - nerrors += test_file_lock_env_var(fapl); + if (use_file_locking && file_locking_enabled) { + nerrors += test_file_locking(fapl, TRUE, TRUE); + nerrors += test_file_locking(fapl, TRUE, FALSE); + nerrors += test_file_locking(fapl, FALSE, TRUE); + nerrors += test_file_locking(fapl, FALSE, FALSE); + } if (nerrors) goto error; diff --git a/test/tarray.c b/test/tarray.c index ba0982f..d278f51 100644 --- a/test/tarray.c +++ b/test/tarray.c @@ -2222,5 +2222,5 @@ test_array(void) void cleanup_array(void) { - remove(FILENAME); + HDremove(FILENAME); } /* end cleanup_array() */ diff --git a/test/tcoords.c b/test/tcoords.c index e92bdde..a52851d 100644 --- a/test/tcoords.c +++ b/test/tcoords.c @@ -87,10 +87,10 @@ test_singleEnd_selElements(hid_t file, hbool_t is_chunked) } /* Construct dataset's name */ - memset(dset_name, 0, (size_t)NAME_LEN); - strcat(dset_name, SINGLE_END_DSET); + HDmemset(dset_name, 0, (size_t)NAME_LEN); + HDstrcat(dset_name, SINGLE_END_DSET); if (is_chunked) - strcat(dset_name, "_chunked"); + HDstrcat(dset_name, "_chunked"); did = H5Dcreate2(file, dset_name, H5T_NATIVE_INT, sid, H5P_DEFAULT, plid, H5P_DEFAULT); CHECK(did, FAIL, "H5Dcreate2"); @@ -259,10 +259,10 @@ test_singleEnd_selHyperslab(hid_t file, hbool_t is_chunked) hsize_t mem3_block[4] = {1, 3, 6, 1}; /* Construct dataset's name */ - memset(dset_name, 0, NAME_LEN); - strcat(dset_name, SINGLE_END_DSET); + HDmemset(dset_name, 0, NAME_LEN); + HDstrcat(dset_name, SINGLE_END_DSET); if (is_chunked) - strcat(dset_name, "_chunked"); + HDstrcat(dset_name, "_chunked"); /* Dataspace for the dataset in file */ sid = H5Screate_simple(4, da_dims, da_dims); @@ -436,10 +436,10 @@ test_multiple_ends(hid_t file, hbool_t is_chunked) } /* Construct dataset's name */ - memset(dset_name, 0, NAME_LEN); - strcat(dset_name, MULTI_ENDS_SEL_HYPER_DSET); + HDmemset(dset_name, 0, NAME_LEN); + HDstrcat(dset_name, MULTI_ENDS_SEL_HYPER_DSET); if (is_chunked) - strcat(dset_name, "_chunked"); + HDstrcat(dset_name, "_chunked"); did = H5Dcreate2(file, dset_name, H5T_NATIVE_INT, sid, H5P_DEFAULT, plid, H5P_DEFAULT); CHECK(did, FAIL, "H5Dcreate2"); @@ -687,5 +687,5 @@ test_coords(void) void cleanup_coords(void) { - remove(FILENAME); + HDremove(FILENAME); } diff --git a/test/testframe.c b/test/testframe.c index 22f694e..bf6a0e8 100644 --- a/test/testframe.c +++ b/test/testframe.c @@ -442,15 +442,15 @@ GetTestExpress(void) /* set it here for now. Should be done in something like h5test_init(). */ if (TestExpress == -1) { - env_val = getenv("HDF5TestExpress"); + env_val = HDgetenv("HDF5TestExpress"); if (env_val == NULL) SetTestExpress(1); - else if (strcmp(env_val, "0") == 0) + else if (HDstrcmp(env_val, "0") == 0) SetTestExpress(0); - else if (strcmp(env_val, "1") == 0) + else if (HDstrcmp(env_val, "1") == 0) SetTestExpress(1); - else if (strcmp(env_val, "2") == 0) + else if (HDstrcmp(env_val, "2") == 0) SetTestExpress(2); else SetTestExpress(3); @@ -521,7 +521,7 @@ ParseTestVerbosity(char *argv) else if (*argv == 'h') SetTestVerbosity(VERBO_HI); else - SetTestVerbosity(atoi(argv)); + SetTestVerbosity(HDatoi(argv)); } /* diff --git a/test/testhdf5.c b/test/testhdf5.c index 152719a..ab79f28 100644 --- a/test/testhdf5.c +++ b/test/testhdf5.c @@ -82,7 +82,7 @@ main(int argc, char *argv[]) TestSummary(); /* Clean up test files, if allowed */ - if (GetTestCleanup() && !getenv("HDF5_NOCLEANUP")) + if (GetTestCleanup() && !HDgetenv("HDF5_NOCLEANUP")) TestCleanup(); /* Release test infrastructure */ diff --git a/test/testmeta.c b/test/testmeta.c index fee1954..c3044a6 100644 --- a/test/testmeta.c +++ b/test/testmeta.c @@ -83,7 +83,7 @@ main(void) for (i = 0; i < NEXTARRAYS; i++) { /* Create dataset */ - sprintf(name, "/ExtArray%06d", i); + HDsprintf(name, "/ExtArray%06d", i); dataset_id = H5Dcreate2(file_id, name, H5T_NATIVE_FLOAT, dataspace_id, H5P_DEFAULT, prop_id, H5P_DEFAULT); @@ -103,7 +103,7 @@ main(void) /* Removed print statement as it would lock system resources on Windows */ /* * HDprintf("\rWriting Object #%d of %d", j+1, NDATAOBJECTS); - * fflush(stdout); + * HDfflush(stdout); */ floatval = (float)j; diff --git a/test/tfile.c b/test/tfile.c index e41cbbd..3d75f9b 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -4195,7 +4195,7 @@ set_multi_split(hid_t fapl, hsize_t pagesize, hbool_t split) /* Free memb_name */ for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) - free(memb_name[mt]); + HDfree(memb_name[mt]); return 0; diff --git a/test/tgenprop.c b/test/tgenprop.c index 910153c..c1d9cac 100644 --- a/test/tgenprop.c +++ b/test/tgenprop.c @@ -2172,5 +2172,5 @@ test_genprop(void) void cleanup_genprop(void) { - remove(FILENAME); + HDremove(FILENAME); } diff --git a/test/th5o.c b/test/th5o.c index 934a3dc..8b67159 100644 --- a/test/th5o.c +++ b/test/th5o.c @@ -247,7 +247,7 @@ test_h5o_open_by_addr(void) { hid_t fid; /* HDF5 File ID */ hid_t grp, dset, dtype, dspace; /* Object identifiers */ - H5L_info2_t li; /* Buffer for H5Lget_info */ + H5L_info2_t li; /* Buffer for H5Lget_info2 */ haddr_t grp_addr; /* Addresses for objects */ haddr_t dset_addr; haddr_t dtype_addr; @@ -1767,5 +1767,5 @@ test_h5o(void) void cleanup_h5o(void) { - remove(TEST_FILENAME); + HDremove(TEST_FILENAME); } diff --git a/test/th5s.c b/test/th5s.c index 07cb0ab..04ac2e6 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -1936,7 +1936,7 @@ test_h5s_encode_irregular_hyper(H5F_libver_t low, H5F_libver_t high) break; default: - assert(0); + HDassert(0); break; } @@ -3400,9 +3400,9 @@ test_h5s(void) void cleanup_h5s(void) { - remove(DATAFILE); - remove(NULLFILE); - remove(BASICFILE); - remove(ZEROFILE); - remove(VERBFNAME); + HDremove(DATAFILE); + HDremove(NULLFILE); + HDremove(BASICFILE); + HDremove(ZEROFILE); + HDremove(VERBFNAME); } diff --git a/test/thread_id.c b/test/thread_id.c index ce60893..d8ddaf8 100644 --- a/test/thread_id.c +++ b/test/thread_id.c @@ -73,7 +73,7 @@ pthread_barrier_init(pthread_barrier_t *barrier, const pthread_barrierattr_t *at if (attr != NULL) return EINVAL; - memset(barrier, 0, sizeof(*barrier)); + HDmemset(barrier, 0, sizeof(*barrier)); barrier->count = count; @@ -96,7 +96,7 @@ barrier_lock(pthread_barrier_t *barrier) int rc; if ((rc = pthread_mutex_lock(&barrier->mtx)) != 0) { - my_errx(EXIT_FAILURE, "%s: pthread_mutex_lock: %s", __func__, strerror(rc)); + my_errx(EXIT_FAILURE, "%s: pthread_mutex_lock: %s", __func__, HDstrerror(rc)); } } @@ -106,7 +106,7 @@ barrier_unlock(pthread_barrier_t *barrier) int rc; if ((rc = pthread_mutex_unlock(&barrier->mtx)) != 0) { - my_errx(EXIT_FAILURE, "%s: pthread_mutex_unlock: %s", __func__, strerror(rc)); + my_errx(EXIT_FAILURE, "%s: pthread_mutex_unlock: %s", __func__, HDstrerror(rc)); } } @@ -203,16 +203,16 @@ atomic_printf(const char *fmt, ...) va_list ap; ssize_t nprinted, nwritten; - va_start(ap, fmt); - nprinted = vsnprintf(buf, sizeof(buf), fmt, ap); - va_end(ap); + HDva_start(ap, fmt); + nprinted = HDvsnprintf(buf, sizeof(buf), fmt, ap); + HDva_end(ap); if (nprinted == -1) my_err(EXIT_FAILURE, "%s.%d: vsnprintf", __func__, __LINE__); else if (nprinted >= (ssize_t)sizeof(buf)) my_errx(EXIT_FAILURE, "%s.%d: vsnprintf overflowed", __func__, __LINE__); - nwritten = write(STDOUT_FILENO, buf, (size_t)nprinted); + nwritten = HDwrite(STDOUT_FILENO, buf, (size_t)nprinted); if (nwritten < nprinted) { my_errx(EXIT_FAILURE, "%s.%d: write error or short write", __func__, __LINE__); } diff --git a/test/timer.c b/test/timer.c index e907655..24f3245 100644 --- a/test/timer.c +++ b/test/timer.c @@ -146,7 +146,7 @@ test_timer_system_user(void) */ if (timer.initial.system < (double)0.0f || timer.initial.user < (double)0.0f) { SKIPPED(); - printf("NOTE: No suitable way to get system/user times on this platform.\n"); + HDprintf("NOTE: No suitable way to get system/user times on this platform.\n"); return 0; } @@ -383,7 +383,7 @@ main(void) h5_reset(); - printf("Testing platform-independent timer functionality.\n"); + HDprintf("Testing platform-independent timer functionality.\n"); nerrors += test_time_formatting() < 0 ? 1 : 0; nerrors += test_timer_system_user() < 0 ? 1 : 0; @@ -391,11 +391,12 @@ main(void) nerrors += test_timer_functionality() < 0 ? 1 : 0; if (nerrors) { - printf("***** %d platform-independent timer TEST%s FAILED! *****\n", nerrors, nerrors > 1 ? "S" : ""); + HDprintf("***** %d platform-independent timer TEST%s FAILED! *****\n", nerrors, + nerrors > 1 ? "S" : ""); return 1; } else { - printf("All platform-independent timer tests passed.\n"); + HDprintf("All platform-independent timer tests passed.\n"); return 0; } } diff --git a/test/titerate.c b/test/titerate.c index bcf19b9..050dcec 100644 --- a/test/titerate.c +++ b/test/titerate.c @@ -966,7 +966,7 @@ find_err_msg_cb(unsigned H5_ATTR_UNUSED n, const H5E_error2_t *err_desc, void *_ return H5_ITER_ERROR; /* If the searched error message is found, stop the iteration */ - if (err_desc->desc != NULL && strcmp(err_desc->desc, searched_err->message) == 0) { + if (err_desc->desc != NULL && HDstrcmp(err_desc->desc, searched_err->message) == 0) { searched_err->found = true; status = H5_ITER_STOP; } diff --git a/test/tmisc.c b/test/tmisc.c index a6db198..2d842be 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -2837,7 +2837,7 @@ test_misc16(void) if (HDstrlen(wdata[i]) != HDstrlen(rdata[i])) { TestErrPrintf( "Line %u: VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n", - (unsigned)__LINE__, (int)i, (int)strlen(wdata[i]), (int)i, (int)strlen(rdata[i])); + (unsigned)__LINE__, (int)i, (int)HDstrlen(wdata[i]), (int)i, (int)HDstrlen(rdata[i])); continue; } /* end if */ if (HDstrcmp(wdata[i], rdata[i]) != 0) { @@ -2922,7 +2922,7 @@ test_misc17(void) if (HDstrlen(wdata[i]) != HDstrlen(rdata[i])) { TestErrPrintf( "Line %u: VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n", - (unsigned)__LINE__, (int)i, (int)strlen(wdata[i]), (int)i, (int)strlen(rdata[i])); + (unsigned)__LINE__, (int)i, (int)HDstrlen(wdata[i]), (int)i, (int)HDstrlen(rdata[i])); continue; } /* end if */ if (HDstrcmp(wdata[i], rdata[i]) != 0) { diff --git a/test/trefer.c b/test/trefer.c index 8aa8bc2..530a409 100644 --- a/test/trefer.c +++ b/test/trefer.c @@ -21,17 +21,18 @@ #include "testhdf5.h" -#define FILE_REF_PARAM "trefer_param.h5" -#define FILE_REF_OBJ "trefer_obj.h5" -#define FILE_REF_VL_OBJ "trefer_vl_obj.h5" -#define FILE_REF_REG "trefer_reg.h5" -#define FILE_REF_REG_1D "trefer_reg_1d.h5" -#define FILE_REF_OBJ_DEL "trefer_obj_del.h5" -#define FILE_REF_GRP "trefer_grp.h5" -#define FILE_REF_ATTR "trefer_attr.h5" -#define FILE_REF_EXT1 "trefer_ext1.h5" -#define FILE_REF_EXT2 "trefer_ext2.h5" -#define FILE_REF_COMPAT "trefer_compat.h5" +#define FILE_REF_PARAM "trefer_param.h5" +#define FILE_REF_OBJ "trefer_obj.h5" +#define FILE_REF_VL_OBJ "trefer_vl_obj.h5" +#define FILE_REF_CMPND_OBJ "trefer_cmpnd_obj.h5" +#define FILE_REF_REG "trefer_reg.h5" +#define FILE_REF_REG_1D "trefer_reg_1d.h5" +#define FILE_REF_OBJ_DEL "trefer_obj_del.h5" +#define FILE_REF_GRP "trefer_grp.h5" +#define FILE_REF_ATTR "trefer_attr.h5" +#define FILE_REF_EXT1 "trefer_ext1.h5" +#define FILE_REF_EXT2 "trefer_ext2.h5" +#define FILE_REF_COMPAT "trefer_compat.h5" /* 1-D dataset with fixed dimensions */ #define SPACE1_RANK 1 @@ -56,6 +57,15 @@ typedef struct s1_t { float c; } s1_t; +/* Compound datatype with reference */ +typedef struct s2_t { + H5R_ref_t ref0; /* reference */ + H5R_ref_t ref1; /* reference */ + H5R_ref_t ref2; /* reference */ + H5R_ref_t ref3; /* reference */ + unsigned int dim_idx; /* dimension index of the dataset */ +} s2_t; + #define GROUPNAME "/group" #define GROUPNAME2 "group2" #define GROUPNAME3 "group3" @@ -805,6 +815,297 @@ test_reference_vlen_obj(void) /**************************************************************** ** +** test_reference_cmpnd_obj(): Test basic H5R (reference) object reference +** within a compound type. +** Tests references to various kinds of objects +** +****************************************************************/ +static void +test_reference_cmpnd_obj(void) +{ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset, /* Dataset ID */ + dset2; /* Dereferenced dataset ID */ + hid_t group; /* Group ID */ + hid_t sid1; /* Dataspace ID */ + hid_t tid1; /* Datatype ID */ + hsize_t dims1[] = {SPACE1_DIM1}; + hsize_t cmpnd_dims[] = {1}; + hid_t dapl_id; /* Dataset access property list */ + H5R_ref_t *wbuf, /* buffer to write to disk */ + *rbuf; /* buffer read from disk */ + unsigned * ibuf, *obuf; + unsigned i, j; /* Counters */ + H5O_type_t obj_type; /* Object type */ + herr_t ret; /* Generic return value */ + s2_t cmpnd_wbuf, cmpnd_rbuf; + + /* Output message about test being performed */ + MESSAGE(5, ("Testing Object Reference Functions within compound type\n")); + + /* Allocate write & read buffers */ + wbuf = HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1); + rbuf = HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1); + ibuf = HDcalloc(sizeof(unsigned), SPACE1_DIM1); + obuf = HDcalloc(sizeof(unsigned), SPACE1_DIM1); + + for (i = 0; i < SPACE1_DIM1; i++) + obuf[i] = i * 3; + + /* Create file */ + fid1 = H5Fcreate(FILE_REF_CMPND_OBJ, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + CHECK(fid1, H5I_INVALID_HID, "H5Fcreate"); + + /* Create dataspace for datasets */ + sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL); + CHECK(sid1, H5I_INVALID_HID, "H5Screate_simple"); + + /* Create dataset access property list */ + dapl_id = H5Pcreate(H5P_DATASET_ACCESS); + CHECK(dapl_id, H5I_INVALID_HID, "H5Pcreate"); + + /* Create a group */ + group = H5Gcreate2(fid1, "Group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(group, H5I_INVALID_HID, "H5Gcreate2"); + + /* Create a dataset (inside Group1) */ + dataset = H5Dcreate2(group, "Dataset1", H5T_NATIVE_UINT, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(dataset, H5I_INVALID_HID, "H5Dcreate2"); + + /* Write selection to disk */ + ret = H5Dwrite(dataset, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, obuf); + CHECK(ret, FAIL, "H5Dwrite"); + + /* Close Dataset */ + ret = H5Dclose(dataset); + CHECK(ret, FAIL, "H5Dclose"); + + /* Create another dataset (inside Group1) */ + dataset = H5Dcreate2(group, "Dataset2", H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dcreate2"); + + /* Close Dataset */ + ret = H5Dclose(dataset); + CHECK(ret, FAIL, "H5Dclose"); + + /* Close disk dataspace */ + ret = H5Sclose(sid1); + CHECK(ret, FAIL, "H5Sclose"); + + /* Create a datatype to refer to */ + tid1 = H5Tcreate(H5T_COMPOUND, sizeof(s1_t)); + CHECK(tid1, H5I_INVALID_HID, "H5Tcreate"); + + /* Insert fields */ + ret = H5Tinsert(tid1, "a", HOFFSET(s1_t, a), H5T_NATIVE_INT); + CHECK(ret, FAIL, "H5Tinsert"); + + ret = H5Tinsert(tid1, "b", HOFFSET(s1_t, b), H5T_NATIVE_INT); + CHECK(ret, FAIL, "H5Tinsert"); + + ret = H5Tinsert(tid1, "c", HOFFSET(s1_t, c), H5T_NATIVE_FLOAT); + CHECK(ret, FAIL, "H5Tinsert"); + + /* Save datatype for later */ + ret = H5Tcommit2(group, "Datatype1", tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Tcommit2"); + + /* Close datatype */ + ret = H5Tclose(tid1); + CHECK(ret, FAIL, "H5Tclose"); + + /* Close group */ + ret = H5Gclose(group); + CHECK(ret, FAIL, "H5Gclose"); + + /* Create compound type */ + tid1 = H5Tcreate(H5T_COMPOUND, sizeof(s2_t)); + CHECK(tid1, H5I_INVALID_HID, "H5Tcreate"); + + /* Insert fields */ + ret = H5Tinsert(tid1, "ref0", HOFFSET(s2_t, ref0), H5T_STD_REF); + CHECK(ret, FAIL, "H5Tinsert"); + + ret = H5Tinsert(tid1, "ref1", HOFFSET(s2_t, ref1), H5T_STD_REF); + CHECK(ret, FAIL, "H5Tinsert"); + + ret = H5Tinsert(tid1, "ref2", HOFFSET(s2_t, ref2), H5T_STD_REF); + CHECK(ret, FAIL, "H5Tinsert"); + + ret = H5Tinsert(tid1, "ref3", HOFFSET(s2_t, ref3), H5T_STD_REF); + CHECK(ret, FAIL, "H5Tinsert"); + + ret = H5Tinsert(tid1, "dim_idx", HOFFSET(s2_t, dim_idx), H5T_NATIVE_INT); + CHECK(ret, FAIL, "H5Tinsert"); + + /* Create dataspace for datasets */ + sid1 = H5Screate_simple(SPACE1_RANK, cmpnd_dims, NULL); + CHECK(sid1, H5I_INVALID_HID, "H5Screate_simple"); + + /* Create a dataset */ + dataset = H5Dcreate2(fid1, "Dataset3", tid1, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(dataset, H5I_INVALID_HID, "H5Dcreate2"); + + /* Create reference to dataset */ + ret = H5Rcreate_object(fid1, "/Group1/Dataset1", H5P_DEFAULT, &wbuf[0]); + CHECK(ret, FAIL, "H5Rcreate_object"); + ret = H5Rget_obj_type3(&wbuf[0], H5P_DEFAULT, &obj_type); + CHECK(ret, FAIL, "H5Rget_obj_type3"); + VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3"); + + /* Create reference to dataset */ + ret = H5Rcreate_object(fid1, "/Group1/Dataset2", H5P_DEFAULT, &wbuf[1]); + CHECK(ret, FAIL, "H5Rcreate_object"); + ret = H5Rget_obj_type3(&wbuf[1], H5P_DEFAULT, &obj_type); + CHECK(ret, FAIL, "H5Rget_obj_type3"); + VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3"); + + /* Create reference to group */ + ret = H5Rcreate_object(fid1, "/Group1", H5P_DEFAULT, &wbuf[2]); + CHECK(ret, FAIL, "H5Rcreate_object"); + ret = H5Rget_obj_type3(&wbuf[2], H5P_DEFAULT, &obj_type); + CHECK(ret, FAIL, "H5Rget_obj_type3"); + VERIFY(obj_type, H5O_TYPE_GROUP, "H5Rget_obj_type3"); + + /* Create reference to named datatype */ + ret = H5Rcreate_object(fid1, "/Group1/Datatype1", H5P_DEFAULT, &wbuf[3]); + CHECK(ret, FAIL, "H5Rcreate_object"); + ret = H5Rget_obj_type3(&wbuf[3], H5P_DEFAULT, &obj_type); + CHECK(ret, FAIL, "H5Rget_obj_type3"); + VERIFY(obj_type, H5O_TYPE_NAMED_DATATYPE, "H5Rget_obj_type3"); + + /* Store dimensions */ + cmpnd_wbuf.ref0 = wbuf[0]; + cmpnd_wbuf.ref1 = wbuf[1]; + cmpnd_wbuf.ref2 = wbuf[2]; + cmpnd_wbuf.ref3 = wbuf[3]; + cmpnd_wbuf.dim_idx = SPACE1_DIM1; + + /* Write selection to disk */ + ret = H5Dwrite(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, &cmpnd_wbuf); + CHECK(ret, FAIL, "H5Dwrite"); + + /* Close disk dataspace */ + ret = H5Sclose(sid1); + CHECK(ret, FAIL, "H5Sclose"); + + /* Close Dataset */ + ret = H5Dclose(dataset); + CHECK(ret, FAIL, "H5Dclose"); + + /* Close datatype */ + ret = H5Tclose(tid1); + CHECK(ret, FAIL, "H5Tclose"); + + /* Close file */ + ret = H5Fclose(fid1); + CHECK(ret, FAIL, "H5Fclose"); + + /* Re-open the file */ + fid1 = H5Fopen(FILE_REF_CMPND_OBJ, H5F_ACC_RDWR, H5P_DEFAULT); + CHECK(fid1, H5I_INVALID_HID, "H5Fopen"); + + /* Open the dataset */ + dataset = H5Dopen2(fid1, "/Dataset3", H5P_DEFAULT); + CHECK(dataset, H5I_INVALID_HID, "H5Dopen2"); + + tid1 = H5Dget_type(dataset); + CHECK(tid1, H5I_INVALID_HID, "H5Dget_type"); + + /* Read selection from disk */ + ret = H5Dread(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, &cmpnd_rbuf); + CHECK(ret, FAIL, "H5Dread"); + + VERIFY(cmpnd_rbuf.dim_idx, SPACE1_DIM1, "H5Dread"); + rbuf[0] = cmpnd_rbuf.ref0; + rbuf[1] = cmpnd_rbuf.ref1; + rbuf[2] = cmpnd_rbuf.ref2; + rbuf[3] = cmpnd_rbuf.ref3; + + /* Close datatype */ + ret = H5Tclose(tid1); + CHECK(ret, FAIL, "H5Tclose"); + + /* Open dataset object */ + dset2 = H5Ropen_object(&rbuf[0], H5P_DEFAULT, dapl_id); + CHECK(dset2, H5I_INVALID_HID, "H5Ropen_object"); + + /* Check information in referenced dataset */ + sid1 = H5Dget_space(dset2); + CHECK(sid1, H5I_INVALID_HID, "H5Dget_space"); + + ret = (int)H5Sget_simple_extent_npoints(sid1); + VERIFY(ret, SPACE1_DIM1, "H5Sget_simple_extent_npoints"); + + /* Read from disk */ + ret = H5Dread(dset2, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, ibuf); + CHECK(ret, FAIL, "H5Dread"); + + for (i = 0; i < SPACE1_DIM1; i++) + VERIFY(ibuf[i], i * 3, "Data"); + + /* Close dereferenced Dataset */ + ret = H5Dclose(dset2); + CHECK(ret, FAIL, "H5Dclose"); + + /* Open group object. GAPL isn't supported yet. But it's harmless to pass in */ + group = H5Ropen_object(&rbuf[2], H5P_DEFAULT, H5P_DEFAULT); + CHECK(group, H5I_INVALID_HID, "H5Ropen_object"); + + /* Close group */ + ret = H5Gclose(group); + CHECK(ret, FAIL, "H5Gclose"); + + /* Open datatype object. TAPL isn't supported yet. But it's harmless to pass in */ + tid1 = H5Ropen_object(&rbuf[3], H5P_DEFAULT, H5P_DEFAULT); + CHECK(tid1, H5I_INVALID_HID, "H5Ropen_object"); + + /* Verify correct datatype */ + { + H5T_class_t tclass; + + tclass = H5Tget_class(tid1); + VERIFY(tclass, H5T_COMPOUND, "H5Tget_class"); + + ret = H5Tget_nmembers(tid1); + VERIFY(ret, 3, "H5Tget_nmembers"); + } + + /* Close datatype */ + ret = H5Tclose(tid1); + CHECK(ret, FAIL, "H5Tclose"); + + /* Close Dataset */ + ret = H5Dclose(dataset); + CHECK(ret, FAIL, "H5Dclose"); + + /* Close dataset access property list */ + ret = H5Pclose(dapl_id); + CHECK(ret, FAIL, "H5Pclose"); + + /* Close file */ + ret = H5Fclose(fid1); + CHECK(ret, FAIL, "H5Fclose"); + + /* Destroy references */ + for (j = 0; j < SPACE1_DIM1; j++) { + ret = H5Rdestroy(&wbuf[j]); + CHECK(ret, FAIL, "H5Rdestroy"); + } + for (j = 0; j < SPACE1_DIM1; j++) { + ret = H5Rdestroy(&rbuf[j]); + CHECK(ret, FAIL, "H5Rdestroy"); + } + + /* Free memory buffers */ + HDfree(wbuf); + HDfree(rbuf); + HDfree(ibuf); + HDfree(obuf); +} /* test_reference_cmpnd_obj() */ + +/**************************************************************** +** ** test_reference_region(): Test basic H5R (reference) object reference code. ** Tests references to various kinds of objects ** @@ -3150,9 +3451,10 @@ test_reference(void) /* Output message about test being performed */ MESSAGE(5, ("Testing References\n")); - test_reference_params(); /* Test for correct parameter checking */ - test_reference_obj(); /* Test basic H5R object reference code */ - test_reference_vlen_obj(); /* Test reference within vlen */ + test_reference_params(); /* Test for correct parameter checking */ + test_reference_obj(); /* Test basic H5R object reference code */ + test_reference_vlen_obj(); /* Test reference within vlen */ + test_reference_cmpnd_obj(); /* Test reference within compound type */ /* Loop through all the combinations of low/high version bounds */ for (low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) { @@ -3198,6 +3500,7 @@ cleanup_reference(void) HDremove(FILE_REF_PARAM); HDremove(FILE_REF_OBJ); HDremove(FILE_REF_VL_OBJ); + HDremove(FILE_REF_CMPND_OBJ); HDremove(FILE_REF_REG); HDremove(FILE_REF_REG_1D); HDremove(FILE_REF_OBJ_DEL); diff --git a/test/trefer_deprec.c b/test/trefer_deprec.c index 6191526..d2a403f 100644 --- a/test/trefer_deprec.c +++ b/test/trefer_deprec.c @@ -1406,9 +1406,9 @@ test_reference_group(void) /* Create bottom dataset */ did = H5Dcreate2(gid, DSETNAME2, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - assert(did > 0); + HDassert(did > 0); ret = H5Dclose(did); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Gclose(gid); CHECK(ret, FAIL, "H5Gclose"); diff --git a/test/tselect.c b/test/tselect.c index 261388a..2aeba77 100644 --- a/test/tselect.c +++ b/test/tselect.c @@ -5239,7 +5239,7 @@ test_select_hyper_union_stagger(void) CHECK(error, FAIL, "H5Fclose"); /* Initialize intput buffer */ - memset(data_out, 0, 7 * 7 * sizeof(int)); + HDmemset(data_out, 0, 7 * 7 * sizeof(int)); /* Open file */ file_id = H5Fopen(FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT); @@ -5537,7 +5537,7 @@ test_select_hyper_valid_combination(void) /* Output message about test being performed */ MESSAGE(6, ("Testing Selection Combination Validity\n")); - assert(SPACE9_DIM2 >= POINT1_NPOINTS); + HDassert(SPACE9_DIM2 >= POINT1_NPOINTS); /* Create dataspace for single point selection */ single_pt_sid = H5Screate_simple(SPACE9_RANK, dims2D, NULL); @@ -8377,7 +8377,7 @@ test_shape_same(void) /* Output message about test being performed */ MESSAGE(6, ("Testing Same Shape Comparisons\n")); - assert(SPACE9_DIM2 >= POINT1_NPOINTS); + HDassert(SPACE9_DIM2 >= POINT1_NPOINTS); /* Create dataspace for "all" selection */ all_sid = H5Screate_simple(SPACE9_RANK, dims, NULL); @@ -14648,7 +14648,7 @@ test_internal_consistency(void) /* Output message about test being performed */ MESSAGE(6, ("Testing Consistency of Internal States\n")); - assert(SPACE9_DIM2 >= POINT1_NPOINTS); + HDassert(SPACE9_DIM2 >= POINT1_NPOINTS); /* Create dataspace for "all" selection */ all_sid = H5Screate_simple(SPACE9_RANK, dims, NULL); @@ -15107,6 +15107,14 @@ test_sel_iter(void) iter_id = H5Ssel_iter_create(sid, (size_t)1, (unsigned)sel_iter_flags); CHECK(iter_id, FAIL, "H5Ssel_iter_create"); + /* Try resetting selection iterator with bad parameters */ + H5E_BEGIN_TRY { ret = H5Ssel_iter_reset(H5I_INVALID_HID, sid); } + H5E_END_TRY; + VERIFY(ret, FAIL, "H5Ssel_iter_reset"); + H5E_BEGIN_TRY { ret = H5Ssel_iter_reset(iter_id, H5I_INVALID_HID); } + H5E_END_TRY; + VERIFY(ret, FAIL, "H5Ssel_iter_reset"); + /* Try retrieving sequences, with bad parameters */ H5E_BEGIN_TRY { /* Invalid ID */ @@ -15257,6 +15265,167 @@ test_sel_iter(void) CHECK(ret, FAIL, "H5Ssel_iter_close"); } /* end for */ + /* Create selection iterator object */ + iter_id = H5Ssel_iter_create(sid, (size_t)1, (unsigned)sel_iter_flags); + CHECK(iter_id, FAIL, "H5Ssel_iter_create"); + + /* Test iterators on various basic selection types using + * H5Ssel_iter_reset instead of creating multiple iterators */ + for (sel_type = H5S_SEL_NONE; sel_type <= H5S_SEL_ALL; sel_type = (H5S_sel_type)(sel_type + 1)) { + switch (sel_type) { + case H5S_SEL_NONE: /* "None" selection */ + ret = H5Sselect_none(sid); + CHECK(ret, FAIL, "H5Sselect_none"); + break; + + case H5S_SEL_POINTS: /* Point selection */ + /* Select sequence of ten points */ + coord1[0][0] = 0; + coord1[0][1] = 9; + coord1[1][0] = 1; + coord1[1][1] = 2; + coord1[2][0] = 2; + coord1[2][1] = 4; + coord1[3][0] = 0; + coord1[3][1] = 6; + coord1[4][0] = 1; + coord1[4][1] = 8; + coord1[5][0] = 2; + coord1[5][1] = 10; + coord1[6][0] = 0; + coord1[6][1] = 11; + coord1[7][0] = 1; + coord1[7][1] = 4; + coord1[8][0] = 2; + coord1[8][1] = 1; + coord1[9][0] = 0; + coord1[9][1] = 3; + ret = H5Sselect_elements(sid, H5S_SELECT_SET, (size_t)POINT1_NPOINTS, + (const hsize_t *)coord1); + CHECK(ret, FAIL, "H5Sselect_elements"); + break; + + case H5S_SEL_HYPERSLABS: /* Hyperslab selection */ + /* Select regular hyperslab */ + start[0] = 3; + start[1] = 0; + stride[0] = 2; + stride[1] = 2; + count[0] = 2; + count[1] = 5; + block[0] = 1; + block[1] = 1; + ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, stride, count, block); + CHECK(ret, FAIL, "H5Sselect_hyperslab"); + break; + + case H5S_SEL_ALL: /* "All" selection */ + ret = H5Sselect_all(sid); + CHECK(ret, FAIL, "H5Sselect_all"); + break; + + case H5S_SEL_ERROR: + case H5S_SEL_N: + default: + HDassert(0 && "Can't occur"); + break; + } /* end switch */ + + /* Try retrieving no sequences, with 0 for maxseq & maxbytes */ + ret = H5Ssel_iter_get_seq_list(iter_id, (size_t)0, (size_t)1, &nseq, &nbytes, off, len); + CHECK(ret, FAIL, "H5Ssel_iter_get_seq_list"); + VERIFY(nseq, 0, "H5Ssel_iter_get_seq_list"); + VERIFY(nbytes, 0, "H5Ssel_iter_get_seq_list"); + ret = H5Ssel_iter_get_seq_list(iter_id, (size_t)1, (size_t)0, &nseq, &nbytes, off, len); + CHECK(ret, FAIL, "H5Ssel_iter_get_seq_list"); + VERIFY(nseq, 0, "H5Ssel_iter_get_seq_list"); + VERIFY(nbytes, 0, "H5Ssel_iter_get_seq_list"); + + /* Reset iterator */ + ret = H5Ssel_iter_reset(iter_id, sid); + CHECK(ret, FAIL, "H5Ssel_iter_reset"); + + /* Try retrieving all sequences */ + ret = H5Ssel_iter_get_seq_list(iter_id, (size_t)SEL_ITER_MAX_SEQ, (size_t)(1024 * 1024), &nseq, + &nbytes, off, len); + CHECK(ret, FAIL, "H5Ssel_iter_get_seq_list"); + + /* Check results from retrieving sequence list */ + switch (sel_type) { + case H5S_SEL_NONE: /* "None" selection */ + VERIFY(nseq, 0, "H5Ssel_iter_get_seq_list"); + VERIFY(nbytes, 0, "H5Ssel_iter_get_seq_list"); + break; + + case H5S_SEL_POINTS: /* Point selection */ + VERIFY(nseq, 10, "H5Ssel_iter_get_seq_list"); + VERIFY(nbytes, 10, "H5Ssel_iter_get_seq_list"); + break; + + case H5S_SEL_HYPERSLABS: /* Hyperslab selection */ + VERIFY(nseq, 10, "H5Ssel_iter_get_seq_list"); + VERIFY(nbytes, 10, "H5Ssel_iter_get_seq_list"); + break; + + case H5S_SEL_ALL: /* "All" selection */ + VERIFY(nseq, 1, "H5Ssel_iter_get_seq_list"); + VERIFY(nbytes, 72, "H5Ssel_iter_get_seq_list"); + break; + + case H5S_SEL_ERROR: + case H5S_SEL_N: + default: + HDassert(0 && "Can't occur"); + break; + } /* end switch */ + + /* Reset iterator */ + ret = H5Ssel_iter_reset(iter_id, sid); + CHECK(ret, FAIL, "H5Ssel_iter_reset"); + + /* Try retrieving all sequences again */ + ret = H5Ssel_iter_get_seq_list(iter_id, (size_t)SEL_ITER_MAX_SEQ, (size_t)(1024 * 1024), &nseq, + &nbytes, off, len); + CHECK(ret, FAIL, "H5Ssel_iter_get_seq_list"); + + /* Check results from retrieving sequence list */ + switch (sel_type) { + case H5S_SEL_NONE: /* "None" selection */ + VERIFY(nseq, 0, "H5Ssel_iter_get_seq_list"); + VERIFY(nbytes, 0, "H5Ssel_iter_get_seq_list"); + break; + + case H5S_SEL_POINTS: /* Point selection */ + VERIFY(nseq, 10, "H5Ssel_iter_get_seq_list"); + VERIFY(nbytes, 10, "H5Ssel_iter_get_seq_list"); + break; + + case H5S_SEL_HYPERSLABS: /* Hyperslab selection */ + VERIFY(nseq, 10, "H5Ssel_iter_get_seq_list"); + VERIFY(nbytes, 10, "H5Ssel_iter_get_seq_list"); + break; + + case H5S_SEL_ALL: /* "All" selection */ + VERIFY(nseq, 1, "H5Ssel_iter_get_seq_list"); + VERIFY(nbytes, 72, "H5Ssel_iter_get_seq_list"); + break; + + case H5S_SEL_ERROR: + case H5S_SEL_N: + default: + HDassert(0 && "Can't occur"); + break; + } /* end switch */ + + /* Reset iterator */ + ret = H5Ssel_iter_reset(iter_id, sid); + CHECK(ret, FAIL, "H5Ssel_iter_reset"); + } /* end for */ + + /* Close selection iterator */ + ret = H5Ssel_iter_close(iter_id); + CHECK(ret, FAIL, "H5Ssel_iter_close"); + /* Point selection which will merge into smaller # of sequences */ coord1[0][0] = 0; coord1[0][1] = 9; @@ -15292,6 +15461,17 @@ test_sel_iter(void) VERIFY(nseq, 6, "H5Ssel_iter_get_seq_list"); VERIFY(nbytes, 10, "H5Ssel_iter_get_seq_list"); + /* Reset iterator */ + ret = H5Ssel_iter_reset(iter_id, sid); + CHECK(ret, FAIL, "H5Ssel_iter_reset"); + + /* Try retrieving all sequences again */ + ret = H5Ssel_iter_get_seq_list(iter_id, (size_t)SEL_ITER_MAX_SEQ, (size_t)(1024 * 1024), &nseq, + &nbytes, off, len); + CHECK(ret, FAIL, "H5Ssel_iter_get_seq_list"); + VERIFY(nseq, 6, "H5Ssel_iter_get_seq_list"); + VERIFY(nbytes, 10, "H5Ssel_iter_get_seq_list"); + /* Close selection iterator */ ret = H5Ssel_iter_close(iter_id); CHECK(ret, FAIL, "H5Ssel_iter_close"); @@ -15330,6 +15510,17 @@ test_sel_iter(void) VERIFY(nseq, 6, "H5Ssel_iter_get_seq_list"); VERIFY(nbytes, 20, "H5Ssel_iter_get_seq_list"); + /* Reset iterator */ + ret = H5Ssel_iter_reset(iter_id, sid); + CHECK(ret, FAIL, "H5Ssel_iter_reset"); + + /* Try retrieving all sequences again */ + ret = H5Ssel_iter_get_seq_list(iter_id, (size_t)SEL_ITER_MAX_SEQ, (size_t)(1024 * 1024), &nseq, + &nbytes, off, len); + CHECK(ret, FAIL, "H5Ssel_iter_get_seq_list"); + VERIFY(nseq, 6, "H5Ssel_iter_get_seq_list"); + VERIFY(nbytes, 20, "H5Ssel_iter_get_seq_list"); + /* Close selection iterator */ ret = H5Ssel_iter_close(iter_id); CHECK(ret, FAIL, "H5Ssel_iter_close"); diff --git a/test/ttsafe.c b/test/ttsafe.c index d2085b9..2b98ded 100644 --- a/test/ttsafe.c +++ b/test/ttsafe.c @@ -134,7 +134,7 @@ main(int argc, char *argv[]) TestSummary(); /* Clean up test files, if allowed */ - if (GetTestCleanup() && !getenv("HDF5_NOCLEANUP")) + if (GetTestCleanup() && !HDgetenv("HDF5_NOCLEANUP")) TestCleanup(); /* Release test infrastructure */ diff --git a/test/ttsafe_cancel.c b/test/ttsafe_cancel.c index 1e40c58..2ec9a20 100644 --- a/test/ttsafe_cancel.c +++ b/test/ttsafe_cancel.c @@ -65,46 +65,46 @@ tts_cancel(void) /* make thread scheduling global */ ret = pthread_attr_init(&attribute); - assert(ret == 0); + HDassert(ret == 0); #ifdef H5_HAVE_SYSTEM_SCOPE_THREADS ret = pthread_attr_setscope(&attribute, PTHREAD_SCOPE_SYSTEM); - assert(ret == 0); + HDassert(ret == 0); #endif /* H5_HAVE_SYSTEM_SCOPE_THREADS */ /* Initialize mutex & condition variables */ ret = pthread_mutex_init(&mutex, NULL); - assert(ret == 0); + HDassert(ret == 0); ret = pthread_cond_init(&cond, NULL); - assert(ret == 0); + HDassert(ret == 0); /* * Create a hdf5 file using H5F_ACC_TRUNC access, default file * creation plist and default file access plist */ cancel_file = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - assert(cancel_file >= 0); + HDassert(cancel_file >= 0); ret = pthread_create(&childthread, &attribute, tts_cancel_thread, NULL); - assert(ret == 0); + HDassert(ret == 0); tts_cancel_barrier(); ret = pthread_cancel(childthread); - assert(ret == 0); + HDassert(ret == 0); dataset = H5Dopen2(cancel_file, DATASETNAME, H5P_DEFAULT); - assert(dataset >= 0); + HDassert(dataset >= 0); ret = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &buffer); - assert(ret >= 0); + HDassert(ret >= 0); if (buffer != 11) TestErrPrintf("operation unsuccessful with value at %d instead of 11\n", buffer); ret = H5Dclose(dataset); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Fclose(cancel_file); - assert(ret >= 0); + HDassert(ret >= 0); /* Destroy the thread attribute */ ret = pthread_attr_destroy(&attribute); - assert(ret == 0); + HDassert(ret == 0); } /* end tts_cancel() */ void * diff --git a/test/ttsafe_dcreate.c b/test/ttsafe_dcreate.c index cedafd0..a5a22be 100644 --- a/test/ttsafe_dcreate.c +++ b/test/ttsafe_dcreate.c @@ -140,7 +140,7 @@ tts_dcreate_creator(void *_thread_data) hsize_t dimsf[1]; /* dataset dimensions */ struct thread_info thread_data; - memcpy(&thread_data, _thread_data, sizeof(struct thread_info)); + HDmemcpy(&thread_data, _thread_data, sizeof(struct thread_info)); /* define dataspace for dataset */ dimsf[0] = 1; diff --git a/test/tunicode.c b/test/tunicode.c index 28f819b..2fed891 100644 --- a/test/tunicode.c +++ b/test/tunicode.c @@ -532,7 +532,7 @@ test_attrname(hid_t fid, const char *string) CHECK(attr_id, FAIL, "H5Acreate2"); size = H5Aget_name(attr_id, (size_t)MAX_STRING_LENGTH, read_buf); CHECK(size, FAIL, "H5Aget_name"); - ret = strcmp(read_buf, string); + ret = HDstrcmp(read_buf, string); VERIFY(ret, 0, "strcmp"); read_buf[0] = '\0'; @@ -541,7 +541,7 @@ test_attrname(hid_t fid, const char *string) CHECK(ret, FAIL, "H5Awrite"); ret = H5Aread(attr_id, dtype_id, read_buf); CHECK(ret, FAIL, "H5Aread"); - ret = strcmp(read_buf, string); + ret = HDstrcmp(read_buf, string); VERIFY(ret, 0, "strcmp"); /* Clean up */ @@ -682,7 +682,7 @@ test_enum(hid_t H5_ATTR_UNUSED fid, const char *string) VERIFY(val, E1_WHITE, "H5Tenum_valueof"); ret = H5Tenum_nameof(type_id, &val, readbuf, (size_t)MAX_STRING_LENGTH); CHECK(ret, FAIL, "H5Tenum_nameof"); - ret = strcmp(readbuf, string); + ret = HDstrcmp(readbuf, string); VERIFY(ret, 0, "strcmp"); /* Close the datatype */ @@ -709,7 +709,7 @@ test_opaque(hid_t H5_ATTR_UNUSED fid, const char *string) /* Read the tag back. */ read_buf = H5Tget_tag(type_id); - ret = strcmp(read_buf, string); + ret = HDstrcmp(read_buf, string); VERIFY(ret, 0, "H5Tget_tag"); H5free_memory(read_buf); diff --git a/test/tvlstr.c b/test/tvlstr.c index c8e65b5..c2d2f2d 100644 --- a/test/tvlstr.c +++ b/test/tvlstr.c @@ -203,7 +203,7 @@ test_vlstrings_basic(void) for (i = 0; i < SPACE1_DIM1; i++) { if (HDstrlen(wdata[i]) != HDstrlen(rdata[i])) { TestErrPrintf("VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n", (int)i, - (int)strlen(wdata[i]), (int)i, (int)HDstrlen(rdata[i])); + (int)HDstrlen(wdata[i]), (int)i, (int)HDstrlen(rdata[i])); continue; } /* end if */ if (HDstrcmp(wdata[i], rdata[i]) != 0) { @@ -307,7 +307,7 @@ test_vlstrings_special(void) for (i = 0; i < SPACE1_DIM1; i++) { if (HDstrlen(wdata[i]) != HDstrlen(rdata[i])) { TestErrPrintf("VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n", (int)i, - (int)strlen(wdata[i]), (int)i, (int)HDstrlen(rdata[i])); + (int)HDstrlen(wdata[i]), (int)i, (int)HDstrlen(rdata[i])); continue; } /* end if */ if ((wdata[i] == NULL && rdata[i] != NULL) || (rdata[i] == NULL && wdata[i] != NULL)) { @@ -536,7 +536,7 @@ test_compact_vlstring(void) for (i = 0; i < SPACE1_DIM1; i++) { if (HDstrlen(wdata[i]) != HDstrlen(rdata[i])) { TestErrPrintf("VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n", (int)i, - (int)strlen(wdata[i]), (int)i, (int)HDstrlen(rdata[i])); + (int)HDstrlen(wdata[i]), (int)i, (int)HDstrlen(rdata[i])); continue; } /* end if */ if (HDstrcmp(wdata[i], rdata[i]) != 0) { diff --git a/test/tvltypes.c b/test/tvltypes.c index 50cfbd7..47b28d3 100644 --- a/test/tvltypes.c +++ b/test/tvltypes.c @@ -2676,13 +2676,13 @@ test_vltypes_fill_value(void) } break; case H5D_VIRTUAL: - assert(0 && "Invalid layout type!"); + HDassert(0 && "Invalid layout type!"); break; case H5D_LAYOUT_ERROR: case H5D_NLAYOUTS: default: - assert(0 && "Unknown layout type!"); + HDassert(0 && "Unknown layout type!"); break; } /* end switch */ @@ -2784,13 +2784,13 @@ test_vltypes_fill_value(void) break; case H5D_VIRTUAL: - assert(0 && "Invalid layout type!"); + HDassert(0 && "Invalid layout type!"); break; case H5D_LAYOUT_ERROR: case H5D_NLAYOUTS: default: - assert(0 && "Unknown layout type!"); + HDassert(0 && "Unknown layout type!"); break; } /* end switch */ @@ -2969,13 +2969,13 @@ test_vltypes_fill_value(void) break; case H5D_VIRTUAL: - assert(0 && "Invalid layout type!"); + HDassert(0 && "Invalid layout type!"); break; case H5D_LAYOUT_ERROR: case H5D_NLAYOUTS: default: - assert(0 && "Unknown layout type!"); + HDassert(0 && "Unknown layout type!"); break; } /* end switch */ @@ -3241,5 +3241,5 @@ test_vltypes(void) void cleanup_vltypes(void) { - remove(FILENAME); + HDremove(FILENAME); } diff --git a/test/twriteorder.c b/test/twriteorder.c index 83a615c..9c8a145 100644 --- a/test/twriteorder.c +++ b/test/twriteorder.c @@ -141,21 +141,21 @@ parse_option(int argc, char *const argv[]) HDexit(EXIT_SUCCESS); break; case 'b': /* number of planes to write/read */ - if ((blocksize_g = atoi(optarg)) <= 0) { + if ((blocksize_g = HDatoi(optarg)) <= 0) { HDfprintf(stderr, "bad blocksize %s, must be a positive integer\n", optarg); usage(progname_g); Hgoto_error(-1); }; break; case 'n': /* number of planes to write/read */ - if ((nlinkedblock_g = atoi(optarg)) < 2) { + if ((nlinkedblock_g = HDatoi(optarg)) < 2) { HDfprintf(stderr, "bad number of linked blocks %s, must be greater than 1.\n", optarg); usage(progname_g); Hgoto_error(-1); }; break; case 'p': /* number of planes to write/read */ - if ((part_size_g = atoi(optarg)) <= 0) { + if ((part_size_g = HDatoi(optarg)) <= 0) { HDfprintf(stderr, "bad partition size %s, must be a positive integer\n", optarg); usage(progname_g); Hgoto_error(-1); @@ -404,7 +404,7 @@ main(int argc, char *argv[]) Hgoto_error(1); }; }; - mypid = getpid(); + mypid = HDgetpid(); /* ============= */ /* launch reader */ @@ -440,7 +440,7 @@ main(int argc, char *argv[]) /* If readwrite, collect exit code of child process */ /* ================================================ */ if (launch_g == UC_READWRITE) { - if ((tmppid = waitpid(childpid, &child_status, child_wait_option)) < 0) { + if ((tmppid = HDwaitpid(childpid, &child_status, child_wait_option)) < 0) { HDperror("waitpid"); Hgoto_error(1); } diff --git a/test/unlink.c b/test/unlink.c index 8129cc9..2f68a69 100644 --- a/test/unlink.c +++ b/test/unlink.c @@ -575,7 +575,7 @@ test_filespace(hid_t fapl) size_t rdcc_nbytes; double rdcc_w0; - puts("Testing file space gets reused:"); + HDputs("Testing file space gets reused:"); /* Open file */ h5_fixname(FILENAME[4], fapl, filename, sizeof filename); diff --git a/test/use_append_mchunks.c b/test/use_append_mchunks.c index 0b2c409..94adfb0 100644 --- a/test/use_append_mchunks.c +++ b/test/use_append_mchunks.c @@ -165,12 +165,12 @@ main(int argc, char *argv[]) /* Fork process */ /* ============ */ if (UC_opts.launch == UC_READWRITE) { - if ((childpid = fork()) < 0) { - perror("fork"); + if ((childpid = HDfork()) < 0) { + HDperror("fork"); Hgoto_error(1); } } - mypid = getpid(); + mypid = HDgetpid(); /* ============= */ /* launch reader */ @@ -239,8 +239,8 @@ main(int argc, char *argv[]) /* If readwrite, collect exit code of child process */ /* ================================================ */ if (UC_opts.launch == UC_READWRITE) { - if ((tmppid = waitpid(childpid, &child_status, child_wait_option)) < 0) { - perror("waitpid"); + if ((tmppid = HDwaitpid(childpid, &child_status, child_wait_option)) < 0) { + HDperror("waitpid"); Hgoto_error(1); } diff --git a/test/use_common.c b/test/use_common.c index ccebd0b..7a3c95a 100644 --- a/test/use_common.c +++ b/test/use_common.c @@ -68,7 +68,7 @@ parse_option(int argc, char *const argv[], options_t *opts) switch (c) { case 'h': usage(opts->progname); - exit(EXIT_SUCCESS); + HDexit(EXIT_SUCCESS); break; case 'f': /* usecase data file name */ opts->filename = HDstrdup(optarg); @@ -2168,8 +2168,6 @@ test_ros3(void) hid_t driver_id = -1; /* ID for this VFD */ unsigned long driver_flags = 0; /* VFD feature flags */ char filename[1024]; /* filename */ - void * os_file_handle = NULL; /* OS file handle */ - hsize_t file_size; /* file size */ H5FD_ros3_fapl_t test_ros3_fa; H5FD_ros3_fapl_t ros3_fa_0 = { /* version = */ H5FD_CURR_ROS3_FAPL_T_VERSION, @@ -2201,9 +2199,9 @@ test_ros3(void) /* need a macro to compare instances of H5FD_ros3_fapl_t */ if ((test_ros3_fa.version != ros3_fa_0.version) || (test_ros3_fa.authenticate != ros3_fa_0.authenticate) || - (strcmp(test_ros3_fa.aws_region, ros3_fa_0.aws_region) != 0) || - (strcmp(test_ros3_fa.secret_id, ros3_fa_0.secret_id) != 0) || - (strcmp(test_ros3_fa.secret_key, ros3_fa_0.secret_key) != 0)) + (HDstrcmp(test_ros3_fa.aws_region, ros3_fa_0.aws_region) != 0) || + (HDstrcmp(test_ros3_fa.secret_id, ros3_fa_0.secret_id) != 0) || + (HDstrcmp(test_ros3_fa.secret_key, ros3_fa_0.secret_key) != 0)) TEST_ERROR; h5_fixname(FILENAME[10], fapl_id, filename, sizeof(filename)); @@ -2252,7 +2250,7 @@ error: AT(); \ HDfprintf(stderr, mesg); \ H5Eprint2(H5E_DEFAULT, stderr); \ - fflush(stderr); \ + HDfflush(stderr); \ ret_value = -1; \ goto done; \ } @@ -2464,7 +2462,7 @@ run_splitter_test(const struct splitter_dataset_def *data, hbool_t ignore_wo_err } /* Verify existence of logfile if appropriate */ - logfile = fopen(vfd_config->log_file_path, "r"); + logfile = HDfopen(vfd_config->log_file_path, "r"); if ((TRUE == provide_logfile_path && NULL == logfile) || (FALSE == provide_logfile_path && NULL != logfile)) { SPLITTER_TEST_FAULT("no logfile when one was expected\n"); @@ -2485,7 +2483,7 @@ done: } if (logfile != NULL) - fclose(logfile); + HDfclose(logfile); HDfree(vfd_config); HDfree(filename_rw); |