diff options
Diffstat (limited to 'test')
61 files changed, 6183 insertions, 3568 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index ed6bacc..276cf09 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -45,7 +45,7 @@ if (BUILD_SHARED_LIBS) INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" ) target_compile_definitions(${HDF5_TEST_LIBSH_TARGET} - PUBLIC "H5_BUILT_AS_DYNAMIC_LIB" $<$<BOOL:${HDF5_ENABLE_THREADSAFE}>:H5_HAVE_THREADSAFE> + PUBLIC "H5_BUILT_AS_DYNAMIC_LIB" ) TARGET_C_PROPERTIES (${HDF5_TEST_LIBSH_TARGET} SHARED) target_link_libraries (${HDF5_TEST_LIBSH_TARGET} @@ -133,7 +133,7 @@ if (BUILD_SHARED_LIBS) # Define VOL Plugin Test Sources #----------------------------------------------------------------------------- set (VOL_PLUGIN_LIBS - echo_vol + null_vol_connector ) foreach (vol_lib ${VOL_PLUGIN_LIBS}) @@ -293,9 +293,9 @@ set (H5_TESTS_MULTIPLE ttsafe ) # Only build single source tests here -foreach (test ${H5_TESTS}) - if (NOT ${test} IN_LIST H5_TESTS_MULTIPLE) - ADD_H5_EXE(${test}) +foreach (h5_test ${H5_TESTS}) + if (NOT h5_test IN_LIST H5_TESTS_MULTIPLE) + ADD_H5_EXE(${h5_test}) endif () endforeach () @@ -374,18 +374,19 @@ set (H5_CHECK_TESTS atomic_reader links_env filenotclosed + del_many_dense_attrs flushrefresh ) -foreach (test ${H5_CHECK_TESTS}) - ADD_H5_EXE(${test}) +foreach (h5_test ${H5_CHECK_TESTS}) + ADD_H5_EXE(${h5_test}) endforeach () #-- Adding test for libinfo set (GREP_RUNNER ${PROJECT_BINARY_DIR}/GrepRunner.cmake) file (WRITE ${GREP_RUNNER} "file (STRINGS \${TEST_PROGRAM} TEST_RESULT REGEX \"SUMMARY OF THE HDF5 CONFIGURATION\") -if (\${TEST_RESULT} STREQUAL \"0\") +if (NOT TEST_RESULT) message (FATAL_ERROR \"Failed: The output: \${TEST_RESULT} of \${TEST_PROGRAM} did not contain SUMMARY OF THE HDF5 CONFIGURATION\") else () message (STATUS \"COMMAND Result: \${TEST_RESULT}\") @@ -410,8 +411,8 @@ set (H5_SWMR_TESTS swmr_writer ) -foreach (test ${H5_SWMR_TESTS}) - ADD_H5_EXE(${test}) +foreach (h5_test ${H5_SWMR_TESTS}) + ADD_H5_EXE(${h5_test}) endforeach () set (H5_VDS_SWMR_TESTS @@ -420,8 +421,8 @@ set (H5_VDS_SWMR_TESTS vds_swmr_writer ) -foreach (test ${H5_VDS_SWMR_TESTS}) - ADD_H5_EXE(${test}) +foreach (h5_test ${H5_VDS_SWMR_TESTS}) + ADD_H5_EXE(${h5_test}) endforeach () #-- Adding test for accum_swmr_reader diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index 3ad9de7..c606eb1 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -171,6 +171,7 @@ set (HDF5_REFERENCE_TEST_FILES le_data.h5 le_extlink1.h5 le_extlink2.h5 + memleak_H5O_dtype_decode_helper_H5Odtype.h5 mergemsg.h5 multi_file_v16-r.h5 multi_file_v16-s.h5 @@ -230,47 +231,31 @@ add_test (NAME H5TEST-clear-testhdf5-objects ) set_tests_properties (H5TEST-clear-testhdf5-objects PROPERTIES FIXTURES_SETUP clear_testhdf5) -if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5TEST-testhdf5-base COMMAND $<TARGET_FILE:testhdf5> -x heap -x file -x select) - set_tests_properties (H5TEST-testhdf5-base PROPERTIES - FIXTURES_REQUIRED clear_testhdf5 - ENVIRONMENT "HDF5_ALARM_SECONDS=3600;srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" - WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST - ) - add_test (NAME H5TEST-testhdf5-heap COMMAND $<TARGET_FILE:testhdf5> -o heap) - set_tests_properties (H5TEST-testhdf5-heap PROPERTIES - FIXTURES_REQUIRED clear_testhdf5 - ENVIRONMENT "HDF5_ALARM_SECONDS=3600;srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" - WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST - ) - add_test (NAME H5TEST-testhdf5-file COMMAND $<TARGET_FILE:testhdf5> -o file) - set_tests_properties (H5TEST-testhdf5-file PROPERTIES - FIXTURES_REQUIRED clear_testhdf5 - ENVIRONMENT "HDF5_ALARM_SECONDS=3600;srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" - WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST - ) - add_test (NAME H5TEST-testhdf5-select COMMAND $<TARGET_FILE:testhdf5> -o select) - set_tests_properties (H5TEST-testhdf5-select PROPERTIES - FIXTURES_REQUIRED clear_testhdf5 - ENVIRONMENT "HDF5_ALARM_SECONDS=3600;srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" - WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST - ) -else () - add_test (NAME H5TEST-testhdf5 COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$<TARGET_FILE:testhdf5>" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=testhdf5.txt" - #-D "TEST_REFERENCE=testhdf5.out" - -D "TEST_FOLDER=${HDF5_TEST_BINARY_DIR}/H5TEST" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - set_tests_properties (H5TEST-testhdf5 PROPERTIES - FIXTURES_REQUIRED clear_testhdf5 - ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" - WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST - ) +add_test (NAME H5TEST-testhdf5-base COMMAND $<TARGET_FILE:testhdf5> -x heap -x file -x select) +set_tests_properties (H5TEST-testhdf5-base PROPERTIES + FIXTURES_REQUIRED clear_testhdf5 + ENVIRONMENT "HDF5_ALARM_SECONDS=3600;srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST +) +add_test (NAME H5TEST-testhdf5-heap COMMAND $<TARGET_FILE:testhdf5> -o heap) +set_tests_properties (H5TEST-testhdf5-heap PROPERTIES + FIXTURES_REQUIRED clear_testhdf5 + ENVIRONMENT "HDF5_ALARM_SECONDS=3600;srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST +) +add_test (NAME H5TEST-testhdf5-file COMMAND $<TARGET_FILE:testhdf5> -o file) +set_tests_properties (H5TEST-testhdf5-file PROPERTIES + FIXTURES_REQUIRED clear_testhdf5 + ENVIRONMENT "HDF5_ALARM_SECONDS=3600;srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST +) +add_test (NAME H5TEST-testhdf5-select COMMAND $<TARGET_FILE:testhdf5> -o select) +set_tests_properties (H5TEST-testhdf5-select PROPERTIES + FIXTURES_REQUIRED clear_testhdf5 + ENVIRONMENT "HDF5_ALARM_SECONDS=3600;srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST +) +if (NOT HDF5_ENABLE_USING_MEMCHECKER) if (BUILD_SHARED_LIBS) add_test (NAME H5TEST-shared-clear-testhdf5-objects COMMAND ${CMAKE_COMMAND} @@ -297,19 +282,28 @@ else () ${HDF5_TEST_BINARY_DIR}/H5TEST-shared ) set_tests_properties (H5TEST-shared-clear-testhdf5-objects PROPERTIES FIXTURES_SETUP shared_clear_testhdf5) - add_test (NAME H5TEST-shared-testhdf5 COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$<TARGET_FILE:testhdf5-shared>" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=testhdf5.txt" - #-D "TEST_REFERENCE=testhdf5.out" - -D "TEST_FOLDER=${HDF5_TEST_BINARY_DIR}/H5TEST-shared" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + add_test (NAME H5TEST-shared-testhdf5-base COMMAND $<TARGET_FILE:testhdf5-shared> -x heap -x file -x select) + set_tests_properties (H5TEST-shared-testhdf5-base PROPERTIES + FIXTURES_REQUIRED shared_clear_testhdf5 + ENVIRONMENT "HDF5_ALARM_SECONDS=3600;srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared" + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared ) - set_tests_properties (H5TEST-shared-testhdf5 PROPERTIES + add_test (NAME H5TEST-shared-testhdf5-heap COMMAND $<TARGET_FILE:testhdf5-shared> -o heap) + set_tests_properties (H5TEST-shared-testhdf5-heap PROPERTIES FIXTURES_REQUIRED shared_clear_testhdf5 - ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared" + ENVIRONMENT "HDF5_ALARM_SECONDS=3600;srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared" + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared + ) + add_test (NAME H5TEST-shared-testhdf5-file COMMAND $<TARGET_FILE:testhdf5-shared> -o file) + set_tests_properties (H5TEST-shared-testhdf5-file PROPERTIES + FIXTURES_REQUIRED shared_clear_testhdf5 + ENVIRONMENT "HDF5_ALARM_SECONDS=3600;srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared" + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared + ) + add_test (NAME H5TEST-shared-testhdf5-select COMMAND $<TARGET_FILE:testhdf5-shared> -o select) + set_tests_properties (H5TEST-shared-testhdf5-select PROPERTIES + FIXTURES_REQUIRED shared_clear_testhdf5 + ENVIRONMENT "HDF5_ALARM_SECONDS=3600;srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared ) endif () @@ -359,6 +353,9 @@ set (test_CLEANFILES lheap.h5 fheap.h5 ohdr.h5 + ohdr_min_a.h5 + ohdr_min_b.h5 + min_dset_ohdr_testfile.h5 stab.h5 extern_*.h5 extern_*.raw @@ -517,6 +514,7 @@ set (test_CLEANFILES flushrefresh_VERIFICATION_CHECKPOINT2 flushrefresh_VERIFICATION_DONE filenotclosed.h5 + del_many_dense_attrs.h5 atomic_data accum_swmr_big.h5 ohdr_swmr.h5 @@ -547,33 +545,33 @@ set (H5TEST_SEPARATE_TESTS flush1 flush2 ) -foreach (test ${H5_TESTS}) - if (NOT ${test} IN_LIST H5TEST_SEPARATE_TESTS) +foreach (h5_test ${H5_TESTS}) + if (NOT h5_test IN_LIST H5TEST_SEPARATE_TESTS) if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5TEST-${test} COMMAND $<TARGET_FILE:${test}>) - set_tests_properties (H5TEST-${test} PROPERTIES + add_test (NAME H5TEST-${h5_test} COMMAND $<TARGET_FILE:${h5_test}>) + set_tests_properties (H5TEST-${h5_test} PROPERTIES FIXTURES_REQUIRED clear_objects ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) else () - if ("${test}" STREQUAL "big" AND CYGWIN) - add_test (NAME H5TEST-${test} + if ("${h5_test}" STREQUAL "big" AND CYGWIN) + add_test (NAME H5TEST-${h5_test} COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${test}" ) else () - add_test (NAME H5TEST-${test} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$<TARGET_FILE:${test}>" + add_test (NAME H5TEST-${h5_test} COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$<TARGET_FILE:${h5_test}>" -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=${test}.txt" + -D "TEST_OUTPUT=${h5_test}.txt" #-D "TEST_REFERENCE=${test}.out" -D "TEST_FOLDER=${HDF5_TEST_BINARY_DIR}/H5TEST" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () - set_tests_properties (H5TEST-${test} PROPERTIES + set_tests_properties (H5TEST-${h5_test} PROPERTIES FIXTURES_REQUIRED clear_objects ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST @@ -582,10 +580,10 @@ foreach (test ${H5_TESTS}) endif () endforeach () -set_tests_properties (H5TEST-fheap PROPERTIES TIMEOUT 1800) -set_tests_properties (H5TEST-big PROPERTIES TIMEOUT 1800) -set_tests_properties (H5TEST-btree2 PROPERTIES TIMEOUT 1800) -set_tests_properties (H5TEST-objcopy PROPERTIES TIMEOUT 1800) +set_tests_properties (H5TEST-fheap PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) +set_tests_properties (H5TEST-big PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) +set_tests_properties (H5TEST-btree2 PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) +set_tests_properties (H5TEST-objcopy PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) if (BUILD_SHARED_LIBS) # Remove any output file left over from previous test run @@ -598,25 +596,25 @@ if (BUILD_SHARED_LIBS) ) set_tests_properties (H5TEST-shared-clear-objects PROPERTIES FIXTURES_SETUP shared_clear_objects) - foreach (test ${H5_TESTS}) - if (NOT ${test} IN_LIST H5TEST_SEPARATE_TESTS) - if ("${test}" STREQUAL "big" AND CYGWIN) - add_test (NAME H5TEST-shared-${test} + foreach (h5_test ${H5_TESTS}) + if (NOT h5_test IN_LIST H5TEST_SEPARATE_TESTS) + if ("${h5_test}" STREQUAL "big" AND CYGWIN) + add_test (NAME H5TEST-shared-${h5_test} COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${test}-shared" ) else () - add_test (NAME H5TEST-shared-${test} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$<TARGET_FILE:${test}-shared>" + add_test (NAME H5TEST-shared-${h5_test} COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$<TARGET_FILE:${h5_test}-shared>" -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=${test}.txt" + -D "TEST_OUTPUT=${h5_test}.txt" #-D "TEST_REFERENCE=${test}.out" -D "TEST_FOLDER=${HDF5_TEST_BINARY_DIR}/H5TEST-shared" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () - set_tests_properties (H5TEST-shared-${test} PROPERTIES + set_tests_properties (H5TEST-shared-${h5_test} PROPERTIES FIXTURES_REQUIRED shared_clear_objects ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared @@ -624,10 +622,10 @@ if (BUILD_SHARED_LIBS) endif () endforeach () - set_tests_properties (H5TEST-shared-fheap PROPERTIES TIMEOUT 1800) - set_tests_properties (H5TEST-shared-big PROPERTIES TIMEOUT 1800) - set_tests_properties (H5TEST-shared-btree2 PROPERTIES TIMEOUT 1800) - set_tests_properties (H5TEST-shared-objcopy PROPERTIES TIMEOUT 1800) + set_tests_properties (H5TEST-shared-fheap PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) + set_tests_properties (H5TEST-shared-big PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) + set_tests_properties (H5TEST-shared-btree2 PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) + set_tests_properties (H5TEST-shared-objcopy PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) endif () #-- Adding test for cache @@ -659,9 +657,10 @@ if (NOT CYGWIN) ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5TestExpress=${HDF_TEST_EXPRESS}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) - set_tests_properties (H5TEST-cache PROPERTIES TIMEOUT 1800) + set_tests_properties (H5TEST-cache PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) endif () +if (TEST_CACHE_IMAGE) #-- Adding test for cache_image add_test ( NAME H5TEST-clear-cache_image-objects @@ -678,6 +677,7 @@ set_tests_properties (H5TEST-cache_image PROPERTIES ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5TestExpress=${HDF_TEST_EXPRESS}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) +endif () if (BUILD_SHARED_LIBS) #-- Adding test for cache @@ -709,7 +709,7 @@ if (BUILD_SHARED_LIBS) ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared;HDF5TestExpress=${HDF_TEST_EXPRESS}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared ) - set_tests_properties (H5TEST-shared-cache PROPERTIES TIMEOUT 1800) + set_tests_properties (H5TEST-shared-cache PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) endif () endif () @@ -793,6 +793,7 @@ set_tests_properties (H5TEST-tcheck_version-release PROPERTIES # atomic_reader # links_env # filenotclosed +# del_many_dense_attrs # flushrefresh ############################################################################## # autotools script tests @@ -800,7 +801,7 @@ set_tests_properties (H5TEST-tcheck_version-release PROPERTIES # NOT CONVERTED accum_swmr_reader is used by accum.c. # NOT CONVERTED atomic_writer and atomic_reader are standalone programs. # links_env is used by testlinks_env.sh -# filenotclosed is used by test_filenotclosed.sh +# filenotclosed and del_many_dense_attrs are used by testabort_fail.sh # NOT CONVERTED flushrefresh is used by testflushrefresh.sh. # NOT CONVERTED use_append_chunk, use_append_mchunks and use_disable_mdc_flushes are used by test_usecases.sh # NOT CONVERTED swmr_* files (besides swmr.c) are used by testswmr.sh. @@ -827,6 +828,23 @@ set_tests_properties (H5TEST-filenotclosed PROPERTIES WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) +#-- Adding test for del_many_dense_attrs +add_test ( + NAME H5TEST-clear-del_many_dense_attrs-objects + COMMAND ${CMAKE_COMMAND} + -E remove + del_many_dense_attrs.h5 + WORKING_DIRECTORY + ${HDF5_TEST_BINARY_DIR}/H5TEST +) +set_tests_properties (H5TEST-clear-del_many_dense_attrs-objects PROPERTIES FIXTURES_SETUP del_many_dense_attrs_clear_objects) +add_test (NAME H5TEST-del_many_dense_attrs COMMAND $<TARGET_FILE:del_many_dense_attrs>) +set_tests_properties (H5TEST-del_many_dense_attrs PROPERTIES + FIXTURES_REQUIRED del_many_dense_attrs_clear_objects + ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST +) + #-- Adding test for err_compat if (HDF5_ENABLE_DEPRECATED_SYMBOLS) add_test (NAME H5TEST-clear-err_compat-objects @@ -843,6 +861,7 @@ if (HDF5_ENABLE_DEPRECATED_SYMBOLS) -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" -D "TEST_MASK_ERROR=true" + -D "ERROR_APPEND=1" -D "TEST_OUTPUT=err_compat.txt" -D "TEST_REFERENCE=err_compat_1" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST" @@ -877,6 +896,7 @@ else () -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" -D "TEST_MASK_ERROR=true" + -D "ERROR_APPEND=1" -D "TEST_OUTPUT=error_test.txt" -D "TEST_REFERENCE=error_test_1" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST" @@ -943,6 +963,7 @@ if (BUILD_SHARED_LIBS) -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" -D "TEST_MASK_ERROR=true" + -D "ERROR_APPEND=1" -D "TEST_OUTPUT=err_compat.txt" -D "TEST_REFERENCE=err_compat_1" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST-shared" @@ -977,6 +998,7 @@ if (BUILD_SHARED_LIBS) -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" -D "TEST_MASK_ERROR=true" + -D "ERROR_APPEND=1" -D "TEST_OUTPUT=error_test.txt" -D "TEST_REFERENCE=error_test_1" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST-shared" @@ -1123,6 +1145,16 @@ endif () ############################################################################## ############################################################################## +### V O L T E S T S ### +############################################################################## +############################################################################## + +if (HDF5_TEST_VOL) + include (CMakeVOLTests.cmake) +endif () + +############################################################################## +############################################################################## ### T H E G E N E R A T O R S ### ############################################################################## ############################################################################## @@ -1161,8 +1193,8 @@ if (HDF5_BUILD_GENERATORS) gen_plist ) - foreach (gen ${H5_GENERATORS}) - ADD_H5_GENERATOR (${gen}) + foreach (h5_gen ${H5_GENERATORS}) + ADD_H5_GENERATOR (${h5_gen}) endforeach () endif () diff --git a/test/CMakeVFDTests.cmake b/test/CMakeVFDTests.cmake index be02110..791f75c 100644 --- a/test/CMakeVFDTests.cmake +++ b/test/CMakeVFDTests.cmake @@ -92,6 +92,7 @@ endif () set (H5_VFD_SKIP_TESTS cache + cache_image accum fheap big @@ -110,33 +111,49 @@ endif () macro (CHECK_VFD_TEST vfdtest vfdname resultcode) if ("${vfdtest}" STREQUAL "flush1" OR "${vfdtest}" STREQUAL "flush2") if ("${vfdname}" STREQUAL "multi" OR "${vfdname}" STREQUAL "split") - if (NOT BUILD_SHARED_LIBS AND NOT ${HDF_CFG_NAME} MATCHES "Debug") + if (NOT BUILD_SHARED_LIBS AND NOT HDF_CFG_NAME MATCHES "Debug") + add_test ( + NAME VFD-${vfdname}-${vfdtest}-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + ${vfdname}/${vfdname}-${vfdtest}.out + ${vfdname}/${vfdname}-${vfdtest}.out.err + ) add_test (NAME VFD-${vfdname}-${vfdtest} COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$<TARGET_FILE:${vfdtest}>" -D "TEST_ARGS:STRING=" -D "TEST_VFD:STRING=${vfdname}" -D "TEST_EXPECT=${resultcode}" - -D "TEST_OUTPUT=${vfdname}-${vfdtest}" + -D "TEST_OUTPUT=${vfdname}-${vfdtest}.out" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}" -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" ) set_tests_properties (VFD-${vfdname}-${vfdtest} PROPERTIES + DEPENDS VFD-${vfdname}-${vfdtest}-clear-objects ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname} ) if (BUILD_SHARED_LIBS) + add_test ( + NAME VFD-${vfdname}-${vfdtest}-shared-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + ${vfdname}-shared/${vfdname}-${vfdtest}-shared.out + ${vfdname}-shared/${vfdname}-${vfdtest}-shared.out.err + ) add_test (NAME VFD-${vfdname}-${test}-shared COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$<TARGET_FILE:${vfdtest}-shared>" -D "TEST_ARGS:STRING=" -D "TEST_VFD:STRING=${vfdname}" -D "TEST_EXPECT=${resultcode}" - -D "TEST_OUTPUT=${vfdname}-${vfdtest}-shared" + -D "TEST_OUTPUT=${vfdname}-${vfdtest}-shared.out" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}-shared" -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" ) set_tests_properties (VFD-${vfdname}-${vfdtest}-shared PROPERTIES + DEPENDS VFD-${vfdname}-${vfdtest}-shared-clear-objects ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}-shared" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname}-shared ) @@ -152,64 +169,96 @@ endif () endif () endif () else () + add_test ( + NAME VFD-${vfdname}-${vfdtest}-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + ${vfdname}/${vfdname}-${vfdtest}.out + ${vfdname}/${vfdname}-${vfdtest}.out.err + ) add_test (NAME VFD-${vfdname}-${vfdtest} COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$<TARGET_FILE:${vfdtest}>" -D "TEST_ARGS:STRING=" -D "TEST_VFD:STRING=${vfdname}" -D "TEST_EXPECT=${resultcode}" - -D "TEST_OUTPUT=${vfdname}-${vfdtest}" + -D "TEST_OUTPUT=${vfdname}-${vfdtest}.out" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}" -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" ) set_tests_properties (VFD-${vfdname}-${vfdtest} PROPERTIES + DEPENDS VFD-${vfdname}-${vfdtest}-clear-objects ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname} ) if (BUILD_SHARED_LIBS) - add_test (NAME VFD-${vfdname}-${test}-shared + add_test ( + NAME VFD-${vfdname}-${vfdtest}-shared-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + ${vfdname}-shared/${vfdname}-${vfdtest}-shared.out + ${vfdname}-shared/${vfdname}-${vfdtest}-shared.out.err + ) + add_test (NAME VFD-${vfdname}-${vfdtest}-shared COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$<TARGET_FILE:${vfdtest}-shared>" -D "TEST_ARGS:STRING=" -D "TEST_VFD:STRING=${vfdname}" -D "TEST_EXPECT=${resultcode}" - -D "TEST_OUTPUT=${vfdname}-${vfdtest}-shared" + -D "TEST_OUTPUT=${vfdname}-${vfdtest}-shared.out" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}-shared" -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" ) set_tests_properties (VFD-${vfdname}-${vfdtest}-shared PROPERTIES + DEPENDS VFD-${vfdname}-${vfdtest}-shared-clear-objects ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}-shared" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname}-shared ) endif () endif () else () + add_test ( + NAME VFD-${vfdname}-${vfdtest}-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + ${vfdname}/${vfdname}-${vfdtest}.out + ${vfdname}/${vfdname}-${vfdtest}.out.err + ) add_test (NAME VFD-${vfdname}-${vfdtest} COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$<TARGET_FILE:${vfdtest}>" -D "TEST_ARGS:STRING=" -D "TEST_VFD:STRING=${vfdname}" -D "TEST_EXPECT=${resultcode}" - -D "TEST_OUTPUT=${vfdname}-${vfdtest}" + -D "TEST_OUTPUT=${vfdname}-${vfdtest}.out" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}" -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" ) set_tests_properties (VFD-${vfdname}-${vfdtest} PROPERTIES + DEPENDS VFD-${vfdname}-${vfdtest}-clear-objects ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname};HDF5TestExpress=${HDF_TEST_EXPRESS}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname} ) if (BUILD_SHARED_LIBS AND NOT "${vfdtest}" STREQUAL "cache") + add_test ( + NAME VFD-${vfdname}-${vfdtest}-shared-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + ${vfdname}-shared/${vfdname}-${vfdtest}-shared.out + ${vfdname}-shared/${vfdname}-${vfdtest}-shared.out.err + ) add_test (NAME VFD-${vfdname}-${vfdtest}-shared COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$<TARGET_FILE:${vfdtest}-shared>" -D "TEST_ARGS:STRING=" -D "TEST_VFD:STRING=${vfdname}" -D "TEST_EXPECT=${resultcode}" - -D "TEST_OUTPUT=${vfdname}-${vfdtest}-shared" + -D "TEST_OUTPUT=${vfdname}-${vfdtest}-shared.out" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}-shared" -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" ) set_tests_properties (VFD-${vfdname}-${vfdtest}-shared PROPERTIES + DEPENDS VFD-${vfdname}-${vfdtest}-shared-clear-objects ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}-shared;HDF5TestExpress=${HDF_TEST_EXPRESS}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname}-shared ) @@ -218,32 +267,48 @@ endif () endmacro () macro (DO_VFD_TEST vfdtest vfdname resultcode) + add_test ( + NAME VFD-${vfdname}-${vfdtest}-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + ${vfdname}/${vfdname}-${vfdtest}.out + ${vfdname}/${vfdname}-${vfdtest}.out.err + ) add_test (NAME VFD-${vfdname}-${vfdtest} COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$<TARGET_FILE:${vfdtest}>" -D "TEST_ARGS:STRING=" -D "TEST_VFD:STRING=${vfdname}" -D "TEST_EXPECT=${resultcode}" - -D "TEST_OUTPUT=${vfdname}-${vfdtest}" + -D "TEST_OUTPUT=${vfdname}-${vfdtest}.out" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}" -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" ) set_tests_properties (VFD-${vfdname}-${vfdtest} PROPERTIES + DEPENDS VFD-${vfdname}-${vfdtest}-clear-objects ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname} ) if (BUILD_SHARED_LIBS) + add_test ( + NAME VFD-${vfdname}-${vfdtest}-shared-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + ${vfdname}-shared/${vfdname}-${vfdtest}-shared.out + ${vfdname}-shared/${vfdname}-${vfdtest}-shared.out.err + ) add_test (NAME VFD-${vfdname}-${vfdtest}-shared COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$<TARGET_FILE:${vfdtest}-shared>" -D "TEST_ARGS:STRING=" -D "TEST_VFD:STRING=${vfdname}" -D "TEST_EXPECT=${resultcode}" - -D "TEST_OUTPUT=${vfdname}-${vfdtest}-shared" + -D "TEST_OUTPUT=${vfdname}-${vfdtest}-shared.out" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}-shared" -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" ) set_tests_properties (VFD-${vfdname}-${vfdtest}-shared PROPERTIES + DEPENDS VFD-${vfdname}-${vfdtest}-shared-clear-objects ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}-shared" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname}-shared ) @@ -251,60 +316,76 @@ endif () endmacro () macro (ADD_VFD_TEST vfdname resultcode) - foreach (test ${H5_TESTS}) - if (NOT ${test} IN_LIST H5_VFD_SKIP_TESTS) + foreach (h5_test ${H5_TESTS}) + if (NOT h5_test IN_LIST H5_VFD_SKIP_TESTS) if (WIN32) - CHECK_VFD_TEST (${test} ${vfdname} ${resultcode}) + CHECK_VFD_TEST (${h5_test} ${vfdname} ${resultcode}) else () - DO_VFD_TEST (${test} ${vfdname} ${resultcode}) + DO_VFD_TEST (${h5_test} ${vfdname} ${resultcode}) endif () endif () endforeach () set_tests_properties (VFD-${vfdname}-flush2 PROPERTIES DEPENDS VFD-${vfdname}-flush1) set_tests_properties (VFD-${vfdname}-flush1 PROPERTIES TIMEOUT 10) set_tests_properties (VFD-${vfdname}-flush2 PROPERTIES TIMEOUT 10) - set_tests_properties (VFD-${vfdname}-istore PROPERTIES TIMEOUT 1800) + set_tests_properties (VFD-${vfdname}-istore PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) if (NOT CYGWIN) - set_tests_properties (VFD-${vfdname}-cache PROPERTIES TIMEOUT 1800) + set_tests_properties (VFD-${vfdname}-cache PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) endif () if (BUILD_SHARED_LIBS) set_tests_properties (VFD-${vfdname}-flush2-shared PROPERTIES DEPENDS VFD-${vfdname}-flush1-shared) set_tests_properties (VFD-${vfdname}-flush1-shared PROPERTIES TIMEOUT 10) set_tests_properties (VFD-${vfdname}-flush2-shared PROPERTIES TIMEOUT 10) - set_tests_properties (VFD-${vfdname}-istore-shared PROPERTIES TIMEOUT 1800) + set_tests_properties (VFD-${vfdname}-istore-shared PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) if (NOT CYGWIN AND NOT WIN32) - set_tests_properties (VFD-${vfdname}-cache-shared PROPERTIES TIMEOUT 1800) + set_tests_properties (VFD-${vfdname}-cache-shared PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) endif () endif () if (HDF5_TEST_FHEAP_VFD) + add_test ( + NAME VFD-${vfdname}-fheap-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + ${vfdname}/${vfdname}-fheap.out + ${vfdname}/${vfdname}-fheap.out.err + ) add_test (NAME VFD-${vfdname}-fheap COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$<TARGET_FILE:fheap>" -D "TEST_ARGS:STRING=" -D "TEST_VFD:STRING=${vfdname}" -D "TEST_EXPECT=${resultcode}" - -D "TEST_OUTPUT=${vfdname}-fheap" + -D "TEST_OUTPUT=${vfdname}-fheap.out" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}" -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" ) set_tests_properties (VFD-${vfdname}-fheap PROPERTIES - TIMEOUT 1800 + DEPENDS VFD-${vfdname}-fheap-clear-objects + TIMEOUT ${CTEST_VERY_LONG_TIMEOUT} ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname};HDF5TestExpress=${HDF_TEST_EXPRESS}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname} ) if (BUILD_SHARED_LIBS) + add_test ( + NAME VFD-${vfdname}-fheap-shared-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + ${vfdname}-shared/${vfdname}-fheap-shared.out + ${vfdname}-shared/${vfdname}-fheap-shared.out.err + ) add_test (NAME VFD-${vfdname}-fheap-shared COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$<TARGET_FILE:fheap-shared>" -D "TEST_ARGS:STRING=" -D "TEST_VFD:STRING=${vfdname}" -D "TEST_EXPECT=${resultcode}" - -D "TEST_OUTPUT=${vfdname}-fheap-shared" + -D "TEST_OUTPUT=${vfdname}-fheap-shared.out" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}-shared" -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" ) set_tests_properties (VFD-${vfdname}-fheap-shared PROPERTIES - TIMEOUT 1800 + DEPENDS VFD-${vfdname}-fheap-shared-clear-objects + TIMEOUT ${CTEST_VERY_LONG_TIMEOUT} ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}-shared;HDF5TestExpress=${HDF_TEST_EXPRESS}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname}-shared ) @@ -313,6 +394,6 @@ endif () endmacro () # Run test with different Virtual File Driver - foreach (vfd ${VFD_LIST}) - ADD_VFD_TEST (${vfd} 0) + foreach (h5_vfd ${VFD_LIST}) + ADD_VFD_TEST (${h5_vfd} 0) endforeach () diff --git a/test/CMakeVOLTests.cmake b/test/CMakeVOLTests.cmake new file mode 100644 index 0000000..cf47291 --- /dev/null +++ b/test/CMakeVOLTests.cmake @@ -0,0 +1,403 @@ + +# Copyright by The HDF Group. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the COPYING file, which can be found at the root of the source code +# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. +# If you do not have access to either file, you may request a copy from +# help@hdfgroup.org. +# + +############################################################################## +############################################################################## +### T E S T I N G ### +############################################################################## +############################################################################## +# included from CMakeTests.cmake + +set (VOL_LIST + vol_native + vol_pass_through1 + vol_pass_through2 +) + +set (vol_native native) +set (vol_pass_through1 "pass_through under_vol=0\;under_info={}") +set (vol_pass_through2 "pass_through under_vol=505\;under_info={under_vol=0\;under_info={}}") + +foreach (voltest ${VOL_LIST}) + file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${voltest}") + file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${voltest}/testfiles") + file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${voltest}/testfiles/plist_files") + if (BUILD_SHARED_LIBS) + file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${voltest}-shared") + file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${voltest}-shared/testfiles") + file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${voltest}-shared/testfiles/plist_files") + endif () +endforeach () + +foreach (voltest ${VOL_LIST}) + foreach (h5_tfile ${HDF5_TEST_FILES}) + HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/${h5_tfile}" "${PROJECT_BINARY_DIR}/${voltest}/${h5_tfile}" "HDF5_VOLTEST_LIB_files") + if (BUILD_SHARED_LIBS) + HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/${h5_tfile}" "${PROJECT_BINARY_DIR}/${voltest}-shared/${h5_tfile}" "HDF5_VOLTEST_LIBSH_files") + endif () + endforeach () +endforeach () + +foreach (voltest ${VOL_LIST}) + foreach (ref_file ${HDF5_REFERENCE_FILES}) + HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/${ref_file}" "${PROJECT_BINARY_DIR}/${voltest}/${ref_file}" "HDF5_VOLTEST_LIB_files") + if (BUILD_SHARED_LIBS) + HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/${ref_file}" "${PROJECT_BINARY_DIR}/${voltest}-shared/${ref_file}" "HDF5_VOLTEST_LIBSH_files") + endif () + endforeach () +endforeach () + +foreach (voltest ${VOL_LIST}) + foreach (h5_file ${HDF5_REFERENCE_TEST_FILES}) + HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/${h5_file}" "${HDF5_TEST_BINARY_DIR}/${voltest}/${h5_file}" "HDF5_VOLTEST_LIB_files") + if (BUILD_SHARED_LIBS) + HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/${h5_file}" "${HDF5_TEST_BINARY_DIR}/${voltest}-shared/${h5_file}" "HDF5_VOLTEST_LIBSH_files") + endif () + endforeach () +endforeach () + +foreach (voltest ${VOL_LIST}) + foreach (plistfile ${HDF5_REFERENCE_PLIST_FILES}) + HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/${plistfile}" "${PROJECT_BINARY_DIR}/${voltest}/testfiles/plist_files/${plistfile}" "HDF5_VOLTEST_LIB_files") + HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/def_${plistfile}" "${PROJECT_BINARY_DIR}/${voltest}/testfiles/plist_files/def_${plistfile}" "HDF5_VOLTEST_LIB_files") + if (BUILD_SHARED_LIBS) + HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/${plistfile}" "${PROJECT_BINARY_DIR}/${voltest}-shared/testfiles/plist_files/${plistfile}" "HDF5_VOLTEST_LIBSH_files") + HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/def_${plistfile}" "${PROJECT_BINARY_DIR}/${voltest}-shared/testfiles/plist_files/def_${plistfile}" "HDF5_VOLTEST_LIBSH_files") + endif () + endforeach () +endforeach () + +add_custom_target(HDF5_VOLTEST_LIB_files ALL COMMENT "Copying files needed by HDF5_VOLTEST_LIB tests" DEPENDS ${HDF5_VOLTEST_LIB_files_list}) +if (BUILD_SHARED_LIBS) + add_custom_target(HDF5_VOLTEST_LIBSH_files ALL COMMENT "Copying files needed by HDF5_VOLTEST_LIBSH tests" DEPENDS ${HDF5_VOLTEST_LIBSH_files_list}) +endif () + +############################################################################## +############################################################################## +### V O L T E S T S ### +############################################################################## +############################################################################## + + set (H5_VOL_SKIP_TESTS + cache + cache_image + accum + fheap + big + vol + error_test + err_compat + tcheck_version + testmeta + links_env + ) + if (NOT CYGWIN) + list (REMOVE_ITEM H5_VOL_SKIP_TESTS big cache) + endif () + + # Windows only macro + macro (CHECK_VOL_TEST voltest volname volinfo resultcode) + if ("${voltest}" STREQUAL "flush1" OR "${voltest}" STREQUAL "flush2") + if ("${volname}" STREQUAL "multi" OR "${volname}" STREQUAL "split") + if (NOT BUILD_SHARED_LIBS AND NOT ${HDF_CFG_NAME} MATCHES "Debug") + add_test ( + NAME VOL-${volname}-${voltest}-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + ${volname}/${volname}-${voltest}.out + ${volname}/${volname}-${voltest}.out.err + ) + add_test (NAME VOL-${volname}-${voltest} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$<TARGET_FILE:${voltest}>" + -D "TEST_ARGS:STRING=" + -D "TEST_VOL:STRING=${volinfo}" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_OUTPUT=${volname}-${voltest}.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${volname}" + -P "${HDF_RESOURCES_DIR}/volTest.cmake" + ) + set_tests_properties (VOL-${volname}-${voltest} PROPERTIES + DEPENDS VOL-${volname}-${voltest}-clear-objects + ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${volname}" + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${volname} + ) + if (BUILD_SHARED_LIBS) + add_test ( + NAME VOL-${volname}-${voltest}-shared-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + ${volname}-shared/${volname}-${voltest}-shared.out + ${volname}-shared/${volname}-${voltest}-shared.out.err + ) + add_test (NAME VOL-${volname}-${voltest}-shared + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$<TARGET_FILE:${voltest}-shared>" + -D "TEST_ARGS:STRING=" + -D "TEST_VOL:STRING=${volinfo}" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_OUTPUT=${volname}-${voltest}-shared.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${volname}-shared" + -P "${HDF_RESOURCES_DIR}/volTest.cmake" + ) + set_tests_properties (VOL-${volname}-${voltest}-shared PROPERTIES + DEPENDS VOL-${volname}-${voltest}-shared-clear-objects + ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${volname}-shared" + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${volname}-shared + ) + endif () + else () + add_test (NAME VOL-${volname}-${voltest} + COMMAND ${CMAKE_COMMAND} -E echo "SKIP VOL-${volname}-${voltest}" + ) + if (BUILD_SHARED_LIBS) + add_test (NAME VOL-${volname}-${voltest}-shared + COMMAND ${CMAKE_COMMAND} -E echo "SKIP VOL-${volname}-${voltest}-shared" + ) + endif () + endif () + else () + add_test ( + NAME VOL-${volname}-${voltest}-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + ${volname}/${volname}-${voltest}.out + ${volname}/${volname}-${voltest}.out.err + ) + add_test (NAME VOL-${volname}-${voltest} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$<TARGET_FILE:${voltest}>" + -D "TEST_ARGS:STRING=" + -D "TEST_VOL:STRING=${volinfo}" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_OUTPUT=${volname}-${voltest}.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${volname}" + -P "${HDF_RESOURCES_DIR}/volTest.cmake" + ) + set_tests_properties (VOL-${volname}-${voltest} PROPERTIES + DEPENDS VOL-${volname}-${voltest}-clear-objects + ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${volname}" + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${volname} + ) + if (BUILD_SHARED_LIBS) + add_test ( + NAME VOL-${volname}-${voltest}-shared-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + ${volname}-shared/${volname}-${voltest}-shared.out + ${volname}-shared/${volname}-${voltest}-shared.out.err + ) + add_test (NAME VOL-${volname}-${voltest}-shared + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$<TARGET_FILE:${voltest}-shared>" + -D "TEST_ARGS:STRING=" + -D "TEST_VOL:STRING=${volinfo}" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_OUTPUT=${volname}-${voltest}-shared.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${volname}-shared" + -P "${HDF_RESOURCES_DIR}/volTest.cmake" + ) + set_tests_properties (VOL-${volname}-${voltest}-shared PROPERTIES + DEPENDS VOL-${volname}-${voltest}-shared-clear-objects + ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${volname}-shared" + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${volname}-shared + ) + endif () + endif () + else () + add_test ( + NAME VOL-${volname}-${voltest}-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + ${volname}/${volname}-${voltest}.out + ${volname}/${volname}-${voltest}.out.err + ) + add_test (NAME VOL-${volname}-${voltest} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$<TARGET_FILE:${voltest}>" + -D "TEST_ARGS:STRING=" + -D "TEST_VOL:STRING=${volinfo}" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_OUTPUT=${volname}-${voltest}.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${volname}" + -P "${HDF_RESOURCES_DIR}/volTest.cmake" + ) + set_tests_properties (VOL-${volname}-${voltest} PROPERTIES + DEPENDS VOL-${volname}-${voltest}-clear-objects + ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${volname};HDF5TestExpress=${HDF_TEST_EXPRESS}" + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${volname} + ) + if (BUILD_SHARED_LIBS AND NOT "${voltest}" STREQUAL "cache") + add_test ( + NAME VOL-${volname}-${voltest}-shared-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + ${volname}-shared/${volname}-${voltest}-shared.out + ${volname}-shared/${volname}-${voltest}-shared.out.err + ) + add_test (NAME VOL-${volname}-${voltest}-shared + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$<TARGET_FILE:${voltest}-shared>" + -D "TEST_ARGS:STRING=" + -D "TEST_VOL:STRING=${volinfo}" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_OUTPUT=${volname}-${voltest}-shared.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${volname}-shared" + -P "${HDF_RESOURCES_DIR}/volTest.cmake" + ) + set_tests_properties (VOL-${volname}-${voltest}-shared PROPERTIES + DEPENDS VOL-${volname}-${voltest}-shared-clear-objects + ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${volname}-shared;HDF5TestExpress=${HDF_TEST_EXPRESS}" + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${volname}-shared + ) + endif () + endif () + endmacro () + + macro (DO_VOL_TEST voltest volname volinfo resultcode) + #message(STATUS "${voltest}-${volname} with ${volinfo}") + add_test ( + NAME VOL-${volname}-${voltest}-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + ${volname}/${volname}-${voltest}.out + ${volname}/${volname}-${voltest}.out.err + ) + add_test (NAME VOL-${volname}-${voltest} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$<TARGET_FILE:${voltest}>" + -D "TEST_ARGS:STRING=" + -D "TEST_VOL:STRING=${volinfo}" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_OUTPUT=${volname}-${voltest}.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${volname}" + -P "${HDF_RESOURCES_DIR}/volTest.cmake" + ) + set_tests_properties (VOL-${volname}-${voltest} PROPERTIES + DEPENDS VOL-${volname}-${voltest}-clear-objects + ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${volname}" + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${volname} + ) + if (BUILD_SHARED_LIBS) + add_test ( + NAME VOL-${volname}-${voltest}-shared-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + ${volname}-shared/${volname}-${voltest}-shared.out + ${volname}-shared/${volname}-${voltest}-shared.out.err + ) + add_test (NAME VOL-${volname}-${voltest}-shared + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$<TARGET_FILE:${voltest}-shared>" + -D "TEST_ARGS:STRING=" + -D "TEST_VOL:STRING=${volinfo}" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_OUTPUT=${volname}-${voltest}-shared.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${volname}-shared" + -P "${HDF_RESOURCES_DIR}/volTest.cmake" + ) + set_tests_properties (VOL-${volname}-${voltest}-shared PROPERTIES + DEPENDS VOL-${volname}-${voltest}-shared-clear-objects + ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${volname}-shared" + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${volname}-shared + ) + endif () + endmacro () + + macro (ADD_VOL_TEST volname volinfo resultcode) + #message(STATUS "volname=${volname} volinfo=${volinfo}") + foreach (h5_test ${H5_TESTS}) + if (NOT h5_test IN_LIST H5_VOL_SKIP_TESTS) + if (WIN32) + CHECK_VOL_TEST (${h5_test} ${volname} "${volinfo}" ${resultcode}) + else () + DO_VOL_TEST (${h5_test} ${volname} "${volinfo}" ${resultcode}) + endif () + endif () + endforeach () + set_tests_properties (VOL-${volname}-flush2 PROPERTIES DEPENDS VOL-${volname}-flush1) + set_tests_properties (VOL-${volname}-flush1 PROPERTIES TIMEOUT 10) + set_tests_properties (VOL-${volname}-flush2 PROPERTIES TIMEOUT 10) + set_tests_properties (VOL-${volname}-istore PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) + if (NOT CYGWIN) + set_tests_properties (VOL-${volname}-cache PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) + endif () + if (BUILD_SHARED_LIBS) + set_tests_properties (VOL-${volname}-flush2-shared PROPERTIES DEPENDS VOL-${volname}-flush1-shared) + set_tests_properties (VOL-${volname}-flush1-shared PROPERTIES TIMEOUT 10) + set_tests_properties (VOL-${volname}-flush2-shared PROPERTIES TIMEOUT 10) + set_tests_properties (VOL-${volname}-istore-shared PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) + if (NOT CYGWIN AND NOT WIN32) + set_tests_properties (VOL-${volname}-cache-shared PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) + endif () + endif () + if (HDF5_TEST_FHEAP_VOL) + add_test ( + NAME VOL-${volname}-fheap-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + ${volname}/${volname}-fheap.out + ${volname}/${volname}-fheap.out.err + ) + add_test (NAME VOL-${volname}-fheap + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$<TARGET_FILE:fheap>" + -D "TEST_ARGS:STRING=" + -D "TEST_VOL:STRING=${volinfo}" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_OUTPUT=${volname}-fheap.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${volname}" + -P "${HDF_RESOURCES_DIR}/volTest.cmake" + ) + set_tests_properties (VOL-${volname}-fheap PROPERTIES + DEPENDS VOL-${volname}-fheap-clear-objects + TIMEOUT ${CTEST_VERY_LONG_TIMEOUT} + ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${volname};HDF5TestExpress=${HDF_TEST_EXPRESS}" + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${volname} + ) + if (BUILD_SHARED_LIBS) + add_test ( + NAME VOL-${volname}-fheap-shared-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + ${volname}-shared/${volname}-fheap-shared.out + ${volname}-shared/${volname}-fheap-shared.out.err + ) + add_test (NAME VOL-${volname}-fheap-shared + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$<TARGET_FILE:fheap-shared>" + -D "TEST_ARGS:STRING=" + -D "TEST_VOL:STRING=${volinfo}" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_OUTPUT=${volname}-fheap-shared.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${volname}-shared" + -P "${HDF_RESOURCES_DIR}/volTest.cmake" + ) + set_tests_properties (VOL-${volname}-fheap-shared PROPERTIES + DEPENDS VOL-${volname}-fheap-shared-clear-objects + TIMEOUT ${CTEST_VERY_LONG_TIMEOUT} + ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${volname}-shared;HDF5TestExpress=${HDF_TEST_EXPRESS}" + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${volname}-shared + ) + endif () + endif () + endmacro () + + # Run test with different Virtual File Driver + foreach (volname ${VOL_LIST}) + #message(STATUS "volname=${volname}") + foreach (volinfo IN LISTS ${volname}) + #message(STATUS "${volname} volinfo=${volinfo}") + ADD_VOL_TEST (${volname} "${volinfo}" 0) + endforeach () + endforeach () + diff --git a/test/Makefile.am b/test/Makefile.am index 1526eca..88dc542 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -29,20 +29,21 @@ AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_builddir)/src # testflushrefresh.sh: flushrefresh # testswmr.sh: swmr* # testvdsswmr.sh: vds_swmr* -# test_filenotclosed.sh: filenotclosed.c +# testabort_fail.sh: filenotclosed.c and del_many_dense_attrs.c # test_filter_plugin.sh: filter_plugin.c # test_usecases.sh: use_append_chunk, use_append_mchunks, use_disable_mdc_flushes -TEST_SCRIPT = testerror.sh testlibinfo.sh testcheck_version.sh testlinks_env.sh test_filenotclosed.sh\ - testswmr.sh testvdsswmr.sh testflushrefresh.sh test_usecases.sh -SCRIPT_DEPEND = error_test$(EXEEXT) err_compat$(EXEEXT) links_env$(EXEEXT) filenotclosed$(EXEEXT) \ +TEST_SCRIPT = testerror.sh testlibinfo.sh testcheck_version.sh testlinks_env.sh \ + testswmr.sh testvdsswmr.sh testflushrefresh.sh test_usecases.sh testabort_fail.sh +SCRIPT_DEPEND = error_test$(EXEEXT) err_compat$(EXEEXT) links_env$(EXEEXT) \ + filenotclosed$(EXEEXT) del_many_dense_attrs$(EXEEXT) \ flushrefresh$(EXEEXT) use_append_chunk$(EXEEXT) use_append_mchunks$(EXEEXT) use_disable_mdc_flushes$(EXEEXT) \ swmr_generator$(EXEEXT) swmr_reader$(EXEEXT) swmr_writer$(EXEEXT) \ swmr_remove_reader$(EXEEXT) swmr_remove_writer$(EXEEXT) swmr_addrem_writer$(EXEEXT) \ swmr_sparse_reader$(EXEEXT) swmr_sparse_writer$(EXEEXT) swmr_start_write$(EXEEXT) \ vds_swmr_gen$(EXEEXT) vds_swmr_reader$(EXEEXT) vds_swmr_writer$(EXEEXT) if HAVE_SHARED_CONDITIONAL - TEST_SCRIPT += test_filter_plugin.sh - SCRIPT_DEPEND += filter_plugin$(EXEEXT) + TEST_SCRIPT += test_filter_plugin.sh test_vol_plugin.sh + SCRIPT_DEPEND += filter_plugin$(EXEEXT) vol_plugin$(EXEEXT) endif check_SCRIPTS = $(TEST_SCRIPT) @@ -52,8 +53,8 @@ check_SCRIPTS = $(TEST_SCRIPT) # As an exception, long-running tests should occur earlier in the list. # This gives them more time to run when tests are executing in parallel. TEST_PROG= testhdf5 \ - cache cache_api cache_image cache_tagging lheap ohdr stab gheap \ - evict_on_close farray earray btree2 fheap \ + cache cache_api cache_image cache_tagging lheap ohdr \ + stab gheap evict_on_close farray earray btree2 fheap \ pool accum hyperslab istore bittests dt_arith page_buffer \ dtypes dsets cmpd_dset filter_fail extend direct_chunk external efc \ objcopy links unlink twriteorder big mtime fillval mount \ @@ -68,7 +69,7 @@ TEST_PROG= testhdf5 \ # accum_swmr_reader is used by accum.c. # atomic_writer and atomic_reader are standalone programs. # links_env is used by testlinks_env.sh -# filenotclosed is used by test_filenotclosed.sh +# filenotclosed and del_many_dense_attrs are used by testabort_fail.sh # flushrefresh is used by testflushrefresh.sh. # use_append_chunk, use_append_mchunks and use_disable_mdc_flushes are used by test_usecases.sh # swmr_* files (besides swmr.c) are used by testswmr.sh. @@ -78,12 +79,13 @@ TEST_PROG= testhdf5 \ # and this lets automake keep all its test programs in one place. check_PROGRAMS=$(TEST_PROG) error_test err_compat tcheck_version \ testmeta accum_swmr_reader atomic_writer atomic_reader \ - links_env filenotclosed flushrefresh use_append_chunk use_append_mchunks use_disable_mdc_flushes \ + links_env filenotclosed del_many_dense_attrs flushrefresh \ + use_append_chunk use_append_mchunks use_disable_mdc_flushes \ swmr_generator swmr_start_write swmr_reader swmr_writer swmr_remove_reader \ swmr_remove_writer swmr_addrem_writer swmr_sparse_reader swmr_sparse_writer \ swmr_check_compat_vfd vds_swmr_gen vds_swmr_reader vds_swmr_writer if HAVE_SHARED_CONDITIONAL - check_PROGRAMS+= filter_plugin + check_PROGRAMS+= filter_plugin vol_plugin endif # These programs generate test files for the tests. They don't need to be @@ -106,9 +108,7 @@ if HAVE_SHARED_CONDITIONAL # The libh5test library provides common support code for the tests. # The filter_plugin* libraries are for use in filter_plugin.c. # Build them as shared libraries if that option was enabled in configure. - # - # echo_vol is used for testing VOL plugin functionality. - noinst_LTLIBRARIES=libh5test.la libfilter_plugin1_dsets.la libfilter_plugin2_dsets.la libfilter_plugin3_dsets.la libfilter_plugin4_groups.la echo_vol.la + noinst_LTLIBRARIES=libh5test.la libfilter_plugin1_dsets.la libfilter_plugin2_dsets.la libfilter_plugin3_dsets.la libfilter_plugin4_groups.la libnull_vol_connector.la libfilter_plugin1_dsets_la_SOURCES=filter_plugin1_dsets.c libfilter_plugin2_dsets_la_SOURCES=filter_plugin2_dsets.c libfilter_plugin3_dsets_la_SOURCES=filter_plugin3_dsets.c @@ -121,8 +121,10 @@ if HAVE_SHARED_CONDITIONAL libfilter_plugin4_groups_la_LIBADD=$(LIBHDF5) # VOL plugin test libraries - echo_vol_la_SOURCES=echo_vol.c - echo_vol_la_LDFLAGS=$(AM_LDFLAGS) -avoid-version -module -shared -export-dynamic -rpath /nowhere + # + # null_vol_connector is used for testing basic VOL plugin functionality. + libnull_vol_connector_la_SOURCES=null_vol_connector.c + libnull_vol_connector_la_LDFLAGS=$(AM_LDFLAGS) -avoid-version -module -shared -export-dynamic -rpath /nowhere else # The libh5test library provides common support code for the tests. @@ -177,6 +179,7 @@ CHECK_CLEANFILES+=accum.h5 cmpd_dset.h5 compact_dataset.h5 dataset.h5 dset_offse extend.h5 istore.h5 extlinks*.h5 frspace.h5 links*.h5 \ sys_file1 tfile[1-7].h5 th5s[1-4].h5 lheap.h5 fheap.h5 ohdr.h5 \ stab.h5 extern_[1-5].h5 extern_[1-4][rw].raw gheap[0-4].h5 \ + ohdr_min_a.h5 ohdr_min_b.h5 min_dset_ohdr_testfile.h5\ dt_arith[1-2] links.h5 links[0-6]*.h5 extlinks[0-15].h5 tmp \ big.data big[0-9][0-9][0-9][0-9][0-9].h5 \ stdio.h5 sec2.h5 dtypes[0-9].h5 dtypes1[0].h5 dt_arith[1-2].h5 tattr.h5 \ @@ -220,6 +223,7 @@ use_disable_mdc_flushes_SOURCES=use_disable_mdc_flushes.c # Temporary files. DISTCLEANFILES=testerror.sh testlibinfo.sh testcheck_version.sh testlinks_env.sh test_filter_plugin.sh \ - testswmr.sh testvdsswmr.sh test_usecases.sh testflushrefresh.sh test_filenotclosed.sh + testswmr.sh testvdsswmr.sh test_usecases.sh testflushrefresh.sh testabort_fail.sh \ + test_vol_plugin.sh include $(top_srcdir)/config/conclude.am diff --git a/test/ShellTests.cmake b/test/ShellTests.cmake index 58dc85d..98f3daf 100644 --- a/test/ShellTests.cmake +++ b/test/ShellTests.cmake @@ -171,6 +171,7 @@ if (UNIX) # atomic_writer # atomic_reader # filenotclosed + # del_many_dense_attrs # flushrefresh ############################################################################## # autotools script tests @@ -178,7 +179,7 @@ if (UNIX) # NOT CONVERTED accum_swmr_reader is used by accum.c. # NOT CONVERTED atomic_writer and atomic_reader are standalone programs. # links_env is used by testlinks_env.sh - # filenotclosed is used by test_filenotclosed.sh + # filenotclosed and del_many_dense_attrs are used by testabort_fail.sh # NOT CONVERTED flushrefresh is used by testflushrefresh.sh. # NOT CONVERTED use_append_chunk, use_append_mchunks and use_disable_mdc_flushes are used by test_usecases.sh # NOT CONVERTED swmr_* files (besides swmr.c) are used by testswmr.sh. diff --git a/test/accum.c b/test/accum.c index 87628d8..da90995 100644 --- a/test/accum.c +++ b/test/accum.c @@ -26,10 +26,13 @@ #include "H5VLprivate.h" /* Virtual Object Layer */ /* Filename */ -#define FILENAME "accum.h5" +/* (The file names are the same as the define in accum_swmr_reader.c) */ +const char *FILENAME[] = { + "accum", + "accum_swmr_big", + NULL +}; -/* The file name is the same as the define in accum_swmr_reader.c */ -#define SWMR_FILENAME "accum_swmr_big.h5" /* The reader forked by test_swmr_write_big() */ #define SWMR_READER "accum_swmr_reader" @@ -92,22 +95,21 @@ main(void) hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ hid_t fid = -1; hid_t fapl = -1; /* File access property list */ + char filename[1024]; H5F_t * f = NULL; /* File for all tests */ /* Test Setup */ - puts("Testing the metadata accumulator"); + HDputs("Testing the metadata accumulator"); /* File access property list */ + h5_reset(); if((fapl = h5_fileaccess()) < 0) FAIL_STACK_ERROR + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); /* Create a test file */ - if((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR - - /* Closing and remove the file */ - if(H5Pclose(fapl) < 0) - FAIL_STACK_ERROR + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR /* Push API context */ if(H5CX_push() < 0) FAIL_STACK_ERROR @@ -143,7 +145,6 @@ main(void) /* End of test code, close and delete file */ if(H5Fclose(fid) < 0) TEST_ERROR - HDremove(FILENAME); /* This test uses a different file */ nerrors += test_swmr_write_big(TRUE); @@ -151,14 +152,15 @@ main(void) if(nerrors) goto error; - puts("All metadata accumulator tests passed."); + HDputs("All metadata accumulator tests passed."); + h5_cleanup(FILENAME, fapl); return 0; error: if(api_ctx_pushed) H5CX_pop(); - puts("*** TESTS FAILED ***"); + HDputs("*** TESTS FAILED ***"); return 1; } /* end main() */ @@ -1828,6 +1830,7 @@ test_swmr_write_big(hbool_t newest_format) hid_t fid = -1; /* File ID */ hid_t fapl = -1; /* File access property list */ H5F_t *rf = NULL; /* File pointer */ + char filename[1024]; uint8_t *wbuf2 = NULL, *rbuf = NULL; /* Buffers for reading & writing */ uint8_t wbuf[1024]; /* Buffer for reading & writing */ unsigned u; /* Local index variable */ @@ -1865,17 +1868,18 @@ test_swmr_write_big(hbool_t newest_format) /* File access property list */ if((fapl = h5_fileaccess()) < 0) FAIL_STACK_ERROR + h5_fixname(FILENAME[1], fapl, filename, sizeof filename); /* Both cases will result in v3 superblock and version 2 object header for SWMR */ if(newest_format) { /* latest format */ if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) FAIL_STACK_ERROR - if((fid = H5Fcreate(SWMR_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR } else { /* non-latest-format */ - if((fid = H5Fcreate(SWMR_FILENAME, H5F_ACC_TRUNC|H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl)) < 0) + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC|H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR } /* end if */ @@ -1884,7 +1888,7 @@ test_swmr_write_big(hbool_t newest_format) FAIL_STACK_ERROR /* Open the file with SWMR_WRITE */ - if((fid = H5Fopen(SWMR_FILENAME, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl)) < 0) + if((fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl)) < 0) FAIL_STACK_ERROR /* Push API context */ @@ -1979,20 +1983,19 @@ test_swmr_write_big(hbool_t newest_format) /* Flush the accumulator */ if(accum_reset(rf) < 0) FAIL_STACK_ERROR; - /* Close the property list */ - if(H5Pclose(fapl) < 0) - FAIL_STACK_ERROR; /* Close and remove the file */ if(H5Fclose(fid) < 0) FAIL_STACK_ERROR; + /* Close the property list */ + if(H5Pclose(fapl) < 0) + FAIL_STACK_ERROR; + /* Pop API context */ if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR api_ctx_pushed = FALSE; - HDremove(SWMR_FILENAME); - /* Release memory */ if(wbuf2) HDfree(wbuf2); @@ -2004,12 +2007,11 @@ test_swmr_write_big(hbool_t newest_format) error: /* Closing and remove the file */ - H5Pclose(fapl); H5Fclose(fid); if(api_ctx_pushed) H5CX_pop(); - HDremove(SWMR_FILENAME); + H5Pclose(fapl); /* Release memory */ if(wbuf2) diff --git a/test/accum_swmr_reader.c b/test/accum_swmr_reader.c index 16e0ddc..ac48a13 100644 --- a/test/accum_swmr_reader.c +++ b/test/accum_swmr_reader.c @@ -23,7 +23,12 @@ #include "H5VLprivate.h" /* Virtual Object Layer */ /* Filename: this is the same as the define in accum.c used by test_swmr_write_big() */ -#define SWMR_FILENAME "accum_swmr_big.h5" +const char *FILENAME[] = { + "accum", + "accum_swmr_big", + NULL +}; + /*------------------------------------------------------------------------- @@ -47,6 +52,7 @@ main(void) hid_t fid = -1; /* File ID */ hid_t fapl = -1; /* file access property list ID */ H5F_t *f = NULL; /* File pointer */ + char filename[1024]; unsigned u; /* Local index variable */ uint8_t rbuf[1024]; /* Buffer for reading */ uint8_t buf[1024]; /* Buffer for holding the expected data */ @@ -68,10 +74,11 @@ main(void) if((fapl = h5_fileaccess()) < 0) FAIL_STACK_ERROR + h5_fixname(FILENAME[1], fapl, filename, sizeof filename); /* Open the file with SWMR_READ */ - if((fid = H5Fopen(SWMR_FILENAME, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0) - FAIL_STACK_ERROR + if((fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0) + FAIL_STACK_ERROR /* Push API context */ if(H5CX_push() < 0) FAIL_STACK_ERROR @@ -79,21 +86,21 @@ main(void) /* Get H5F_t * to internal file structure */ if(NULL == (f = (H5F_t *)H5VL_object(fid))) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* Should read in [1024, 2024] with buf data */ if(H5F_block_read(f, H5FD_MEM_DEFAULT, (haddr_t)1024, (size_t)1024, rbuf) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Verify the data read is correct */ if(HDmemcmp(buf, rbuf, (size_t)1024) != 0) - TEST_ERROR; + TEST_ERROR; /* CLose the file */ if(H5Pclose(fapl) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Fclose(fid) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Pop API context */ if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR diff --git a/test/app_ref.c b/test/app_ref.c index 3ef3fef..a4853fa 100644 --- a/test/app_ref.c +++ b/test/app_ref.c @@ -83,8 +83,8 @@ Abrt_Handler (int H5_ATTR_UNUSED sig) int i, n; for (i=0; i<T_NUMCLASSES; i++) { - fprintf(stderr, "%s ID reference count: %n", IDNAME[i], &n); - fprintf(stderr, "%*d\n", (n < ERR_WIDTH) ? (ERR_WIDTH - n) : 0, rc[i]); + HDfprintf(stderr, "%s ID reference count: %n", IDNAME[i], &n); + HDfprintf(stderr, "%*d\n", (n < ERR_WIDTH) ? (ERR_WIDTH - n) : 0, rc[i]); } } @@ -195,7 +195,7 @@ main (void) error: - puts("***** APPLICATION REFERENCE COUNT TESTS FAILED *****"); + HDputs("***** APPLICATION REFERENCE COUNT TESTS FAILED *****"); return 1; } @@ -524,7 +524,7 @@ reader(char *filename, hid_t fapl) } if(zero) { H5_FAILED(); - printf(" %d zero%s\n", zero, 1 == zero ? "" : "s"); + HDprintf(" %d zero%s\n", zero, 1 == zero ? "" : "s"); } else if(wrong) { SKIPPED(); HDputs(" Possible overlap with another region."); @@ -765,7 +765,7 @@ main (int ac, char **av) family_size_def = (hsize_t)HDstrtoull(*av, NULL, 0); } else{ - printf("***Missing fsize value***\n"); + HDprintf("***Missing fsize value***\n"); usage(); return 1; } diff --git a/test/bittests.c b/test/bittests.c index ccd725c..e29c188 100644 --- a/test/bittests.c +++ b/test/bittests.c @@ -57,13 +57,13 @@ test_find (void) n = H5T__bit_find(v1, (size_t)0, (size_t)0, H5T_BIT_LSB, TRUE); if(-1 != n) { H5_FAILED(); - puts (" Zero length test failed (lsb)!"); + HDputs (" Zero length test failed (lsb)!"); goto failed; } n = H5T__bit_find(v1, (size_t)0, (size_t)0, H5T_BIT_MSB, TRUE); if(-1 != n) { H5_FAILED(); - puts (" Zero length test failed (msb)!"); + HDputs (" Zero length test failed (msb)!"); goto failed; } @@ -73,13 +73,13 @@ test_find (void) n = H5T__bit_find(v1, (size_t)0, 8 * sizeof(v1), H5T_BIT_LSB, TRUE); if(-1 != n) { H5_FAILED(); - puts (" Zero buffer test failed (lsb)!"); + HDputs (" Zero buffer test failed (lsb)!"); goto failed; } n = H5T__bit_find(v1, (size_t)0, 8 * sizeof(v1), H5T_BIT_MSB, TRUE); if(-1 != n) { H5_FAILED(); - puts (" Zero buffer test failed (msb)!"); + HDputs (" Zero buffer test failed (msb)!"); goto failed; } @@ -90,13 +90,13 @@ test_find (void) n = H5T__bit_find(v1, (size_t)0, 8 * sizeof(v1), H5T_BIT_LSB, TRUE); if((ssize_t)i != n) { H5_FAILED(); - printf (" Test for set bit %d failed (lsb)!\n", i); + HDprintf (" Test for set bit %d failed (lsb)!\n", i); goto failed; } n = H5T__bit_find(v1, (size_t)0, 8 * sizeof(v1), H5T_BIT_MSB, TRUE); if((ssize_t)i != n) { H5_FAILED(); - printf (" Test for set bit %d failed (msb)!\n", i); + HDprintf (" Test for set bit %d failed (msb)!\n", i); goto failed; } } @@ -106,13 +106,13 @@ test_find (void) n = H5T__bit_find(v1, (size_t)0, 8 * sizeof(v1), H5T_BIT_LSB, FALSE); if(-1 != n) { H5_FAILED(); - puts (" One buffer test failed (lsb)!"); + HDputs (" One buffer test failed (lsb)!"); goto failed; } n = H5T__bit_find(v1, (size_t)0, 8 * sizeof(v1), H5T_BIT_MSB, FALSE); if(-1 != n) { H5_FAILED(); - puts (" One buffer test failed (msb)!"); + HDputs (" One buffer test failed (msb)!"); goto failed; } @@ -123,13 +123,13 @@ test_find (void) n = H5T__bit_find (v1, (size_t)0, 8*sizeof(v1), H5T_BIT_LSB, FALSE); if ((ssize_t)i!=n) { H5_FAILED(); - printf (" Test for clear bit %d failed (lsb)!\n", i); + HDprintf (" Test for clear bit %d failed (lsb)!\n", i); goto failed; } n = H5T__bit_find (v1, (size_t)0, 8*sizeof(v1), H5T_BIT_MSB, FALSE); if ((ssize_t)i!=n) { H5_FAILED(); - printf (" Test for clear bit %d failed (lsb)!\n", i); + HDprintf (" Test for clear bit %d failed (lsb)!\n", i); goto failed; } } @@ -139,9 +139,9 @@ test_find (void) return 0; failed: - printf (" v = 0x"); - for (i=0; i<(int)sizeof(v1); i++) printf ("%02x", v1[i]); - printf ("\n"); + HDprintf (" v = 0x"); + for (i=0; i<(int)sizeof(v1); i++) HDprintf ("%02x", v1[i]); + HDprintf ("\n"); return -1; } @@ -185,12 +185,12 @@ test_copy (void) for (j=0; j<(int)sizeof(v2); j++) if (v2[j]) break; if (size>0 && j>=(int)sizeof(v2)) { H5_FAILED(); - puts (" Unabled to find copied region in destination"); + HDputs (" Unabled to find copied region in destination"); goto failed; } if (0==size && j<(int)sizeof(v2)) { H5_FAILED(); - puts (" Found copied bits when we shouldn't have"); + HDputs (" Found copied bits when we shouldn't have"); goto failed; } @@ -199,25 +199,25 @@ test_copy (void) n = H5T__bit_find (v2, (size_t)0, 8*sizeof(v2), H5T_BIT_LSB, 1); if (size>0 && n!=(ssize_t)d_offset) { H5_FAILED(); - printf (" Unable to find first copied bit in destination " + HDprintf (" Unable to find first copied bit in destination " "(n=%d)\n", (int)n); goto failed; } if (0==size && n>=0) { H5_FAILED(); - puts (" Found copied bits and shouldn't have!"); + HDputs (" Found copied bits and shouldn't have!"); goto failed; } n = H5T__bit_find (v2, d_offset, 8*sizeof(v2)-d_offset, H5T_BIT_LSB, 0); if (d_offset+size<8*sizeof(v2) && n!=(ssize_t)size) { H5_FAILED(); - printf (" Unable to find last copied bit in destination " + HDprintf (" Unable to find last copied bit in destination " "(n=%d)\n", (int)n); goto failed; } if (d_offset+size==8*sizeof(v2) && n>=0) { H5_FAILED(); - puts (" High-order zeros are present and shouldn't be!"); + HDputs (" High-order zeros are present and shouldn't be!"); goto failed; } @@ -228,25 +228,25 @@ test_copy (void) n = H5T__bit_find (v2, (size_t)0, 8*sizeof(v2), H5T_BIT_MSB, 1); if (size>0 && (size_t)(n+1)!=d_offset+size) { H5_FAILED(); - printf (" Unable to find last copied bit in destination " + HDprintf (" Unable to find last copied bit in destination " "(reverse, n=%d)\n", (int)n); goto failed; } if (0==size && n>=0) { H5_FAILED(); - puts (" Found copied bits but shouldn't have (reverse)!"); + HDputs (" Found copied bits but shouldn't have (reverse)!"); goto failed; } n = H5T__bit_find (v2, (size_t)0, d_offset+size, H5T_BIT_MSB, 0); if (d_offset>0 && n+1!=(ssize_t)d_offset) { H5_FAILED(); - printf (" Unable to find beginning of copied data " + HDprintf (" Unable to find beginning of copied data " "(reverse, n=%d)\n", (int)n); goto failed; } if (0==d_offset && n>=0) { H5_FAILED(); - puts (" Found leading original data but shouldn't have!"); + HDputs (" Found leading original data but shouldn't have!"); goto failed; } @@ -256,14 +256,14 @@ test_copy (void) return 0; failed: - printf (" i=%d, s_offset=%lu, d_offset=%lu, size=%lu\n", + HDprintf (" i=%d, s_offset=%lu, d_offset=%lu, size=%lu\n", i, (unsigned long)s_offset, (unsigned long)d_offset, (unsigned long)size); - printf (" s = 0x"); - for (j=sizeof(v1)-1; j>=0; --j) printf ("%02x", v1[j]); - printf ("\n d = 0x"); - for (j=sizeof(v2)-1; j>=0; --j) printf ("%02x", v2[j]); - printf ("\n"); + HDprintf (" s = 0x"); + for (j=sizeof(v1)-1; j>=0; --j) HDprintf ("%02x", v1[j]); + HDprintf ("\n d = 0x"); + for (j=sizeof(v2)-1; j>=0; --j) HDprintf ("%02x", v2[j]); + HDprintf ("\n"); return -1; } @@ -311,7 +311,7 @@ test_shift (void) n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_LSB, 1); if(n != (ssize_t)offset + shift_dist) { H5_FAILED(); - printf (" Unable to find first bit in destination " + HDprintf (" Unable to find first bit in destination " "(n=%d)\n", (int)n); goto failed; } @@ -323,7 +323,7 @@ test_shift (void) n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_MSB, 1); if (n!=(ssize_t)(offset+size-1)) { H5_FAILED(); - printf (" Unable to find last bit in destination " + HDprintf (" Unable to find last bit in destination " "(reverse, n=%d)\n", (int)n); goto failed; } @@ -338,7 +338,7 @@ test_shift (void) n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_LSB, 1); if ((size_t)n!=offset) { H5_FAILED(); - printf (" Unable to find first bit in destination " + HDprintf (" Unable to find first bit in destination " "(n=%d)\n", (int)n); goto failed; } @@ -350,7 +350,7 @@ test_shift (void) n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_MSB, 1); if(n != (ssize_t)(offset + size) - shift_dist - 1) { H5_FAILED(); - printf (" Unable to find last bit in destination " + HDprintf (" Unable to find last bit in destination " "(reverse, n=%d)\n", (int)n); goto failed; } @@ -373,7 +373,7 @@ test_shift (void) n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_LSB, 1); if (n >= 0) { H5_FAILED(); - printf (" Unable to verify all bits are zero in destination(LSB) " + HDprintf (" Unable to verify all bits are zero in destination(LSB) " "(n=%d)\n", (int)n); goto failed; } @@ -382,7 +382,7 @@ test_shift (void) n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_MSB, 1); if (n >= 0) { H5_FAILED(); - printf (" Unable to verify all bits are zero in destination(MSB) " + HDprintf (" Unable to verify all bits are zero in destination(MSB) " "(n=%d)\n", (int)n); goto failed; } @@ -392,11 +392,11 @@ test_shift (void) return 0; failed: - printf (" i=%d, offset=%lu, size=%lu, shift_dist=%lu\n", + HDprintf (" i=%d, offset=%lu, size=%lu, shift_dist=%lu\n", i, (unsigned long)offset, (unsigned long)size, (unsigned long)shift_dist); - for (j=sizeof(vector)-1; j>=0; --j) printf ("%02x", vector[j]); - printf ("\n"); + for (j=sizeof(vector)-1; j>=0; --j) HDprintf ("%02x", vector[j]); + HDprintf ("\n"); return -1; } @@ -446,13 +446,13 @@ test_increment (void) n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_LSB, 1); if (size!=1 && (size_t)n!=offset+size-1) { H5_FAILED(); - printf (" Unable to find first bit in destination " + HDprintf (" Unable to find first bit in destination " "(n=%d)\n", (int)n); goto failed; } if(size==1 && n>=0) { H5_FAILED(); - printf (" Unable to verify all-zero bit in destination " + HDprintf (" Unable to verify all-zero bit in destination " "(n=%d)\n", (int)n); goto failed; } @@ -464,13 +464,13 @@ test_increment (void) n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_MSB, 1); if (size!=1 && n!=(ssize_t)(offset+size-1)) { H5_FAILED(); - printf (" Unable to find last bit in destination " + HDprintf (" Unable to find last bit in destination " "(reverse, n=%d)\n", (int)n); goto failed; } if(size==1 && n>=0) { H5_FAILED(); - printf (" Unable to verify all-zero bit in destination " + HDprintf (" Unable to verify all-zero bit in destination " "(reverse, n=%d)\n", (int)n); goto failed; } @@ -480,10 +480,10 @@ test_increment (void) return 0; failed: - printf (" i=%d, offset=%lu, size=%lu\n", + HDprintf (" i=%d, offset=%lu, size=%lu\n", i, (unsigned long)offset, (unsigned long)size); - for (j=sizeof(vector)-1; j>=0; --j) printf ("%02x", vector[j]); - printf ("\n"); + for (j=sizeof(vector)-1; j>=0; --j) HDprintf ("%02x", vector[j]); + HDprintf ("\n"); return -1; } @@ -530,7 +530,7 @@ test_decrement (void) n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_LSB, 1); if ((size_t)n!=offset) { H5_FAILED(); - printf (" Unable to find first bit in destination " + HDprintf (" Unable to find first bit in destination " "(n=%d)\n", (int)n); goto failed; } @@ -542,7 +542,7 @@ test_decrement (void) n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_MSB, 1); if (n!=(ssize_t)(offset+size-1)) { H5_FAILED(); - printf (" Unable to find last bit in destination " + HDprintf (" Unable to find last bit in destination " "(reverse, n=%d)\n", (int)n); goto failed; } @@ -552,10 +552,10 @@ test_decrement (void) return 0; failed: - printf (" i=%d, offset=%lu, size=%lu\n", + HDprintf (" i=%d, offset=%lu, size=%lu\n", i, (unsigned long)offset, (unsigned long)size); - for (j=sizeof(vector)-1; j>=0; --j) printf ("%02x", vector[j]); - printf ("\n"); + for (j=sizeof(vector)-1; j>=0; --j) HDprintf ("%02x", vector[j]); + HDprintf ("\n"); return -1; } @@ -602,7 +602,7 @@ test_negate (void) n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_LSB, 1); if ((size_t)n!=offset) { H5_FAILED(); - printf (" Unable to find first bit in destination " + HDprintf (" Unable to find first bit in destination " "(n=%d)\n", (int)n); goto failed; } @@ -614,7 +614,7 @@ test_negate (void) n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_MSB, 1); if (n!=(ssize_t)(offset+size-1)) { H5_FAILED(); - printf (" Unable to find last bit in destination " + HDprintf (" Unable to find last bit in destination " "(reverse, n=%d)\n", (int)n); goto failed; } @@ -630,7 +630,7 @@ test_negate (void) n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_LSB, 1); if (n>=0) { H5_FAILED(); - printf (" Unable to verify all-zero bits in destination " + HDprintf (" Unable to verify all-zero bits in destination " "(n=%d)\n", (int)n); goto failed; } @@ -642,7 +642,7 @@ test_negate (void) n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_MSB, 1); if (n>=0) { H5_FAILED(); - printf (" Unable to verify all-zero bits in destination " + HDprintf (" Unable to verify all-zero bits in destination " "(reverse, n=%d)\n", (int)n); goto failed; } @@ -652,10 +652,10 @@ test_negate (void) return 0; failed: - printf (" i=%d, offset=%lu, size=%lu\n", + HDprintf (" i=%d, offset=%lu, size=%lu\n", i, (unsigned long)offset, (unsigned long)size); - for (j=sizeof(vector)-1; j>=0; --j) printf ("%02x", vector[j]); - printf ("\n"); + for (j=sizeof(vector)-1; j>=0; --j) HDprintf ("%02x", vector[j]); + HDprintf ("\n"); return -1; } @@ -697,12 +697,12 @@ test_set (void) for (j=0; j<(int)sizeof(v2); j++) if (v2[j]) break; if (size>0 && j>=(int)sizeof(v2)) { H5_FAILED(); - puts (" Unabled to find set region in buffer"); + HDputs (" Unabled to find set region in buffer"); goto failed; } if (0==size && j<(int)sizeof(v2)) { H5_FAILED(); - puts (" Found set bits when we shouldn't have"); + HDputs (" Found set bits when we shouldn't have"); goto failed; } @@ -711,25 +711,25 @@ test_set (void) n = H5T__bit_find (v2, (size_t)0, 8*sizeof(v2), H5T_BIT_LSB, 1); if (size>0 && n!=(ssize_t)d_offset) { H5_FAILED(); - printf (" Unable to find first set bit in destination " + HDprintf (" Unable to find first set bit in destination " "(n=%d)\n", (int)n); goto failed; } if (0==size && n>=0) { H5_FAILED(); - puts (" Found set bits and shouldn't have!"); + HDputs (" Found set bits and shouldn't have!"); goto failed; } n = H5T__bit_find (v2, d_offset, 8*sizeof(v2)-d_offset, H5T_BIT_LSB, 0); if (d_offset+size<8*sizeof(v2) && n!=(ssize_t)size) { H5_FAILED(); - printf (" Unable to find last set bit in destination " + HDprintf (" Unable to find last set bit in destination " "(n=%d)\n", (int)n); goto failed; } if (d_offset+size==8*sizeof(v2) && n>=0) { H5_FAILED(); - puts (" High-order zeros are present and shouldn't be!"); + HDputs (" High-order zeros are present and shouldn't be!"); goto failed; } @@ -740,25 +740,25 @@ test_set (void) n = H5T__bit_find (v2, (size_t)0, 8*sizeof(v2), H5T_BIT_MSB, 1); if (size>0 && (size_t)(n+1)!=d_offset+size) { H5_FAILED(); - printf (" Unable to find last set bit in destination " + HDprintf (" Unable to find last set bit in destination " "(reverse, n=%d)\n", (int)n); goto failed; } if (0==size && n>=0) { H5_FAILED(); - puts (" Found set bits but shouldn't have (reverse)!"); + HDputs (" Found set bits but shouldn't have (reverse)!"); goto failed; } n = H5T__bit_find (v2, (size_t)0, d_offset+size, H5T_BIT_MSB, 0); if (d_offset>0 && n+1!=(ssize_t)d_offset) { H5_FAILED(); - printf (" Unable to find beginning of set bit region " + HDprintf (" Unable to find beginning of set bit region " "(reverse, n=%d)\n", (int)n); goto failed; } if (0==d_offset && n>=0) { H5_FAILED(); - puts (" Found leading zeros but shouldn't have!"); + HDputs (" Found leading zeros but shouldn't have!"); goto failed; } @@ -768,11 +768,11 @@ test_set (void) return 0; failed: - printf (" i=%d, d_offset=%lu, size=%lu\n", + HDprintf (" i=%d, d_offset=%lu, size=%lu\n", i, (unsigned long)d_offset, (unsigned long)size); - printf (" d = 0x"); - for (j=sizeof(v2)-1; j>=0; --j) printf ("%02x", v2[j]); - printf ("\n"); + HDprintf (" d = 0x"); + for (j=sizeof(v2)-1; j>=0; --j) HDprintf ("%02x", v2[j]); + HDprintf ("\n"); return -1; } @@ -814,12 +814,12 @@ test_clear (void) for (j=0; j<(int)sizeof(v2); j++) if (0xff!=v2[j]) break; if (size>0 && j>=(int)sizeof(v2)) { H5_FAILED(); - puts (" Unabled to find cleared region in buffer"); + HDputs (" Unabled to find cleared region in buffer"); goto failed; } if (0==size && j<(int)sizeof(v2)) { H5_FAILED(); - puts (" Found cleared bits when we shouldn't have"); + HDputs (" Found cleared bits when we shouldn't have"); goto failed; } @@ -828,25 +828,25 @@ test_clear (void) n = H5T__bit_find (v2, (size_t)0, 8*sizeof(v2), H5T_BIT_LSB, 0); if (size>0 && n!=(ssize_t)d_offset) { H5_FAILED(); - printf (" Unable to find first cleared bit in destination " + HDprintf (" Unable to find first cleared bit in destination " "(n=%d)\n", (int)n); goto failed; } if (0==size && n>=0) { H5_FAILED(); - puts (" Found cleared bits and shouldn't have!"); + HDputs (" Found cleared bits and shouldn't have!"); goto failed; } n = H5T__bit_find (v2, d_offset, 8*sizeof(v2)-d_offset, H5T_BIT_LSB, 1); if (d_offset+size<8*sizeof(v2) && n!=(ssize_t)size) { H5_FAILED(); - printf (" Unable to find last cleared bit in destination " + HDprintf (" Unable to find last cleared bit in destination " "(n=%d)\n", (int)n); goto failed; } if (d_offset+size==8*sizeof(v2) && n>=0) { H5_FAILED(); - puts (" High-order ones are present and shouldn't be!"); + HDputs (" High-order ones are present and shouldn't be!"); goto failed; } @@ -857,25 +857,25 @@ test_clear (void) n = H5T__bit_find (v2, (size_t)0, 8*sizeof(v2), H5T_BIT_MSB, 0); if (size>0 && (size_t)(n+1)!=d_offset+size) { H5_FAILED(); - printf (" Unable to find last cleared bit in destination " + HDprintf (" Unable to find last cleared bit in destination " "(reverse, n=%d)\n", (int)n); goto failed; } if (0==size && n>=0) { H5_FAILED(); - puts (" Found cleared bits but shouldn't have (reverse)!"); + HDputs (" Found cleared bits but shouldn't have (reverse)!"); goto failed; } n = H5T__bit_find (v2, (size_t)0, d_offset+size, H5T_BIT_MSB, 1); if (d_offset>0 && n+1!=(ssize_t)d_offset) { H5_FAILED(); - printf (" Unable to find beginning of cleared bit region " + HDprintf (" Unable to find beginning of cleared bit region " "(reverse, n=%d)\n", (int)n); goto failed; } if (0==d_offset && n>=0) { H5_FAILED(); - puts (" Found leading ones but shouldn't have!"); + HDputs (" Found leading ones but shouldn't have!"); goto failed; } @@ -885,11 +885,11 @@ test_clear (void) return 0; failed: - printf (" i=%d, d_offset=%lu, size=%lu\n", + HDprintf (" i=%d, d_offset=%lu, size=%lu\n", i, (unsigned long)d_offset, (unsigned long)size); - printf (" d = 0x"); - for (j=sizeof(v2)-1; j>=0; --j) printf ("%02x", v2[j]); - printf ("\n"); + HDprintf (" d = 0x"); + for (j=sizeof(v2)-1; j>=0; --j) HDprintf ("%02x", v2[j]); + HDprintf ("\n"); return -1; } @@ -928,11 +928,11 @@ main(void) nerrors += test_negate() < 0 ? 1 : 0; if(nerrors) { - printf("***** %u FAILURE%s! *****\n", + HDprintf("***** %u FAILURE%s! *****\n", nerrors, 1 == nerrors ? "" : "S"); exit(EXIT_FAILURE); } - printf("All bit tests passed.\n"); + HDprintf("All bit tests passed.\n"); H5close(); diff --git a/test/cache_image.c b/test/cache_image.c index 10e9a8a..ee49502 100644 --- a/test/cache_image.c +++ b/test/cache_image.c @@ -40,27 +40,27 @@ static void attempt_swmr_open_hdf5_file(hbool_t create_file, static void verify_datasets(hid_t file_id, int min_dset, int max_dset); /* local test function declarations */ -static unsigned check_cache_image_ctl_flow_1(void); -static unsigned check_cache_image_ctl_flow_2(void); -static unsigned check_cache_image_ctl_flow_3(void); -static unsigned check_cache_image_ctl_flow_4(void); -static unsigned check_cache_image_ctl_flow_5(void); -static unsigned check_cache_image_ctl_flow_6(void); - -static unsigned cache_image_smoke_check_1(void); -static unsigned cache_image_smoke_check_2(void); -static unsigned cache_image_smoke_check_3(void); -static unsigned cache_image_smoke_check_4(void); -static unsigned cache_image_smoke_check_5(void); -static unsigned cache_image_smoke_check_6(void); - -static unsigned cache_image_api_error_check_1(void); -static unsigned cache_image_api_error_check_2(void); -static unsigned cache_image_api_error_check_3(void); -static unsigned cache_image_api_error_check_4(void); - -static unsigned get_free_sections_test(void); -static unsigned evict_on_close_test(void); +static unsigned check_cache_image_ctl_flow_1(hbool_t single_file_vfd); +static unsigned check_cache_image_ctl_flow_2(hbool_t single_file_vfd); +static unsigned check_cache_image_ctl_flow_3(hbool_t single_file_vfd); +static unsigned check_cache_image_ctl_flow_4(hbool_t single_file_vfd); +static unsigned check_cache_image_ctl_flow_5(hbool_t single_file_vfd); +static unsigned check_cache_image_ctl_flow_6(hbool_t single_file_vfd); + +static unsigned cache_image_smoke_check_1(hbool_t single_file_vfd); +static unsigned cache_image_smoke_check_2(hbool_t single_file_vfd); +static unsigned cache_image_smoke_check_3(hbool_t single_file_vfd); +static unsigned cache_image_smoke_check_4(hbool_t single_file_vfd); +static unsigned cache_image_smoke_check_5(hbool_t single_file_vfd); +static unsigned cache_image_smoke_check_6(hbool_t single_file_vfd); + +static unsigned cache_image_api_error_check_1(hbool_t single_file_vfd); +static unsigned cache_image_api_error_check_2(hbool_t single_file_vfd); +static unsigned cache_image_api_error_check_3(hbool_t single_file_vfd); +static unsigned cache_image_api_error_check_4(hbool_t single_file_vfd); + +static unsigned get_free_sections_test(hbool_t single_file_vfd); +static unsigned evict_on_close_test(hbool_t single_file_vfd); /****************************************************************************/ @@ -713,6 +713,9 @@ open_hdf5_file(hbool_t create_file, hbool_t mdci_sbem_expected, file_id = H5Fopen(hdf_file_name, H5F_ACC_RDWR, fapl_id); } + /* tidy up */ + H5Pclose(fapl_id); + if ( file_id < 0 ) { pass = FALSE; @@ -1329,7 +1332,7 @@ verify_datasets(hid_t file_id, int min_dset, int max_dset) */ static unsigned -check_cache_image_ctl_flow_1(void) +check_cache_image_ctl_flow_1(hbool_t single_file_vfd) { const char * fcn_name = "check_cache_image_ctl_flow_1()"; char filename[512]; @@ -1341,6 +1344,13 @@ check_cache_image_ctl_flow_1(void) TESTING("metadata cache image control flow test 1"); + /* Check for VFD that is a single file */ + if(!single_file_vfd) { + SKIPPED(); + HDputs(" Cache image not supported with the current VFD."); + return 0; + } + pass = TRUE; if ( show_progress ) @@ -1608,7 +1618,7 @@ check_cache_image_ctl_flow_1(void) */ static unsigned -check_cache_image_ctl_flow_2(void) +check_cache_image_ctl_flow_2(hbool_t single_file_vfd) { const char * fcn_name = "check_cache_image_ctl_flow_2()"; char filename[512]; @@ -1620,6 +1630,13 @@ check_cache_image_ctl_flow_2(void) TESTING("metadata cache image control flow test 2"); + /* Check for VFD that is a single file */ + if(!single_file_vfd) { + SKIPPED(); + HDputs(" Cache image not supported with the current VFD."); + return 0; + } + pass = TRUE; if ( show_progress ) @@ -1871,7 +1888,7 @@ check_cache_image_ctl_flow_2(void) */ static unsigned -check_cache_image_ctl_flow_3(void) +check_cache_image_ctl_flow_3(hbool_t single_file_vfd) { const char * fcn_name = "check_cache_image_ctl_flow_3()"; char filename[512]; @@ -1883,6 +1900,13 @@ check_cache_image_ctl_flow_3(void) TESTING("metadata cache image control flow test 3"); + /* Check for VFD that is a single file */ + if(!single_file_vfd) { + SKIPPED(); + HDputs(" Cache image not supported with the current VFD."); + return 0; + } + pass = TRUE; if ( show_progress ) /* 0 */ @@ -2242,7 +2266,7 @@ check_cache_image_ctl_flow_3(void) */ static unsigned -check_cache_image_ctl_flow_4(void) +check_cache_image_ctl_flow_4(hbool_t single_file_vfd) { const char * fcn_name = "check_cache_image_ctl_flow_4()"; char filename[512]; @@ -2254,6 +2278,13 @@ check_cache_image_ctl_flow_4(void) TESTING("metadata cache image control flow test 4"); + /* Check for VFD that is a single file */ + if(!single_file_vfd) { + SKIPPED(); + HDputs(" Cache image not supported with the current VFD."); + return 0; + } + pass = TRUE; if ( show_progress ) /* 0 */ @@ -2573,7 +2604,7 @@ check_cache_image_ctl_flow_4(void) */ static unsigned -check_cache_image_ctl_flow_5(void) +check_cache_image_ctl_flow_5(hbool_t single_file_vfd) { const char * fcn_name = "check_cache_image_ctl_flow_5()"; char filename[512]; @@ -2585,6 +2616,13 @@ check_cache_image_ctl_flow_5(void) TESTING("metadata cache image control flow test 5"); + /* Check for VFD that is a single file */ + if(!single_file_vfd) { + SKIPPED(); + HDputs(" Cache image not supported with the current VFD."); + return 0; + } + pass = TRUE; if ( show_progress ) /* 0 */ @@ -2854,7 +2892,7 @@ check_cache_image_ctl_flow_5(void) */ static unsigned -check_cache_image_ctl_flow_6(void) +check_cache_image_ctl_flow_6(hbool_t single_file_vfd) { const char * fcn_name = "check_cache_image_ctl_flow_6()"; char filename[512]; @@ -2866,6 +2904,13 @@ check_cache_image_ctl_flow_6(void) TESTING("metadata cache image control flow test 6"); + /* Check for VFD that is a single file */ + if(!single_file_vfd) { + SKIPPED(); + HDputs(" Cache image not supported with the current VFD."); + return 0; + } + pass = TRUE; if ( show_progress ) /* 0 */ @@ -3139,7 +3184,7 @@ check_cache_image_ctl_flow_6(void) */ static unsigned -cache_image_smoke_check_1(void) +cache_image_smoke_check_1(hbool_t single_file_vfd) { const char * fcn_name = "cache_image_smoke_check_1()"; char filename[512]; @@ -3151,6 +3196,13 @@ cache_image_smoke_check_1(void) TESTING("metadata cache image smoke check 1"); + /* Check for VFD that is a single file */ + if(!single_file_vfd) { + SKIPPED(); + HDputs(" Cache image not supported with the current VFD."); + return 0; + } + pass = TRUE; if ( show_progress ) @@ -3562,7 +3614,7 @@ cache_image_smoke_check_1(void) */ static unsigned -cache_image_smoke_check_2(void) +cache_image_smoke_check_2(hbool_t single_file_vfd) { const char * fcn_name = "cache_image_smoke_check_2()"; char filename[512]; @@ -3574,6 +3626,13 @@ cache_image_smoke_check_2(void) TESTING("metadata cache image smoke check 2"); + /* Check for VFD that is a single file */ + if(!single_file_vfd) { + SKIPPED(); + HDputs(" Cache image not supported with the current VFD."); + return 0; + } + pass = TRUE; if ( show_progress ) @@ -3863,7 +3922,7 @@ cache_image_smoke_check_2(void) */ static unsigned -cache_image_smoke_check_3(void) +cache_image_smoke_check_3(hbool_t single_file_vfd) { const char * fcn_name = "cache_image_smoke_check_3()"; char filename[512]; @@ -3875,6 +3934,13 @@ cache_image_smoke_check_3(void) TESTING("metadata cache image smoke check 3"); + /* Check for VFD that is a single file */ + if(!single_file_vfd) { + SKIPPED(); + HDputs(" Cache image not supported with the current VFD."); + return 0; + } + pass = TRUE; if ( show_progress ) @@ -4248,7 +4314,7 @@ cache_image_smoke_check_3(void) */ static unsigned -cache_image_smoke_check_4(void) +cache_image_smoke_check_4(hbool_t single_file_vfd) { const char * fcn_name = "cache_image_smoke_check_4()"; char filename[512]; @@ -4262,6 +4328,13 @@ cache_image_smoke_check_4(void) TESTING("metadata cache image smoke check 4"); + /* Check for VFD that is a single file */ + if(!single_file_vfd) { + SKIPPED(); + HDputs(" Cache image not supported with the current VFD."); + return 0; + } + pass = TRUE; if ( show_progress ) @@ -4650,10 +4723,10 @@ cache_image_smoke_check_4(void) *------------------------------------------------------------------------- */ -#define MAX_NUM_GROUPS 128 +#define MAX_NUM_GROUPS 64 static unsigned -cache_image_smoke_check_5(void) +cache_image_smoke_check_5(hbool_t single_file_vfd) { const char * fcn_name = "cache_image_smoke_check_5()"; char filename[512]; @@ -4670,6 +4743,13 @@ cache_image_smoke_check_5(void) TESTING("metadata cache image smoke check 5"); + /* Check for VFD that is a single file */ + if(!single_file_vfd) { + SKIPPED(); + HDputs(" Cache image not supported with the current VFD."); + return 0; + } + pass = TRUE; if ( show_progress ) @@ -4679,12 +4759,16 @@ cache_image_smoke_check_5(void) /* setup the file name */ if ( pass ) { - if ( h5_fixname(FILENAMES[0], H5P_DEFAULT, filename, sizeof(filename)) + hid_t fapl_id = h5_fileaccess(); + + if ( h5_fixname(FILENAMES[0], fapl_id, filename, sizeof(filename)) == NULL ) { pass = FALSE; failure_mssg = "h5_fixname() failed.\n"; } + + H5Pclose(fapl_id); } if ( show_progress ) @@ -5168,7 +5252,7 @@ cache_image_smoke_check_5(void) */ static unsigned -cache_image_smoke_check_6(void) +cache_image_smoke_check_6(hbool_t single_file_vfd) { const char * fcn_name = "cache_image_smoke_check_6()"; char filename[512]; @@ -5183,6 +5267,13 @@ cache_image_smoke_check_6(void) TESTING("metadata cache image smoke check 6"); + /* Check for VFD that is a single file */ + if(!single_file_vfd) { + SKIPPED(); + HDputs(" Cache image not supported with the current VFD."); + return 0; + } + pass = TRUE; if ( show_progress ) @@ -5578,7 +5669,7 @@ cache_image_smoke_check_6(void) */ static unsigned -cache_image_api_error_check_1(void) +cache_image_api_error_check_1(hbool_t single_file_vfd) { const char * fcn_name = "cache_image_api_error_check_1()"; char filename[512]; @@ -5590,6 +5681,13 @@ cache_image_api_error_check_1(void) TESTING("metadata cache image api error check 1"); + /* Check for VFD that is a single file */ + if(!single_file_vfd) { + SKIPPED(); + HDputs(" Cache image not supported with the current VFD."); + return 0; + } + pass = TRUE; if ( show_progress ) @@ -5954,7 +6052,7 @@ cache_image_api_error_check_1(void) */ static unsigned -cache_image_api_error_check_2(void) +cache_image_api_error_check_2(hbool_t single_file_vfd) { const char * fcn_name = "cache_image_api_error_check_2()"; char filename[512]; @@ -5966,6 +6064,13 @@ cache_image_api_error_check_2(void) TESTING("metadata cache image api error check 2"); + /* Check for VFD that is a single file */ + if(!single_file_vfd) { + SKIPPED(); + HDputs(" Cache image not supported with the current VFD."); + return 0; + } + pass = TRUE; if ( show_progress ) @@ -6365,7 +6470,7 @@ cache_image_api_error_check_2(void) */ static unsigned -cache_image_api_error_check_3(void) +cache_image_api_error_check_3(hbool_t single_file_vfd) { const char * fcn_name = "cache_image_api_error_check_3()"; char filename[512]; @@ -6377,6 +6482,13 @@ cache_image_api_error_check_3(void) TESTING("metadata cache image api error check 3"); + /* Check for VFD that is a single file */ + if(!single_file_vfd) { + SKIPPED(); + HDputs(" Cache image not supported with the current VFD."); + return 0; + } + pass = TRUE; if ( show_progress ) @@ -6649,7 +6761,7 @@ cache_image_api_error_check_3(void) */ static unsigned -cache_image_api_error_check_4(void) +cache_image_api_error_check_4(hbool_t single_file_vfd) { const char * fcn_name = "cache_image_api_error_check_4()"; char filename[512]; @@ -6663,6 +6775,13 @@ cache_image_api_error_check_4(void) TESTING("metadata cache image api error check 4"); + /* Check for VFD that is a single file */ + if(!single_file_vfd) { + SKIPPED(); + HDputs(" Cache image not supported with the current VFD."); + return 0; + } + pass = TRUE; if ( show_progress ) @@ -7238,7 +7357,7 @@ cache_image_api_error_check_4(void) *------------------------------------------------------------------------- */ static unsigned -get_free_sections_test(void) +get_free_sections_test(hbool_t single_file_vfd) { const char * fcn_name = "get_free_sections_test()"; char filename[512]; @@ -7251,6 +7370,13 @@ get_free_sections_test(void) TESTING("Cache image / H5Fget_free_sections() interaction"); + /* Check for VFD that is a single file */ + if(!single_file_vfd) { + SKIPPED(); + HDputs(" Cache image not supported with the current VFD."); + return 0; + } + pass = TRUE; if ( show_progress ) @@ -7710,7 +7836,7 @@ get_free_sections_test(void) *------------------------------------------------------------------------- */ static unsigned -evict_on_close_test(void) +evict_on_close_test(hbool_t single_file_vfd) { #ifndef H5_HAVE_PARALLEL const char * fcn_name = "evict_on_close_test()"; @@ -7731,6 +7857,13 @@ evict_on_close_test(void) return 0; #else + /* Check for VFD that is a single file */ + if(!single_file_vfd) { + SKIPPED(); + HDputs(" Cache image not supported with the current VFD."); + return 0; + } + pass = TRUE; if ( show_progress ) @@ -8041,9 +8174,16 @@ evict_on_close_test(void) int main(void) { + const char *env_h5_drvr; /* File driver value from environment */ + hbool_t single_file_vfd; /* Whether VFD used stores data in a single file */ unsigned nerrs = 0; int express_test; + /* Get the VFD to use */ + env_h5_drvr = HDgetenv("HDF5_DRIVER"); + if(env_h5_drvr == NULL) + env_h5_drvr = "nomatch"; + H5open(); express_test = GetTestExpress(); @@ -8053,27 +8193,30 @@ main(void) printf(" express_test = %d\n", express_test); printf("=========================================\n"); - nerrs += check_cache_image_ctl_flow_1(); - nerrs += check_cache_image_ctl_flow_2(); - nerrs += check_cache_image_ctl_flow_3(); - nerrs += check_cache_image_ctl_flow_4(); - nerrs += check_cache_image_ctl_flow_5(); - nerrs += check_cache_image_ctl_flow_6(); - - nerrs += cache_image_smoke_check_1(); - nerrs += cache_image_smoke_check_2(); - nerrs += cache_image_smoke_check_3(); - nerrs += cache_image_smoke_check_4(); - nerrs += cache_image_smoke_check_5(); - nerrs += cache_image_smoke_check_6(); - - nerrs += cache_image_api_error_check_1(); - nerrs += cache_image_api_error_check_2(); - nerrs += cache_image_api_error_check_3(); - nerrs += cache_image_api_error_check_4(); - - nerrs += get_free_sections_test(); - nerrs += evict_on_close_test(); + /* Check for VFD which stores data in multiple files */ + single_file_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family")); + + nerrs += check_cache_image_ctl_flow_1(single_file_vfd); + nerrs += check_cache_image_ctl_flow_2(single_file_vfd); + nerrs += check_cache_image_ctl_flow_3(single_file_vfd); + nerrs += check_cache_image_ctl_flow_4(single_file_vfd); + nerrs += check_cache_image_ctl_flow_5(single_file_vfd); + nerrs += check_cache_image_ctl_flow_6(single_file_vfd); + + nerrs += cache_image_smoke_check_1(single_file_vfd); + nerrs += cache_image_smoke_check_2(single_file_vfd); + nerrs += cache_image_smoke_check_3(single_file_vfd); + nerrs += cache_image_smoke_check_4(single_file_vfd); + nerrs += cache_image_smoke_check_5(single_file_vfd); + nerrs += cache_image_smoke_check_6(single_file_vfd); + + nerrs += cache_image_api_error_check_1(single_file_vfd); + nerrs += cache_image_api_error_check_2(single_file_vfd); + nerrs += cache_image_api_error_check_3(single_file_vfd); + nerrs += cache_image_api_error_check_4(single_file_vfd); + + nerrs += get_free_sections_test(single_file_vfd); + nerrs += evict_on_close_test(single_file_vfd); return(nerrs > 0); diff --git a/test/cache_tagging.c b/test/cache_tagging.c index 752dd27..b91f013 100644 --- a/test/cache_tagging.c +++ b/test/cache_tagging.c @@ -448,7 +448,7 @@ check_file_creation_tags(hid_t fcpl_id, int type) TESTING("tag application during file creation"); /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* Create a test file with provided fcpl_t */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, fapl)) < 0 ) TEST_ERROR; @@ -539,7 +539,7 @@ check_file_open_tags(hid_t fcpl, int type) /* ===== */ /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* Create a test file with provided fcpl_t */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR; @@ -652,7 +652,7 @@ check_group_creation_tags(void) /* ===== */ /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* Create a test file with provided fcpl_t */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; @@ -751,7 +751,7 @@ check_multi_group_creation_tags(void) TESTING("tag application during multiple group creation"); /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* Set latest version of library */ if ( H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0 ) TEST_ERROR; @@ -881,7 +881,7 @@ check_link_iteration_tags(void) TESTING("tag application during iteration over links in a group"); /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* =========== */ /* Create File */ @@ -1000,7 +1000,7 @@ check_dense_attribute_tags(void) TESTING("tag application during dense attribute manipulation"); /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; if ( H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0 ) TEST_ERROR; /* Create Dcpl */ @@ -1184,7 +1184,7 @@ check_group_open_tags(void) /* ===== */ /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* Create a test file with provided fcpl_t */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; @@ -1295,7 +1295,7 @@ check_attribute_creation_tags(hid_t fcpl, int type) /* ===== */ /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* Create a test file with provided fcpl_t */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR; @@ -1429,7 +1429,7 @@ check_attribute_open_tags(hid_t fcpl, int type) /* ===== */ /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* Create a test file with provided fcpl_t */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR; @@ -1576,7 +1576,7 @@ check_attribute_rename_tags(hid_t fcpl, int type) if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR; /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* Create a test file with provided fcpl_t */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR; @@ -1761,7 +1761,7 @@ check_attribute_delete_tags(hid_t fcpl, int type) if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR; /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* Create a test file with provided fcpl_t */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR; @@ -1917,7 +1917,7 @@ check_dataset_creation_tags(hid_t fcpl, int type) /* ===== */ /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR; @@ -2051,7 +2051,7 @@ check_dataset_creation_earlyalloc_tags(hid_t fcpl, int type) /* ===== */ /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR; @@ -2187,7 +2187,7 @@ check_dataset_open_tags(void) /* ========= */ /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* Create file */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; @@ -2318,7 +2318,7 @@ check_dataset_write_tags(void) if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR; /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* Create file */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; @@ -2457,7 +2457,7 @@ check_attribute_write_tags(hid_t fcpl, int type) if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR; /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* Create a test file with provided fcpl_t */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR; @@ -2613,7 +2613,7 @@ check_dataset_read_tags(void) if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR; /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* Create file */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; @@ -2751,7 +2751,7 @@ check_dataset_size_retrieval(void) if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR; /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* Create file */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; @@ -2890,7 +2890,7 @@ check_dataset_extend_tags(void) if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR; /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* Create file */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; @@ -3017,7 +3017,7 @@ check_object_info_tags(void) /* ===== */ /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* Create a test file */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; @@ -3126,7 +3126,7 @@ check_object_copy_tags(void) /* ===== */ /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* Create a test file */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; @@ -3257,7 +3257,7 @@ check_link_removal_tags(hid_t fcpl, int type) if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR; /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* Create file */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR; @@ -3416,7 +3416,7 @@ check_link_getname_tags(void) if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR; /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* Create file */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; @@ -3553,7 +3553,7 @@ check_external_link_creation_tags(void) /* ===== */ /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* Create a test file */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; @@ -3660,7 +3660,7 @@ check_external_link_open_tags(void) /* ===== */ /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* Create a test file */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; @@ -3671,8 +3671,6 @@ check_external_link_open_tags(void) /* Create a second file */ if ( (fid2 = H5Fcreate(FILENAME2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; - if ( H5Pclose(fapl) < 0 ) TEST_ERROR; - /* determine tag value of root group's object header */ if ( get_object_header_tag(fid2, &root2_tag) < 0 ) TEST_ERROR; @@ -3688,7 +3686,9 @@ check_external_link_open_tags(void) /* Close and Reopen the file */ if ( H5Fclose(fid) < 0 ) TEST_ERROR; - if ( (fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( (fid = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl)) < 0 ) TEST_ERROR; + + if ( H5Pclose(fapl) < 0 ) TEST_ERROR; /* Evict as much as we can from the cache so we can track full tag path */ if ( evict_entries(fid) < 0 ) TEST_ERROR; @@ -3787,7 +3787,7 @@ check_invalid_tag_application(void) #if H5C_DO_TAGGING_SANITY_CHECKS /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* Create a test file */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c index b011bc2..a8baeac 100644 --- a/test/cmpd_dset.c +++ b/test/cmpd_dset.c @@ -2070,7 +2070,7 @@ test_ooo_order(char *filename, hid_t fapl_id) /* Close and reopen the file */ if(H5Tclose(dtype)) TEST_ERROR if(H5Fclose(file)) TEST_ERROR - if((file = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) TEST_ERROR + if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0) TEST_ERROR /* Open the type */ if((dtype_tmp = H5Topen2(file, "dtype", H5P_DEFAULT)) < 0) TEST_ERROR @@ -2123,7 +2123,7 @@ test_ooo_order(char *filename, hid_t fapl_id) if(H5Tclose(dtype_tmp)) TEST_ERROR if(H5Tclose(dtype)) TEST_ERROR if(H5Fclose(file)) TEST_ERROR - if((file = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) TEST_ERROR + if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl_id)) < 0) TEST_ERROR /* Open the type, and verify status */ if((dtype_tmp = H5Topen2(file, "dtype2", H5P_DEFAULT)) < 0) TEST_ERROR diff --git a/test/cork.c b/test/cork.c index dceaf5a..240be77 100644 --- a/test/cork.c +++ b/test/cork.c @@ -286,19 +286,19 @@ static unsigned verify_obj_dset_cork(hbool_t swmr) { /* Variable Declarations */ - hid_t fid = -1; /* File ID */ + hid_t fid = -1; /* File ID */ hid_t fapl = -1; /* File access property list */ hid_t aid = -1; /* Attribute ID */ hid_t sid = -1, sid2 = -1; /* Dataspace IDs */ hid_t did = -1, did2 = -1; /* Dataset IDs */ hid_t oid = -1; /* Object ID */ - hid_t dcpl2; /* Dataset creation property list */ + hid_t dcpl2; /* Dataset creation property list */ int i = 0; /* Local index variable */ - hsize_t dim[1] = {100}; /* Dataset dimension size */ + hsize_t dim[1] = {100}; /* Dataset dimension size */ hsize_t chunk_dim[1] = {7}; /* Dataset chunk dimension size */ H5O_info_t oinfo, oinfo2; /* Object metadata information */ char attrname[500]; /* Name of attribute */ - unsigned flags; /* File access flags */ + unsigned flags; /* File access flags */ if(swmr) { TESTING("cork status for dataset objects with attributes (SWMR)"); @@ -341,7 +341,7 @@ verify_obj_dset_cork(hbool_t swmr) TEST_ERROR /* Attach and write to an attribute to the dataset: DSET */ - if((aid = H5Acreate2(did, ATTR, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if((aid = H5Acreate2(did, ATTR, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Verify cork status of the dataset: DSET */ @@ -380,11 +380,11 @@ verify_obj_dset_cork(hbool_t swmr) TEST_ERROR /* Attach 8 attributes to the dataset */ - for(i = 0;i < 8; i++) { - sprintf(attrname, "attr %d", i); - if((aid = H5Acreate2(did2, attrname, H5T_NATIVE_UINT, sid2, H5P_DEFAULT, H5P_DEFAULT)) < 0) + for(i = 0; i < 8; i++) { + HDsprintf(attrname, "attr %d", i); + if((aid = H5Acreate2(did2, attrname, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Awrite(aid, H5T_NATIVE_UINT, &i) < 0) + if(H5Awrite(aid, H5T_NATIVE_INT, &i) < 0) TEST_ERROR if(H5Aclose(aid) < 0) TEST_ERROR diff --git a/test/del_many_dense_attrs.c b/test/del_many_dense_attrs.c new file mode 100644 index 0000000..d88045c --- /dev/null +++ b/test/del_many_dense_attrs.c @@ -0,0 +1,203 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Purpose: Test to verify that the infinite loop closing library/abort failure + * is fixed when the application creates and removes dense attributes + * (See HDFFV-10659). + */ + + +#include "h5test.h" + +/* The test file name */ +const char *FILENAME[] = { + "del_many_dense_attrs", + NULL +}; + +#define ATTR_COUNT 64 /* The number of attributes */ + +/*------------------------------------------------------------------------- + * Function: catch_signal + * + * Purpose: The signal handler to catch the SIGABRT signal. + * + * Return: No return + * + * Programmer: Vailin Choi + * + *------------------------------------------------------------------------- + */ +static void catch_signal(int H5_ATTR_UNUSED signo) +{ + HDexit(1); +} /* catch_signal() */ + + +/*------------------------------------------------------------------------- + * Function: main + * + * Purpose: Test to verify that the infinite loop closing library/abort failure + * is fixed when the application creates and removes dense attributes + * (See HDFFV-10659). + * + * Return: Success: exit(EXIT_SUCCESS) + * Failure: exit(EXIT_FAILURE) + * + * Programmer: Vailin Choi; Dec 2018 + * + *------------------------------------------------------------------------- + */ +int +main(void) +{ + hid_t fid = -1; /* HDF5 File ID */ + hid_t gid = -1; /* Group ID */ + hid_t sid = -1; /* Dataspace ID */ + hid_t aid = -1; /* Attribute ID */ + hid_t tid = -1; /* Datatype ID */ + hid_t fapl = -1; /* File access property lists */ + hid_t gcpl = -1; /* Group creation property list */ + char aname[50]; /* Name of attribute */ + char *basename="attr"; /* Name prefix for attribute */ + char filename[100]; /* File name */ + int i; /* Local index variable */ + + /* Testing setup */ + h5_reset(); + + /* To exit from the file for SIGABRT signal */ + if(HDsignal(SIGABRT, catch_signal) == SIG_ERR) + TEST_ERROR + + fapl = h5_fileaccess(); + h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); + + /* Set to latest format */ + if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) + TEST_ERROR + + /* Create the file */ + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + TEST_ERROR + + /* Close the file */ + if(H5Fclose(fid) < 0) + TEST_ERROR + + /* Re-open the file */ + if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) + TEST_ERROR + + /* Create the group creation property list */ + if((gcpl = H5Pcreate(H5P_GROUP_CREATE)) < 0) + TEST_ERROR + + /* Set to use dense storage for all attributes on the group */ + if(H5Pset_attr_phase_change(gcpl, 0, 0) < 0) + TEST_ERROR + + /* Create the group in the file */ + if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, gcpl, H5P_DEFAULT)) < 0) + TEST_ERROR + + /* Create dataspace */ + if((sid = H5Screate(H5S_SCALAR)) < 0) + TEST_ERROR + + /* Get a copy of the datatype */ + if((tid = H5Tcopy(H5T_NATIVE_FLOAT)) < 0) + TEST_ERROR + + /* Create attributes in the group */ + for(i = ATTR_COUNT; i >= 0; i--) { + /* Set up the attribute name */ + HDsprintf(aname, "%s%d", basename, i); + + /* Create the attribute */ + if((aid = H5Acreate2(gid, aname, tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR + + /* Write to the attribute */ + if(H5Awrite(aid, tid, &i) < 0) + TEST_ERROR + + /* Close the attribute */ + if(H5Aclose(aid) < 0) + TEST_ERROR + } + + /* Close the datatype */ + if(H5Tclose(tid) < 0) + TEST_ERROR + + /* Close the dataspace */ + if(H5Sclose(sid) < 0) + TEST_ERROR + + /* Close the group */ + if(H5Gclose(gid) < 0) + TEST_ERROR + + /* Close the group creation property list */ + if(H5Pclose(gcpl) < 0) + TEST_ERROR + + /* Close the file */ + if(H5Fclose(fid) < 0) + TEST_ERROR + + /* Re-open the file */ + if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) + TEST_ERROR + + /* Open the group */ + if((gid = H5Gopen2(fid, "group", H5P_DEFAULT)) < 0) + TEST_ERROR + + /* Delete the attributes */ + for (i = 0; i <= ATTR_COUNT; i++) { + /* Set up the attribute name */ + HDsprintf(aname, "%s%d", basename, i); + + /* Delete the attribute */ + if(H5Adelete(gid, aname) < 0) + TEST_ERROR + } /* end for */ + + /* Close the group */ + if(H5Gclose(gid) < 0) + TEST_ERROR + + /* Close the file */ + if(H5Fclose(fid) < 0) + TEST_ERROR + + h5_cleanup(FILENAME, fapl); + + return(EXIT_SUCCESS); + +error: + H5E_BEGIN_TRY { + H5Gclose(gid); + H5Sclose(sid); + H5Tclose(tid); + H5Aclose(aid); + H5Fclose(fid); + H5Pclose(gcpl); + H5Pclose(fapl); + } H5E_END_TRY + + return EXIT_FAILURE; +} diff --git a/test/direct_chunk.c b/test/direct_chunk.c index 2ef38ea..2edfe64 100644 --- a/test/direct_chunk.c +++ b/test/direct_chunk.c @@ -1910,10 +1910,10 @@ test_read_unallocated_chunk (hid_t file) goto error; /* Write a single chunk to intialize the chunk storage */ - HDmemset(&chunk_dims, 0, sizeof(chunk_dims)); + HDmemset(direct_buf, 0, CHUNK_NX * CHUNK_NY * sizeof(int)); offset[0] = 0; offset[1] = 0; - if(H5Dwrite_chunk(dataset, dxpl, filter_mask, offset, chunk_nbytes, &chunk_dims) < 0) + if(H5Dwrite_chunk(dataset, dxpl, filter_mask, offset, chunk_nbytes, direct_buf) < 0) goto error; /* Attempt to read each chunk in the dataset. Chunks are not allocated, diff --git a/test/dsets.c b/test/dsets.c index 5cd376a..5de9cfa 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -86,6 +86,9 @@ const char *FILENAME[] = { NULL }; +#define OHMIN_FILENAME_A "ohdr_min_a" + + #define FILENAME_BUF_SIZE 1024 #define KB 1024 @@ -338,7 +341,7 @@ filter_count(unsigned int flags, size_t H5_ATTR_UNUSED cd_nelmts, count_nbytes_written += nbytes; return nbytes; -} +} /* end filter_count() */ /*------------------------------------------------------------------------- @@ -481,11 +484,11 @@ test_create(hid_t file) if(H5Dclose(dataset) < 0) goto error; PASSED(); - return 0; + return SUCCEED; error: - return -1; -} + return FAIL; +} /* end test_create() */ /*------------------------------------------------------------------------- @@ -605,7 +608,7 @@ test_simple_io(const char *env_h5_drvr, hid_t fapl) puts(" Current VFD doesn't support continuous address space"); } /* end else */ - return 0; + return SUCCEED; error: if(space > 0) @@ -620,8 +623,8 @@ error: HDclose(f); if(tconv_buf) HDfree(tconv_buf); - return -1; -} + return FAIL; +} /* end test_simple_io() */ /*------------------------------------------------------------------------- @@ -713,7 +716,7 @@ test_userblock_offset(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) puts(" Current VFD doesn't support continuous address space"); } /* end else */ - return 0; + return SUCCEED; error: if(space > 0) @@ -726,8 +729,8 @@ error: if(H5Fclose(file) < 0) TEST_ERROR if(f > 0) HDclose(f); - return -1; -} + return FAIL; +} /* end test_userblock_offset() */ /*------------------------------------------------------------------------- @@ -826,7 +829,7 @@ test_compact_io(hid_t fapl) **************************************/ /* Create a copy of file access property list */ - if((new_fapl = new_fapl = h5_fileaccess()) < 0) TEST_ERROR + if((new_fapl = h5_fileaccess()) < 0) TEST_ERROR /* Loop through all the combinations of low/high library format bounds, skipping invalid combinations. @@ -907,7 +910,7 @@ test_compact_io(hid_t fapl) if(H5Pclose(plist) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -919,8 +922,8 @@ test_compact_io(hid_t fapl) H5Fclose(verfile); } H5E_END_TRY; - return -1; -} + return FAIL; +} /* end test_compact_io() */ /*------------------------------------------------------------------------- @@ -1056,7 +1059,7 @@ test_max_compact(hid_t fapl) FAIL_STACK_ERROR PASSED(); - return 0; + return SUCCEED; error: if(wbuf) @@ -1072,7 +1075,7 @@ error: H5Fclose(file); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_max_compact() */ @@ -1181,7 +1184,7 @@ test_layout_extend(hid_t fapl) if(H5Fclose(fid) < 0) FAIL_STACK_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -1195,7 +1198,7 @@ error: H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_layout_extend() */ @@ -1331,7 +1334,7 @@ test_conv_buffer(hid_t fid) HDfree(cf); HDfree(cfrR); puts(" PASSED"); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -1347,8 +1350,8 @@ error: H5Dclose(dataset); } H5E_END_TRY; - return -1; -} + return FAIL; +} /* end test_conv_buffer() */ /*------------------------------------------------------------------------- @@ -1418,7 +1421,7 @@ test_tconv(hid_t file) HDfree(in); puts(" PASSED"); - return 0; + return SUCCEED; error: if(out) @@ -1431,8 +1434,8 @@ error: H5Sclose(space); } H5E_END_TRY; - return -1; -} + return FAIL; +} /* end test_tconv() */ /* This message derives from H5Z */ const H5Z_class2_t H5Z_BOGUS[1] = {{ @@ -1465,7 +1468,7 @@ can_apply_bogus(hid_t H5_ATTR_UNUSED dcpl_id, hid_t type_id, hid_t H5_ATTR_UNUSE return 1; else return -1; -} +} /* end can_apply_bogus() */ /*------------------------------------------------------------------------- @@ -1483,7 +1486,7 @@ filter_bogus(unsigned int H5_ATTR_UNUSED flags, size_t H5_ATTR_UNUSED cd_nelmts, size_t H5_ATTR_UNUSED *buf_size, void H5_ATTR_UNUSED **buf) { return nbytes; -} +} /* end filter_bogus() */ /*------------------------------------------------------------------------- @@ -1583,7 +1586,7 @@ filter_bogus2(unsigned int flags, size_t cd_nelmts, /* Filter is "no op" */ else return(nbytes); -} +} /* end filter_bogus2() */ /*------------------------------------------------------------------------- @@ -1601,7 +1604,7 @@ filter_bogus3(unsigned int H5_ATTR_UNUSED flags, size_t H5_ATTR_UNUSED cd_nelmts size_t H5_ATTR_UNUSED *buf_size, void H5_ATTR_UNUSED **buf) { return 0; -} +} /* end filter_bogus3() */ /* This message derives from H5Z */ const H5Z_class2_t H5Z_CORRUPT[1] = {{ @@ -1690,7 +1693,7 @@ filter_cb_cont(H5Z_filter_t filter, void H5_ATTR_UNUSED *buf, size_t H5_ATTR_UNU return H5Z_CB_CONT; else return H5Z_CB_FAIL; -} +} /* end filter_cb_cont() */ /*------------------------------------------------------------------------- @@ -1709,7 +1712,7 @@ filter_cb_fail(H5Z_filter_t filter, void H5_ATTR_UNUSED *buf, size_t H5_ATTR_UNU return H5Z_CB_FAIL; else return H5Z_CB_CONT; -} +} /* end filter_cb_fail() */ /*------------------------------------------------------------------------- @@ -2052,13 +2055,13 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, if(H5Pclose (write_dxpl) < 0) goto error; HDfree (tconv_buf); - return(0); + return SUCCEED; error: if(tconv_buf) HDfree (tconv_buf); - return -1; -} + return FAIL; +} /* end test_filter_internal() */ /*------------------------------------------------------------------------- * Function: test_filter_noencoder @@ -2160,7 +2163,7 @@ test_filter_noencoder(const char *dset_name) PASSED(); - return 0; + return SUCCEED; error: H5_FAILED(); @@ -2175,8 +2178,8 @@ error: if(file_id != -1) H5Fclose(file_id); - return -1; -} + return FAIL; +} /* end test_filter_noencoder() */ #endif /* H5_HAVE_FILTER_SZIP */ /*------------------------------------------------------------------------- @@ -2242,11 +2245,11 @@ test_get_filter_info(void) if(err >= 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: - return -1; -} + return FAIL; +} /* end test_get_filter_info() */ /*------------------------------------------------------------------------- * Function: test_filters @@ -2517,11 +2520,11 @@ H5_ATTR_UNUSED SKIPPED(); puts(" szip filter not enabled"); #endif /* H5_HAVE_FILTER_SZIP */ - return 0; + return SUCCEED; error: - return -1; -} + return FAIL; +} /* end test_filters() */ /*------------------------------------------------------------------------- @@ -2856,11 +2859,11 @@ test_onebyte_shuffle(hid_t file) PASSED(); - return 0; + return SUCCEED; error: - return -1; -} + return FAIL; +} /* end test_onebyte_shuffle() */ /*------------------------------------------------------------------------- @@ -2974,11 +2977,11 @@ test_nbit_int(hid_t file) PASSED(); - return 0; + return SUCCEED; error: - return -1; -} + return FAIL; +} /* end test_nbit_int() */ /*------------------------------------------------------------------------- @@ -3092,11 +3095,11 @@ test_nbit_float(hid_t file) PASSED(); - return 0; + return SUCCEED; error: - return -1; -} + return FAIL; +} /* end test_nbit_float() */ /*------------------------------------------------------------------------- @@ -3224,11 +3227,11 @@ test_nbit_double(hid_t file) PASSED(); - return 0; + return SUCCEED; error: - return -1; -} + return FAIL; +} /* end test_nbit_double() */ /*------------------------------------------------------------------------- @@ -3351,11 +3354,11 @@ test_nbit_array(hid_t file) PASSED(); - return 0; + return SUCCEED; error: - return -1; -} + return FAIL; +} /* end test_nbit_array() */ /*------------------------------------------------------------------------- @@ -3568,11 +3571,11 @@ test_nbit_compound(hid_t file) PASSED(); - return 0; + return SUCCEED; error: - return -1; -} + return FAIL; +} /* end test_nbit_compound() */ /*------------------------------------------------------------------------- @@ -3913,11 +3916,11 @@ out: PASSED(); - return 0; + return SUCCEED; error: - return -1; -} + return FAIL; +} /* end test_nbit_compound_2() */ /*------------------------------------------------------------------------- @@ -4093,11 +4096,11 @@ test_nbit_compound_3(hid_t file) PASSED(); - return 0; + return SUCCEED; error: - return -1; -} + return FAIL; +} /* end test_nbit_compound_3() */ /*------------------------------------------------------------------------- @@ -4261,10 +4264,10 @@ test_nbit_int_size(hid_t file) PASSED(); - return 0; + return SUCCEED; error: - return -1; -} + return FAIL; +} /* end test_nbit_int_size() */ /*------------------------------------------------------------------------- @@ -4458,10 +4461,10 @@ test_nbit_flt_size(hid_t file) PASSED(); - return 0; + return SUCCEED; error: - return -1; -} + return FAIL; +} /* end test_nbit_flt_size() */ /*------------------------------------------------------------------------- * Function: test_scaleoffset_int @@ -4569,10 +4572,10 @@ test_scaleoffset_int(hid_t file) PASSED(); - return 0; + return SUCCEED; error: - return -1; -} + return FAIL; +} /* end test_scaleoffset_int() */ /*------------------------------------------------------------------------- @@ -4697,10 +4700,10 @@ test_scaleoffset_int_2(hid_t file) PASSED(); - return 0; + return SUCCEED; error: - return -1; -} + return FAIL; +} /* end test_scaleoffset_int_2() */ /*------------------------------------------------------------------------- @@ -4810,10 +4813,10 @@ test_scaleoffset_float(hid_t file) PASSED(); - return 0; + return SUCCEED; error: - return -1; -} + return FAIL; +} /* end test_scaleoffset_float() */ /*------------------------------------------------------------------------- @@ -4939,10 +4942,10 @@ test_scaleoffset_float_2(hid_t file) PASSED(); - return 0; + return SUCCEED; error: - return -1; -} + return FAIL; +} /* end test_scaleoffset_float_2() */ /*------------------------------------------------------------------------- @@ -5052,10 +5055,10 @@ test_scaleoffset_double(hid_t file) PASSED(); - return 0; + return SUCCEED; error: - return -1; -} + return FAIL; +} /* end test_scaleoffset_double() */ /*------------------------------------------------------------------------- @@ -5182,10 +5185,10 @@ test_scaleoffset_double_2(hid_t file) PASSED(); - return 0; + return SUCCEED; error: - return -1; -} + return FAIL; +} /* end test_scaleoffset_double_2() */ /*------------------------------------------------------------------------- @@ -5242,17 +5245,17 @@ test_multiopen (hid_t file) if(H5Pclose(dcpl) < 0) goto error; PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { - H5Dclose(dset1); - H5Dclose(dset2); - H5Sclose(space); - H5Pclose(dcpl); + H5Dclose(dset1); + H5Dclose(dset2); + H5Sclose(space); + H5Pclose(dcpl); } H5E_END_TRY; - return -1; -} + return FAIL; +} /* end test_multiopen() */ /*------------------------------------------------------------------------- @@ -5338,7 +5341,7 @@ test_types(hid_t file) /* Cleanup */ if(H5Gclose(grp) < 0) goto error; PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -5347,8 +5350,8 @@ test_types(hid_t file) H5Sclose(space); H5Dclose(dset); } H5E_END_TRY; - return -1; -} + return FAIL; +} /* end test_types() */ /* This message derives from H5Z */ const H5Z_class2_t H5Z_CAN_APPLY_TEST[1] = {{ @@ -5525,10 +5528,10 @@ test_can_apply(hid_t file) PASSED(); - return 0; + return SUCCEED; error: - return -1; + return FAIL; } /* end test_can_apply() */ /* This message derives from H5Z */ @@ -5684,10 +5687,10 @@ test_can_apply2(hid_t file) PASSED(); - return 0; + return SUCCEED; error: - return -1; + return FAIL; } /* end test_can_apply2() */ @@ -5876,11 +5879,11 @@ file) SKIPPED(); puts(" Szip filter is not enabled."); #endif /* H5_HAVE_FILTER_SZIP */ - return 0; + return SUCCEED; #ifdef H5_HAVE_FILTER_SZIP error: - return -1; + return FAIL; #endif /* H5_HAVE_FILTER_SZIP */ } /* end test_can_apply_szip() */ @@ -6155,10 +6158,10 @@ test_set_local(hid_t fapl) PASSED(); - return 0; + return SUCCEED; error: - return -1; + return FAIL; } /* end test_set_local() */ @@ -6233,7 +6236,7 @@ test_compare_dcpl(hid_t file) PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -6243,7 +6246,7 @@ error: H5Pclose(dcpl1); H5Pclose(dcpl2); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_compare_dcpl() */ @@ -6360,7 +6363,7 @@ test_copy_dcpl(hid_t file, hid_t fapl) PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -6375,7 +6378,7 @@ error: H5Pclose(dcpl1_copy); H5Pclose(dcpl2_copy); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_copy_dcpl() */ @@ -6492,7 +6495,7 @@ test_filter_delete(hid_t file) #else SKIPPED(); #endif - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -6501,7 +6504,7 @@ error: H5Dclose(dsid); H5Sclose(sid); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_filter_delete() */ @@ -6574,7 +6577,7 @@ auxread_fdata(hid_t fid, const char *name) if(buf) HDfree(buf); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -6586,8 +6589,8 @@ error: if(buf) HDfree(buf); } H5E_END_TRY; - return -1; -} + return FAIL; +} /* end auxread_fdata() */ /*------------------------------------------------------------------------- @@ -6647,7 +6650,7 @@ test_filters_endianess(void) PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -6656,7 +6659,7 @@ error: H5Sclose(sid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_filters_endianess() */ @@ -6806,7 +6809,7 @@ test_zero_dims(hid_t file) if(H5Sclose(s2) < 0) FAIL_STACK_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -6820,7 +6823,7 @@ error: H5Dclose(d2); H5Sclose(s2); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_zero_dims() */ @@ -6999,7 +7002,7 @@ test_missing_chunk(hid_t file) if(H5Dclose(did2) < 0) TEST_ERROR; PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -7012,7 +7015,7 @@ error: H5Sclose(s); H5Sclose(sid2); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_missing_chunk() */ @@ -7370,7 +7373,7 @@ test_random_chunks_real(const char *testname, hbool_t early_alloc, hid_t fapl) if(H5Fclose(file) < 0) TEST_ERROR; PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -7380,7 +7383,7 @@ error: H5Dclose(d); H5Fclose(file); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_random_chunks_real() */ @@ -7627,10 +7630,10 @@ test_deprec(hid_t file) if(H5Pclose(dcpl) < 0) goto error; - return 0; + return SUCCEED; error: - return -1; + return FAIL; } /* end test_deprec() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ @@ -7734,7 +7737,7 @@ test_huge_chunks(hid_t fapl) if(H5Fclose(fid) < 0) FAIL_STACK_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -7743,7 +7746,7 @@ error: H5Sclose(sid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_huge_chunks() */ @@ -7938,7 +7941,7 @@ test_chunk_cache(hid_t fapl) if (H5Fclose(fid) < 0) FAIL_STACK_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -7951,7 +7954,7 @@ error: H5Sclose(sid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_chunk_cache() */ @@ -8225,7 +8228,7 @@ test_big_chunks_bypass_cache(hid_t fapl) HDfree(rdata2); PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -8244,7 +8247,7 @@ error: HDfree(rdata1); if(rdata2) HDfree(rdata2); - return -1; + return FAIL; } /* end test_big_chunks_bypass_cache() */ @@ -8580,7 +8583,7 @@ test_chunk_fast(const char *env_h5_driver, hid_t fapl) if(H5Pclose(my_fapl) < 0) FAIL_STACK_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -8591,7 +8594,7 @@ error: H5Fclose(fid); H5Pclose(my_fapl); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_chunk_fast() */ @@ -8704,7 +8707,7 @@ test_reopen_chunk_fast(hid_t fapl) } /* end for */ PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -8714,7 +8717,7 @@ error: H5Sclose(scalar_sid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_reopen_chunk_fast() */ @@ -8813,7 +8816,7 @@ test_chunk_fast_bug1(hid_t fapl) if(H5Sclose(sid) < 0) FAIL_STACK_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -8822,7 +8825,7 @@ error: H5Sclose(sid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_chunk_fast_bug1() */ /* This message derives from H5Z */ @@ -9268,7 +9271,7 @@ test_chunk_expand(hid_t fapl) PASSED(); } /* end else */ - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -9281,7 +9284,7 @@ error: H5Sclose(scalar_sid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_chunk_expand() */ @@ -9686,7 +9689,7 @@ test_fixed_array(hid_t fapl) HDfree(rbuf_big); PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -9700,7 +9703,7 @@ error: HDfree(wbuf_big); if(rbuf_big) HDfree(rbuf_big); - return -1; + return FAIL; } /* end test_fixed_array() */ @@ -9944,7 +9947,7 @@ test_single_chunk(hid_t fapl) HDfree(t_rbuf); PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -9964,7 +9967,7 @@ error: HDfree(t_wbuf); if(t_rbuf) HDfree(t_rbuf); - return -1; + return FAIL; } /* end test_single_chunk() */ @@ -10030,15 +10033,15 @@ test_idx_compatible(void) } PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { H5Dclose(did); H5Fclose(fid); } H5E_END_TRY; - return -1; -} /* test_idx_compatible */ + return FAIL; +} /* end test_idx_compatible() */ /*------------------------------------------------------------------------- * @@ -10168,7 +10171,7 @@ test_unfiltered_edge_chunks(hid_t fapl) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -10177,8 +10180,8 @@ error: H5Sclose(sid); H5Fclose(fid); } H5E_END_TRY; - return -1; -} /* test_unfiltered_edge_chunks */ + return FAIL; +} /* end test_unfiltered_edge_chunks() */ /*------------------------------------------------------------------------- @@ -10282,7 +10285,7 @@ test_large_chunk_shrink(hid_t fapl) PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -10292,7 +10295,7 @@ error: H5Sclose(scalar_sid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_large_chunk_shrink() */ @@ -10376,7 +10379,7 @@ test_zero_dim_dset(hid_t fapl) PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -10385,7 +10388,7 @@ error: H5Sclose(sid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_zero_dim_dset() */ @@ -10426,7 +10429,7 @@ test_swmr_non_latest(const char *env_h5_driver, hid_t fapl) if(!H5FD__supports_swmr_test(env_h5_driver)) { SKIPPED(); HDputs(" Test skipped due to VFD not supporting SWMR I/O."); - return 0; + return SUCCEED; } /* Check if we are using the latest version of the format */ @@ -10625,7 +10628,7 @@ test_swmr_non_latest(const char *env_h5_driver, hid_t fapl) PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -10635,7 +10638,7 @@ error: H5Gclose(gid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* test_swmr_non_latest() */ @@ -10676,7 +10679,7 @@ test_earray_hdr_fd(const char *env_h5_driver, hid_t fapl) if(!H5FD__supports_swmr_test(env_h5_driver)) { SKIPPED(); HDputs(" Test skipped due to VFD not supporting SWMR I/O."); - return 0; + return SUCCEED; } if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) @@ -10743,7 +10746,7 @@ test_earray_hdr_fd(const char *env_h5_driver, hid_t fapl) PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -10755,7 +10758,7 @@ error: H5Sclose(sid); H5Sclose(msid); } H5E_END_TRY; - return -1; + return FAIL; } /* test_earray_hdr_fd() */ @@ -10796,7 +10799,7 @@ test_farray_hdr_fd(const char *env_h5_driver, hid_t fapl) if(!H5FD__supports_swmr_test(env_h5_driver)) { SKIPPED(); HDputs(" Test skipped due to VFD not supporting SWMR I/O."); - return 0; + return SUCCEED; } if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) @@ -10863,7 +10866,7 @@ test_farray_hdr_fd(const char *env_h5_driver, hid_t fapl) PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -10875,8 +10878,8 @@ error: H5Sclose(sid); H5Sclose(msid); } H5E_END_TRY; - return -1; -} /* test_farray_hdr_fd() */ + return FAIL; +} /* end test_farray_hdr_fd() */ /*------------------------------------------------------------------------- @@ -10916,7 +10919,7 @@ test_bt2_hdr_fd(const char *env_h5_driver, hid_t fapl) if(!H5FD__supports_swmr_test(env_h5_driver)) { SKIPPED(); HDputs(" Test skipped due to VFD not supporting SWMR I/O."); - return 0; + return SUCCEED; } if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) @@ -10983,7 +10986,7 @@ test_bt2_hdr_fd(const char *env_h5_driver, hid_t fapl) PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -10995,8 +10998,8 @@ error: H5Sclose(sid); H5Sclose(msid); } H5E_END_TRY; - return -1; -} /* test_bt2_hdr_fd() */ + return FAIL; +} /* end test_bt2_hdr_fd() */ /*------------------------------------------------------------------------- @@ -11379,7 +11382,7 @@ test_storage_size(hid_t fapl) PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -11389,7 +11392,7 @@ error: H5Sclose(sid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_storage_size() */ @@ -11470,7 +11473,7 @@ test_power2up(hid_t fapl) PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -11480,7 +11483,7 @@ error: H5Pclose(dcpl); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_power2up() */ @@ -11792,13 +11795,13 @@ test_scatter(void) PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { H5Sclose(sid); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_scatter() */ @@ -11860,7 +11863,7 @@ gather_cb(const void *dst_buf, size_t dst_buf_bytes_used, error: return FAIL; -} +} /* end gather_cb() */ static herr_t test_gather(void) @@ -12154,13 +12157,13 @@ test_gather(void) PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { H5Sclose(sid); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_gather() */ @@ -12194,7 +12197,7 @@ scatter_error_cb_fail(void **src_buf/*out*/, size_t *src_buf_bytes_used/*out*/, *src_buf_bytes_used = nelmts * sizeof(scatter_info->src_buf[0]); return FAIL; -} +} /* end scatter_error_cb_fail() */ static herr_t scatter_error_cb_null(void **src_buf/*out*/, size_t *src_buf_bytes_used/*out*/, @@ -12212,7 +12215,7 @@ scatter_error_cb_null(void **src_buf/*out*/, size_t *src_buf_bytes_used/*out*/, *src_buf_bytes_used = nelmts * sizeof(scatter_info->src_buf[0]); return SUCCEED; -} +} /* end scatter_error_cb_null() */ static herr_t scatter_error_cb_unalign(void **src_buf/*out*/, size_t *src_buf_bytes_used/*out*/, @@ -12223,7 +12226,7 @@ scatter_error_cb_unalign(void **src_buf/*out*/, size_t *src_buf_bytes_used/*out* *src_buf_bytes_used = *(size_t *)_src_buf_bytes_used; return SUCCEED; -} +} /* endscatter_error_cb_unalign() */ static herr_t test_scatter_error(void) @@ -12357,13 +12360,13 @@ test_scatter_error(void) PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { H5Sclose(sid); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_scatter_error() */ @@ -12386,7 +12389,7 @@ gather_error_cb_fail(const void H5_ATTR_UNUSED *dst_buf, size_t H5_ATTR_UNUSED dst_buf_bytes_used, void H5_ATTR_UNUSED *op_data) { return FAIL; -} +} /* end gather_error_cb_fail() */ static herr_t test_gather_error(void) @@ -12496,13 +12499,13 @@ test_gather_error(void) PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { H5Sclose(sid); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_gather_error() */ /*------------------------------------------------------------------------- @@ -12599,8 +12602,8 @@ static herr_t dls_01_read_stuff( hid_t fid ); static herr_t dls_01_main( void ); static herr_t -dls_01_setup_file( hid_t fid ) { - +dls_01_setup_file( hid_t fid ) +{ int status = 0; hid_t sid = 0, did = 0, tid = 0, dcpl = 0; int ndims = 1; @@ -12638,17 +12641,15 @@ dls_01_setup_file( hid_t fid ) { status = H5Sclose( sid ); if ( status != 0 ) TEST_ERROR - return 0; + return SUCCEED; error: - - return -1; - -} /* dls_01_setup_file */ + return FAIL; +} /* end dls_01_setup_file() */ static herr_t -dls_01_write_data( hid_t fid, char* buffer ) { - +dls_01_write_data( hid_t fid, char* buffer ) +{ int status = 0; hid_t did = 0, tid = 0; hsize_t extent[1] = {4}; @@ -12674,17 +12675,15 @@ dls_01_write_data( hid_t fid, char* buffer ) { status = H5Dclose( did ); if ( status != 0 ) TEST_ERROR - return 0; + return SUCCEED; error: - - return -1; - -} /* dls_01_write_data */ + return FAIL; +} /* end dls_01_write_data() */ static herr_t -dls_01_read_stuff( hid_t fid ) { - +dls_01_read_stuff( hid_t fid ) +{ int status = 0; hid_t did = 0; H5O_info_t info; @@ -12698,17 +12697,15 @@ dls_01_read_stuff( hid_t fid ) { status = H5Dclose( did ); if ( status != 0 ) TEST_ERROR - return 0; + return SUCCEED; error: - - return -1; - -} /* dls_01_read_stuff() */ + return FAIL; +} /* end dls_01_read_stuff() */ static herr_t -dls_01_main( void ) { - +dls_01_main( void ) +{ char filename[512]; int status = 0; hid_t fapl = 0, fid = 0; @@ -12765,15 +12762,12 @@ dls_01_main( void ) { PASSED(); - return 0; + return SUCCEED; error: - if ( buffer ) HDfree(buffer); - - return -1; - -} /* dls_01_main() */ + return FAIL; +} /* end dls_01_main() */ /*------------------------------------------------------------------------- * Function: test_compact_open_close_dirty @@ -12881,7 +12875,7 @@ test_compact_open_close_dirty(hid_t fapl) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -12890,8 +12884,8 @@ error: H5Dclose(did); H5Fclose(fid); } H5E_END_TRY; - return -1; -} /* test_compact_open_close_dirty() */ + return FAIL; +} /* end test_compact_open_close_dirty() */ /*------------------------------------------------------------------------- @@ -13030,7 +13024,7 @@ test_versionbounds(void) TEST_ERROR dcpl = -1; PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -13043,8 +13037,119 @@ test_versionbounds(void) H5Fclose(srcfile); H5Fclose(vfile); } H5E_END_TRY; - return -1; -} /* test_versionbounds() */ + return FAIL; +} /* end test_versionbounds() */ + + +/*----------------------------------------------------------------------------- + * Function: test_object_header_minimization_dcpl + * + * Purpose: Test the "datset object header minimization" property as part of + * the DCPL. + * + * Return: Success/pass: 0 + * Failure/error: -1 + * + * Programmer: Jacob Smith + * 2018 August 15 + * + * Changes: None. + *----------------------------------------------------------------------------- + */ +static herr_t +test_object_header_minimization_dcpl(void) +{ + hid_t dcpl_id = -1; + hid_t file_id = -1; + char filename[FILENAME_BUF_SIZE] = ""; + hbool_t minimize = FALSE; + herr_t ret; + + TESTING("dcpl flags to minimize dataset object header"); + + /*********/ + /* SETUP */ + /*********/ + + if(NULL == h5_fixname(OHMIN_FILENAME_A, H5P_DEFAULT, filename, sizeof(filename))) + TEST_ERROR + + file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if (0 > file_id) TEST_ERROR + + dcpl_id = H5Pcreate(H5P_DATASET_CREATE); + if (0 > dcpl_id) TEST_ERROR + + /*********/ + /* TESTS */ + /*********/ + + /* default value (not set explicitly) + */ + if (H5Pget_dset_no_attrs_hint(dcpl_id, &minimize) == FAIL) TEST_ERROR + if (FALSE != minimize) + TEST_ERROR + + /* FALSE-set value + */ + if (H5Pset_dset_no_attrs_hint(dcpl_id, FALSE) == FAIL) TEST_ERROR + if (H5Pget_dset_no_attrs_hint(dcpl_id, &minimize) == FAIL) TEST_ERROR + if (FALSE != minimize) + TEST_ERROR + + /* TRUE-set value + */ + if (H5Pset_dset_no_attrs_hint(dcpl_id, TRUE) == FAIL) TEST_ERROR + if (H5Pget_dset_no_attrs_hint(dcpl_id, &minimize) == FAIL) TEST_ERROR + if (TRUE != minimize) + TEST_ERROR + + /* error cases + */ + H5E_BEGIN_TRY { + ret = H5Pget_dset_no_attrs_hint(-1, &minimize); + } H5E_END_TRY; + if (ret == SUCCEED) + TEST_ERROR /* Invalid DCPL ID should fail */ + + H5E_BEGIN_TRY { + ret = H5Pset_dset_no_attrs_hint(-1, FALSE); + } H5E_END_TRY; + if (ret == SUCCEED) + TEST_ERROR /* Invalid DCPL ID should fail */ + + H5E_BEGIN_TRY { + ret = H5Pset_dset_no_attrs_hint(-1, TRUE); + } H5E_END_TRY; + if (ret == SUCCEED) + TEST_ERROR /* Invalid DCPL ID should fail */ + + H5E_BEGIN_TRY { + ret = H5Pget_dset_no_attrs_hint(dcpl_id, NULL); + } H5E_END_TRY; + if (ret == SUCCEED) + TEST_ERROR /* NULL out pointer should fail */ + + /************/ + /* TEARDOWN */ + /************/ + + if (H5Fclose(file_id) == FAIL) + TEST_ERROR + + if (H5Pclose(dcpl_id) == FAIL) + TEST_ERROR + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Pclose(dcpl_id); + H5Fclose(file_id); + } H5E_END_TRY; + return FAIL; +} /* end test_object_header_minimization_dcpl() */ /*------------------------------------------------------------------------- @@ -13068,6 +13173,7 @@ main(void) hid_t fcpl = -1, fcpl2 = -1; unsigned new_format; unsigned paged; + unsigned minimized_ohdr; int mdc_nelmts; size_t rdcc_nelmts; size_t rdcc_nbytes; @@ -13118,10 +13224,12 @@ main(void) /* Test with paged aggregation enabled or not */ for(paged = FALSE; paged <= TRUE; paged++) { - /* Temporary: skip testing for multi/split drivers: - fail file create when persisting free-space or using paged aggregation strategy */ - if(!contig_addr_vfd && paged) - continue; + /* Temporary: skip testing for multi/split drivers: + fail file create when persisting free-space or using paged aggregation strategy */ + if(!contig_addr_vfd && paged) + continue; + + for (minimized_ohdr = FALSE; minimized_ohdr <= TRUE; minimized_ohdr++) { /* Test with old & new format groups */ for(new_format = FALSE; new_format <= TRUE; new_format++) { @@ -13153,6 +13261,12 @@ main(void) if((file = H5Fcreate(filename, H5F_ACC_TRUNC, my_fcpl, my_fapl)) < 0) goto error; + if (TRUE == minimized_ohdr) { + if (0 > H5Fset_dset_no_attrs_hint(file, TRUE)) + goto error; + puts("(minimized dataset object headers with file setting)"); + } + /* Cause the library to emit initial messages */ if((grp = H5Gcreate2(file, "emit diagnostics", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; @@ -13230,6 +13344,7 @@ main(void) if(H5Fclose(file) < 0) goto error; } /* end for new_format */ + } /* for minimized dset object headers */ } /* end for paged */ /* Close property lists */ @@ -13246,6 +13361,8 @@ main(void) /* Tests version bounds using its own file */ nerrors += (test_versionbounds() < 0 ? 1 : 0); + nerrors += (test_object_header_minimization_dcpl() < 0 ? 1 : 0); + /* Run misc tests */ nerrors += dls_01_main(); @@ -13261,12 +13378,12 @@ main(void) #endif /* H5_HAVE_FILTER_SZIP */ h5_cleanup(FILENAME, fapl); - return 0; + return EXIT_SUCCESS; error: nerrors = MAX(1, nerrors); printf("***** %d DATASET TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S"); - return 1; -} + return EXIT_FAILURE; +} /* end main() */ diff --git a/test/dt_arith.c b/test/dt_arith.c index c7f2986..2729ba1 100644 --- a/test/dt_arith.c +++ b/test/dt_arith.c @@ -4883,7 +4883,24 @@ run_fp_tests(const char *name) #if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0 nerrors += test_conv_flt_1(name, TEST_DENORM, H5T_NATIVE_FLOAT, H5T_NATIVE_LDOUBLE); nerrors += test_conv_flt_1(name, TEST_DENORM, H5T_NATIVE_DOUBLE, H5T_NATIVE_LDOUBLE); +#ifndef H5_DISABLE_SOME_LDOUBLE_CONV nerrors += test_conv_flt_1(name, TEST_DENORM, H5T_NATIVE_LDOUBLE, H5T_NATIVE_FLOAT); +#else + { + char str[256]; /*string */ + + HDsnprintf(str, sizeof(str), "Testing %s denormalized %s -> %s conversions", + name, "long double", "float"); + printf("%-70s", str); + SKIPPED(); +#if H5_SIZEOF_LONG_DOUBLE!=0 + HDputs(" Test skipped due to the conversion problem on IBM ppc64le cpu."); +#else + HDputs(" Test skipped due to disabled long double."); +#endif + } +#endif + nerrors += test_conv_flt_1(name, TEST_DENORM, H5T_NATIVE_LDOUBLE, H5T_NATIVE_DOUBLE); #endif @@ -4893,8 +4910,24 @@ run_fp_tests(const char *name) #if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0 nerrors += test_conv_flt_1(name, TEST_SPECIAL, H5T_NATIVE_FLOAT, H5T_NATIVE_LDOUBLE); nerrors += test_conv_flt_1(name, TEST_SPECIAL, H5T_NATIVE_DOUBLE, H5T_NATIVE_LDOUBLE); +#ifndef H5_DISABLE_SOME_LDOUBLE_CONV nerrors += test_conv_flt_1(name, TEST_SPECIAL, H5T_NATIVE_LDOUBLE, H5T_NATIVE_FLOAT); nerrors += test_conv_flt_1(name, TEST_SPECIAL, H5T_NATIVE_LDOUBLE, H5T_NATIVE_DOUBLE); +#else + { + char str[256]; /*string */ + + HDsnprintf(str, sizeof(str), "Testing %s special %s -> %s conversions", + name, "long double", "float or double"); + printf("%-70s", str); + SKIPPED(); +#if H5_SIZEOF_LONG_DOUBLE!=0 + HDputs(" Test skipped due to the conversion problem on IBM ppc64le cpu."); +#else + HDputs(" Test skipped due to disabled long double."); +#endif + } +#endif #endif done: @@ -4963,7 +4996,7 @@ run_int_fp_conv(const char *name) nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_INT, H5T_NATIVE_LDOUBLE); nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_UINT, H5T_NATIVE_LDOUBLE); #if H5_SIZEOF_LONG!=H5_SIZEOF_INT -#ifndef H5_LONG_TO_LDOUBLE_SPECIAL +#if !defined(H5_LONG_TO_LDOUBLE_SPECIAL) && !defined(H5_DISABLE_SOME_LDOUBLE_CONV) nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_LONG, H5T_NATIVE_LDOUBLE); nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_ULONG, H5T_NATIVE_LDOUBLE); #else @@ -5077,16 +5110,46 @@ run_fp_int_conv(const char *name) #endif #if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE - nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SCHAR); - nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_UCHAR); - nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SHORT); - nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_USHORT); - nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_INT); - nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_UINT); + if(test_values != TEST_SPECIAL) { + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SCHAR); + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_UCHAR); + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SHORT); + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_USHORT); + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_INT); + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_UINT); + } else { +#ifndef H5_DISABLE_SOME_LDOUBLE_CONV + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SCHAR); + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_UCHAR); + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SHORT); + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_USHORT); + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_INT); + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_UINT); +#else + char str[256]; /*string */ + + HDsnprintf(str, sizeof(str), "Testing %s special %s -> %s conversions", + name, "long double", "signed and unsigned char, short, int, long"); + printf("%-70s", str); + SKIPPED(); +#if H5_SIZEOF_LONG_DOUBLE!=0 + HDputs(" Test skipped due to the conversion problem on IBM ppc64le cpu."); +#else + HDputs(" Test skipped due to disabled long double."); +#endif +#endif + } #if H5_SIZEOF_LONG!=H5_SIZEOF_INT && H5_SIZEOF_LONG_DOUBLE!=0 #ifndef H5_LDOUBLE_TO_LONG_SPECIAL - nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_LONG); - nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_ULONG); + if(test_values != TEST_SPECIAL && test_values != TEST_NORMAL) { + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_LONG); + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_ULONG); + } else { +#ifndef H5_DISABLE_SOME_LDOUBLE_CONV + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_LONG); + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_ULONG); +#endif + } #else { char str[256]; /*string */ @@ -20,6 +20,7 @@ #include "H5Fpkg.h" #include "H5CXprivate.h" /* API Contexts */ #include "H5Iprivate.h" +#include "H5Pprivate.h" /* Property lists */ const char *FILENAME[] = { "efc0", @@ -2896,6 +2897,8 @@ int main(void) { unsigned nerrors = 0; /* track errors */ + H5P_genplist_t *plist; /* Property list pointer for FAPL */ + H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ /* Test Setup */ @@ -2917,6 +2920,15 @@ main(void) if(H5CX_push() < 0) FAIL_STACK_ERROR api_ctx_pushed = TRUE; + /* Get the VOL info from the fapl */ + plist = (H5P_genplist_t *)H5I_object(fapl_id); + H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop); + + /* Stash a copy of the "top-level" connector property, before any pass-through + * connectors modify or unwrap it. + */ + H5CX_set_vol_connector_prop(&connector_prop); + /* Test Functions */ nerrors += test_single(); nerrors += test_graph_nocycle(); diff --git a/test/enc_dec_plist.c b/test/enc_dec_plist.c index 36db2d0..33d23dc 100644 --- a/test/enc_dec_plist.c +++ b/test/enc_dec_plist.c @@ -146,6 +146,9 @@ main(void) if((H5Pset_fill_value(dcpl, H5T_NATIVE_DOUBLE, &fill)) < 0) FAIL_STACK_ERROR + if((H5Pset_dset_no_attrs_hint(dcpl, FALSE)) < 0) + FAIL_STACK_ERROR + max_size[0] = 100; if((H5Pset_external(dcpl, "ext1.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int)/4))) < 0) @@ -460,8 +463,6 @@ main(void) FAIL_STACK_ERROR if((H5Pset_mdc_image_config(fapl, &my_cache_image_config)) < 0) FAIL_STACK_ERROR - if((H5Pset_core_write_tracking(fapl, TRUE, 1024 * 1024)) < 0) - FAIL_STACK_ERROR /* Test encoding & decoding property list */ if(test_encode_decode(fapl) < 0) diff --git a/test/flushrefreshTest.cmake b/test/flushrefreshTest.cmake index f66ee64..aa18c8a 100644 --- a/test/flushrefreshTest.cmake +++ b/test/flushrefreshTest.cmake @@ -53,7 +53,7 @@ if (TEST_ENV_VAR) #message (STATUS "ENV:${TEST_ENV_VAR}=$ENV{${TEST_ENV_VAR}}") endif () -message(STATUS "Background: ${PERL_EXECUTABLE} ${PERL_SCRIPT} ${TEST_PROGRAM}") +message (STATUS "Background: ${PERL_EXECUTABLE} ${PERL_SCRIPT} ${TEST_PROGRAM}") execute_process ( COMMAND ${PERL_EXECUTABLE} ${PERL_SCRIPT} ${TEST_PROGRAM} RESULT_VARIABLE SCRIPT_RESULT @@ -61,34 +61,34 @@ execute_process ( OUTPUT_VARIABLE SCRIPT_OUTPUT WORKING_DIRECTORY ${TEST_FOLDER} ) -message(STATUS "Background: ${SCRIPT_OUTPUT}") -if (NOT "${SCRIPT_RESULT}" STREQUAL "0") +message (STATUS "Background: ${SCRIPT_OUTPUT}") +if (SCRIPT_RESULT) message (FATAL_ERROR "Failed: The background script failed ${SCRIPT_RESULT}: ${SCRIPT_ERR}") endif () -set(verification_done "0") -while(verification_done LESS "1") - message(STATUS "checking first stage:${TEST_FOLDER}/${TEST_ARGS1}") - if(EXISTS ${TEST_FOLDER}/${TEST_ERR}) +set (verification_done "0") +while (verification_done LESS "1") + message (STATUS "checking first stage:${TEST_FOLDER}/${TEST_ARGS1}") + if (EXISTS ${TEST_FOLDER}/${TEST_ERR}) # Error exit script - set(verification_done "3") - elseif(EXISTS ${TEST_FOLDER}/${TEST_ARGS1}) + set (verification_done "3") + elseif (EXISTS ${TEST_FOLDER}/${TEST_ARGS1}) file (STRINGS ${TEST_FOLDER}/${TEST_ARGS1} v1) list (LENGTH v1 len_v1) - message(STATUS "v1:${v1} len_v1:${len_v1}") - if (NOT "${len_v1}" STREQUAL "0") + message (STATUS "v1:${v1} len_v1:${len_v1}") + if (len_v1) list (GET v1 0 param1) list (GET v1 -1 param2) endif () - file(REMOVE ${TEST_FOLDER}/${TEST_ARGS1}) - message(STATUS "PARAM1:${param1} PARAM2:${param2}") + file (REMOVE ${TEST_FOLDER}/${TEST_ARGS1}) + message (STATUS "PARAM1:${param1} PARAM2:${param2}") - if(${param1} MATCHES "VERIFICATION_DONE") - set(verification_done "1") - file(WRITE ${TEST_FOLDER}/${TEST_ARGS2} "all flush verification complete") - message(STATUS "write: ${TEST_FOLDER}/${TEST_ARGS2}") - else() - message(STATUS "execute: ${TEST_PROGRAM} ${param1} ${param2}") + if (param1 MATCHES "VERIFICATION_DONE") + set (verification_done "1") + file (WRITE ${TEST_FOLDER}/${TEST_ARGS2} "all flush verification complete") + message (STATUS "write: ${TEST_FOLDER}/${TEST_ARGS2}") + else () + message (STATUS "execute: ${TEST_PROGRAM} ${param1} ${param2}") execute_process ( COMMAND ${TEST_PROGRAM} ${param1} ${param2} RESULT_VARIABLE TEST_RESULT @@ -98,40 +98,40 @@ while(verification_done LESS "1") ERROR_VARIABLE TEST_ERROR WORKING_DIRECTORY ${TEST_FOLDER} ) - message(STATUS "flush verification: ${TEST_OUT}") - if (NOT "${TEST_RESULT}" STREQUAL "0") + message (STATUS "flush verification: ${TEST_OUT}") + if (TEST_RESULT) message (FATAL_ERROR "Failed: The flush verification failed ${TEST_RESULT}: ${TEST_ERROR}") endif () - file(WRITE ${TEST_FOLDER}/${TEST_ARGS2} "verification flush process done") - endif() - else() - message(STATUS "waiting: ${TEST_FOLDER}/${TEST_ARGS1}") + file (WRITE ${TEST_FOLDER}/${TEST_ARGS2} "verification flush process done") + endif () + else () + message (STATUS "waiting: ${TEST_FOLDER}/${TEST_ARGS1}") #execute_process (COMMAND ${CMAKE_COMMAND} -E sleep 2) - endif() -endwhile() + endif () +endwhile () -while(verification_done LESS "2") - message(STATUS "checking second stage:${TEST_FOLDER}/${TEST_ARGS1}") - if(EXISTS ${TEST_FOLDER}/${TEST_ERR}) +while (verification_done LESS "2") + message (STATUS "checking second stage:${TEST_FOLDER}/${TEST_ARGS1}") + if (EXISTS ${TEST_FOLDER}/${TEST_ERR}) # Error exit script - set(verification_done "3") - elseif(EXISTS ${TEST_FOLDER}/${TEST_ARGS1}) + set (verification_done "3") + elseif (EXISTS ${TEST_FOLDER}/${TEST_ARGS1}) file (STRINGS ${TEST_FOLDER}/${TEST_ARGS1} v1) list (LENGTH v1 len_v1) - message(STATUS "v1:${v1} len_v1:${len_v1}") - if (NOT "${len_v1}" STREQUAL "0") + message (STATUS "v1:${v1} len_v1:${len_v1}") + if (len_v1) list (GET v1 0 param1) list (GET v1 -1 param2) endif () - file(REMOVE ${TEST_FOLDER}/${TEST_ARGS1}) - message(STATUS "PARAM1:${param1} PARAM2:${param2}") + file (REMOVE ${TEST_FOLDER}/${TEST_ARGS1}) + message (STATUS "PARAM1:${param1} PARAM2:${param2}") - if(${param1} MATCHES "VERIFICATION_DONE") - set(verification_done "2") - file(WRITE ${TEST_FOLDER}/${TEST_ARGS2} "all refresh verification complete") - message(STATUS "write: ${TEST_FOLDER}/${TEST_ARGS2}") - else() - message(STATUS "execute: ${TEST_PROGRAM} ${param1}") + if (param1 MATCHES "VERIFICATION_DONE") + set (verification_done "2") + file (WRITE ${TEST_FOLDER}/${TEST_ARGS2} "all refresh verification complete") + message (STATUS "write: ${TEST_FOLDER}/${TEST_ARGS2}") + else () + message (STATUS "execute: ${TEST_PROGRAM} ${param1}") execute_process ( COMMAND ${TEST_PROGRAM} ${param1} RESULT_VARIABLE TEST_RESULT @@ -141,22 +141,22 @@ while(verification_done LESS "2") ERROR_VARIABLE TEST_ERROR WORKING_DIRECTORY ${TEST_FOLDER} ) - message(STATUS "refresh verification: ${TEST_OUT}") - if (NOT "${TEST_RESULT}" STREQUAL "0") + message (STATUS "refresh verification: ${TEST_OUT}") + if (TEST_RESULT) message (FATAL_ERROR "Failed: The refresh verification failed ${TEST_RESULT}: ${TEST_ERROR}") endif () - file(WRITE ${TEST_FOLDER}/${TEST_ARGS2} "refresh verifiction process done") - endif() - else() - message(STATUS "waiting: ${TEST_FOLDER}/${TEST_ARGS1}") + file (WRITE ${TEST_FOLDER}/${TEST_ARGS2} "refresh verifiction process done") + endif () + else () + message (STATUS "waiting: ${TEST_FOLDER}/${TEST_ARGS1}") #execute_process (COMMAND ${CMAKE_COMMAND} -E sleep 2) - endif() -endwhile() + endif () +endwhile () message (STATUS "COMMAND Result: ${TEST_RESULT}") # if the return value is !=${TEST_EXPECT} bail out -if (NOT "${TEST_RESULT}" STREQUAL "${TEST_EXPECT}") +if (NOT TEST_RESULT EQUAL TEST_EXPECT) if (NOT TEST_NOERRDISPLAY) if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}) file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) diff --git a/test/gen_bogus.c b/test/gen_bogus.c index ec29eb9..237b024 100644 --- a/test/gen_bogus.c +++ b/test/gen_bogus.c @@ -89,6 +89,14 @@ generate_datasets(hid_t loc_id, unsigned bogus_id) if((did = H5Dcreate2(loc_id, "Dataset4", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) goto error; if(H5Dclose(did) < 0) goto error; + /* Set "shareable" message flag for bogus message */ + bogus_flags = H5O_MSG_FLAG_SHAREABLE; + if(H5Pset(dcpl, H5O_BOGUS_MSG_FLAGS_NAME, &bogus_flags) < 0) goto error; + + /* Create fourth dataset, with "shareable" message flag */ + if((did = H5Dcreate2(loc_id, "Dataset5", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) goto error; + if(H5Dclose(did) < 0) goto error; + /* Close dataset creation property list */ if(H5Pclose(dcpl) < 0) goto error; diff --git a/test/gen_plist.c b/test/gen_plist.c index 62693bd..68da6cc 100644 --- a/test/gen_plist.c +++ b/test/gen_plist.c @@ -125,6 +125,9 @@ main(void) if((ret = H5Pset_fill_value(dcpl1, H5T_STD_I32BE, &fill)) < 0) assert(ret > 0); + if((ret = H5Pset_dset_no_attrs_hint(dcpl1, FALSE)) < 0) + assert(ret > 0); + max_size[0] = 100; if((ret = H5Pset_external(dcpl1, "ext1.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int)/4))) < 0) @@ -363,9 +366,6 @@ main(void) if((ret = H5Pset_mdc_image_config(fapl1, &my_cache_image_config)) < 0) assert(ret > 0); - if((ret = H5Pset_core_write_tracking(fapl1, TRUE, (size_t)(1024 * 1024))) < 0) - assert(ret > 0); - if((ret = encode_plist(fapl1, little_endian, word_length, "testfiles/plist_files/fapl_")) < 0) assert(ret > 0); @@ -476,7 +476,7 @@ encode_plist(hid_t plist_id, int little_endian, int word_length, const char *fil HDassert(ret > 0); fd = HDopen(filename, O_RDWR | O_CREAT | O_TRUNC, H5_POSIX_CREATE_MODE_RW); - HDassert(fd > 0); + HDassert(fd >= 0); write_size = HDwrite(fd, temp_buf, temp_size); HDassert(write_size == (ssize_t)temp_size); diff --git a/test/h5test.c b/test/h5test.c index 0805f06..0ba28f3 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -158,47 +158,8 @@ h5_clean_files(const char *base_name[], hid_t fapl) int i; for(i = 0; base_name[i]; i++) { - char filename[1024]; - char temp[2048]; - hid_t driver; - - if(NULL == h5_fixname(base_name[i], fapl, filename, sizeof(filename))) - continue; - - driver = H5Pget_driver(fapl); - - if(driver == H5FD_FAMILY) { - int j; - - for(j = 0; /*void*/; j++) { - HDsnprintf(temp, sizeof temp, filename, j); - - if(HDaccess(temp, F_OK) < 0) - break; - - HDremove(temp); - } /* end for */ - } else if(driver == H5FD_CORE) { - hbool_t backing; /* Whether the core file has backing store */ - - H5Pget_fapl_core(fapl, NULL, &backing); - - /* If the file was stored to disk with bacing store, remove it */ - if(backing) - HDremove(filename); - } else if (driver == H5FD_MULTI) { - H5FD_mem_t mt; - - HDassert(HDstrlen(multi_letters)==H5FD_MEM_NTYPES); - - for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,mt)) { - HDsnprintf(temp, sizeof temp, "%s-%c.h5", filename, multi_letters[mt]); - HDremove(temp); /*don't care if it fails*/ - } /* end for */ - } else { - HDremove(filename); - } - } /* end for */ + h5_delete_test_file(base_name[i], fapl); + } /* Close the FAPL used to access the file */ H5Pclose(fapl); @@ -266,10 +227,10 @@ h5_delete_test_file(const char *base_name, hid_t fapl) for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,mt)) { HDsnprintf(sub_filename, sizeof(sub_filename), "%s-%c.h5", filename, multi_letters[mt]); HDremove(sub_filename); - } /* end for */ + } } else { HDremove(filename); - } /* end if */ + } /* end driver selection tree */ return; } /* end h5_delete_test_file() */ @@ -652,7 +613,7 @@ h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix, printf("*** Hint ***\n" "You can use environment variable HDF5_PARAPREFIX to " "run parallel test files in a\n" - "different directory or to add file type prefix. E.g.,\n" + "different directory or to add file type prefix. e.g.,\n" " HDF5_PARAPREFIX=pfs:/PFS/user/me\n" " export HDF5_PARAPREFIX\n" "*** End of Hint ***\n"); @@ -802,10 +763,10 @@ h5_rmprefix(const char *filename) * * Purpose: Returns a file access template which is the default template * but with a file driver, VOL connector, or libver bound set - * according to a constant or environment variable + * according to a constant or environment variable * - * Return: Success: A file access property list - * Failure: -1 + * Return: Success: A file access property list + * Failure: H5I_INVALID_HID * * Programmer: Robb Matzke * Thursday, November 19, 1998 @@ -815,28 +776,77 @@ h5_rmprefix(const char *filename) hid_t h5_fileaccess(void) { - hid_t fapl = -1; + hid_t fapl_id = H5I_INVALID_HID; - if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) - return -1; + if((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) + goto error; /* Attempt to set up a file driver first */ - if(h5_get_vfd_fapl(fapl) < 0) - return -1; + if(h5_get_vfd_fapl(fapl_id) < 0) + goto error; /* Next, try to set up a VOL connector */ - if(h5_get_vol_fapl(fapl) < 0) - return -1; + if(h5_get_vol_fapl(fapl_id) < 0) + goto error; /* Finally, check for libver bounds */ - if(h5_get_libver_fapl(fapl) < 0) - return -1; + if(h5_get_libver_fapl(fapl_id) < 0) + goto error; - return(fapl); + return fapl_id; + +error: + if(fapl_id != H5I_INVALID_HID) + H5Pclose(fapl_id); + return H5I_INVALID_HID; } /* end h5_fileaccess() */ /*------------------------------------------------------------------------- + * Function: h5_fileaccess_flags + * + * Purpose: Returns a file access template which is the default template + * but with a file driver, VOL connector, or libver bound set + * according to a constant or environment variable + * + * Return: Success: A file access property list + * Failure: H5I_INVALID_HID + * + * Programmer: Robb Matzke + * Thursday, November 19, 1998 + * + *------------------------------------------------------------------------- + */ +hid_t +h5_fileaccess_flags(unsigned flags) +{ + hid_t fapl_id = H5I_INVALID_HID; + + if((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) + goto error; + + /* Attempt to set up a file driver first */ + if((flags & H5_FILEACCESS_VFD) && h5_get_vfd_fapl(fapl_id) < 0) + goto error; + + /* Next, try to set up a VOL connector */ + if((flags & H5_FILEACCESS_VOL) && h5_get_vol_fapl(fapl_id) < 0) + goto error; + + /* Finally, check for libver bounds */ + if((flags & H5_FILEACCESS_LIBVER) && h5_get_libver_fapl(fapl_id) < 0) + goto error; + + return fapl_id; + +error: + if(fapl_id != H5I_INVALID_HID) + H5Pclose(fapl_id); + return H5I_INVALID_HID; +} /* end h5_fileaccess_flags() */ + + +/*------------------------------------------------------------------------- * Function: h5_get_vfd_fapl * * Purpose: Sets the file driver for a FAPL according to the value specified @@ -855,6 +865,7 @@ h5_get_vfd_fapl(hid_t fapl) { const char *env = NULL; /* HDF5_DRIVER environment variable */ const char *tok = NULL; /* strtok pointer */ + char *lasts = NULL; /* Context pointer for strtok_r() call */ char buf[1024]; /* buffer for tokenizing HDF5_DRIVER */ /* Get the environment variable, if it exists */ @@ -877,7 +888,7 @@ h5_get_vfd_fapl(hid_t fapl) */ HDstrncpy(buf, env, sizeof(buf)); buf[sizeof(buf) - 1] = '\0'; - if(NULL == (tok = HDstrtok(buf, " \t\n\r"))) + if(NULL == (tok = HDstrtok_r(buf, " \t\n\r", &lasts))) goto done; if(!HDstrcmp(tok, "sec2")) { @@ -890,11 +901,11 @@ h5_get_vfd_fapl(hid_t fapl) goto error; } else if(!HDstrcmp(tok, "core")) { /* In-memory driver settings (backing store on, 1 MB increment) */ - if(H5Pset_fapl_core(fapl, (size_t)1, TRUE) < 0) + if(H5Pset_fapl_core(fapl, (size_t)H5_MB, TRUE) < 0) goto error; } else if(!HDstrcmp(tok, "core_paged")) { /* In-memory driver with write tracking and paging on */ - if(H5Pset_fapl_core(fapl, (size_t)1, TRUE) < 0) + if(H5Pset_fapl_core(fapl, (size_t)H5_MB, TRUE) < 0) goto error; if(H5Pset_core_write_tracking(fapl, TRUE, (size_t)4096) < 0) goto error; @@ -936,7 +947,7 @@ h5_get_vfd_fapl(hid_t fapl) hsize_t fam_size = 100 * 1024 * 1024; /* 100 MB */ /* Was a family size specified in the environment variable? */ - if((tok = HDstrtok(NULL, " \t\n\r"))) + if((tok = HDstrtok_r(NULL, " \t\n\r", &lasts))) fam_size = (hsize_t)(HDstrtod(tok, NULL) * 1024 * 1024); if(H5Pset_fapl_family(fapl, fam_size, H5P_DEFAULT) < 0) goto error; @@ -945,7 +956,7 @@ h5_get_vfd_fapl(hid_t fapl) unsigned log_flags = H5FD_LOG_LOC_IO | H5FD_LOG_ALLOC; /* Were special log file flags specified in the environment variable? */ - if((tok = HDstrtok(NULL, " \t\n\r"))) + if((tok = HDstrtok_r(NULL, " \t\n\r", &lasts))) log_flags = (unsigned)HDstrtol(tok, NULL, 0); if(H5Pset_fapl_log(fapl, NULL, log_flags, (size_t)0) < 0) @@ -990,6 +1001,7 @@ h5_get_libver_fapl(hid_t fapl) { const char *env = NULL; /* HDF5_DRIVER environment variable */ const char *tok = NULL; /* strtok pointer */ + char *lasts = NULL; /* Context pointer for strtok_r() call */ char buf[1024]; /* buffer for tokenizing HDF5_DRIVER */ /* Get the environment variable, if it exists */ @@ -1012,7 +1024,7 @@ h5_get_libver_fapl(hid_t fapl) */ HDstrncpy(buf, env, sizeof(buf)); buf[sizeof(buf) - 1] = '\0'; - if(NULL == (tok = HDstrtok(buf, " \t\n\r"))) + if(NULL == (tok = HDstrtok_r(buf, " \t\n\r", &lasts))) goto done; if(!HDstrcmp(tok, "latest")) { @@ -1040,7 +1052,7 @@ error: * fapl but with a VOL connector set according to the constant * or environment variable HDF5_VOL_CONNECTOR. * - * Return: Success: A file access property list ID + * Return: Success: 0 * Failure: -1 * * Programmer: Jordan Henderson @@ -1053,6 +1065,7 @@ h5_get_vol_fapl(hid_t fapl) { const char *env = NULL; const char *tok = NULL; + char *lasts = NULL; /* Context pointer for strtok_r() call */ htri_t connector_is_registered; char buf[1024]; /* Buffer for tokenizing HDF5_VOL_CONNECTOR */ void *vol_info = NULL; /* VOL connector info */ @@ -1075,7 +1088,7 @@ h5_get_vol_fapl(hid_t fapl) */ HDstrncpy(buf, env, sizeof(buf)); buf[sizeof(buf) - 1] = '\0'; - if(NULL == (tok = HDstrtok(buf, " \t\n\r"))) + if(NULL == (tok = HDstrtok_r(buf, " \t\n\r", &lasts))) goto done; /* First, check to see if the connector is already registered */ @@ -1105,7 +1118,7 @@ h5_get_vol_fapl(hid_t fapl) } /* end else */ /* Was there any connector info specified in the environment variable? */ - if(NULL != (tok = HDstrtok(NULL, " \t\n\r"))) + if(NULL != (tok = HDstrtok_r(NULL, " \t\n\r", &lasts))) if(H5VLconnector_str_to_info(tok, connector_id, &vol_info) < 0) goto error; @@ -1257,7 +1270,7 @@ h5_set_info_object(void) int ret_value=0; /* handle any MPI INFO hints via $HDF5_MPI_INFO */ - if ((envp = getenv("HDF5_MPI_INFO")) != NULL){ + if ((envp = HDgetenv("HDF5_MPI_INFO")) != NULL){ char *next, *valp; valp = envp = next = HDstrdup(envp); @@ -1319,7 +1332,7 @@ h5_set_info_object(void) /* actually set the darned thing */ if (MPI_SUCCESS != MPI_Info_set(h5_io_info_g, namep, valp)) { - printf("MPI_Info_set failed\n"); + HDprintf("MPI_Info_set failed\n"); ret_value = -1; } } @@ -1495,9 +1508,9 @@ print_func(const char *format, ...) va_list arglist; int ret_value; - va_start(arglist, format); + HDva_start(arglist, format); ret_value = vprintf(format, arglist); - va_end(arglist); + HDva_end(arglist); return ret_value; } @@ -1582,7 +1595,7 @@ getenv_all(MPI_Comm comm, int root, const char* name) int len; static char* env = NULL; - assert(name); + HDassert(name); MPI_Initialized(&mpi_initialized); MPI_Finalized(&mpi_finalized); @@ -1590,7 +1603,7 @@ getenv_all(MPI_Comm comm, int root, const char* name) if(mpi_initialized && !mpi_finalized) { MPI_Comm_rank(comm, &mpi_rank); MPI_Comm_size(comm, &mpi_size); - assert(root < mpi_size); + HDassert(root < mpi_size); /* The root task does the getenv call * and sends the result to the other tasks */ @@ -1925,6 +1938,42 @@ static herr_t dummy_vfd_read(H5FD_t H5_ATTR_UNUSED *_file, H5FD_mem_t H5_ATTR_UN static herr_t dummy_vfd_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, const void *buf); static herr_t dummy_vfd_write(H5FD_t H5_ATTR_UNUSED *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUSED fapl_id, haddr_t H5_ATTR_UNUSED addr, size_t H5_ATTR_UNUSED size, const void H5_ATTR_UNUSED *buf) { return FAIL; } +/* Dummy VFD with the minimum parameters to make a VFD that can be registered */ +static const H5FD_class_t H5FD_dummy_g = { + "dummy", /* name */ + 1, /* maxaddr */ + H5F_CLOSE_WEAK, /* fc_degree */ + NULL, /* terminate */ + NULL, /* sb_size */ + NULL, /* sb_encode */ + NULL, /* sb_decode */ + 0, /* fapl_size */ + NULL, /* fapl_get */ + NULL, /* fapl_copy */ + NULL, /* fapl_free */ + 0, /* dxpl_size */ + NULL, /* dxpl_copy */ + NULL, /* dxpl_free */ + dummy_vfd_open, /* open */ + dummy_vfd_close, /* close */ + NULL, /* cmp */ + NULL, /* query */ + NULL, /* get_type_map */ + NULL, /* alloc */ + NULL, /* free */ + dummy_vfd_get_eoa, /* get_eoa */ + dummy_vfd_set_eoa, /* set_eoa */ + dummy_vfd_get_eof, /* get_eof */ + NULL, /* get_handle */ + dummy_vfd_read, /* read */ + dummy_vfd_write, /* write */ + NULL, /* flush */ + NULL, /* truncate */ + NULL, /* lock */ + NULL, /* unlock */ + H5FD_FLMAP_DICHOTOMY /* fl_map */ +}; + /*------------------------------------------------------------------------- * Function: h5_get_dummy_vfd_class() @@ -1952,21 +2001,11 @@ h5_get_dummy_vfd_class(void) H5FD_class_t *vfd_class = NULL; /* Dummy VFD that will be returned */ /* Create the class and initialize everything to zero/NULL */ - if(NULL == (vfd_class = (H5FD_class_t *)HDcalloc((size_t)1, sizeof(H5FD_class_t)))) + if(NULL == (vfd_class = (H5FD_class_t *)HDmalloc(sizeof(H5FD_class_t)))) TEST_ERROR; - /* Fill in the minimum parameters to make a VFD that - * can be registered. - */ - vfd_class->name = "dummy"; - vfd_class->maxaddr = 1; - vfd_class->open = dummy_vfd_open; - vfd_class->close = dummy_vfd_close; - vfd_class->get_eoa = dummy_vfd_get_eoa; - vfd_class->set_eoa = dummy_vfd_set_eoa; - vfd_class->get_eof = dummy_vfd_get_eof; - vfd_class->read = dummy_vfd_read; - vfd_class->write = dummy_vfd_write; + /* Copy the dummy VFD */ + HDmemcpy(vfd_class, &H5FD_dummy_g, sizeof(H5FD_class_t)); return vfd_class; diff --git a/test/h5test.h b/test/h5test.h index c72f389..66a7863 100644 --- a/test/h5test.h +++ b/test/h5test.h @@ -102,7 +102,7 @@ H5TEST_DLLVAR MPI_Info h5_io_info_g; /* MPI INFO object for IO */ * the H5_FAILED() macro is invoked automatically when an API function fails. */ #define TESTING(WHAT) {printf("Testing %-62s",WHAT); fflush(stdout);} -#define TESTING_2(WHAT) {printf(" Testing %-62s",WHAT); fflush(stdout);} +#define TESTING_2(WHAT) {printf(" Testing %-60s",WHAT); fflush(stdout);} #define PASSED() {puts(" PASSED");fflush(stdout);} #define H5_FAILED() {puts("*FAILED*");fflush(stdout);} #define H5_WARNING() {puts("*WARNING*");fflush(stdout);} @@ -121,6 +121,11 @@ H5TEST_DLLVAR MPI_Info h5_io_info_g; /* MPI INFO object for IO */ #define ALARM_ON TestAlarmOn() #define ALARM_OFF HDalarm(0) +/* Flags for h5_fileaccess_flags() */ +#define H5_FILEACCESS_VFD 0x01 +#define H5_FILEACCESS_VOL 0x02 +#define H5_FILEACCESS_LIBVER 0x04 + #ifdef __cplusplus extern "C" { #endif @@ -132,6 +137,7 @@ H5TEST_DLL char *h5_fixname(const char *base_name, hid_t fapl, char *fullname, s H5TEST_DLL char *h5_fixname_no_suffix(const char *base_name, hid_t fapl, char *fullname, size_t size); H5TEST_DLL char *h5_fixname_printf(const char *base_name, hid_t fapl, char *fullname, size_t size); H5TEST_DLL hid_t h5_fileaccess(void); +H5TEST_DLL hid_t h5_fileaccess_flags(unsigned flags); H5TEST_DLL void h5_no_hwconv(void); H5TEST_DLL const char *h5_rmprefix(const char *filename); H5TEST_DLL void h5_reset(void); diff --git a/test/links.c b/test/links.c index e0dc39e..520f784 100644 --- a/test/links.c +++ b/test/links.c @@ -315,6 +315,8 @@ typedef struct { const obj_visit_t *info; /* Pointer to the object visit structure to use */ } ovisit_ud_t; +static hid_t dcpl_g; /* for [un]minimized dataset object headers */ + /*------------------------------------------------------------------------- @@ -377,7 +379,7 @@ mklinks(hid_t fapl, hbool_t new_format) if(H5Gclose(grp) < 0) TEST_ERROR /* Create a dataset */ - if((d1 = H5Dcreate2(file, "d1", H5T_NATIVE_INT, scalar, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((d1 = H5Dcreate2(file, "d1", H5T_NATIVE_INT, scalar, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR if(H5Dclose(d1) < 0) TEST_ERROR /* Create a hard link */ @@ -451,8 +453,8 @@ new_links(hid_t fapl, hbool_t new_format) if((grp2_b = H5Gcreate2(file_b, "grp2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Create datasets */ - if((dset1 = H5Dcreate2(file_a, "dataset1", H5T_NATIVE_INT, scalar, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if((dset2 = H5Dcreate2(grp1_a, "dataset2", H5T_NATIVE_INT, scalar, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((dset1 = H5Dcreate2(file_a, "dataset1", H5T_NATIVE_INT, scalar, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR + if((dset2 = H5Dcreate2(grp1_a, "dataset2", H5T_NATIVE_INT, scalar, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR /* Create links within a file. Both of source and destination use * H5L_SAME_LOC. Both hard and soft links should fail. */ @@ -545,7 +547,7 @@ cklinks(hid_t fapl, hbool_t new_format) if(H5Oget_info_by_name2(file, "grp1/hard", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5O_TYPE_DATASET != oinfo2.type) { H5_FAILED(); - printf(" %d: Unexpected object type should have been a dataset\n", __LINE__); + HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__); TEST_ERROR } /* end if */ if(H5F_addr_ne(oinfo1.addr, oinfo2.addr)) { @@ -580,7 +582,7 @@ cklinks(hid_t fapl, hbool_t new_format) if(H5Oget_info_by_name2(file, "grp1/soft", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5O_TYPE_DATASET != oinfo2.type) { H5_FAILED(); - printf(" %d: Unexpected object type should have been a dataset\n", __LINE__); + HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__); TEST_ERROR } /* end if */ if(H5F_addr_ne(oinfo1.addr, oinfo2.addr)) { @@ -609,12 +611,12 @@ cklinks(hid_t fapl, hbool_t new_format) if(H5Lget_info(file, "grp1/dangle", &linfo2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5L_TYPE_SOFT != linfo2.type) { H5_FAILED(); - printf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__); + HDprintf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__); TEST_ERROR } /* end if */ if(H5Lget_val(file, "grp1/dangle", linkval, sizeof linkval, H5P_DEFAULT) < 0) { H5_FAILED(); - printf(" %d: Can't retrieve link value\n", __LINE__); + HDprintf(" %d: Can't retrieve link value\n", __LINE__); TEST_ERROR } /* end if */ if(HDstrcmp(linkval, "foobar")) { @@ -636,12 +638,12 @@ cklinks(hid_t fapl, hbool_t new_format) if(H5Lget_info(file, "grp1/recursive", &linfo2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5L_TYPE_SOFT != linfo2.type) { H5_FAILED(); - printf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__); + HDprintf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__); TEST_ERROR } /* end if */ if(H5Lget_val(file, "grp1/recursive", linkval, sizeof linkval, H5P_DEFAULT) < 0) { H5_FAILED(); - printf(" %d: Can't retrieve link value\n", __LINE__); + HDprintf(" %d: Can't retrieve link value\n", __LINE__); TEST_ERROR } /* end if */ if(HDstrcmp(linkval, "/grp1/recursive")) { @@ -706,7 +708,7 @@ ck_new_links(hid_t fapl, hbool_t new_format) /* Check hard links */ if(H5O_TYPE_DATASET != oi_hard1.type || H5O_TYPE_DATASET != oi_hard2.type) { H5_FAILED(); - printf(" %d: Unexpected object type should have been a dataset\n", __LINE__); + HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__); TEST_ERROR } if(H5F_addr_ne(oi_dset.addr, oi_hard1.addr) || H5F_addr_ne(oi_dset.addr, oi_hard2.addr)) { @@ -1014,7 +1016,7 @@ test_lcpl(hid_t fapl, hbool_t new_format) if((space_id=H5Screate_simple(2 ,dims, NULL)) < 0) TEST_ERROR /* Create a dataset using the default LCPL */ - if((dset_id = H5Dcreate2(file_id, "/dataset", H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((dset_id = H5Dcreate2(file_id, "/dataset", H5T_NATIVE_INT, space_id, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR if(H5Dclose(dset_id) < 0) TEST_ERROR /* Check that its character encoding is the default */ @@ -1043,7 +1045,7 @@ test_lcpl(hid_t fapl, hbool_t new_format) if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR /* Create a dataset using the new LCPL */ - if((dset_id = H5Dcreate2(file_id, "/dataset2", H5T_NATIVE_INT, space_id, lcpl_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((dset_id = H5Dcreate2(file_id, "/dataset2", H5T_NATIVE_INT, space_id, lcpl_id, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR if(H5Dclose(dset_id) < 0) TEST_ERROR /* Check that its character encoding is UTF-8 */ @@ -2602,7 +2604,7 @@ external_link_toomany(hid_t fapl, hbool_t new_format) } H5E_END_TRY; if (gid >= 0) { H5_FAILED(); - printf("%d: Should have failed for sequence of too many nested links.", __LINE__); + HDprintf("%d: Should have failed for sequence of too many nested links.", __LINE__); goto error; } @@ -3758,7 +3760,11 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format) if((space = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR /* Create dataset creation property list */ - if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR; + if (dcpl_g == H5P_DEFAULT) + dcpl = H5Pcreate(H5P_DATASET_CREATE); + else + dcpl = H5Pcopy(dcpl_g); + if (0 > dcpl) TEST_ERROR; if(H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_LATE) < 0) TEST_ERROR; /* create "Dataset" in group "A" of target file */ @@ -6100,7 +6106,7 @@ external_link_closing(hid_t fapl, hbool_t new_format) /* Test creating each kind of object */ if((gid = H5Gcreate2(fid1, "elink/elink/elink/group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if(H5Tcommit2(fid1, "elink/elink/elink/type1", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if((did = H5Dcreate2(fid1, "elink/elink/elink/dataset1", tid2, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((did = H5Dcreate2(fid1, "elink/elink/elink/dataset1", tid2, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR /* Close objects */ if(H5Gclose(gid) < 0) TEST_ERROR @@ -7298,7 +7304,7 @@ external_open_twice(hid_t fapl, hbool_t new_format) if((space = H5Screate(H5S_SCALAR)) < 0) TEST_ERROR if((oid1 = H5Dcreate2(fid2, "dset", H5T_NATIVE_INT, space, H5P_DEFAULT, - H5P_DEFAULT, H5P_DEFAULT)) < 0) + dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR if(H5Dclose(oid1) < 0) TEST_ERROR @@ -7514,8 +7520,11 @@ external_link_with_committed_datatype(hid_t fapl, hbool_t new_format) if((sid2 = H5Screate_simple(2, dims, NULL)) < 0) FAIL_STACK_ERROR - if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) - FAIL_STACK_ERROR + if (dcpl_g == H5P_DEFAULT) + dcpl = H5Pcreate(H5P_DATASET_CREATE); + else + dcpl = H5Pcopy(dcpl_g); + if (0 > dcpl) FAIL_STACK_ERROR if(H5Pset_chunk(dcpl, 2, chunks) < 0) FAIL_STACK_ERROR @@ -7743,7 +7752,6 @@ done: case H5I_FILE: case H5I_DATASPACE: case H5I_ATTR: - case H5I_REFERENCE: case H5I_VFL: case H5I_VOL: case H5I_GENPROP_CLS: @@ -7832,7 +7840,6 @@ done: case H5I_FILE: case H5I_DATASPACE: case H5I_ATTR: - case H5I_REFERENCE: case H5I_VFL: case H5I_VOL: case H5I_GENPROP_CLS: @@ -8816,6 +8823,12 @@ ud_link_errors(hid_t fapl, hbool_t new_format) TEST_ERROR } H5E_END_TRY + /* Try to create a link with H5Lcreate_ud that has a NULL udata pointer, but a non-zero udata_size value */ + H5E_BEGIN_TRY { + if(H5Lcreate_ud(fid, "/ud_link", (H5L_type_t)UD_CBFAIL_TYPE, NULL, 1, H5P_DEFAULT, H5P_DEFAULT) >= 0) + TEST_ERROR + } H5E_END_TRY; + /* Create a user-defined link to the group. */ strcpy(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 @@ -9060,7 +9073,7 @@ lapl_nlinks(hid_t fapl, hbool_t new_format) dims[0] = 2; dims[1] = 2; if((sid = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR - if((did = H5Dcreate2(gid, "dataset", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((did = H5Dcreate2(gid, "dataset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR /* Close group */ @@ -9172,7 +9185,7 @@ linkinfo(hid_t fapl, hbool_t new_format) if(H5Lcreate_soft("group", fid, "softlink", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if((sid = H5Screate(H5S_SCALAR)) < 0) TEST_ERROR - if((did = H5Dcreate2(fid, "dataset", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((did = H5Dcreate2(fid, "dataset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR if(H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_PLIST_TYPE, NULL, (size_t)0, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR if(H5Lcreate_external("file_name", "obj_path", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR @@ -9337,13 +9350,13 @@ build_visit_file(hid_t fapl) /* Create dataset in each group */ if((sid = H5Screate(H5S_SCALAR)) < 0) TEST_ERROR - if((did = H5Dcreate2(fid, "/Dataset_zero", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((did = H5Dcreate2(fid, "/Dataset_zero", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR - if((did = H5Dcreate2(fid, "/Group1/Dataset_one", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((did = H5Dcreate2(fid, "/Group1/Dataset_one", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR - if((did = H5Dcreate2(fid, "/Group1/Group2/Dataset_two", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((did = H5Dcreate2(fid, "/Group1/Group2/Dataset_two", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR if(H5Sclose(sid) < 0) TEST_ERROR @@ -14892,6 +14905,7 @@ main(void) hid_t fapl, fapl2; /* File access property lists */ int nerrors = 0; unsigned new_format; /* Whether to use the new format or not */ + unsigned minimize_dset_oh; unsigned efc; /* Whether to use the external file cache */ const char *env_h5_drvr; /* File Driver value from environment */ @@ -14902,165 +14916,187 @@ main(void) h5_reset(); fapl = h5_fileaccess(); - /* Copy the file access property list */ + /* fapl2 uses "latest version bounds" */ if((fapl2 = H5Pcopy(fapl)) < 0) TEST_ERROR - - /* Set the "use the latest version of the format" bounds for creating objects in the file */ if(H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) TEST_ERROR - /* Loop over using new group format */ - for(new_format = FALSE; new_format <= TRUE; new_format++) { - hid_t my_fapl; + for (minimize_dset_oh = 0; minimize_dset_oh <= 1; minimize_dset_oh++) { + if (minimize_dset_oh) { + HDprintf("\n-Testing with minimzed dataset object headers-\n"); + dcpl_g = H5Pcreate(H5P_DATASET_CREATE); + if (0 > dcpl_g) TEST_ERROR + } else { + HDprintf("\n-Testing with unminimzed dataset object headers-\n"); + dcpl_g = H5P_DEFAULT; + } - /* Check for FAPL to use */ - if(new_format) - my_fapl = fapl2; - else - my_fapl = fapl; - - /* General tests... (on both old & new format groups */ - nerrors += mklinks(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += cklinks(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += new_links(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += ck_new_links(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += long_links(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += toomany(my_fapl, new_format) < 0 ? 1 : 0; - - /* Test new H5L link creation routine */ - nerrors += test_lcpl(my_fapl, new_format); - nerrors += test_move(my_fapl, new_format); - nerrors += test_copy(my_fapl, new_format); - nerrors += test_move_preserves(my_fapl, new_format); + for(new_format = FALSE; new_format <= TRUE; new_format++) { + hid_t my_fapl; + + /* Check for FAPL to use */ + if(new_format) { + my_fapl = fapl2; + HDprintf("\n--Testing with 'new format'--\n"); + } else { + my_fapl = fapl; + HDprintf("\n--Testing with 'old format'--\n"); + } + + /* always enter tests without external cache */ + if(H5Pset_elink_file_cache_size(my_fapl, 0) < 0) + TEST_ERROR + + /* General tests... (on both old & new format groups */ + nerrors += mklinks(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += cklinks(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += new_links(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += ck_new_links(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += long_links(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += toomany(my_fapl, new_format) < 0 ? 1 : 0; + + /* Test new H5L link creation routine */ + nerrors += test_lcpl(my_fapl, new_format); + nerrors += test_move(my_fapl, new_format); + nerrors += test_copy(my_fapl, new_format); + nerrors += test_move_preserves(my_fapl, new_format); #ifndef H5_NO_DEPRECATED_SYMBOLS - nerrors += test_deprec(my_fapl, new_format); + nerrors += test_deprec(my_fapl, new_format); #endif /* H5_NO_DEPRECATED_SYMBOLS */ - /* tests for external link */ - /* Test external file cache first, so it sees the default efc setting on - * the fapl */ - nerrors += external_file_cache(my_fapl, new_format) < 0 ? 1 : 0; - - /* This test cannot run with the EFC because it assumes that an - * intermediate file is not held open */ - nerrors += external_link_mult(my_fapl, new_format) < 0 ? 1 : 0; - - /* This test cannot run with the EFC because the EFC cannot currently - * reopen a cached file with a different intent */ - nerrors += external_set_elink_acc_flags(env_h5_drvr, my_fapl, new_format) < 0 ? 1 : 0; - - /* Try external link tests both with and without the external file cache - */ - for(efc = FALSE; efc <= TRUE; efc++) { - if(efc) { - if(H5Pset_elink_file_cache_size(my_fapl, 8) < 0) - TEST_ERROR - printf("\n---Testing with external file cache---\n"); - } /* end if */ - else { - if(H5Pset_elink_file_cache_size(my_fapl, 0) < 0) - TEST_ERROR - printf("\n---Testing without external file cache---\n"); - } /* end else */ + /* tests for external link */ + /* Test external file cache first, so it sees the default efc setting on + * the fapl */ + nerrors += external_file_cache(my_fapl, new_format) < 0 ? 1 : 0; + + /* This test cannot run with the EFC because it assumes that an + * intermediate file is not held open */ + nerrors += external_link_mult(my_fapl, new_format) < 0 ? 1 : 0; + + /* This test cannot run with the EFC because the EFC cannot currently + * reopen a cached file with a different intent */ + nerrors += external_set_elink_acc_flags(env_h5_drvr, my_fapl, new_format) < 0 ? 1 : 0; + + /* Try external link tests both with and without the external file cache + */ + for(efc = FALSE; efc <= TRUE; efc++) { + if(efc) { + if(H5Pset_elink_file_cache_size(my_fapl, 8) < 0) + TEST_ERROR + HDprintf("\n---Testing with external file cache---\n"); + } /* end if */ + else { + if(H5Pset_elink_file_cache_size(my_fapl, 0) < 0) + TEST_ERROR + HDprintf("\n---Testing without external file cache---\n"); + } /* end else */ - nerrors += external_link_root(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_path(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_self(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_pingpong(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_toomany(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_dangling(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_recursive(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_query(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_unlink_compact(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_unlink_dense(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_move(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_ride(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_closing(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_endian(new_format) < 0 ? 1 : 0; - nerrors += external_link_strong(my_fapl, new_format) < 0 ? 1 : 0; - - nerrors += external_link_prefix(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_abs_mainpath(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_rel_mainpath(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_cwd(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_abstar(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_abstar_cur(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_reltar(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_chdir(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_set_elink_fapl1(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_set_elink_fapl2(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_set_elink_fapl3(new_format) < 0 ? 1 : 0; - nerrors += external_set_elink_cb(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_root(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_path(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_self(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_pingpong(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_toomany(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_dangling(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_recursive(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_query(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_unlink_compact(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_unlink_dense(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_move(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_ride(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_closing(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_endian(new_format) < 0 ? 1 : 0; + nerrors += external_link_strong(my_fapl, new_format) < 0 ? 1 : 0; + + nerrors += external_link_prefix(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_abs_mainpath(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_rel_mainpath(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_cwd(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_abstar(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_abstar_cur(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_reltar(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_chdir(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_set_elink_fapl1(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_set_elink_fapl2(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_set_elink_fapl3(new_format) < 0 ? 1 : 0; + nerrors += external_set_elink_cb(my_fapl, new_format) < 0 ? 1 : 0; #ifdef H5_HAVE_WINDOW_PATH - nerrors += external_link_win1(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_win2(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_win3(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_win4(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_win5(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_win6(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_win7(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_win8(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_win9(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_win1(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_win2(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_win3(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_win4(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_win5(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_win6(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_win7(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_win8(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_win9(my_fapl, new_format) < 0 ? 1 : 0; #endif - nerrors += external_symlink(env_h5_drvr, my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_copy_invalid_object(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_dont_fail_to_source(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_open_twice(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_with_committed_datatype(my_fapl, new_format) < 0 ? 1 : 0; - } /* end for */ - - /* These tests assume that external links are a form of UD links, - * so assume that everything that passed for external links - * above has already been tested for UD links. - */ - if(new_format == TRUE) { - nerrors += ud_hard_links(fapl2) < 0 ? 1 : 0; /* requires new format groups */ - nerrors += ud_link_reregister(fapl2) < 0 ? 1 : 0; /* requires new format groups */ - } /* end if */ - nerrors += ud_callbacks(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += ud_link_errors(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += lapl_udata(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += lapl_nlinks(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += linkinfo(my_fapl, new_format) < 0 ? 1 : 0; - - /* Misc. extra tests, useful for both new & old format files */ - nerrors += link_visit(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += link_visit_by_name(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += obj_visit(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += obj_visit_by_name(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += obj_visit_stop(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += link_filters(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += obj_exists(my_fapl, new_format) < 0 ? 1 : 0; - - /* Keep this test last, it's testing files that are used above */ - /* do not do this for files used by external link tests */ - nerrors += check_all_closed(my_fapl, new_format, EXTSTOP) < 0 ? 1 : 0; - } /* end for */ + nerrors += external_symlink(env_h5_drvr, my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_copy_invalid_object(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_dont_fail_to_source(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_open_twice(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_with_committed_datatype(my_fapl, new_format) < 0 ? 1 : 0; + } /* with/without external file cache */ + + /* These tests assume that external links are a form of UD links, + * so assume that everything that passed for external links + * above has already been tested for UD links. + */ + if(new_format == TRUE) { + nerrors += ud_hard_links(fapl2) < 0 ? 1 : 0; /* requires new format groups */ + nerrors += ud_link_reregister(fapl2) < 0 ? 1 : 0; /* requires new format groups */ + } /* end if */ + nerrors += ud_callbacks(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += ud_link_errors(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += lapl_udata(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += lapl_nlinks(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += linkinfo(my_fapl, new_format) < 0 ? 1 : 0; + + /* Misc. extra tests, useful for both new & old format files */ + nerrors += link_visit(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += link_visit_by_name(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += obj_visit(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += obj_visit_by_name(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += obj_visit_stop(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += link_filters(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += obj_exists(my_fapl, new_format) < 0 ? 1 : 0; + + /* Keep this test last, it's testing files that are used above */ + /* do not do this for files used by external link tests */ + nerrors += check_all_closed(my_fapl, new_format, EXTSTOP) < 0 ? 1 : 0; + } /* new/old format */ + + /* New group revision feature tests */ + nerrors += corder_create_empty(fapl2) < 0 ? 1 : 0; - /* New group revision feature tests */ - nerrors += corder_create_empty(fapl2) < 0 ? 1 : 0; /* XXX: when creation order indexing is fully working, go back and add checks * to these tests to make certain that the creation order values are * correct. */ - nerrors += corder_create_compact(fapl2) < 0 ? 1 : 0; - nerrors += corder_create_dense(fapl2) < 0 ? 1 : 0; - nerrors += corder_transition(fapl2) < 0 ? 1 : 0; - nerrors += corder_delete(fapl2) < 0 ? 1 : 0; - nerrors += link_info_by_idx(fapl2) < 0 ? 1 : 0; - nerrors += delete_by_idx(fapl2) < 0 ? 1 : 0; - nerrors += link_iterate(fapl2) < 0 ? 1 : 0; - nerrors += open_by_idx(fapl2) < 0 ? 1 : 0; - nerrors += object_info(fapl2) < 0 ? 1 : 0; - nerrors += group_info(fapl2) < 0 ? 1 : 0; - nerrors += timestamps(fapl2) < 0 ? 1 : 0; - - /* Test new API calls on old-style groups */ - nerrors += link_info_by_idx_old(fapl) < 0 ? 1 : 0; - nerrors += delete_by_idx_old(fapl) < 0 ? 1 : 0; - nerrors += link_iterate_old(fapl) < 0 ? 1 : 0; - nerrors += open_by_idx_old(fapl) < 0 ? 1 : 0; - nerrors += object_info_old(fapl) < 0 ? 1 : 0; - nerrors += group_info_old(fapl) < 0 ? 1 : 0; + nerrors += corder_create_compact(fapl2) < 0 ? 1 : 0; + nerrors += corder_create_dense(fapl2) < 0 ? 1 : 0; + nerrors += corder_transition(fapl2) < 0 ? 1 : 0; + nerrors += corder_delete(fapl2) < 0 ? 1 : 0; + nerrors += link_info_by_idx(fapl2) < 0 ? 1 : 0; + nerrors += delete_by_idx(fapl2) < 0 ? 1 : 0; + nerrors += link_iterate(fapl2) < 0 ? 1 : 0; + nerrors += open_by_idx(fapl2) < 0 ? 1 : 0; + nerrors += object_info(fapl2) < 0 ? 1 : 0; + nerrors += group_info(fapl2) < 0 ? 1 : 0; + nerrors += timestamps(fapl2) < 0 ? 1 : 0; + + /* Test new API calls on old-style groups */ + nerrors += link_info_by_idx_old(fapl) < 0 ? 1 : 0; + nerrors += delete_by_idx_old(fapl) < 0 ? 1 : 0; + nerrors += link_iterate_old(fapl) < 0 ? 1 : 0; + nerrors += open_by_idx_old(fapl) < 0 ? 1 : 0; + nerrors += object_info_old(fapl) < 0 ? 1 : 0; + nerrors += group_info_old(fapl) < 0 ? 1 : 0; + + if (minimize_dset_oh) { + if (H5Pclose(dcpl_g) < 0) + TEST_ERROR; + dcpl_g = -1; + } + } /* [un]minimized dataset object headers */ /* Close 2nd FAPL */ H5Pclose(fapl2); @@ -15077,11 +15113,11 @@ main(void) /* Results */ if(nerrors) { - printf("***** %d LINK TEST%s FAILED! *****\n", + HDprintf("***** %d LINK TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S"); HDexit(EXIT_FAILURE); } - printf("All link tests passed.\n"); + HDprintf("All link tests passed.\n"); /* clean up symlink created by external link tests */ HDremove(SYMLINK1); diff --git a/test/memleak_H5O_dtype_decode_helper_H5Odtype.h5 b/test/memleak_H5O_dtype_decode_helper_H5Odtype.h5 Binary files differnew file mode 100644 index 0000000..b5980b7 --- /dev/null +++ b/test/memleak_H5O_dtype_decode_helper_H5Odtype.h5 diff --git a/test/mount.c b/test/mount.c index c6230ee..b7d2858 100644 --- a/test/mount.c +++ b/test/mount.c @@ -192,7 +192,7 @@ test_illegal(hid_t fapl) } H5E_END_TRY; if(status >= 0) { H5_FAILED(); - puts(" Mounting a file on itself should have failed."); + HDputs(" Mounting a file on itself should have failed."); TEST_ERROR } /* end if */ @@ -208,7 +208,7 @@ test_illegal(hid_t fapl) } H5E_END_TRY; if(status >= 0) { H5_FAILED(); - puts(" Mounting two files at one mount point should have failed."); + HDputs(" Mounting two files at one mount point should have failed."); TEST_ERROR } /* end if */ if(H5Funmount(mnt, ".") < 0) FAIL_STACK_ERROR @@ -227,7 +227,7 @@ test_illegal(hid_t fapl) } H5E_END_TRY; if(status >= 0) { H5_FAILED(); - puts(" Mounting same file opened twice at one mount point should have failed."); + HDputs(" Mounting same file opened twice at one mount point should have failed."); TEST_ERROR } /* end if */ if(H5Funmount(mnt, ".") < 0) FAIL_STACK_ERROR @@ -240,7 +240,7 @@ test_illegal(hid_t fapl) } H5E_END_TRY; if(status >= 0) { H5_FAILED(); - puts(" Creating a cycle with mount points should have failed."); + HDputs(" Creating a cycle with mount points should have failed."); TEST_ERROR } /* end if */ if(H5Funmount(file1, "/mnt1") < 0) FAIL_STACK_ERROR @@ -423,7 +423,7 @@ test_hide(hid_t fapl) } H5E_END_TRY; if(grp >= 0) { H5_FAILED(); - puts(" Name is still accessible under mount point."); + HDputs(" Name is still accessible under mount point."); TEST_ERROR } /* end if */ @@ -434,7 +434,7 @@ test_hide(hid_t fapl) if(H5Oget_info_by_name2(file1, "/file1", &oi2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(oi1.fileno != oi2.fileno || H5F_addr_ne(oi1.addr, oi2.addr)) { H5_FAILED(); - puts(" Hard link failed for hidden object."); + HDputs(" Hard link failed for hidden object."); TEST_ERROR } /* end if */ @@ -503,7 +503,7 @@ test_assoc(hid_t fapl) if(oi1.fileno != oi2.fileno || H5F_addr_ne(oi1.addr, oi2.addr)) { H5_FAILED(); - puts(" Association failed."); + HDputs(" Association failed."); TEST_ERROR } /* end if */ @@ -628,7 +628,7 @@ test_move(hid_t fapl) } H5E_END_TRY; if(status >= 0) { H5_FAILED(); - puts(" Moving an object across files should't have been possible"); + HDputs(" Moving an object across files should't have been possible"); TEST_ERROR } /* end if */ @@ -834,7 +834,7 @@ test_unlink(hid_t fapl) } H5E_END_TRY; if(status >= 0) { H5_FAILED(); - puts(" Incorrect traversal from mount point!"); + HDputs(" Incorrect traversal from mount point!"); TEST_ERROR } /* end if */ @@ -851,7 +851,7 @@ test_unlink(hid_t fapl) } H5E_END_TRY; if(status >= 0) { H5_FAILED(); - puts(" Traversal through mount point should not have worked!"); + HDputs(" Traversal through mount point should not have worked!"); TEST_ERROR } /* end if */ H5E_BEGIN_TRY { @@ -859,7 +859,7 @@ test_unlink(hid_t fapl) } H5E_END_TRY; if(status >= 0) { H5_FAILED(); - puts(" Traversal through mount point should not have worked!"); + HDputs(" Traversal through mount point should not have worked!"); TEST_ERROR } /* end if */ @@ -873,7 +873,7 @@ test_unlink(hid_t fapl) } H5E_END_TRY; if(status >= 0) { H5_FAILED(); - printf(" %d: Unmount by name should not have been allowed!\n",__LINE__); + HDprintf(" %d: Unmount by name should not have been allowed!\n",__LINE__); TEST_ERROR } /* end if */ H5E_BEGIN_TRY { @@ -881,7 +881,7 @@ test_unlink(hid_t fapl) } H5E_END_TRY; if(status >= 0) { H5_FAILED(); - printf(" %d: Unmount by name should not have been allowed!\n",__LINE__); + HDprintf(" %d: Unmount by name should not have been allowed!\n",__LINE__); TEST_ERROR } /* end if */ if(H5Funmount(mnt, ".") < 0) FAIL_STACK_ERROR @@ -1005,7 +1005,7 @@ test_interlink(hid_t fapl) } H5E_END_TRY; if(status >= 0) { H5_FAILED(); - puts(" Interfile hard link should not have been allowed!"); + HDputs(" Interfile hard link should not have been allowed!"); TEST_ERROR } /* end if */ @@ -1015,7 +1015,7 @@ test_interlink(hid_t fapl) } H5E_END_TRY; if(status >= 0) { H5_FAILED(); - puts(" Interfile renaming should not have been allowed!"); + HDputs(" Interfile renaming should not have been allowed!"); TEST_ERROR } /* end if */ @@ -1033,7 +1033,7 @@ test_interlink(hid_t fapl) } H5E_END_TRY; if(dset >= 0) { H5_FAILED(); - puts(" Dataset and shared type must be in the same file!"); + HDputs(" Dataset and shared type must be in the same file!"); TEST_ERROR } /* end if */ @@ -1172,7 +1172,7 @@ test_close(hid_t fapl) if(H5Fclose(file1) < 0) FAIL_STACK_ERROR if(H5Oget_info_by_name2(file2, "/mnt1", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) { H5_FAILED(); - puts(" File1 contents are not accessible!"); + HDputs(" File1 contents are not accessible!"); TEST_ERROR } /* end if */ if(H5Fclose(file2) < 0) FAIL_STACK_ERROR @@ -4379,13 +4379,13 @@ main(void) if (nerrors) goto error; - puts("All mount tests passed."); + HDputs("All mount tests passed."); h5_cleanup(FILENAME, fapl); return 0; error: - puts("***** MOUNT ERRORS *****"); + HDputs("***** MOUNT ERRORS *****"); return 1; } diff --git a/test/echo_vol.c b/test/null_vol_connector.c index 7f59832..b62b370 100644 --- a/test/echo_vol.c +++ b/test/null_vol_connector.c @@ -10,19 +10,20 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* - * Purpose: A simple virtual object layer (VOL) plugin that just echoes - * the name of the API call. +/* Purpose: A simple virtual object layer (VOL) connector with almost no + * functionality that is used for testing basic plugin handling + * (registration, etc.). */ #include "H5PLextern.h" -/* The VOL class struct. - */ -static const H5VL_class_t echo_vol_g = { +#include "null_vol_connector.h" + +/* The VOL class struct */ +static const H5VL_class_t null_vol_g = { 0, /* version */ - (H5VL_class_value_t)501, /* value */ - "echo", /* name */ + NULL_VOL_CONNECTOR_VALUE, /* value */ + NULL_VOL_CONNECTOR_NAME, /* name */ 0, /* capability flags */ NULL, /* initialize */ NULL, /* terminate */ @@ -106,22 +107,10 @@ static const H5VL_class_t echo_vol_g = { NULL /* optional */ }; - - /* These two functions are necessary to load this plugin using * the HDF5 library. */ -H5PL_type_t -H5PLget_plugin_type(void) -{ - return H5PL_TYPE_VOL; -} - - -const void* -H5PLget_plugin_info(void) -{ - return &echo_vol_g; -} +H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_VOL;} +const void *H5PLget_plugin_info(void) {return &null_vol_g;} diff --git a/test/null_vol_connector.h b/test/null_vol_connector.h new file mode 100644 index 0000000..11c8826 --- /dev/null +++ b/test/null_vol_connector.h @@ -0,0 +1,25 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* Purpose: A simple virtual object layer (VOL) connector with almost no + * functionality that is used for testing basic plugin handling + * (registration, etc.). + */ + +#ifndef _null_vol_connector_H +#define _null_vol_connector_H + +#define NULL_VOL_CONNECTOR_VALUE ((H5VL_class_value_t)160) +#define NULL_VOL_CONNECTOR_NAME "null_vol_connector" + +#endif /* _null_vol_connector_H */ + diff --git a/test/objcopy.c b/test/objcopy.c index 6ee2f72..4055781 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -1167,7 +1167,7 @@ compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts, if((obj2_sid = H5Rget_region(parent2, H5R_DATASET_REGION, ref_buf2)) < 0) TEST_ERROR /* Check if dataspaces are the same shape */ - if(H5S_select_shape_same_test(obj1_sid, obj2_sid) < 0) TEST_ERROR + if(H5S__select_shape_same_test(obj1_sid, obj2_sid) < 0) TEST_ERROR /* Close dataspaces */ if(H5Sclose(obj1_sid) < 0) TEST_ERROR @@ -2136,9 +2136,7 @@ test_copy_dataset_versionbounds(hid_t fcpl_src, hid_t fapl_src) char src_fname[NAME_BUF_SIZE]; /* Name of source file */ char dst_fname[NAME_BUF_SIZE]; /* Name of destination file */ H5F_libver_t low, high; /* File format bounds */ - H5F_libver_t low_src, high_src; /* Source file format bounds */ unsigned srcdset_fillversion; /* Fill version of source dataset */ - hbool_t valid_high = FALSE; /* TRUE if high bound is valid */ int i, j; /* Local index variables */ H5D_t *dsetp = NULL; /* Pointer to internal dset structure */ herr_t ret; /* Generic return value */ @@ -7871,7 +7869,7 @@ test_copy_old_layout(hid_t fcpl_dst, hid_t fapl, hbool_t test_open) addr_reset(); /* Setup */ - if((src_fapl = h5_fileaccess()) < 0) TEST_ERROR + if((src_fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0) TEST_ERROR /* open source file (read-only) */ if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR diff --git a/test/ohdr.c b/test/ohdr.c index cca7e7e..85554a5 100644 --- a/test/ohdr.c +++ b/test/ohdr.c @@ -36,9 +36,16 @@ const char *FILENAME[] = { "ohdr", + "ohdr_min_a", + "ohdr_min_b", NULL }; +/* used for object header size comparison */ +#define EQ 1 +#define LT 2 +#define GT 3 + /* The tbogus.h5 is generated from gen_bogus.c in HDF5 'test' directory. * To get this data file, define H5O_ENABLE_BOGUS in src/H5Oprivate, rebuild * the library and simply compile gen_bogus.c with that HDF5 library and run it. @@ -514,6 +521,16 @@ test_unknown(unsigned bogus_id, char *filename, hid_t fapl) PASSED(); + TESTING("object with unknown header message & 'shareable' flag set"); + + /* Open the dataset with the unknown header message, adn "shareable" flag */ + if((did = H5Dopen2(loc_bogus, "Dataset5", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + if(H5Dclose(did) < 0) + FAIL_STACK_ERROR + + PASSED(); + TESTING("object in r/o file with unknown header message & 'fail if unknown and open for write' flag set"); /* Open the dataset with the unknown header message, and "fail if unknown and open for write" flag */ @@ -733,6 +750,883 @@ error: return FAIL; } /* test_unknown() */ +/* + * Set an attribute with the given information. + * If the out parameter `attr_id` is negative, a new attribute will be + * created with the given information. Else, it will attempt to update the + * attribute with the new value. + * + * `dataspace_id` ignored if `attribute_id` >= 0 + */ +static herr_t +put_attribute(hid_t loc_id, const char *attrname, const void *attrvalue, hid_t datatype_id, hid_t dataspace_id, hid_t *attribute_id) +{ + if((*attribute_id) < 0) { + hid_t id = -1; + id = H5Acreate2(loc_id, attrname, datatype_id, dataspace_id, H5P_DEFAULT, H5P_DEFAULT); + if(id < 0) + return FAIL; + *attribute_id = id; + } + return H5Awrite(*attribute_id, datatype_id, attrvalue); +} /* put_attribute */ + +/* + * Count the number of attributes attached to an object. + * Returns negative in event of error. + */ +static int +count_attributes(hid_t dset_id) +{ + H5O_info_t info; + + if(H5Oget_info2(dset_id, &info, H5O_INFO_ALL) < 0) + return -1; + else + return (int)info.num_attrs; /* should never exceed int bounds */ +} /* count_attributes */ + +/* + * Get the total space used by the object header. + * Used by oh_compare() + * On success, stores size in `size_out` pointer. + */ +static herr_t +_oh_getsize(hid_t did, hsize_t *size_out) +{ + H5O_info_t info; + if(FAIL == H5Oget_info2(did, &info, H5O_INFO_HDR)) + return FAIL; + *size_out = info.hdr.space.total; + return SUCCEED; +} /* _oh_getsize */ + +/* + * Compare the TOTAL space used by datasets' object headers. + * Returns negative value if an error occurred, + * else positive #defined indicator value EQ, LT, GT. + */ +static int +oh_compare(hid_t did1, hid_t did2) +{ + hsize_t space1 = 0; + hsize_t space2 = 0; + + if(FAIL == _oh_getsize(did1, &space1)) + return -1; + if(FAIL == _oh_getsize(did2, &space2)) + return -2; + + if(space1 < space2) + return LT; + else if(space1 > space2) + return GT; + else + return EQ; +} /* oh_compare() */ + +/* + * Demonstrate attribute addition to datasets. + * Conduct additions side-by-side with a standard datataset and one with + * minimized dataset object headers. + */ +static herr_t +test_minimized_dset_ohdr_attribute_addition(hid_t fapl_id) +{ + hsize_t array_10[1] = {10}; /* dataspace extent */ + char buffer[10] = ""; /* to inspect string attribute */ + int a_out = 0; + char filename[512] = ""; + hid_t int_type_id = -1; + hid_t char_type_id = -1; + hid_t dcpl_id = -1; + hid_t dspace_id = -1; + hid_t dspace_scalar_id = -1; + hid_t dset_id = -1; + hid_t mindset_id = -1; + hid_t attr_1_id = -1; + hid_t attr_1a_id = -1; + hid_t attr_2_id = -1; + hid_t attr_2a_id = -1; + hid_t attr_3_id = -1; + hid_t attr_3a_id = -1; + hid_t file_id = -1; + herr_t ret; + int count = 0; + + TESTING("minimized dset object headers attribute additions") + + /********* + * SETUP * + *********/ + + if(h5_fixname(FILENAME[1], fapl_id, filename, sizeof(filename)) == NULL) + TEST_ERROR + + dspace_id = H5Screate_simple(1, array_10, NULL); + if(dspace_id < 0) TEST_ERROR + + dspace_scalar_id = H5Screate(H5S_SCALAR); + if(dspace_scalar_id < 0) TEST_ERROR + + char_type_id = H5Tcopy(H5T_NATIVE_CHAR); + if(char_type_id < 0) TEST_ERROR + + int_type_id = H5Tcopy(H5T_NATIVE_INT); + if(int_type_id < 0) TEST_ERROR + + dcpl_id = H5Pcreate(H5P_DATASET_CREATE); + if(dcpl_id < 0) TEST_ERROR + + ret = H5Pset_dset_no_attrs_hint(dcpl_id, TRUE); + if(ret < 0) TEST_ERROR + + file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id); + if(file_id < 0) TEST_ERROR + + H5E_BEGIN_TRY { + count = count_attributes(dset_id); + } H5E_END_TRY; + if(count != -1) TEST_ERROR + + dset_id = H5Dcreate2(file_id, "dataset", int_type_id, dspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + if(dset_id < 0) TEST_ERROR + + mindset_id = H5Dcreate2(file_id, "mindataset", int_type_id, dspace_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT); + if(mindset_id < 0) TEST_ERROR + + /******************** + * TEST/DEMONSTRATE * + ********************/ + + /* ------------------- + * no attributes added + */ + + count = count_attributes(dset_id); + if(count != 0) TEST_ERROR + count = count_attributes(mindset_id); + if(count != 0) TEST_ERROR + + /* ----------------- + * add one attribute + */ + ret = put_attribute(dset_id, "PURPOSE", "DEMO", char_type_id, dspace_id, &attr_1_id); + if(ret < 0) TEST_ERROR + + ret = put_attribute(mindset_id, "PURPOSE", "DEMO", char_type_id, dspace_id, &attr_1a_id); + if(ret < 0) TEST_ERROR + + count = count_attributes(dset_id); + if(count != 1) TEST_ERROR + count = count_attributes(mindset_id); + if(count != 1) TEST_ERROR + + ret = H5Aread(attr_1_id, char_type_id, buffer); + if(ret < 0) TEST_ERROR + if(HDstrcmp("DEMO", buffer)) TEST_ERROR + + ret = H5Aread(attr_1a_id, char_type_id, buffer); + if(ret < 0) TEST_ERROR + if(HDstrcmp("DEMO", buffer)) TEST_ERROR + + /* ----------------- + * modify one attribute + */ + + ret = put_attribute(dset_id, "PURPOSE", "REWRITE", char_type_id, -1, &attr_1_id); + if(ret < 0) TEST_ERROR + + ret = put_attribute(mindset_id, "PURPOSE", "REWRITE", char_type_id, -1, &attr_1a_id); + if(ret < 0) TEST_ERROR + + count = count_attributes(dset_id); + if(count != 1) TEST_ERROR + count = count_attributes(mindset_id); + if(count != 1) TEST_ERROR + + ret = H5Aread(attr_1_id, char_type_id, buffer); + if(ret < 0) TEST_ERROR + if(HDstrcmp("REWRITE", buffer)) TEST_ERROR + + ret = H5Aread(attr_1a_id, char_type_id, buffer); + if(ret < 0) TEST_ERROR + if(HDstrcmp("REWRITE", buffer)) TEST_ERROR + + /* ----------------- + * add second attribute + */ + + a_out = 5; + ret = put_attribute(dset_id, "RANK", &a_out, int_type_id, dspace_scalar_id, &attr_2_id); + if(ret < 0) TEST_ERROR + + a_out = 3; + ret = put_attribute(mindset_id, "RANK", &a_out, int_type_id, dspace_scalar_id, &attr_2a_id); + if(ret < 0) TEST_ERROR + + count = count_attributes(dset_id); + if(count != 2) TEST_ERROR + count = count_attributes(mindset_id); + if(count != 2) TEST_ERROR + + ret = H5Aread(attr_2_id, int_type_id, &a_out); + if(ret < 0) TEST_ERROR + if(a_out != 5) TEST_ERROR + + ret = H5Aread(attr_2a_id, int_type_id, &a_out); + if(ret < 0) TEST_ERROR + if(a_out != 3) TEST_ERROR + + /* ----------------- + * add third attribute + */ + + a_out = -86; + ret = put_attribute(dset_id, "FLAVOR", &a_out, int_type_id, dspace_scalar_id, &attr_3_id); + if(ret < 0) TEST_ERROR + + a_out = 2185; + ret = put_attribute(mindset_id, "FLAVOR", &a_out, int_type_id, dspace_scalar_id, &attr_3a_id); + if(ret < 0) TEST_ERROR + + count = count_attributes(dset_id); + if(count != 3) TEST_ERROR + count = count_attributes(mindset_id); + if(count != 3) TEST_ERROR + + ret = H5Aread(attr_3_id, int_type_id, &a_out); + if(ret < 0) TEST_ERROR + if(a_out != -86) TEST_ERROR + + ret = H5Aread(attr_3a_id, int_type_id, &a_out); + if(ret < 0) TEST_ERROR + if(a_out != 2185) TEST_ERROR + + /************ + * TEARDOWN * + ************/ + + if(H5Tclose(int_type_id) < 0) TEST_ERROR + if(H5Tclose(char_type_id) < 0) TEST_ERROR + if(H5Pclose(dcpl_id) < 0) TEST_ERROR + if(H5Sclose(dspace_id) < 0) TEST_ERROR + if(H5Dclose(dset_id) < 0) TEST_ERROR + if(H5Dclose(mindset_id) < 0) TEST_ERROR + if(H5Aclose(attr_1_id) < 0) TEST_ERROR + if(H5Aclose(attr_1a_id) < 0) TEST_ERROR + if(H5Aclose(attr_2_id) < 0) TEST_ERROR + if(H5Aclose(attr_2a_id) < 0) TEST_ERROR + if(H5Aclose(attr_3_id) < 0) TEST_ERROR + if(H5Aclose(attr_3a_id) < 0) TEST_ERROR + if(H5Fclose(file_id) < 0) TEST_ERROR + + PASSED() + return SUCCEED; + +error : + H5E_BEGIN_TRY { + (void)H5Tclose(int_type_id); + (void)H5Tclose(char_type_id); + (void)H5Pclose(dcpl_id); + (void)H5Sclose(dspace_id); + (void)H5Dclose(dset_id); + (void)H5Dclose(mindset_id); + (void)H5Aclose(attr_1_id); + (void)H5Aclose(attr_1a_id); + (void)H5Aclose(attr_2_id); + (void)H5Aclose(attr_2a_id); + (void)H5Aclose(attr_3_id); + (void)H5Aclose(attr_3a_id); + (void)H5Fclose(file_id); + } H5E_END_TRY; + return FAIL; +} /* test_minimized_dset_ohdr_attribute_addition */ + +/* + * Compare header sizes against when headers have been minimized. + * Repeats tests with headers "compact" and normal. + */ +static herr_t +test_minimized_dset_ohdr_size_comparisons(hid_t fapl_id) +{ + hsize_t array_10[1] = {10}; /* dataspace extents */ + unsigned compact = 0; + + /* IDs that are file-agnostic */ + hid_t dspace_id = -1; + hid_t int_type_id = -1; + hid_t dcpl_minimize = -1; + hid_t dcpl_dontmin = -1; + hid_t dcpl_default = -1; + + /* IDs for non-minimized file open */ + hid_t file_f_id = -1; /* lower 'f' for standard file setting */ + hid_t dset_f_x_id = -1; /* 'x' for default */ + hid_t dset_f_N_id = -1; /* 'N' for explcit non-minimized dset */ + hid_t dset_f_Y_id = -1; /* 'Y' for minimized dset */ + + /* IDs for minimized file open */ + hid_t file_F_id = -1; /* upper 'F' for minimized file setting */ + hid_t dset_F_x_id = -1; /* 'x' for default */ + hid_t dset_F_N_id = -1; /* 'N' for explcit non-minimized dset */ + hid_t dset_F_Y_id = -1; /* 'Y' for minimized dset */ + + char filename_a[512] = ""; + char filename_b[512] = ""; + + herr_t ret; + + /* dataset suffixes: + * | default | minimize | don't minimize (dcpl-set) + * ---------------+---------+----------+--------------- + * file-default | f_x | f_Y | f_N + * ---------------+---------+----------+--------------- + * file-minimized | F_x | F_Y | F_N + */ + + TESTING("minimized dset object headers size comparisons"); + + /********* + * SETUP * + *********/ + + if(h5_fixname(FILENAME[1], fapl_id, filename_a, sizeof(filename_a)) == NULL) + TEST_ERROR + + if(h5_fixname(FILENAME[2], fapl_id, filename_b, sizeof(filename_b)) == NULL) + TEST_ERROR + + for (compact = 0; compact < 2; compact++) { /* 0 or 1 */ + dcpl_default = H5Pcreate(H5P_DATASET_CREATE); + if(dcpl_default < 0) TEST_ERROR + + dcpl_minimize = H5Pcreate(H5P_DATASET_CREATE); + if(dcpl_minimize < 0) TEST_ERROR + ret = H5Pset_dset_no_attrs_hint(dcpl_minimize, TRUE); + if(ret < 0) TEST_ERROR + + dcpl_dontmin = H5Pcreate(H5P_DATASET_CREATE); + if(dcpl_dontmin < 0) TEST_ERROR + ret = H5Pset_dset_no_attrs_hint(dcpl_dontmin, FALSE); + if(ret < 0) TEST_ERROR + + if(compact) { + HDprintf("...compact "); + ret = H5Pset_layout(dcpl_default, H5D_COMPACT); + if(ret < 0) TEST_ERROR + ret = H5Pset_layout(dcpl_minimize, H5D_COMPACT); + if(ret < 0) TEST_ERROR + ret = H5Pset_layout(dcpl_dontmin, H5D_COMPACT); + if(ret < 0) TEST_ERROR + } else + HDprintf("...not compact "); + + dspace_id = H5Screate_simple(1, array_10, NULL); + if(dspace_id < 0) TEST_ERROR + + int_type_id = H5Tcopy(H5T_NATIVE_INT); + if(int_type_id < 0) TEST_ERROR + + file_f_id = H5Fcreate(filename_a, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id); + if(file_f_id < 0) TEST_ERROR + + dset_f_x_id = H5Dcreate2(file_f_id, "default", int_type_id, dspace_id, H5P_DEFAULT, dcpl_default, H5P_DEFAULT); + if(dset_f_x_id < 0) TEST_ERROR + + dset_f_N_id = H5Dcreate2(file_f_id, "dsetNOT", int_type_id, dspace_id, H5P_DEFAULT, dcpl_dontmin, H5P_DEFAULT); + if(dset_f_N_id < 0) TEST_ERROR + + dset_f_Y_id = H5Dcreate2(file_f_id, "dsetMIN", int_type_id, dspace_id, H5P_DEFAULT, dcpl_minimize, H5P_DEFAULT); + if(dset_f_x_id < 0) TEST_ERROR + + file_F_id = H5Fcreate(filename_b, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id); + if(file_F_id < 0) TEST_ERROR + ret = H5Fset_dset_no_attrs_hint(file_F_id, TRUE); + if(ret < 0) TEST_ERROR + + dset_F_x_id = H5Dcreate2(file_F_id, "default", int_type_id, dspace_id, H5P_DEFAULT, dcpl_default, H5P_DEFAULT); + if(dset_F_x_id < 0) TEST_ERROR + + dset_F_N_id = H5Dcreate2(file_F_id, "dsetNOT", int_type_id, dspace_id, H5P_DEFAULT, dcpl_dontmin, H5P_DEFAULT); + if(dset_F_N_id < 0) TEST_ERROR + + dset_F_Y_id = H5Dcreate2(file_F_id, "dsetMIN", int_type_id, dspace_id, H5P_DEFAULT, dcpl_minimize, H5P_DEFAULT); + if(dset_F_Y_id < 0) TEST_ERROR + + /********* + * TESTS * + *********/ + + if(oh_compare(dset_f_x_id, dset_f_x_id) != EQ) TEST_ERROR /* identity */ + + if(oh_compare(dset_f_x_id, dset_f_N_id) != EQ) TEST_ERROR + if(oh_compare(dset_f_x_id, dset_f_Y_id) != GT) TEST_ERROR + if(oh_compare(dset_f_N_id, dset_f_Y_id) != GT) TEST_ERROR + + if(oh_compare(dset_F_x_id, dset_F_N_id) != EQ) TEST_ERROR + if(oh_compare(dset_F_x_id, dset_F_Y_id) != EQ) TEST_ERROR + if(oh_compare(dset_F_N_id, dset_F_Y_id) != EQ) TEST_ERROR + + if(oh_compare(dset_F_x_id, dset_f_Y_id) != EQ) TEST_ERROR + if(oh_compare(dset_F_x_id, dset_f_x_id) != LT) TEST_ERROR + + /************ + * TEARDOWN * + ************/ + + if(H5Sclose(dspace_id) < 0) TEST_ERROR + if(H5Tclose(int_type_id) < 0) TEST_ERROR + if(H5Pclose(dcpl_default) < 0) TEST_ERROR + if(H5Pclose(dcpl_minimize) < 0) TEST_ERROR + if(H5Pclose(dcpl_dontmin) < 0) TEST_ERROR + + if(H5Fclose(file_f_id) < 0) TEST_ERROR + if(H5Dclose(dset_f_x_id) < 0) TEST_ERROR + if(H5Dclose(dset_f_N_id) < 0) TEST_ERROR + if(H5Dclose(dset_f_Y_id) < 0) TEST_ERROR + + if(H5Fclose(file_F_id) < 0) TEST_ERROR + if(H5Dclose(dset_F_x_id) < 0) TEST_ERROR + if(H5Dclose(dset_F_N_id) < 0) TEST_ERROR + if(H5Dclose(dset_F_Y_id) < 0) TEST_ERROR + + } /* compact and non-compact */ + + PASSED() + return SUCCEED; + +error : + H5E_BEGIN_TRY { + (void)H5Pclose(dcpl_default); + (void)H5Pclose(dcpl_minimize); + (void)H5Pclose(dcpl_dontmin); + (void)H5Sclose(dspace_id); + (void)H5Tclose(int_type_id); + + (void)H5Fclose(file_f_id); + (void)H5Dclose(dset_f_x_id); + (void)H5Dclose(dset_f_N_id); + (void)H5Dclose(dset_f_Y_id); + + (void)H5Fclose(file_F_id); + (void)H5Dclose(dset_F_x_id); + (void)H5Dclose(dset_F_N_id); + (void)H5Dclose(dset_F_Y_id); + } H5E_END_TRY; + return FAIL; +} /* test_minimized_dset_ohdr_size_comparisons */ + +/* + * Test minimized dataset object header with filter/pipeline message + */ +static herr_t +test_minimized_dset_ohdr_with_filter(hid_t fapl_id) +{ + char filename[512] = ""; + const hsize_t extents[1] = {1024}; /* extents of dataspace */ + const unsigned filter_values[] = {0}; /* TBD */ + const hsize_t chunk_dim[] = {32}; /* needed for filter */ + const int ndims = 1; + hid_t dspace_id = -1; + hid_t dtype_id = -1; + hid_t dcpl_xZ_id = -1; + hid_t dcpl_mx_id = -1; + hid_t dcpl_mZ_id = -1; + hid_t dset_xx_id = -1; + hid_t dset_xZ_id = -1; + hid_t dset_mx_id = -1; + hid_t dset_mZ_id = -1; + hid_t file_id = -1; + herr_t ret; + + /* dcpl suffixes: + * | default | minimize + * ----------+---------+--------- + * no filter | xx | mx + * ----------+---------+--------- + * filter | xZ | mZ + */ + + TESTING("minimized dset object headers with filter message"); + + /********* + * SETUP * + *********/ + + if(h5_fixname(FILENAME[1], fapl_id, filename, sizeof(filename)) == NULL) + TEST_ERROR + + dcpl_mx_id = H5Pcreate(H5P_DATASET_CREATE); + if(dcpl_mx_id < 0) TEST_ERROR + ret = H5Pset_dset_no_attrs_hint(dcpl_mx_id, TRUE); + if(ret < 0) TEST_ERROR + + dcpl_xZ_id = H5Pcreate(H5P_DATASET_CREATE); + if(dcpl_xZ_id < 0) TEST_ERROR + ret = H5Pset_chunk(dcpl_xZ_id, ndims, chunk_dim); + if(ret < 0) TEST_ERROR + ret = H5Pset_filter(dcpl_xZ_id, H5Z_FILTER_DEFLATE, H5Z_FLAG_OPTIONAL, 0, filter_values); + if(ret < 0) TEST_ERROR + dcpl_mZ_id = H5Pcreate(H5P_DATASET_CREATE); + if(dcpl_mZ_id < 0) TEST_ERROR + ret = H5Pset_dset_no_attrs_hint(dcpl_mZ_id, TRUE); + if(ret < 0) TEST_ERROR + ret = H5Pset_chunk(dcpl_mZ_id, ndims, chunk_dim); + if(ret < 0) TEST_ERROR + ret = H5Pset_filter( dcpl_mZ_id, H5Z_FILTER_DEFLATE, H5Z_FLAG_OPTIONAL, 0, filter_values); + if(ret < 0) TEST_ERROR + + dspace_id = H5Screate_simple(1, extents, extents); + if(dspace_id < 0) TEST_ERROR + + dtype_id = H5Tcopy(H5T_NATIVE_INT); + if(dtype_id < 0) TEST_ERROR + + file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id); + if(file_id < 0) TEST_ERROR + + dset_xx_id = H5Dcreate2(file_id, "xx", dtype_id, dspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + if(dset_xx_id < 0) TEST_ERROR + + dset_mx_id = H5Dcreate2(file_id, "Mx", dtype_id, dspace_id, H5P_DEFAULT, dcpl_mx_id, H5P_DEFAULT); + if(dset_mx_id < 0) TEST_ERROR + + dset_xZ_id = H5Dcreate2(file_id, "xZ", dtype_id, dspace_id, H5P_DEFAULT, dcpl_xZ_id, H5P_DEFAULT); + if(dset_xZ_id < 0) TEST_ERROR + + dset_mZ_id = H5Dcreate2(file_id, "MZ", dtype_id, dspace_id, H5P_DEFAULT, dcpl_mZ_id, H5P_DEFAULT); + if(dset_mZ_id < 0) TEST_ERROR + + /********* + * TESTS * + *********/ + + if(oh_compare(dset_mx_id, dset_xx_id) != LT) TEST_ERROR + if(oh_compare(dset_mx_id, dset_xZ_id) != LT) TEST_ERROR + if(oh_compare(dset_mZ_id, dset_mx_id) != GT) TEST_ERROR + if(oh_compare(dset_mZ_id, dset_xZ_id) != LT) TEST_ERROR + + /************ + * TEARDOWN * + ************/ + + if(H5Sclose(dspace_id) < 0) TEST_ERROR + if(H5Tclose(dtype_id) < 0) TEST_ERROR + if(H5Pclose(dcpl_xZ_id) < 0) TEST_ERROR + if(H5Pclose(dcpl_mx_id) < 0) TEST_ERROR + if(H5Pclose(dcpl_mZ_id) < 0) TEST_ERROR + if(H5Dclose(dset_xx_id) < 0) TEST_ERROR + if(H5Dclose(dset_xZ_id) < 0) TEST_ERROR + if(H5Dclose(dset_mx_id) < 0) TEST_ERROR + if(H5Dclose(dset_mZ_id) < 0) TEST_ERROR + if(H5Fclose(file_id) < 0) TEST_ERROR + + PASSED() + return SUCCEED; + +error: + H5E_BEGIN_TRY { + (void)H5Sclose(dspace_id); + (void)H5Tclose(dtype_id); + (void)H5Pclose(dcpl_xZ_id); + (void)H5Pclose(dcpl_mx_id); + (void)H5Pclose(dcpl_mZ_id); + (void)H5Dclose(dset_xx_id); + (void)H5Dclose(dset_xZ_id); + (void)H5Dclose(dset_mx_id); + (void)H5Dclose(dset_mZ_id); + (void)H5Fclose(file_id); + } H5E_END_TRY; + return FAIL; +} /* test_minimized_dset_ohdr_with_filter */ + +/* + * Test minimized dataset object header and recording modification times. + */ +static herr_t +test_minimized_dset_ohdr_modification_times(hid_t _fapl_id) +{ + /* test-local structure for parameterized testing + */ + struct testcase { + unsigned oh_version; + }; + + char filename[512] = ""; + const hsize_t extents[1] = {128}; /* extents of dataspace */ + hid_t dspace_id = -1; + hid_t dtype_id = -1; + hid_t dcpl_xT_id = -1; /* Track modtime */ + hid_t dcpl_mx_id = -1; /* minimized */ + hid_t dcpl_mT_id = -1; /* minimized, Track */ + hid_t dcpl_mN_id = -1; /* minimized, do Not track */ + hid_t dset_xx_id = -1; + hid_t dset_xT_id = -1; + hid_t dset_mx_id = -1; + hid_t dset_mT_id = -1; + hid_t dset_mN_id = -1; + hid_t file_id = -1; + hid_t fapl_id = -1; + herr_t ret; + + unsigned i = 0; /* for testcase loop */ + unsigned n_cases = 2; /* must match `cases` array size below */ + struct testcase cases[2] = { + { 1, }, /* version 1 object header */ + { 2, }, /* version 2 object header */ + }; + + /* dcpl suffixes: + * | default | minimize + * ------------+---------+--------- + * default | xx | mx + * ------------+---------+--------- + * don't track | xN | mN + * ------------+---------+--------- + * track | xT | mT + */ + + TESTING("minimized dset object headers with modification times"); + + /********* + * SETUP * + *********/ + + if(h5_fixname(FILENAME[1], _fapl_id, filename, sizeof(filename)) == NULL) + TEST_ERROR + + dcpl_mx_id = H5Pcreate(H5P_DATASET_CREATE); + if(dcpl_mx_id < 0) TEST_ERROR + ret = H5Pset_dset_no_attrs_hint(dcpl_mx_id, TRUE); + if(ret < 0) TEST_ERROR + + dcpl_xT_id = H5Pcreate(H5P_DATASET_CREATE); + if(dcpl_xT_id < 0) TEST_ERROR + ret = H5Pset_obj_track_times(dcpl_xT_id, TRUE); + if(ret < 0) TEST_ERROR + + dcpl_mT_id = H5Pcreate(H5P_DATASET_CREATE); + if(dcpl_mT_id < 0) TEST_ERROR + ret = H5Pset_dset_no_attrs_hint(dcpl_mT_id, TRUE); + if(ret < 0) TEST_ERROR + ret = H5Pset_obj_track_times(dcpl_mT_id, TRUE); + if(ret < 0) TEST_ERROR + + dcpl_mN_id = H5Pcreate(H5P_DATASET_CREATE); + if(dcpl_mN_id < 0) TEST_ERROR + ret = H5Pset_dset_no_attrs_hint(dcpl_mN_id, TRUE); + if(ret < 0) TEST_ERROR + ret = H5Pset_obj_track_times(dcpl_mN_id, FALSE); + if(ret < 0) TEST_ERROR + + dspace_id = H5Screate_simple(1, extents, extents); + if(dspace_id < 0) TEST_ERROR + + dtype_id = H5Tcopy(H5T_NATIVE_INT); + if(dtype_id < 0) TEST_ERROR + + for (i = 0; i < n_cases; i++) { + + /* -------------- * + * per-case setup * + * -------------- */ + + fapl_id = H5Pcopy(_fapl_id); + if(fapl_id < 0) TEST_ERROR + + if(cases[i].oh_version > 1) { + ret = H5Pset_libver_bounds(fapl_id, H5F_LIBVER_V18, H5F_LIBVER_V110); + if(ret < 0) TEST_ERROR + } + + file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id); + if(file_id < 0) TEST_ERROR + + dset_xx_id = H5Dcreate2( file_id, "xx", dtype_id, dspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + if(dset_xx_id < 0) TEST_ERROR + + dset_mx_id = H5Dcreate2(file_id, "mx", dtype_id, dspace_id, H5P_DEFAULT, dcpl_mx_id, H5P_DEFAULT); + if(dset_mx_id < 0) TEST_ERROR + + dset_xT_id = H5Dcreate2(file_id, "xT", dtype_id, dspace_id, H5P_DEFAULT, dcpl_xT_id, H5P_DEFAULT); + if(dset_xT_id < 0) TEST_ERROR + dset_mT_id = H5Dcreate2(file_id, "mT", dtype_id, dspace_id, H5P_DEFAULT, dcpl_mT_id, H5P_DEFAULT); + if(dset_mT_id < 0) TEST_ERROR + + dset_mN_id = H5Dcreate2(file_id, "mN", dtype_id, dspace_id, H5P_DEFAULT, dcpl_mN_id, H5P_DEFAULT); + if(dset_mN_id < 0) TEST_ERROR + + /* ----- * + * TESTS * + * ----- */ + + /* sanity check */ + if(oh_compare(dset_mx_id, dset_xx_id) != LT) TEST_ERROR + if(oh_compare(dset_mx_id, dset_xT_id) != LT) TEST_ERROR + + if(oh_compare(dset_xx_id, dset_xT_id) != EQ) TEST_ERROR + if(oh_compare(dset_mx_id, dset_mT_id) != EQ) TEST_ERROR + if(oh_compare(dset_mN_id, dset_mT_id) != LT) TEST_ERROR + + if(oh_compare(dset_mT_id, dset_xT_id) != LT) TEST_ERROR + + /* ----------------- * + * per-case teardown * + * ----------------- */ + + if(H5Dclose(dset_xx_id) < 0) TEST_ERROR + if(H5Dclose(dset_xT_id) < 0) TEST_ERROR + if(H5Dclose(dset_mx_id) < 0) TEST_ERROR + if(H5Dclose(dset_mT_id) < 0) TEST_ERROR + if(H5Dclose(dset_mN_id) < 0) TEST_ERROR + if(H5Fclose(file_id) < 0) TEST_ERROR + if(H5Pclose(fapl_id) < 0) TEST_ERROR + + } /* for each version tested */ + + /************ + * TEARDOWN * + ************/ + + if(H5Sclose(dspace_id) < 0) TEST_ERROR + if(H5Tclose(dtype_id) < 0) TEST_ERROR + if(H5Pclose(dcpl_xT_id) < 0) TEST_ERROR + if(H5Pclose(dcpl_mx_id) < 0) TEST_ERROR + if(H5Pclose(dcpl_mT_id) < 0) TEST_ERROR + if(H5Pclose(dcpl_mN_id) < 0) TEST_ERROR + + PASSED() + return SUCCEED; + +error: + H5E_BEGIN_TRY { + (void)H5Sclose(dspace_id); + (void)H5Tclose(dtype_id); + (void)H5Pclose(dcpl_xT_id); + (void)H5Pclose(dcpl_mx_id); + (void)H5Pclose(dcpl_mT_id); + (void)H5Pclose(dcpl_mN_id); + (void)H5Dclose(dset_xx_id); + (void)H5Dclose(dset_xT_id); + (void)H5Dclose(dset_mx_id); + (void)H5Dclose(dset_mT_id); + (void)H5Dclose(dset_mN_id); + (void)H5Fclose(file_id); + (void)H5Pclose(fapl_id); + } H5E_END_TRY; + return FAIL; +} /* test_minimized_dset_ohdr_modification_times */ + +/* + * Test minimized dataset object header with a fill value set. + */ +static herr_t +test_minimized_dset_ohdr_fillvalue_backwards_compatability(hid_t _fapl_id) +{ + char filename[512] = ""; + const hsize_t extents[1] = {64}; /* extents of dataspace */ + const int fill[1] = {343}; /* fill value of dataset */ + hid_t file_id = -1; + hid_t dtype_id = -1; + hid_t dspace_id = -1; + hid_t dcpl_id = -1; + hid_t fapl_id = -1; + hid_t dset_0_id = -1; + hid_t dset_1_id = -1; + herr_t ret; + + /********* + * SETUP * + *********/ + + TESTING("minimized dset object headers with fill values and different libver support"); + + fapl_id = H5Pcopy(_fapl_id); + if(fapl_id < 0) TEST_ERROR + + if(h5_fixname(FILENAME[1], fapl_id, filename, sizeof(filename)) == NULL) + TEST_ERROR + + dspace_id = H5Screate_simple(1, extents, extents); + if(dspace_id < 0) TEST_ERROR + + dtype_id = H5Tcopy(H5T_NATIVE_INT); + if(dtype_id < 0) TEST_ERROR + + dcpl_id = H5Pcreate(H5P_DATASET_CREATE); + if(dcpl_id < 0) TEST_ERROR + + ret = H5Pset_dset_no_attrs_hint(dcpl_id, TRUE); + if(ret == FAIL) TEST_ERROR; + + ret = H5Pset_fill_value(dcpl_id, dtype_id, fill); + if(ret == FAIL) TEST_ERROR; + + ret = H5Pset_libver_bounds(fapl_id, H5F_LIBVER_EARLIEST, H5F_LIBVER_LATEST); + if(ret == FAIL) TEST_ERROR; + + file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id); + if(file_id < 0) TEST_ERROR + + dset_0_id = H5Dcreate2(file_id, "fullrange", dtype_id, dspace_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT); + if(dset_0_id < 0) TEST_ERROR + + /* Close file and re-open with different libver bounds. + * Dataset "fullrange" must also be closed for expected reopen behavior. + */ + if(H5Fclose(file_id) < 0) TEST_ERROR; + if(H5Dclose(dset_0_id) < 0) TEST_ERROR + + ret = H5Pset_libver_bounds(fapl_id, H5F_LIBVER_V18, H5F_LIBVER_LATEST); + if(ret == FAIL) TEST_ERROR; + + file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl_id); + if(file_id < 0) TEST_ERROR + + dset_1_id = H5Dcreate2(file_id, "upperrange", dtype_id, dspace_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT); + if(dset_1_id < 0) TEST_ERROR + + /* re-open "fullrange" dataset + */ + dset_0_id = H5Dopen2(file_id, "fullrange", H5P_DEFAULT); + if(dset_0_id < 0) TEST_ERROR + + /********* + * TESTS * + *********/ + + /* dset not supporting pre-1.08 should be smaller? */ + if(oh_compare(dset_1_id, dset_0_id) != LT) TEST_ERROR + + /************ + * TEARDOWN * + ************/ + + if(H5Sclose(dspace_id) < 0) TEST_ERROR + if(H5Tclose(dtype_id) < 0) TEST_ERROR + if(H5Pclose(dcpl_id) < 0) TEST_ERROR + if(H5Pclose(fapl_id) < 0) TEST_ERROR + if(H5Dclose(dset_0_id) < 0) TEST_ERROR + if(H5Dclose(dset_1_id) < 0) TEST_ERROR + if(H5Fclose(file_id) < 0) TEST_ERROR; + + PASSED() + return SUCCEED; + +error: + H5E_BEGIN_TRY { + (void)H5Sclose(dspace_id); + (void)H5Tclose(dtype_id); + (void)H5Pclose(dcpl_id); + (void)H5Pclose(fapl_id); + (void)H5Dclose(dset_0_id); + (void)H5Dclose(dset_1_id); + (void)H5Fclose(file_id); + } H5E_END_TRY; + return FAIL; +} /* test_minimized_dset_ohdr_fillvalue_backwards_compatability */ + #define STR_EARLIEST "earliest" #define STR_V18 "v18" #define STR_LATEST "latest" @@ -792,6 +1686,8 @@ main(void) hid_t fapl = -1; hid_t file = -1; H5F_t *f = NULL; + const char *env_h5_drvr; /* File driver value from environment */ + hbool_t single_file_vfd; /* Whether VFD used stores data in a single file */ char filename[1024]; H5O_hdr_info_t hdr_info; /* Object info */ H5O_loc_t oh_loc; /* Object header locations */ @@ -802,6 +1698,14 @@ main(void) hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret; /* Generic return value */ + /* Get the VFD to use */ + env_h5_drvr = HDgetenv("HDF5_DRIVER"); + if(env_h5_drvr == NULL) + env_h5_drvr = "nomatch"; + + /* Check for VFD which stores data in multiple files */ + single_file_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family")); + /* Reset library */ h5_reset(); fapl = h5_fileaccess(); @@ -1020,16 +1924,43 @@ main(void) * and the various "fail/mark if unknown" object header message flags */ HDputs("Accessing objects with unknown header messages: H5O_BOGUS_VALID_ID"); - if(test_unknown(H5O_BOGUS_VALID_ID, filename, fapl) < 0) - TEST_ERROR + if(single_file_vfd) { + if(test_unknown(H5O_BOGUS_VALID_ID, filename, fapl) < 0) + TEST_ERROR + } /* end if */ + else { + SKIPPED(); + HDputs(" Unknown header message test not supported with the current VFD."); + } /* end else */ HDputs("Accessing objects with unknown header messages: H5O_BOGUS_INVALID_ID"); - if(test_unknown(H5O_BOGUS_INVALID_ID, filename, fapl) < 0) - TEST_ERROR + if(single_file_vfd) { + if(test_unknown(H5O_BOGUS_INVALID_ID, filename, fapl) < 0) + TEST_ERROR + } /* end if */ + else { + SKIPPED(); + HDputs(" Unknown header message test not supported with the current VFD."); + } /* end else */ /* Test object header creation metadata cache issues */ if(test_ohdr_cache(filename, fapl) < 0) TEST_ERROR + if(test_minimized_dset_ohdr_attribute_addition(fapl) < 0) + TEST_ERROR + + if(test_minimized_dset_ohdr_size_comparisons(fapl) < 0) + TEST_ERROR + + if(test_minimized_dset_ohdr_with_filter(fapl) < 0) + TEST_ERROR + + if(test_minimized_dset_ohdr_modification_times(fapl) < 0) + TEST_ERROR + + if(test_minimized_dset_ohdr_fillvalue_backwards_compatability(fapl) < 0) + TEST_ERROR + } /* high */ } /* low */ diff --git a/test/tattr.c b/test/tattr.c index 3a7cf2c..454ea71 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -143,6 +143,16 @@ float attr_data5=-5.123F; /* Test data for 5th attribute */ #define DIM1 100 #define RANK 2 +/* Used by test_attr_info_null_info_pointer() */ +#define GET_INFO_NULL_POINTER_ATTR_NAME "NullInfoPointerAttr" + +/* Used by test_attr_rename_invalid_name() */ +#define INVALID_RENAME_TEST_ATTR_NAME "InvalidRenameTestAttr" +#define INVALID_RENAME_TEST_NEW_ATTR_NAME "InvalidRenameTestNewAttr" + +/* Used by test_attr_get_name_invalid_buf() */ +#define GET_NAME_INVALID_BUF_TEST_ATTR_NAME "InvalidNameBufferTestAttr" + /* Attribute iteration struct */ typedef struct { H5_iter_order_t order; /* Direction of iteration */ @@ -157,6 +167,12 @@ typedef struct { static herr_t attr_op1(hid_t loc_id, const char *name, const H5A_info_t *ainfo, void *op_data); +/* Global dcpl ID, can be re-set as a generated dcpl for various operations + * across multiple tests. + * e.g., minimized dataset object headers + */ +static hid_t dcpl_g = H5P_DEFAULT; + /**************************************************************** @@ -196,7 +212,7 @@ test_attr_basic_write(hid_t fapl) CHECK(sid1, FAIL, "H5Screate_simple"); /* Create a dataset */ - dataset = H5Dcreate2(fid1, DSET1_NAME, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + dataset = H5Dcreate2(fid1, DSET1_NAME, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, dcpl_g, H5P_DEFAULT); CHECK(dataset, FAIL, "H5Dcreate2"); /* Create dataspace for attribute */ @@ -516,7 +532,7 @@ test_attr_flush(hid_t fapl) spc = H5Screate(H5S_SCALAR); CHECK(spc, FAIL, "H5Screate"); - set = H5Dcreate2(fil, DSET1_NAME, H5T_NATIVE_DOUBLE, spc, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + set = H5Dcreate2(fil, DSET1_NAME, H5T_NATIVE_DOUBLE, spc, H5P_DEFAULT, dcpl_g, H5P_DEFAULT); CHECK(set, FAIL, "H5Dcreate2"); att = H5Acreate2(set, ATTR1_NAME, H5T_NATIVE_DOUBLE, spc, H5P_DEFAULT, H5P_DEFAULT); @@ -587,7 +603,7 @@ test_attr_plist(hid_t fapl) CHECK(sid1, FAIL, "H5Screate_simple"); /* Create a dataset */ - dataset = H5Dcreate2(fid1, DSET1_NAME, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + dataset = H5Dcreate2(fid1, DSET1_NAME, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, dcpl_g, H5P_DEFAULT); CHECK(dataset, FAIL, "H5Dcreate2"); /* Create dataspace for attribute */ @@ -701,7 +717,7 @@ test_attr_compound_write(hid_t fapl) CHECK(sid1, FAIL, "H5Screate_simple"); /* Create a dataset */ - dataset = H5Dcreate2(fid1, DSET1_NAME, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + dataset = H5Dcreate2(fid1, DSET1_NAME, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, dcpl_g, H5P_DEFAULT); CHECK(dataset, FAIL, "H5Dcreate2"); /* Close dataset's dataspace */ @@ -937,7 +953,7 @@ test_attr_scalar_write(hid_t fapl) CHECK(sid1, FAIL, "H5Screate_simple"); /* Create a dataset */ - dataset = H5Dcreate2(fid1, DSET1_NAME, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + dataset = H5Dcreate2(fid1, DSET1_NAME, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, dcpl_g, H5P_DEFAULT); CHECK(dataset, FAIL, "H5Dcreate2"); /* Create dataspace for attribute */ @@ -1078,7 +1094,7 @@ test_attr_mult_write(hid_t fapl) CHECK(sid1, FAIL, "H5Screate_simple"); /* Create a dataset */ - dataset = H5Dcreate2(fid1, DSET1_NAME, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + dataset = H5Dcreate2(fid1, DSET1_NAME, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, dcpl_g, H5P_DEFAULT); CHECK(dataset, FAIL, "H5Dcreate2"); /* Close dataset's dataspace */ @@ -1456,7 +1472,7 @@ test_attr_iterate(hid_t fapl) CHECK(sid, FAIL, "H5Screate"); /* Create a new dataset */ - dataset = H5Dcreate2(file, DSET2_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + dataset = H5Dcreate2(file, DSET2_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT); CHECK(dataset, FAIL, "H5Dcreate2"); /* Close dataspace */ @@ -1680,7 +1696,7 @@ test_attr_dtype_shared(hid_t fapl) CHECK(space_id, FAIL, "H5Screate"); /* Create dataset */ - dset_id = H5Dcreate2(file_id, DSET1_NAME, type_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + dset_id = H5Dcreate2(file_id, DSET1_NAME, type_id, space_id, H5P_DEFAULT, dcpl_g, H5P_DEFAULT); CHECK(dset_id, FAIL, "H5Dcreate2"); /* Check reference count on named datatype */ @@ -1834,7 +1850,7 @@ test_attr_duplicate_ids(hid_t fapl) /* Create a dataset */ dataset = H5Dcreate2(fid1, DSET1_NAME, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, - H5P_DEFAULT, H5P_DEFAULT); + dcpl_g, H5P_DEFAULT); CHECK(dataset, FAIL, "H5Dcreate2"); /* Create dataspace for attribute */ @@ -2159,9 +2175,14 @@ test_attr_dense_create(hid_t fcpl, hid_t fapl) sid = H5Screate(H5S_SCALAR); CHECK(sid, FAIL, "H5Screate"); - /* Query the group creation properties */ - dcpl = H5Pcreate(H5P_DATASET_CREATE); - CHECK(dcpl, FAIL, "H5Pcreate"); + /* need DCPL to query the group creation properties */ + if (dcpl_g == H5P_DEFAULT) { + dcpl = H5Pcreate(H5P_DATASET_CREATE); + CHECK(dcpl, FAIL, "H5Pcreate"); + } else { + dcpl = H5Pcopy(dcpl_g); + CHECK(dcpl, FAIL, "H5Pcopy"); + } /* Create a dataset */ dataset = H5Dcreate2(fid, DSET1_NAME, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); @@ -2290,9 +2311,14 @@ test_attr_dense_open(hid_t fcpl, hid_t fapl) sid = H5Screate(H5S_SCALAR); CHECK(sid, FAIL, "H5Screate"); - /* Query the group creation properties */ - dcpl = H5Pcreate(H5P_DATASET_CREATE); - CHECK(dcpl, FAIL, "H5Pcreate"); + /* need DCPL to query the group creation properties */ + if (dcpl_g == H5P_DEFAULT) { + dcpl = H5Pcreate(H5P_DATASET_CREATE); + CHECK(dcpl, FAIL, "H5Pcreate"); + } else { + dcpl = H5Pcopy(dcpl_g); + CHECK(dcpl, FAIL, "H5Pcopy"); + } /* Enable creation order tracking on attributes, so creation order tests work */ ret = H5Pset_attr_creation_order(dcpl, H5P_CRT_ORDER_TRACKED); @@ -2404,14 +2430,25 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl) h5_stat_size_t empty_filesize; /* Size of empty file */ h5_stat_size_t filesize; /* Size of file after modifications */ H5O_info_t oinfo; /* Object info */ + int use_min_dset_oh = (dcpl_g != H5P_DEFAULT); herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Deleting Attributes in Dense Storage\n")); - /* Create file */ + if (use_min_dset_oh) { /* using minimized dataset headers */ + /* modify fcpl... + * sidestep "bug" where file space is lost with minimized dset ohdrs + */ + fcpl = H5Pcopy(fcpl); + CHECK(fcpl, FAIL, "H5Pcopy"); + ret = H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, TRUE, 1); + CHECK(ret, FAIL, "H5Pset_file_space_strategy"); + } fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl); CHECK(fid, FAIL, "H5Fcreate"); + if (use_min_dset_oh) + CHECK(H5Pclose(fcpl), FAIL, "H5Pclose"); /* Close file */ ret = H5Fclose(fid); @@ -2430,9 +2467,14 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl) sid = H5Screate(H5S_SCALAR); CHECK(sid, FAIL, "H5Screate"); - /* Query the group creation properties */ - dcpl = H5Pcreate(H5P_DATASET_CREATE); - CHECK(dcpl, FAIL, "H5Pcreate"); + /* need DCPL to query the group creation properties */ + if (use_min_dset_oh) { + dcpl = H5Pcopy(dcpl_g); + CHECK(dcpl, FAIL, "H5Pcopy"); + } else { + dcpl = H5Pcreate(H5P_DATASET_CREATE); + CHECK(dcpl, FAIL, "H5Pcreate"); + } /* Enable creation order tracking on attributes, so creation order tests work */ ret = H5Pset_attr_creation_order(dcpl, H5P_CRT_ORDER_TRACKED); @@ -2583,14 +2625,25 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl) h5_stat_size_t filesize; /* Size of file after modifications */ H5O_info_t oinfo; /* Object info */ unsigned u; /* Local index variable */ + int use_min_dset_oh = (dcpl_g != H5P_DEFAULT); herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Renaming Attributes in Dense Storage\n")); - /* Create file */ + if (use_min_dset_oh) { /* using minimized dataset headers */ + /* modify fcpl... + * sidestep "bug" where file space is lost with minimized dset ohdrs + */ + fcpl = H5Pcopy(fcpl); + CHECK(fcpl, FAIL, "H5Pcopy"); + ret = H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, TRUE, 1); + CHECK(ret, FAIL, "H5Pset_file_space_strategy"); + } fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl); CHECK(fid, FAIL, "H5Fcreate"); + if (use_min_dset_oh) + CHECK(H5Pclose(fcpl), FAIL, "H5Pclose"); /* Close file */ ret = H5Fclose(fid); @@ -2609,9 +2662,14 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl) sid = H5Screate(H5S_SCALAR); CHECK(sid, FAIL, "H5Screate"); - /* Query the group creation properties */ - dcpl = H5Pcreate(H5P_DATASET_CREATE); - CHECK(dcpl, FAIL, "H5Pcreate"); + /* need DCPL to query the group creation properties */ + if (use_min_dset_oh) { + dcpl = H5Pcopy(dcpl_g); + CHECK(dcpl, FAIL, "H5Pcopy"); + } else { + dcpl = H5Pcreate(H5P_DATASET_CREATE); + CHECK(dcpl, FAIL, "H5Pcreate"); + } /* Create a dataset */ dataset = H5Dcreate2(fid, DSET1_NAME, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); @@ -2742,20 +2800,29 @@ test_attr_dense_unlink(hid_t fcpl, hid_t fapl) h5_stat_size_t filesize; /* Size of file after modifications */ H5O_info_t oinfo; /* Object info */ unsigned u; /* Local index variable */ + int use_min_dset_oh = (dcpl_g != H5P_DEFAULT); herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Unlinking Object with Attributes in Dense Storage\n")); - /* Create file */ + if (use_min_dset_oh) { /* using minimized dataset headers */ + /* modify fcpl... + * sidestep "bug" where file space is lost with minimized dset ohdrs + */ + fcpl = H5Pcopy(fcpl); + CHECK(fcpl, FAIL, "H5Pcopy"); + ret = H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, TRUE, 1); + CHECK(ret, FAIL, "H5Pset_file_space_strategy"); + } fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl); CHECK(fid, FAIL, "H5Fcreate"); + if (use_min_dset_oh) + CHECK(H5Pclose(fcpl), FAIL, "H5Pclose"); - /* Close file */ ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); - /* Get size of file */ empty_filesize = h5_get_file_size(FILENAME, fapl); if(empty_filesize < 0) TestErrPrintf("Line %d: file size wrong!\n", __LINE__); @@ -2768,9 +2835,14 @@ test_attr_dense_unlink(hid_t fcpl, hid_t fapl) sid = H5Screate(H5S_SCALAR); CHECK(sid, FAIL, "H5Screate"); - /* Query the group creation properties */ - dcpl = H5Pcreate(H5P_DATASET_CREATE); - CHECK(dcpl, FAIL, "H5Pcreate"); + /* need DCPL to query the group creation properties */ + if (use_min_dset_oh) { + dcpl = H5Pcopy(dcpl_g); + CHECK(dcpl, FAIL, "H5Pcopy"); + } else { + dcpl = H5Pcreate(H5P_DATASET_CREATE); + CHECK(dcpl, FAIL, "H5Pcreate"); + } /* Create a dataset */ dataset = H5Dcreate2(fid, DSET1_NAME, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); @@ -2896,9 +2968,14 @@ test_attr_dense_limits(hid_t fcpl, hid_t fapl) sid = H5Screate(H5S_SCALAR); CHECK(sid, FAIL, "H5Screate"); - /* Query the group creation properties */ - dcpl = H5Pcreate(H5P_DATASET_CREATE); - CHECK(dcpl, FAIL, "H5Pcreate"); + /* need DCPL to query the group creation properties */ + if (dcpl_g == H5P_DEFAULT) { + dcpl = H5Pcreate(H5P_DATASET_CREATE); + CHECK(dcpl, FAIL, "H5Pcreate"); + } else { + dcpl = H5Pcopy(dcpl_g); + CHECK(dcpl, FAIL, "H5Pcopy"); + } /* Change limits on compact/dense attribute storage */ max_compact = 0; @@ -3063,9 +3140,14 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl) sid = H5Screate(H5S_SCALAR); CHECK(sid, FAIL, "H5Screate"); - /* Query the group creation properties */ - dcpl = H5Pcreate(H5P_DATASET_CREATE); - CHECK(dcpl, FAIL, "H5Pcreate"); + /* need DCPL to query the group creation properties */ + if (dcpl_g == H5P_DEFAULT) { + dcpl = H5Pcreate(H5P_DATASET_CREATE); + CHECK(dcpl, FAIL, "H5Pcreate"); + } else { + dcpl = H5Pcopy(dcpl_g); + CHECK(dcpl, FAIL, "H5Pcopy"); + } /* Create a dataset */ dataset = H5Dcreate2(fid, DSET1_NAME, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); @@ -3593,9 +3675,14 @@ test_attr_big(hid_t fcpl, hid_t fapl) big_sid = H5Screate_simple(ATTR6_RANK, dims, NULL); CHECK(big_sid, FAIL, "H5Screate_simple"); - /* Query the group creation properties */ - dcpl = H5Pcreate(H5P_DATASET_CREATE); - CHECK(dcpl, FAIL, "H5Pcreate"); + /* need DCPL to query the group creation properties */ + if (dcpl_g == H5P_DEFAULT) { + dcpl = H5Pcreate(H5P_DATASET_CREATE); + CHECK(dcpl, FAIL, "H5Pcreate"); + } else { + dcpl = H5Pcopy(dcpl_g); + CHECK(dcpl, FAIL, "H5Pcopy"); + } /* Retrieve limits for compact/dense attribute storage */ ret = H5Pget_attr_phase_change(dcpl, &max_compact, &min_dense); @@ -3860,7 +3947,7 @@ test_attr_null_space(hid_t fcpl, hid_t fapl) CHECK(null_sid, FAIL, "H5Screate"); /* Create a dataset */ - dataset = H5Dcreate2(fid, DSET1_NAME, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + dataset = H5Dcreate2(fid, DSET1_NAME, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT); CHECK(dataset, FAIL, "H5Dcreate2"); @@ -4053,7 +4140,7 @@ test_attr_deprec(hid_t fcpl, hid_t fapl) CHECK(sid, FAIL, "H5Screate"); /* Create a dataset */ - dataset = H5Dcreate2(fid, DSET1_NAME, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + dataset = H5Dcreate2(fid, DSET1_NAME, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT); CHECK(dataset, FAIL, "H5Dcreate2"); @@ -4288,8 +4375,13 @@ test_attr_corder_create_basic(hid_t fcpl, hid_t fapl) CHECK(fid, FAIL, "H5Fcreate"); /* Create dataset creation property list */ - dcpl = H5Pcreate(H5P_DATASET_CREATE); - CHECK(dcpl, FAIL, "H5Pcreate"); + if (dcpl_g == H5P_DEFAULT) { + dcpl = H5Pcreate(H5P_DATASET_CREATE); + CHECK(dcpl, FAIL, "H5Pcreate"); + } else { + dcpl = H5Pcopy(dcpl_g); + CHECK(dcpl, FAIL, "H5Pcopy"); + } /* Get creation order indexing on object */ ret = H5Pget_attr_creation_order(dcpl, &crt_order_flags); @@ -4411,8 +4503,13 @@ test_attr_corder_create_compact(hid_t fcpl, hid_t fapl) CHECK(fid, FAIL, "H5Fcreate"); /* Create dataset creation property list */ - dcpl = H5Pcreate(H5P_DATASET_CREATE); - CHECK(dcpl, FAIL, "H5Pcreate"); + if (dcpl_g == H5P_DEFAULT) { + dcpl = H5Pcreate(H5P_DATASET_CREATE); + CHECK(dcpl, FAIL, "H5Pcreate"); + } else { + dcpl = H5Pcopy(dcpl_g); + CHECK(dcpl, FAIL, "H5Pcopy"); + } /* Set attribute creation order tracking & indexing for object */ ret = H5Pset_attr_creation_order(dcpl, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)); @@ -4611,8 +4708,13 @@ test_attr_corder_create_dense(hid_t fcpl, hid_t fapl) CHECK(fid, FAIL, "H5Fcreate"); /* Create dataset creation property list */ - dcpl = H5Pcreate(H5P_DATASET_CREATE); - CHECK(dcpl, FAIL, "H5Pcreate"); + if (dcpl_g == H5P_DEFAULT) { + dcpl = H5Pcreate(H5P_DATASET_CREATE); + CHECK(dcpl, FAIL, "H5Pcreate"); + } else { + dcpl = H5Pcopy(dcpl_g); + CHECK(dcpl, FAIL, "H5Pcopy"); + } /* Set attribute creation order tracking & indexing for object */ ret = H5Pset_attr_creation_order(dcpl, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)); @@ -4946,8 +5048,13 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) CHECK(fid, FAIL, "H5Fcreate"); /* Create dataset creation property list */ - dcpl = H5Pcreate(H5P_DATASET_CREATE); - CHECK(dcpl, FAIL, "H5Pcreate"); + if (dcpl_g == H5P_DEFAULT) { + dcpl = H5Pcreate(H5P_DATASET_CREATE); + CHECK(dcpl, FAIL, "H5Pcreate"); + } else { + dcpl = H5Pcopy(dcpl_g); + CHECK(dcpl, FAIL, "H5Pcopy"); + } /* Set attribute creation order tracking & indexing for object */ ret = H5Pset_attr_creation_order(dcpl, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)); @@ -5357,8 +5464,13 @@ test_attr_corder_delete(hid_t fcpl, hid_t fapl) CHECK(sid, FAIL, "H5Screate"); /* Create dataset creation property list */ - dcpl = H5Pcreate(H5P_DATASET_CREATE); - CHECK(dcpl, FAIL, "H5Pcreate"); + if (dcpl_g == H5P_DEFAULT) { + dcpl = H5Pcreate(H5P_DATASET_CREATE); + CHECK(dcpl, FAIL, "H5Pcreate"); + } else { + dcpl = H5Pcopy(dcpl_g); + CHECK(dcpl, FAIL, "H5Pcopy"); + } /* Set attribute creation order tracking & indexing for object */ ret = H5Pset_attr_creation_order(dcpl, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)); @@ -5700,8 +5812,13 @@ test_attr_info_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(sid, FAIL, "H5Screate"); /* Create dataset creation property list */ - dcpl = H5Pcreate(H5P_DATASET_CREATE); - CHECK(dcpl, FAIL, "H5Pcreate"); + if (dcpl_g == H5P_DEFAULT) { + dcpl = H5Pcreate(H5P_DATASET_CREATE); + CHECK(dcpl, FAIL, "H5Pcreate"); + } else { + dcpl = H5Pcopy(dcpl_g); + CHECK(dcpl, FAIL, "H5Pcopy"); + } /* Query the attribute creation properties */ ret = H5Pget_attr_phase_change(dcpl, &max_compact, &min_dense); @@ -5875,6 +5992,208 @@ test_attr_info_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* test_attr_info_by_idx() */ +/*************************************************************** +** +** test_attr_info_null_info_pointer(): A test to ensure that +** passing a NULL attribute info pointer to H5Aget_info +** (_by_name/_by_idx) doesn't cause bad behavior. +** +****************************************************************/ +static void +test_attr_info_null_info_pointer(hid_t fcpl, hid_t fapl) +{ + herr_t err_ret = -1; + hid_t fid; + hid_t attr; + hid_t sid; + + /* Create dataspace for attribute */ + sid = H5Screate(H5S_SCALAR); + CHECK(sid, FAIL, "H5Screate"); + + /* Create file */ + fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl); + CHECK(fid, FAIL, "H5Fcreate"); + + /* Create attribute */ + attr = H5Acreate2(fid, GET_INFO_NULL_POINTER_ATTR_NAME, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); + CHECK(attr, FAIL, "H5Acreate2"); + + H5E_BEGIN_TRY { + err_ret = H5Aget_info(attr, NULL); + } H5E_END_TRY; + + CHECK(err_ret, SUCCEED, "H5Aget_info"); + + H5E_BEGIN_TRY { + err_ret = H5Aget_info_by_name(fid, ".", GET_INFO_NULL_POINTER_ATTR_NAME, NULL, H5P_DEFAULT); + } H5E_END_TRY; + + CHECK(err_ret, SUCCEED, "H5Aget_info_by_name"); + + H5E_BEGIN_TRY { + err_ret = H5Aget_info_by_idx(fid, ".", H5_INDEX_NAME, H5_ITER_INC, 0, NULL, H5P_DEFAULT); + } H5E_END_TRY; + + CHECK(err_ret, SUCCEED, "H5Aget_info_by_idx"); + + /* Close dataspace */ + err_ret = H5Sclose(sid); + CHECK(err_ret, FAIL, "H5Sclose"); + + /* Close attribute */ + err_ret = H5Aclose(attr); + CHECK(err_ret, FAIL, "H5Aclose"); + + /* Close file */ + err_ret = H5Fclose(fid); + CHECK(err_ret, FAIL, "H5Fclose"); +} + + +/*************************************************************** +** +** test_attr_rename_invalid_name(): A test to ensure that +** passing a NULL or empty attribute name to +** H5Arename(_by_name) doesn't cause bad behavior. +** +****************************************************************/ +static void +test_attr_rename_invalid_name(hid_t fcpl, hid_t fapl) +{ + herr_t err_ret = -1; + hid_t fid; + hid_t attr; + hid_t sid; + + /* Create dataspace for attribute */ + sid = H5Screate(H5S_SCALAR); + CHECK(sid, FAIL, "H5Screate"); + + /* Create file */ + fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl); + CHECK(fid, FAIL, "H5Fcreate"); + + /* Create attribute */ + attr = H5Acreate2(fid, INVALID_RENAME_TEST_ATTR_NAME, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); + CHECK(attr, FAIL, "H5Acreate2"); + + H5E_BEGIN_TRY { + err_ret = H5Arename(fid, NULL, INVALID_RENAME_TEST_NEW_ATTR_NAME); + } H5E_END_TRY; + + CHECK(err_ret, SUCCEED, "H5Arename"); + + H5E_BEGIN_TRY { + err_ret = H5Arename(fid, "", INVALID_RENAME_TEST_NEW_ATTR_NAME); + } H5E_END_TRY; + + CHECK(err_ret, SUCCEED, "H5Arename"); + + H5E_BEGIN_TRY { + err_ret = H5Arename(fid, INVALID_RENAME_TEST_ATTR_NAME, NULL); + } H5E_END_TRY; + + CHECK(err_ret, SUCCEED, "H5Arename"); + + H5E_BEGIN_TRY { + err_ret = H5Arename(fid, INVALID_RENAME_TEST_ATTR_NAME, ""); + } H5E_END_TRY; + + CHECK(err_ret, SUCCEED, "H5Arename"); + + H5E_BEGIN_TRY { + err_ret = H5Arename_by_name(fid, ".", NULL, INVALID_RENAME_TEST_NEW_ATTR_NAME, H5P_DEFAULT); + } H5E_END_TRY; + + CHECK(err_ret, SUCCEED, "H5Arename_by_name"); + + H5E_BEGIN_TRY { + err_ret = H5Arename_by_name(fid, ".", "", INVALID_RENAME_TEST_NEW_ATTR_NAME, H5P_DEFAULT); + } H5E_END_TRY; + + CHECK(err_ret, SUCCEED, "H5Arename_by_name"); + + H5E_BEGIN_TRY { + err_ret = H5Arename_by_name(fid, ".", INVALID_RENAME_TEST_ATTR_NAME, NULL, H5P_DEFAULT); + } H5E_END_TRY; + + CHECK(err_ret, SUCCEED, "H5Arename_by_name"); + + H5E_BEGIN_TRY { + err_ret = H5Arename_by_name(fid, ".", INVALID_RENAME_TEST_ATTR_NAME, "", H5P_DEFAULT); + } H5E_END_TRY; + + CHECK(err_ret, SUCCEED, "H5Arename_by_name"); + + /* Close dataspace */ + err_ret = H5Sclose(sid); + CHECK(err_ret, FAIL, "H5Sclose"); + + /* Close attribute */ + err_ret = H5Aclose(attr); + CHECK(err_ret, FAIL, "H5Aclose"); + + /* Close file */ + err_ret = H5Fclose(fid); + CHECK(err_ret, FAIL, "H5Fclose"); +} + + +/*************************************************************** +** +** test_attr_get_name_invalid_buf(): A test to ensure that +** passing a NULL buffer to H5Aget_name(_by_idx) when +** the 'size' parameter is non-zero doesn't cause bad +** behavior. +** +****************************************************************/ +static void +test_attr_get_name_invalid_buf(hid_t fcpl, hid_t fapl) +{ + ssize_t err_ret = -1; + hid_t fid; + hid_t attr; + hid_t sid; + + /* Create dataspace for attribute */ + sid = H5Screate(H5S_SCALAR); + CHECK(sid, FAIL, "H5Screate"); + + /* Create file */ + fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl); + CHECK(fid, FAIL, "H5Fcreate"); + + /* Create attribute */ + attr = H5Acreate2(fid, GET_NAME_INVALID_BUF_TEST_ATTR_NAME, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); + CHECK(attr, FAIL, "H5Acreate2"); + + H5E_BEGIN_TRY { + err_ret = H5Aget_name(attr, 1, NULL); + } H5E_END_TRY; + + VERIFY(err_ret, FAIL, "H5Aget_name"); + + H5E_BEGIN_TRY { + err_ret = H5Aget_name_by_idx(fid, ".", H5_INDEX_NAME, H5_ITER_INC, 0, NULL, 1, H5P_DEFAULT); + } H5E_END_TRY; + + VERIFY(err_ret, FAIL, "H5Aget_name_by_idx"); + + /* Close dataspace */ + err_ret = H5Sclose(sid); + CHECK(err_ret, FAIL, "H5Sclose"); + + /* Close attribute */ + err_ret = H5Aclose(attr); + CHECK(err_ret, FAIL, "H5Aclose"); + + /* Close file */ + err_ret = H5Fclose(fid); + CHECK(err_ret, FAIL, "H5Fclose"); +} + + /**************************************************************** ** ** test_attr_delete_by_idx(): Test basic H5A (attribute) code. @@ -5912,8 +6231,13 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(sid, FAIL, "H5Screate"); /* Create dataset creation property list */ - dcpl = H5Pcreate(H5P_DATASET_CREATE); - CHECK(dcpl, FAIL, "H5Pcreate"); + if (dcpl_g == H5P_DEFAULT) { + dcpl = H5Pcreate(H5P_DATASET_CREATE); + CHECK(dcpl, FAIL, "H5Pcreate"); + } else { + dcpl = H5Pcopy(dcpl_g); + CHECK(dcpl, FAIL, "H5Pcopy"); + } /* Query the attribute creation properties */ ret = H5Pget_attr_phase_change(dcpl, &max_compact, &min_dense); @@ -6855,8 +7179,13 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(sid, FAIL, "H5Screate"); /* Create dataset creation property list */ - dcpl = H5Pcreate(H5P_DATASET_CREATE); - CHECK(dcpl, FAIL, "H5Pcreate"); + if (dcpl_g == H5P_DEFAULT) { + dcpl = H5Pcreate(H5P_DATASET_CREATE); + CHECK(dcpl, FAIL, "H5Pcreate"); + } else { + dcpl = H5Pcopy(dcpl_g); + CHECK(dcpl, FAIL, "H5Pcopy"); + } /* Query the attribute creation properties */ ret = H5Pget_attr_phase_change(dcpl, &max_compact, &min_dense); @@ -7216,8 +7545,13 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(sid, FAIL, "H5Screate"); /* Create dataset creation property list */ - dcpl = H5Pcreate(H5P_DATASET_CREATE); - CHECK(dcpl, FAIL, "H5Pcreate"); + if (dcpl_g == H5P_DEFAULT) { + dcpl = H5Pcreate(H5P_DATASET_CREATE); + CHECK(dcpl, FAIL, "H5Pcreate"); + } else { + dcpl = H5Pcopy(dcpl_g); + CHECK(dcpl, FAIL, "H5Pcopy"); + } /* Query the attribute creation properties */ ret = H5Pget_attr_phase_change(dcpl, &max_compact, &min_dense); @@ -7563,8 +7897,13 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(sid, FAIL, "H5Screate"); /* Create dataset creation property list */ - dcpl = H5Pcreate(H5P_DATASET_CREATE); - CHECK(dcpl, FAIL, "H5Pcreate"); + if (dcpl_g == H5P_DEFAULT) { + dcpl = H5Pcreate(H5P_DATASET_CREATE); + CHECK(dcpl, FAIL, "H5Pcreate"); + } else { + dcpl = H5Pcopy(dcpl_g); + CHECK(dcpl, FAIL, "H5Pcopy"); + } /* Query the attribute creation properties */ ret = H5Pget_attr_phase_change(dcpl, &max_compact, &min_dense); @@ -7817,8 +8156,13 @@ test_attr_create_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(sid, FAIL, "H5Screate"); /* Create dataset creation property list */ - dcpl = H5Pcreate(H5P_DATASET_CREATE); - CHECK(dcpl, FAIL, "H5Pcreate"); + if (dcpl_g == H5P_DEFAULT) { + dcpl = H5Pcreate(H5P_DATASET_CREATE); + CHECK(dcpl, FAIL, "H5Pcreate"); + } else { + dcpl = H5Pcopy(dcpl_g); + CHECK(dcpl, FAIL, "H5Pcopy"); + } /* Query the attribute creation properties */ ret = H5Pget_attr_phase_change(dcpl, &max_compact, &min_dense); @@ -8118,8 +8462,13 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl) } /* end if */ /* Set up to query the object creation properties */ - dcpl = H5Pcreate(H5P_DATASET_CREATE); - CHECK(dcpl, FAIL, "H5Pcreate"); + if (dcpl_g == H5P_DEFAULT) { + dcpl = H5Pcreate(H5P_DATASET_CREATE); + CHECK(dcpl, FAIL, "H5Pcreate"); + } else { + dcpl = H5Pcopy(dcpl_g); + CHECK(dcpl, FAIL, "H5Pcopy"); + } /* Create datasets */ dataset = H5Dcreate2(fid, DSET1_NAME, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); @@ -8449,8 +8798,13 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) } /* end if */ /* Set up to query the object creation properties */ - dcpl = H5Pcreate(H5P_DATASET_CREATE); - CHECK(dcpl, FAIL, "H5Pcreate"); + if (dcpl_g == H5P_DEFAULT) { + dcpl = H5Pcreate(H5P_DATASET_CREATE); + CHECK(dcpl, FAIL, "H5Pcreate"); + } else { + dcpl = H5Pcopy(dcpl_g); + CHECK(dcpl, FAIL, "H5Pcopy"); + } /* Create datasets */ dataset = H5Dcreate2(fid, DSET1_NAME, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); @@ -8895,8 +9249,13 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl) } /* end if */ /* Set up to query the object creation properties */ - dcpl = H5Pcreate(H5P_DATASET_CREATE); - CHECK(dcpl, FAIL, "H5Pcreate"); + if (dcpl_g == H5P_DEFAULT) { + dcpl = H5Pcreate(H5P_DATASET_CREATE); + CHECK(dcpl, FAIL, "H5Pcreate"); + } else { + dcpl = H5Pcopy(dcpl_g); + CHECK(dcpl, FAIL, "H5Pcopy"); + } /* Create datasets */ dataset = H5Dcreate2(fid, DSET1_NAME, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); @@ -9264,8 +9623,13 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl) } /* end if */ /* Set up to query the object creation properties */ - dcpl = H5Pcreate(H5P_DATASET_CREATE); - CHECK(dcpl, FAIL, "H5Pcreate"); + if (dcpl_g == H5P_DEFAULT) { + dcpl = H5Pcreate(H5P_DATASET_CREATE); + CHECK(dcpl, FAIL, "H5Pcreate"); + } else { + dcpl = H5Pcopy(dcpl_g); + CHECK(dcpl, FAIL, "H5Pcopy"); + } /* Create datasets */ dataset = H5Dcreate2(fid, DSET1_NAME, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); @@ -9856,7 +10220,7 @@ test_attr_bug3(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Tcommit2"); /* Create dataset */ - did = H5Dcreate2(fid, "dset", tid2, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + did = H5Dcreate2(fid, "dset", tid2, sid2, H5P_DEFAULT, dcpl_g, H5P_DEFAULT); CHECK(did, FAIL, "H5Dcreate2"); /* Create attribute on datatype, using that datatype as its datatype */ @@ -9991,7 +10355,7 @@ test_attr_bug4(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Tcommit2"); /* Create dataset */ - did = H5Dcreate2(fid, "dset", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + did = H5Dcreate2(fid, "dset", tid, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT); CHECK(did, FAIL, "H5Dcreate2"); /* Create attributes on group and dataset */ @@ -10073,7 +10437,7 @@ test_attr_bug5(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Tcommit2"); /* Create dataset */ - did1 = H5Dcreate2(fid1, BUG3_DSET_NAME, tid1, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + did1 = H5Dcreate2(fid1, BUG3_DSET_NAME, tid1, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT); CHECK(did1, FAIL, "H5Dcreate2"); /* Create attribute on root group */ @@ -10771,120 +11135,107 @@ test_attr(void) { hid_t fapl = (-1), fapl2 = (-1); /* File access property lists */ hid_t fcpl = (-1), fcpl2 = (-1); /* File creation property lists */ - unsigned new_format; /* Whether to use the new format or not */ - unsigned use_shared; /* Whether to use shared attributes or not */ - herr_t ret; /* Generic return value */ + hid_t dcpl = -1; + unsigned new_format; /* Whether to use the new format or not */ + unsigned use_shared; /* Whether to use shared attributes or not */ + unsigned minimize_dset_oh; /* Whether to use minimized dataset object headers */ + herr_t ret; /* Generic return value */ - /* Output message about test being performed */ MESSAGE(5, ("Testing Attributes\n")); - /* Create a default file access property list */ fapl = H5Pcreate(H5P_FILE_ACCESS); CHECK(fapl, FAIL, "H5Pcreate"); - /* Copy the file access property list */ fapl2 = H5Pcopy(fapl); CHECK(fapl2, FAIL, "H5Pcopy"); - - /* Set the "use the latest version of the format" bounds for creating objects in the file */ ret = H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST); CHECK(ret, FAIL, "H5Pset_libver_bounds"); - /* Create a default file creation property list */ fcpl = H5Pcreate(H5P_FILE_CREATE); CHECK(fcpl, FAIL, "H5Pcreate"); - /* Copy the file creation property list */ + /* files with fcpl2 make all attributes ( > 1 byte) shared + * (i.e. all of them :-) */ fcpl2 = H5Pcopy(fcpl); CHECK(fcpl2, FAIL, "H5Pcopy"); - - /* Make attributes > 1 byte shared (i.e. all of them :-) */ ret = H5Pset_shared_mesg_nindexes(fcpl2, (unsigned)1); CHECK_I(ret, "H5Pset_shared_mesg_nindexes"); ret = H5Pset_shared_mesg_index(fcpl2, (unsigned)0, H5O_SHMESG_ATTR_FLAG, (unsigned)1); CHECK_I(ret, "H5Pset_shared_mesg_index"); - /* Loop over using new group format */ - for(new_format = FALSE; new_format <= TRUE; new_format++) { - hid_t my_fapl; + for(minimize_dset_oh = 0; minimize_dset_oh <= 1; minimize_dset_oh++) { + if(minimize_dset_oh == 0) { + MESSAGE(7, ("testing with default dataset object headers\n")); + dcpl_g = H5P_DEFAULT; + } else { + MESSAGE(7, ("testing with minimzied dataset object headers\n")); + dcpl = H5Pcreate(H5P_DATASET_CREATE); + CHECK(dcpl, FAIL, "H5Pcreate"); + ret = H5Pset_dset_no_attrs_hint(dcpl, TRUE); + CHECK_I(ret, "H5Pset_dset_no_attrs_hint"); + dcpl_g = dcpl; + } + + for(new_format = FALSE; new_format <= TRUE; new_format++) { + hid_t my_fapl; - /* Set the FAPL for the type of format */ - if(new_format) { - MESSAGE(7, ("testing with new file format\n")); - my_fapl = fapl2; - } /* end if */ - else { - MESSAGE(7, ("testing with old file format\n")); - my_fapl = fapl; - } /* end else */ + if(new_format) { + MESSAGE(7, ("testing with new file format\n")); + my_fapl = fapl2; + } else { + MESSAGE(7, ("testing with old file format\n")); + my_fapl = fapl; + } - /* These next two tests use the same file information */ - test_attr_basic_write(my_fapl); /* Test basic H5A writing code */ - test_attr_basic_read(my_fapl); /* Test basic H5A reading code */ + /* These next two tests use the same file information */ + test_attr_basic_write(my_fapl); /* Test basic H5A writing code */ + test_attr_basic_read(my_fapl); /* Test basic H5A reading code */ - /* These next two tests use their own file information */ - test_attr_flush(my_fapl); /* Test H5A I/O in the presence of H5Fflush calls */ - test_attr_plist(my_fapl); /* Test attribute property lists */ + /* These next two tests use their own file information */ + test_attr_flush(my_fapl); /* Test H5A I/O in the presence of H5Fflush calls */ + test_attr_plist(my_fapl); /* Test attribute property lists */ - /* These next two tests use the same file information */ - test_attr_compound_write(my_fapl); /* Test complex datatype H5A writing code */ - test_attr_compound_read(my_fapl); /* Test complex datatype H5A reading code */ + /* These next two tests use the same file information */ + test_attr_compound_write(my_fapl); /* Test complex datatype H5A writing code */ + test_attr_compound_read(my_fapl); /* Test complex datatype H5A reading code */ - /* These next two tests use the same file information */ - test_attr_scalar_write(my_fapl); /* Test scalar dataspace H5A writing code */ - test_attr_scalar_read(my_fapl); /* Test scalar dataspace H5A reading code */ + /* These next two tests use the same file information */ + test_attr_scalar_write(my_fapl); /* Test scalar dataspace H5A writing code */ + test_attr_scalar_read(my_fapl); /* Test scalar dataspace H5A reading code */ - /* These next four tests use the same file information */ - test_attr_mult_write(my_fapl); /* Test H5A writing code for multiple attributes */ - test_attr_mult_read(my_fapl); /* Test H5A reading code for multiple attributes */ - test_attr_iterate(my_fapl); /* Test H5A iterator code */ - test_attr_delete(my_fapl); /* Test H5A code for deleting attributes */ + /* These next four tests use the same file information */ + test_attr_mult_write(my_fapl); /* Test H5A writing code for multiple attributes */ + test_attr_mult_read(my_fapl); /* Test H5A reading code for multiple attributes */ + test_attr_iterate(my_fapl); /* Test H5A iterator code */ + test_attr_delete(my_fapl); /* Test H5A code for deleting attributes */ - /* This next test uses its own file information */ - test_attr_dtype_shared(my_fapl); /* Test using shared dataypes in attributes */ + /* This next test uses its own file information */ + test_attr_dtype_shared(my_fapl); /* Test using shared dataypes in attributes */ - /* This next test uses its own file information */ - test_attr_duplicate_ids(my_fapl); + /* This next test uses its own file information */ + test_attr_duplicate_ids(my_fapl); - /* Tests on "new format" attribute storage */ - if(new_format == TRUE) { - /* Loop over using shared attributes */ for(use_shared = FALSE; use_shared <= TRUE; use_shared++) { hid_t my_fcpl; - /* Set the FCPL for shared or not */ - if(use_shared) { + if(new_format == TRUE && use_shared) { MESSAGE(7, ("testing with shared attributes\n")); my_fcpl = fcpl2; - } /* end if */ - else { + } else { MESSAGE(7, ("testing without shared attributes\n")); my_fcpl = fcpl; - } /* end else */ - - /* General attribute tests */ - test_attr_dense_create(my_fcpl, my_fapl); /* Test dense attribute storage creation */ - test_attr_dense_open(my_fcpl, my_fapl); /* Test opening attributes in dense storage */ - test_attr_dense_delete(my_fcpl, my_fapl); /* Test deleting attributes in dense storage */ - test_attr_dense_rename(my_fcpl, my_fapl); /* Test renaming attributes in dense storage */ - test_attr_dense_unlink(my_fcpl, my_fapl); /* Test unlinking object with attributes in dense storage */ - test_attr_dense_limits(my_fcpl, my_fapl); /* Test dense attribute storage limits */ - test_attr_dense_dup_ids(my_fcpl, my_fapl); /* Test duplicated IDs for dense attribute storage */ + } test_attr_big(my_fcpl, my_fapl); /* Test storing big attribute */ test_attr_null_space(my_fcpl, my_fapl); /* Test storing attribute with NULL dataspace */ test_attr_deprec(fcpl, my_fapl); /* Test deprecated API routines */ test_attr_many(new_format, my_fcpl, my_fapl); /* Test storing lots of attributes */ + test_attr_info_null_info_pointer(my_fcpl, my_fapl); /* Test passing a NULL attribute info pointer to H5Aget_info(_by_name/_by_idx) */ + test_attr_rename_invalid_name(my_fcpl, my_fapl); /* Test passing a NULL or empty attribute name to H5Arename(_by_name) */ + test_attr_get_name_invalid_buf(my_fcpl, my_fapl); /* Test passing NULL buffer to H5Aget_name(_by_idx) */ - /* Attribute creation order tests */ - test_attr_corder_create_basic(my_fcpl, my_fapl);/* Test creating an object w/attribute creation order info */ - test_attr_corder_create_compact(my_fcpl, my_fapl); /* Test compact attribute storage on an object w/attribute creation order info */ - test_attr_corder_create_dense(my_fcpl, my_fapl);/* Test dense attribute storage on an object w/attribute creation order info */ - test_attr_corder_create_reopen(my_fcpl, my_fapl);/* Test creating attributes w/reopening file from using new format to using old format */ - test_attr_corder_transition(my_fcpl, my_fapl); /* Test attribute storage transitions on an object w/attribute creation order info */ - test_attr_corder_delete(my_fcpl, my_fapl); /* Test deleting object using dense storage w/attribute creation order info */ - - /* New attribute API routine tests */ + /* New attribute API routine tests + */ test_attr_info_by_idx(new_format, my_fcpl, my_fapl); /* Test querying attribute info by index */ test_attr_delete_by_idx(new_format, my_fcpl, my_fapl); /* Test deleting attribute by index */ test_attr_iterate2(new_format, my_fcpl, my_fapl); /* Test iterating over attributes by index */ @@ -10892,56 +11243,68 @@ test_attr(void) test_attr_open_by_name(new_format, my_fcpl, my_fapl); /* Test opening attributes by name */ test_attr_create_by_name(new_format, my_fcpl, my_fapl); /* Test creating attributes by name */ - /* More complex tests with both "new format" and "shared" attributes */ - if(use_shared == TRUE) { - test_attr_shared_write(my_fcpl, my_fapl); /* Test writing to shared attributes in compact & dense storage */ - test_attr_shared_rename(my_fcpl, my_fapl); /* Test renaming shared attributes in compact & dense storage */ - test_attr_shared_delete(my_fcpl, my_fapl); /* Test deleting shared attributes in compact & dense storage */ - test_attr_shared_unlink(my_fcpl, my_fapl); /* Test unlinking object with shared attributes in compact & dense storage */ - } /* end if */ - - /* Tests that address specific bugs */ + /* Tests that address specific bugs + */ test_attr_bug1(my_fcpl, my_fapl); /* Test odd allocation operations */ test_attr_bug2(my_fcpl, my_fapl); /* Test many deleted attributes */ test_attr_bug3(my_fcpl, my_fapl); /* Test "self referential" attributes */ test_attr_bug4(my_fcpl, my_fapl); /* Test attributes on named datatypes */ test_attr_bug5(my_fcpl, my_fapl); /* Test opening/closing attributes through different file handles */ test_attr_bug6(my_fcpl, my_fapl); /* Test reading empty attribute */ - test_attr_bug7(my_fcpl, my_fapl); /* Test creating and deleting large attributes in ohdr chunk 0 */ + /* test_attr_bug7 is specific to the "new" object header format, + * and in fact fails if used with the old format due to the + * attributes being larger than 64K */ test_attr_bug8(my_fcpl, my_fapl); /* Test attribute expanding object header with undecoded messages */ test_attr_bug9(my_fcpl, my_fapl); /* Test large attributes converting to dense storage */ - test_attr_delete_last_dense(my_fcpl, my_fapl); /* Test */ - } /* end for */ - } /* end if */ - else { - /* General attribute tests */ - test_attr_big(fcpl, my_fapl); /* Test storing big attribute */ - test_attr_null_space(fcpl, my_fapl); /* Test storing attribute with NULL dataspace */ - test_attr_deprec(fcpl, my_fapl); /* Test deprecated API routines */ - test_attr_many(new_format, fcpl, my_fapl); /* Test storing lots of attributes */ - - /* New attribute API routine tests, on old-format storage */ - test_attr_info_by_idx(new_format, fcpl, my_fapl); /* Test querying attribute info by index */ - test_attr_delete_by_idx(new_format, fcpl, my_fapl); /* Test deleting attribute by index */ - test_attr_iterate2(new_format, fcpl, my_fapl); /* Test iterating over attributes by index */ - test_attr_open_by_idx(new_format, fcpl, my_fapl); /* Test opening attributes by index */ - test_attr_open_by_name(new_format, fcpl, my_fapl); /* Test opening attributes by name */ - test_attr_create_by_name(new_format, fcpl, my_fapl); /* Test creating attributes by name */ - - /* Tests that address specific bugs */ - test_attr_bug1(fcpl, my_fapl); /* Test odd allocation operations */ - test_attr_bug2(fcpl, my_fapl); /* Test many deleted attributes */ - test_attr_bug3(fcpl, my_fapl); /* Test "self referential" attributes */ - test_attr_bug4(fcpl, my_fapl); /* Test attributes on named datatypes */ - test_attr_bug5(fcpl, my_fapl); /* Test opening/closing attributes through different file handles */ - test_attr_bug6(fcpl, my_fapl); /* Test reading empty attribute */ - /* Skip test_attr_bug7 because it is specific to the new object - * header format and in fact fails if used with the old format, due - * to the attributes being larger than 64K */ - test_attr_bug8(fcpl, my_fapl); /* Test attribute expanding object header with undecoded messages */ - test_attr_bug9(fcpl, my_fapl); /* Test large attributes converting to dense storage */ - } /* end else */ - } /* end for */ + + /* tests specific to the "new format" + */ + if (new_format == TRUE) { + /* General attribute tests */ + test_attr_dense_create(my_fcpl, my_fapl); /* Test dense attribute storage creation */ + test_attr_dense_open(my_fcpl, my_fapl); /* Test opening attributes in dense storage */ + test_attr_dense_delete(my_fcpl, my_fapl); /* Test deleting attributes in dense storage */ + test_attr_dense_rename(my_fcpl, my_fapl); /* Test renaming attributes in dense storage */ + test_attr_dense_unlink(my_fcpl, my_fapl); /* Test unlinking object with attributes in dense storage */ + test_attr_dense_limits(my_fcpl, my_fapl); /* Test dense attribute storage limits */ + test_attr_dense_dup_ids(my_fcpl, my_fapl); /* Test duplicated IDs for dense attribute storage */ + + /* Attribute creation order tests + */ + test_attr_corder_create_basic(my_fcpl, my_fapl);/* Test creating an object w/attribute creation order info */ + test_attr_corder_create_compact(my_fcpl, my_fapl); /* Test compact attribute storage on an object w/attribute creation order info */ + test_attr_corder_create_dense(my_fcpl, my_fapl);/* Test dense attribute storage on an object w/attribute creation order info */ + test_attr_corder_create_reopen(my_fcpl, my_fapl);/* Test creating attributes w/reopening file from using new format to using old format */ + test_attr_corder_transition(my_fcpl, my_fapl); /* Test attribute storage transitions on an object w/attribute creation order info */ + test_attr_corder_delete(my_fcpl, my_fapl); /* Test deleting object using dense storage w/attribute creation order info */ + + /* More complex tests with exclusively both "new format" and "shared" attributes + */ + if(use_shared == TRUE) { + test_attr_shared_write(my_fcpl, my_fapl); /* Test writing to shared attributes in compact & dense storage */ + test_attr_shared_rename(my_fcpl, my_fapl); /* Test renaming shared attributes in compact & dense storage */ + test_attr_shared_delete(my_fcpl, my_fapl); /* Test deleting shared attributes in compact & dense storage */ + test_attr_shared_unlink(my_fcpl, my_fapl); /* Test unlinking object with shared attributes in compact & dense storage */ + } /* if using shared attributes */ + + test_attr_delete_last_dense(my_fcpl, my_fapl); + + /* test_attr_bug7 is specific to the "new" object header format, + * and in fact fails if used with the old format due to the + * attributes being larger than 64K */ + test_attr_bug7(my_fcpl, my_fapl); /* Test creating and deleting large attributes in ohdr chunk 0 */ + + } /* if using "new format" */ + } /* for unshared/shared attributes */ + } /* for old/new format */ + + if (minimize_dset_oh != 0) { + ret = H5Pclose(dcpl); + CHECK(ret, FAIL, "H5Pclose"); + dcpl_g = H5P_DEFAULT; + } + + } /* for default/minimized dataset object headers */ /* Close FCPLs */ ret = H5Pclose(fcpl); diff --git a/test/tbogus.h5 b/test/tbogus.h5 Binary files differindex 91ab76f..efcbd79 100644 --- a/test/tbogus.h5 +++ b/test/tbogus.h5 diff --git a/test/test_vol_plugin.sh.in b/test/test_vol_plugin.sh.in new file mode 100644 index 0000000..38220ef --- /dev/null +++ b/test/test_vol_plugin.sh.in @@ -0,0 +1,84 @@ +#! /bin/sh +# +# Copyright by The HDF Group. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the COPYING file, which can be found at the root of the source code +# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. +# If you do not have access to either file, you may request a copy from +# help@hdfgroup.org. +# +# This shell script is for testing VOL connector plugins. +# +srcdir=@srcdir@ +TOP_BUILDDIR=@top_builddir@ + +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + +nerrors=0 +verbose=yes +exit_code=$EXIT_SUCCESS + +TEST_NAME=vol_plugin +TEST_BIN=`pwd`/$TEST_NAME +FROM_DIR=`pwd`/.libs +case $(uname) in + CYGWIN* ) + NULL_VOL_PLUGIN="$FROM_DIR/cygnull_vol_connector*" + ;; + *) + NULL_VOL_PLUGIN="$FROM_DIR/libnull_vol_connector*" + ;; +esac +TEMP_PLUGIN_DIR=null_vol_plugin_dir +CP="cp -p" # Use -p to preserve mode,ownership, timestamps +RM="rm -rf" + +# Print a line-line message left justified in a field of 70 characters +# beginning with the word "Testing". +# +TESTING() { + SPACES=" " + echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012' +} + +# Main Body +# Create test directory if necessary. +test -d $TEMP_PLUGIN_DIR || mkdir -p $TEMP_PLUGIN_DIR +if [ $? != 0 ]; then + echo "Failed to create VOL connector plugin test directory ($TEMP_PLUGIN_DIR)" + exit $EXIT_FAILURE +fi + +# Copy plugin for the tests. +$CP $NULL_VOL_PLUGIN $TEMP_PLUGIN_DIR +if [ $? != 0 ]; then + echo "Failed to copy NULL VOL plugin ($NULL_VOL_PLUGIN) to test directory." + exit $EXIT_FAILURE +fi + +# setup plugin path +ENVCMD="env HDF5_PLUGIN_PATH=${TEMP_PLUGIN_DIR}" + +# Run the test +$ENVCMD $TEST_BIN +if [ $? != 0 ]; then + nerrors=`expr $nerrors + 1` +fi + +# print results +if test $nerrors -ne 0 ; then + echo "$nerrors errors encountered" + exit_code=$EXIT_FAILURE +else + echo "All VOL plugin tests passed." + exit_code=$EXIT_SUCCESS +fi + +# Clean up temporary files/directories and leave +$RM $TEMP_PLUGIN_DIR + +exit $exit_code diff --git a/test/test_filenotclosed.sh.in b/test/testabort_fail.sh.in index 0b43c5b..925d8a4 100644 --- a/test/test_filenotclosed.sh.in +++ b/test/testabort_fail.sh.in @@ -13,6 +13,9 @@ # # Test to verify that the assertion/abort failure is fixed when the application # does not close the file. (See HDFFV-10160) +# +# Test to verify that the infinite loop closing library/abort failure is fixed +# when the application creates and removes dense attributes (See HDFFV-10659) srcdir=@srcdir@ @@ -20,22 +23,44 @@ nerrors=0 ############################################################################## ############################################################################## -### T H E T E S T ### +### T H E T E S T S ### ############################################################################## ############################################################################## - +# +# echo "Testing file not closed assertion/abort failure" TEST_NAME=filenotclosed # The test name -TEST_BIN=`pwd`/$TEST_NAME # The path of the test binary +TEST_BIN=`pwd`/$TEST_NAME # The path of the test binary # # Run the test -#$RUNSERIAL $TEST_BIN >/dev/null 2>&1 -$RUNSERIAL $TEST_BIN 2>&1 +$RUNSERIAL $TEST_BIN >/dev/null 2>&1 exitcode=$? if [ $exitcode -eq 0 ]; then echo "Test PASSED" else + echo "Test FAILED" nerrors="`expr $nerrors + 1`" - echo "***Error encountered***" fi -exit $nerrors +# +# +echo "Testing infinite loop closing library/abort failure" +TEST_NAME=del_many_dense_attrs # The test name +TEST_BIN=`pwd`/$TEST_NAME # The path of the test binary +# Run the test +$RUNSERIAL $TEST_BIN >/dev/null 2>&1 +exitcode=$? +if [ $exitcode -eq 0 ]; then + echo "Test PASSED" +else + echo "Test FAILED" + nerrors="`expr $nerrors + 1`" +fi +# +# +if test $nerrors -eq 0 ; then + echo "All tests for abort failure passed." + exit 0 +else + echo "Tests for abort failure failed with $nerrors errors." + exit 1 +fi diff --git a/test/testfiles/plist_files/def_fapl_32be b/test/testfiles/plist_files/def_fapl_32be Binary files differindex 6e94011..53ef572 100644 --- a/test/testfiles/plist_files/def_fapl_32be +++ b/test/testfiles/plist_files/def_fapl_32be diff --git a/test/testfiles/plist_files/def_fapl_32le b/test/testfiles/plist_files/def_fapl_32le Binary files differindex 6e94011..53ef572 100644 --- a/test/testfiles/plist_files/def_fapl_32le +++ b/test/testfiles/plist_files/def_fapl_32le diff --git a/test/testfiles/plist_files/def_fapl_64be b/test/testfiles/plist_files/def_fapl_64be Binary files differindex 6e94011..53ef572 100644 --- a/test/testfiles/plist_files/def_fapl_64be +++ b/test/testfiles/plist_files/def_fapl_64be diff --git a/test/testfiles/plist_files/def_fapl_64le b/test/testfiles/plist_files/def_fapl_64le Binary files differindex 6e94011..53ef572 100644 --- a/test/testfiles/plist_files/def_fapl_64le +++ b/test/testfiles/plist_files/def_fapl_64le diff --git a/test/testfiles/plist_files/fapl_32be b/test/testfiles/plist_files/fapl_32be Binary files differindex 237b291..d89a44c 100644 --- a/test/testfiles/plist_files/fapl_32be +++ b/test/testfiles/plist_files/fapl_32be diff --git a/test/testfiles/plist_files/fapl_32le b/test/testfiles/plist_files/fapl_32le Binary files differindex 237b291..d89a44c 100644 --- a/test/testfiles/plist_files/fapl_32le +++ b/test/testfiles/plist_files/fapl_32le diff --git a/test/testfiles/plist_files/fapl_64be b/test/testfiles/plist_files/fapl_64be Binary files differindex 237b291..d89a44c 100644 --- a/test/testfiles/plist_files/fapl_64be +++ b/test/testfiles/plist_files/fapl_64be diff --git a/test/testfiles/plist_files/fapl_64le b/test/testfiles/plist_files/fapl_64le Binary files differindex 237b291..d89a44c 100644 --- a/test/testfiles/plist_files/fapl_64le +++ b/test/testfiles/plist_files/fapl_64le diff --git a/test/testfiles/plist_files/lapl_32be b/test/testfiles/plist_files/lapl_32be Binary files differindex 9d81759..eee238e 100644 --- a/test/testfiles/plist_files/lapl_32be +++ b/test/testfiles/plist_files/lapl_32be diff --git a/test/testfiles/plist_files/lapl_32le b/test/testfiles/plist_files/lapl_32le Binary files differindex 9d81759..eee238e 100644 --- a/test/testfiles/plist_files/lapl_32le +++ b/test/testfiles/plist_files/lapl_32le diff --git a/test/testfiles/plist_files/lapl_64be b/test/testfiles/plist_files/lapl_64be Binary files differindex 9d81759..eee238e 100644 --- a/test/testfiles/plist_files/lapl_64be +++ b/test/testfiles/plist_files/lapl_64be diff --git a/test/testfiles/plist_files/lapl_64le b/test/testfiles/plist_files/lapl_64le Binary files differindex 9d81759..eee238e 100644 --- a/test/testfiles/plist_files/lapl_64le +++ b/test/testfiles/plist_files/lapl_64le diff --git a/test/testframe.c b/test/testframe.c index 335118c..97b2d1f 100644 --- a/test/testframe.c +++ b/test/testframe.c @@ -15,7 +15,7 @@ * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu> * Tuesday, January 6, 2004 * - * Purpose: Provides support functions for the testing framework. + * Purpose: Provides support functions for the testing framework. * */ @@ -28,24 +28,25 @@ #define MAXTESTDESC 64 typedef struct TestStruct { - int NumErrors; - char Description[MAXTESTDESC]; - int SkipFlag; - char Name[MAXTESTNAME]; - void (*Call)(void); - void (*Cleanup)(void); - const void *Parameters; + int NumErrors; + char Description[MAXTESTDESC]; + int SkipFlag; + char Name[MAXTESTNAME]; + void (*Call)(void); + void (*Cleanup)(void); + const void *Parameters; } TestStruct; /* * Variables used by testing framework. */ +static int enable_error_stack = 0; /* enable error stack; disable=0 enable=1 */ static int num_errs = 0; /* Total number of errors during testing */ int TestVerbosity = VERBO_DEF; /* Default Verbosity is Low */ -static int Summary = 0; /* Show test summary. Default is no. */ -static int CleanUp = 1; /* Do cleanup or not. Default is yes. */ -static int TestExpress = -1; /* Do TestExpress or not. -1 means not set yet. */ +static int Summary = 0; /* Show test summary. Default is no. */ +static int CleanUp = 1; /* Do cleanup or not. Default is yes. */ +static int TestExpress = -1; /* Do TestExpress or not. -1 means not set yet. */ static TestStruct *Test = NULL; /* Array of tests */ static unsigned TestAlloc = 0; /* Size of the Test array */ static unsigned Index = 0; @@ -54,7 +55,7 @@ static const char *TestProgName = NULL; static void (*TestPrivateUsage)(void) = NULL; static int (*TestPrivateParser)(int ac, char *av[]) = NULL; - + /* * Setup a test function and add it to the list of tests. * It must have no parameters and returns void. @@ -74,12 +75,12 @@ AddTest(const char *TheName, void (*TheCall) (void), void (*Cleanup) (void), con /* Sanity checking */ if (HDstrlen(TheDescr) >= MAXTESTDESC) { printf("Test description ('%s') too long, increase MAXTESTDESC(%d).\n", - TheDescr, MAXTESTDESC); + TheDescr, MAXTESTDESC); exit(EXIT_FAILURE); } /* end if */ if (HDstrlen(TheName) >= MAXTESTNAME) { printf("Test name too long, increase MAXTESTNAME(%d).\n", - MAXTESTNAME); + MAXTESTNAME); exit(EXIT_FAILURE); } /* end if */ @@ -102,12 +103,12 @@ AddTest(const char *TheName, void (*TheCall) (void), void (*Cleanup) (void), con /* Set up test function */ HDstrcpy(Test[Index].Description, TheDescr); if(*TheName != '-') { - HDstrcpy(Test[Index].Name, TheName); - Test[Index].SkipFlag = 0; + HDstrcpy(Test[Index].Name, TheName); + Test[Index].SkipFlag = 0; } - else { /* skip test by default */ - HDstrcpy(Test[Index].Name, TheName+1); - Test[Index].SkipFlag = 1; + else { /* skip test by default */ + HDstrcpy(Test[Index].Name, TheName+1); + Test[Index].SkipFlag = 1; } Test[Index].Call = TheCall; Test[Index].Cleanup = Cleanup; @@ -118,7 +119,7 @@ AddTest(const char *TheName, void (*TheCall) (void), void (*Cleanup) (void), con Index++; } - + /* * Initialize testing framework * @@ -130,8 +131,8 @@ AddTest(const char *TheName, void (*TheCall) (void), void (*Cleanup) (void), con * private options. Default to NULL which means none is provided. * * Modifications: - * Albert Cheng 2004/08/17 - * Added the ProgName, private_usage and private_parser arguments. + * Albert Cheng 2004/08/17 + * Added the ProgName, private_usage and private_parser arguments. */ void TestInit(const char *ProgName, void (*private_usage)(void), int (*private_parser)(int ac, char *av[])) { @@ -140,7 +141,8 @@ void TestInit(const char *ProgName, void (*private_usage)(void), int (*private_p * half the functions this test calls are private, so automatic error * reporting wouldn't do much good since it's triggered at the API layer. */ - H5Eset_auto2(H5E_DEFAULT, NULL, NULL); + if (enable_error_stack == 0) + H5Eset_auto2(H5E_DEFAULT, NULL, NULL); /* * Record the program name and private routines if provided. @@ -152,50 +154,50 @@ void TestInit(const char *ProgName, void (*private_usage)(void), int (*private_p TestPrivateParser = private_parser; } - + /* * Print test usage. - * First print the common test options, then the extra options if provided. + * First print the common test options, then the extra options if provided. * * Modification: - * 2004/08/18 Albert Cheng. Add TestPrivateUsage feature. + * 2004/08/18 Albert Cheng. Add TestPrivateUsage feature. */ void TestUsage(void) { - unsigned i; - - print_func("Usage: %s [-v[erbose] (l[ow]|m[edium]|h[igh]|0-9)] %s\n", - TestProgName, (TestPrivateUsage ? "<extra options>" : "")); - print_func(" [-[e]x[clude] name]+ \n"); - print_func(" [-o[nly] name]+ \n"); - print_func(" [-b[egin] name] \n"); - print_func(" [-s[ummary]] \n"); - print_func(" [-c[leanoff]] \n"); - print_func(" [-h[elp]] \n"); - print_func("\n\n"); - print_func("verbose controls the amount of information displayed\n"); - print_func("exclude to exclude tests by name\n"); - print_func("only to name tests which should be run\n"); - print_func("begin start at the name of the test givin\n"); - print_func("summary prints a summary of test results at the end\n"); - print_func("cleanoff does not delete *.hdf files after execution of tests\n"); - print_func("help print out this information\n"); - if (TestPrivateUsage){ - print_func("\nExtra options\n"); - TestPrivateUsage(); - } - print_func("\n\n"); - print_func("This program currently tests the following: \n\n"); - print_func("%16s %s\n", "Name", "Description"); - print_func("%16s %s\n", "----", "-----------"); - - for (i = 0; i < Index; i++) - print_func("%16s %s\n", Test[i].Name, Test[i].Description); - - print_func("\n\n"); + unsigned i; + + print_func("Usage: %s [-v[erbose] (l[ow]|m[edium]|h[igh]|0-9)] %s\n", + TestProgName, (TestPrivateUsage ? "<extra options>" : "")); + print_func(" [-[e]x[clude] name]+ \n"); + print_func(" [-o[nly] name]+ \n"); + print_func(" [-b[egin] name] \n"); + print_func(" [-s[ummary]] \n"); + print_func(" [-c[leanoff]] \n"); + print_func(" [-h[elp]] \n"); + print_func("\n\n"); + print_func("verbose controls the amount of information displayed\n"); + print_func("exclude to exclude tests by name\n"); + print_func("only to name tests which should be run\n"); + print_func("begin start at the name of the test givin\n"); + print_func("summary prints a summary of test results at the end\n"); + print_func("cleanoff does not delete *.hdf files after execution of tests\n"); + print_func("help print out this information\n"); + if (TestPrivateUsage){ + print_func("\nExtra options\n"); + TestPrivateUsage(); + } + print_func("\n\n"); + print_func("This program currently tests the following: \n\n"); + print_func("%16s %s\n", "Name", "Description"); + print_func("%16s %s\n", "----", "-----------"); + + for (i = 0; i < Index; i++) + print_func("%16s %s\n", Test[i].Name, Test[i].Description); + + print_func("\n\n"); } - + /* * Print test info. */ @@ -209,7 +211,7 @@ void TestInfo(const char *ProgName) print_func("Linked with hdf5 version %u.%u release %u\n", major, minor, release); } - + /* * Parse command line information. * argc, argv: the usual command line argument count and strings @@ -218,7 +220,7 @@ void TestInfo(const char *ProgName) * exit EXIT_FAILURE if error is encountered. * * Modification: - * 2004/08/18 Albert Cheng. Add extra_parse feature. + * 2004/08/18 Albert Cheng. Add extra_parse feature. */ void TestParseCmdLine(int argc, char *argv[]) { @@ -226,80 +228,82 @@ void TestParseCmdLine(int argc, char *argv[]) int ret_code; while (argv++, --argc > 0){ - if ((HDstrcmp(*argv, "-verbose") == 0) || - (HDstrcmp(*argv, "-v") == 0)) { - if (argc > 0){ - --argc; ++argv; - ParseTestVerbosity(*argv); - }else{ - TestUsage(); - exit(EXIT_FAILURE); - } - } - else if (((HDstrcmp(*argv, "-exclude") == 0) || - (HDstrcmp(*argv, "-x") == 0))) { - if (argc > 0){ - --argc; ++argv; - SetTest(*argv, SKIPTEST); - }else{ - TestUsage(); - exit(EXIT_FAILURE); - } - } - else if (((HDstrcmp(*argv, "-begin") == 0) || - (HDstrcmp(*argv, "-b") == 0))) { - if (argc > 0){ - --argc; ++argv; - SetTest(*argv, BEGINTEST); - }else{ - TestUsage(); - exit(EXIT_FAILURE); - } - } - else if (((HDstrcmp(*argv, "-only") == 0) || - (HDstrcmp(*argv, "-o") == 0))) { - if(argc > 0) { - unsigned Loop; - - --argc; ++argv; - - /* Skip all tests, then activate only one. */ + if ((HDstrcmp(*argv, "-verbose") == 0) || + (HDstrcmp(*argv, "-v") == 0)) { + if (argc > 0){ + --argc; ++argv; + ParseTestVerbosity(*argv); + }else{ + TestUsage(); + exit(EXIT_FAILURE); + } + } + else if (((HDstrcmp(*argv, "-exclude") == 0) || + (HDstrcmp(*argv, "-x") == 0))) { + if (argc > 0){ + --argc; ++argv; + SetTest(*argv, SKIPTEST); + }else{ + TestUsage(); + exit(EXIT_FAILURE); + } + } + else if (((HDstrcmp(*argv, "-begin") == 0) || + (HDstrcmp(*argv, "-b") == 0))) { + if (argc > 0){ + --argc; ++argv; + SetTest(*argv, BEGINTEST); + }else{ + TestUsage(); + exit(EXIT_FAILURE); + } + } + else if (((HDstrcmp(*argv, "-only") == 0) || + (HDstrcmp(*argv, "-o") == 0))) { + if(argc > 0) { + unsigned Loop; + + --argc; ++argv; + + /* Skip all tests, then activate only one. */ if(!skipped_all) { for(Loop = 0; Loop < Index; Loop++) Test[Loop].SkipFlag = 1; skipped_all = TRUE; } /* end if */ - SetTest(*argv, ONLYTEST); - } /* end if */ + SetTest(*argv, ONLYTEST); + } /* end if */ else { - TestUsage(); - exit(EXIT_FAILURE); - } - } - else if ((HDstrcmp(*argv, "-summary") == 0) || (HDstrcmp(*argv, "-s") == 0)) - Summary = 1; - else if ((HDstrcmp(*argv, "-help") == 0) || (HDstrcmp(*argv, "-h") == 0)) { - TestUsage(); - exit(EXIT_SUCCESS); + TestUsage(); + exit(EXIT_FAILURE); } - else if ((HDstrcmp(*argv, "-cleanoff") == 0) || (HDstrcmp(*argv, "-c") == 0)) - SetTestNoCleanup(); - else { - /* non-standard option. Break out. */ - break; - } + } + else if ((HDstrcmp(*argv, "-summary") == 0) || (HDstrcmp(*argv, "-s") == 0)) + Summary = 1; + else if (HDstrcmp(*argv, "-enable-error-stack") == 0) + enable_error_stack = 1; + else if ((HDstrcmp(*argv, "-help") == 0) || (HDstrcmp(*argv, "-h") == 0)) { + TestUsage(); + exit(EXIT_SUCCESS); + } + else if ((HDstrcmp(*argv, "-cleanoff") == 0) || (HDstrcmp(*argv, "-c") == 0)) + SetTestNoCleanup(); + else { + /* non-standard option. Break out. */ + break; + } } /* Call extra parsing function if provided. */ if (NULL != TestPrivateParser){ - ret_code=TestPrivateParser(argc+1, argv-1); - if (ret_code != 0) - exit(EXIT_FAILURE); + ret_code=TestPrivateParser(argc+1, argv-1); + if (ret_code != 0) + exit(EXIT_FAILURE); } } - + /* * Perform Tests. */ @@ -314,10 +318,10 @@ void PerformTests(void) MESSAGE(2, ("Testing -- %s (%s) \n", Test[Loop].Description, Test[Loop].Name)); MESSAGE(5, ("===============================================\n")); Test[Loop].NumErrors = num_errs; - Test_parameters = Test[Loop].Parameters; - ALARM_ON; + Test_parameters = Test[Loop].Parameters; + ALARM_ON; Test[Loop].Call(); - ALARM_OFF; + ALARM_OFF; Test[Loop].NumErrors = num_errs - Test[Loop].NumErrors; MESSAGE(5, ("===============================================\n")); MESSAGE(5, ("There were %d errors detected.\n\n", (int)Test[Loop].NumErrors)); @@ -332,7 +336,7 @@ void PerformTests(void) print_func("All tests were successful. \n\n"); } - + /* * Display test summary. */ @@ -354,7 +358,7 @@ void TestSummary(void) print_func("\n\n"); } - + /* * Cleanup files from testing */ @@ -370,7 +374,7 @@ void TestCleanup(void) Test[Loop].Cleanup(); } - + /* * Shutdown the test infrastructure */ @@ -380,7 +384,7 @@ void TestShutdown(void) HDfree(Test); } - + /* * Retrieve the verbosity level for the testing framework */ @@ -504,16 +508,16 @@ int SetTestNoCleanup(void) void ParseTestVerbosity(char *argv) { if (*argv == 'l') - SetTestVerbosity(VERBO_LO); + SetTestVerbosity(VERBO_LO); else if (*argv == 'm') - SetTestVerbosity(VERBO_MED); + SetTestVerbosity(VERBO_MED); else if (*argv == 'h') - SetTestVerbosity(VERBO_HI); + SetTestVerbosity(VERBO_HI); else - SetTestVerbosity(atoi(argv)); + SetTestVerbosity(atoi(argv)); } - + /* * Retrieve the number of testing errors for the testing framework */ @@ -522,7 +526,7 @@ H5_ATTR_PURE int GetTestNumErrs(void) return(num_errs); } - + /* * Increment the number of testing errors */ @@ -531,7 +535,7 @@ void IncTestNumErrs(void) num_errs++; } - + /* * Retrieve the current Test Parameters pointer. */ @@ -540,7 +544,7 @@ H5_ATTR_PURE const void *GetTestParameters(void) return(Test_parameters); } - + /* * This routine is designed to provide equivalent functionality to 'printf' * and also increment the error count for the testing framework. @@ -563,7 +567,7 @@ TestErrPrintf(const char *format, ...) return ret_value; } - + /* * Set (control) which test will be tested. * SKIPTEST: skip this test @@ -576,41 +580,41 @@ void SetTest(const char *testname, int action) unsigned Loop; switch (action){ - case SKIPTEST: - for (Loop = 0; Loop < Index; Loop++) - if (HDstrcmp(testname, Test[Loop].Name) == 0){ - Test[Loop].SkipFlag = 1; - break; - } - break; - case BEGINTEST: - for (Loop = 0; Loop < Index; Loop++) { - if (HDstrcmp(testname, Test[Loop].Name) != 0) - Test[Loop].SkipFlag = 1; - else{ - /* Found it. Set it to run. Done. */ - Test[Loop].SkipFlag = 0; - break; - } - } - break; - case ONLYTEST: - for (Loop = 0; Loop < Index; Loop++) { - if (HDstrcmp(testname, Test[Loop].Name) == 0) { - /* Found it. Set it to run. Break to skip the rest. */ - Test[Loop].SkipFlag = 0; - break; - } - } - break; - default: - /* error */ - printf("*** ERROR: Unknown action (%d) for SetTest\n", action); - break; + case SKIPTEST: + for (Loop = 0; Loop < Index; Loop++) + if (HDstrcmp(testname, Test[Loop].Name) == 0){ + Test[Loop].SkipFlag = 1; + break; + } + break; + case BEGINTEST: + for (Loop = 0; Loop < Index; Loop++) { + if (HDstrcmp(testname, Test[Loop].Name) != 0) + Test[Loop].SkipFlag = 1; + else{ + /* Found it. Set it to run. Done. */ + Test[Loop].SkipFlag = 0; + break; + } + } + break; + case ONLYTEST: + for (Loop = 0; Loop < Index; Loop++) { + if (HDstrcmp(testname, Test[Loop].Name) == 0) { + /* Found it. Set it to run. Break to skip the rest. */ + Test[Loop].SkipFlag = 0; + break; + } + } + break; + default: + /* error */ + printf("*** ERROR: Unknown action (%d) for SetTest\n", action); + break; } } - + /* * Enable alarm on test execution, configurable by environment variable */ diff --git a/test/tfile.c b/test/tfile.c index e342da0..c5e913c 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -1430,7 +1430,6 @@ test_obj_count_and_id(hid_t fid1, hid_t fid2, hid_t did, hid_t gid1, case H5I_DATATYPE: case H5I_DATASPACE: case H5I_ATTR: - case H5I_REFERENCE: case H5I_VFL: case H5I_VOL: case H5I_GENPROP_CLS: @@ -1596,16 +1595,18 @@ test_file_perm2(void) ** *****************************************************************/ static void -test_file_is_accessible(void) +test_file_is_accessible(const char *env_h5_drvr) { hid_t fid; /* File opened with read-write permission */ hid_t fcpl_id; /* File creation property list */ hid_t fapl = -1; /* File access property list */ int fd; /* POSIX file descriptor */ + char filename[FILENAME_LEN]; /* Filename to use */ ssize_t nbytes; /* Number of bytes written */ unsigned u; /* Local index variable */ unsigned char buf[1024]; /* Buffer of data to write */ htri_t status; /* Whether a file is an HDF5 file */ + hbool_t single_file_vfd; /* Whether VFD used is a single file */ herr_t ret; /* Output message about test being performed */ @@ -1614,9 +1615,10 @@ test_file_is_accessible(void) /* Get FAPL */ fapl = h5_fileaccess(); CHECK(fapl, FAIL, "H5Pcreate"); + h5_fixname(FILE1, fapl, filename, sizeof filename); /* Create a file */ - fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); + fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); CHECK(fid, FAIL, "H5Fcreate"); /* Close file */ @@ -1624,53 +1626,60 @@ test_file_is_accessible(void) CHECK(ret, FAIL, "H5Fclose"); /* Verify that the file is an HDF5 file */ - status = H5Fis_accessible(FILE1, fapl); + status = H5Fis_accessible(filename, fapl); VERIFY(status, TRUE, "H5Fis_accessible"); - /* Create a file creation property list with a non-default user block size */ - fcpl_id = H5Pcreate(H5P_FILE_CREATE); - CHECK(fcpl_id, FAIL, "H5Pcreate"); + /* This test is not currently working for the family VFD */ + if(0 != HDstrcmp(env_h5_drvr, "family")) { + /* Create a file creation property list with a non-default user block size */ + fcpl_id = H5Pcreate(H5P_FILE_CREATE); + CHECK(fcpl_id, FAIL, "H5Pcreate"); - ret = H5Pset_userblock(fcpl_id, (hsize_t)2048); - CHECK(ret, FAIL, "H5Pset_userblock"); + ret = H5Pset_userblock(fcpl_id, (hsize_t)2048); + CHECK(ret, FAIL, "H5Pset_userblock"); - /* Create file with non-default user block */ - fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl_id, fapl); - CHECK(fid, FAIL, "H5Fcreate"); + /* Create file with non-default user block */ + fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_id, fapl); + CHECK(fid, FAIL, "H5Fcreate"); - /* Release file-creation property list */ - ret = H5Pclose(fcpl_id); - CHECK(ret, FAIL, "H5Pclose"); + /* Release file-creation property list */ + ret = H5Pclose(fcpl_id); + CHECK(ret, FAIL, "H5Pclose"); - /* Close file */ - ret = H5Fclose(fid); - CHECK(ret, FAIL, "H5Fclose"); + /* Close file */ + ret = H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); - /* Verify that the file is an HDF5 file */ - status = H5Fis_accessible(FILE1, fapl); - VERIFY(status, TRUE, "H5Fis_accessible"); + /* Verify that the file is an HDF5 file */ + status = H5Fis_accessible(filename, fapl); + VERIFY(status, TRUE, "H5Fis_accessible"); + } /* end if */ - /* Create non-HDF5 file and check it */ - fd = HDopen(FILE1, O_RDWR|O_CREAT|O_TRUNC, H5_POSIX_CREATE_MODE_RW); - CHECK(fd, FAIL, "HDopen"); + /* This test only works for VFDs with a single file */ + single_file_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family")); + if(single_file_vfd) { + /* Create non-HDF5 file and check it */ + fd = HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, H5_POSIX_CREATE_MODE_RW); + CHECK(fd, FAIL, "HDopen"); - /* Initialize information to write */ - for (u=0; u<1024; u++) - buf[u]=(unsigned char)u; + /* Initialize information to write */ + for (u=0; u<1024; u++) + buf[u]=(unsigned char)u; - /* Write some information */ - nbytes = HDwrite(fd, buf, (size_t)1024); - VERIFY(nbytes, 1024, "HDwrite"); + /* Write some information */ + nbytes = HDwrite(fd, buf, (size_t)1024); + VERIFY(nbytes, 1024, "HDwrite"); - /* Close the file */ - ret = HDclose(fd); - CHECK(ret, FAIL, "HDclose"); + /* Close the file */ + ret = HDclose(fd); + CHECK(ret, FAIL, "HDclose"); - /* Verify that the file is not an HDF5 file */ - status = H5Fis_accessible(FILE1, fapl); - VERIFY(status, FALSE, "H5Fis_accessible"); + /* Verify that the file is not an HDF5 file */ + status = H5Fis_accessible(filename, fapl); + VERIFY(status, FALSE, "H5Fis_accessible"); + } /* end if */ /* Close property list */ ret = H5Pclose(fapl); @@ -1694,6 +1703,7 @@ test_file_ishdf5(void) hid_t fcpl; /* File creation property list */ hid_t fapl = -1; /* File access property list */ int fd; /* File Descriptor */ + char filename[FILENAME_LEN]; /* Filename to use */ ssize_t nbytes; /* Number of bytes written */ unsigned u; /* Local index variable */ unsigned char buf[1024]; /* Buffer of data to write */ @@ -1706,9 +1716,10 @@ test_file_ishdf5(void) /* Get FAPL */ fapl = h5_fileaccess(); CHECK(fapl, FAIL, "H5Pcreate"); + h5_fixname(FILE1, fapl, filename, sizeof filename); /* Create a file */ - file = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); + file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); CHECK(file, FAIL, "H5Fcreate"); /* Close file */ @@ -1716,7 +1727,7 @@ test_file_ishdf5(void) CHECK(ret, FAIL, "H5Fclose"); /* Verify that the file is an HDF5 file */ - status = H5Fis_hdf5(FILE1); + status = H5Fis_hdf5(filename); VERIFY(status, TRUE, "H5Fis_hdf5"); @@ -1728,7 +1739,7 @@ test_file_ishdf5(void) CHECK(ret, FAIL, "H5Pset_userblock"); /* Create file with non-default user block */ - file = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl, fapl); + file = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl); CHECK(file, FAIL, "H5Fcreate"); /* Release file-creation property list */ @@ -1740,12 +1751,12 @@ test_file_ishdf5(void) CHECK(ret, FAIL, "H5Fclose"); /* Verify that the file is an HDF5 file */ - status = H5Fis_hdf5(FILE1); + status = H5Fis_hdf5(filename); VERIFY(status, TRUE, "H5Fis_hdf5"); /* Create non-HDF5 file and check it */ - fd = HDopen(FILE1, O_RDWR|O_CREAT|O_TRUNC, H5_POSIX_CREATE_MODE_RW); + fd = HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, H5_POSIX_CREATE_MODE_RW); CHECK(fd, FAIL, "HDopen"); /* Initialize information to write */ @@ -1761,7 +1772,7 @@ test_file_ishdf5(void) CHECK(ret, FAIL, "HDclose"); /* Verify that the file is not an HDF5 file */ - status = H5Fis_hdf5(FILE1); + status = H5Fis_hdf5(filename); VERIFY(status, FALSE, "H5Fis_hdf5"); /* Close property list */ @@ -2248,6 +2259,7 @@ test_file_double_file_dataset_open(hbool_t new_format) hsize_t max_dims2[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* Maximum dimension sizes for v2 B-tree index */ hsize_t chunks[1] = {2}, chunks2[2] = {4, 5}; /* Chunk dimension sizes */ hsize_t size; /* File size */ + char filename[FILENAME_LEN]; /* Filename to use */ const char* data[] = {"String 1", "String 2", "String 3", "String 4", "String 5"}; /* Input Data */ const char* e_data[] = {"String 1", "String 2", "String 3", "String 4", "String 5", "String 6", "String 7"}; /* Input Data */ char* buffer[5]; /* Output buffer */ @@ -2264,9 +2276,10 @@ test_file_double_file_dataset_open(hbool_t new_format) ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST); CHECK(ret, FAIL, "H5Pset_libver_bounds"); } /* end if */ + h5_fixname(FILE1, fapl, filename, sizeof filename); /* Create the test file */ - fid1 = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); + fid1 = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); CHECK(fid1, FAIL, "H5Fcreate"); /* Create a chunked dataset with fixed array indexing */ @@ -2348,8 +2361,6 @@ test_file_double_file_dataset_open(hbool_t new_format) CHECK(ret, FAIL, "H5Sclose"); ret = H5Pclose(dcpl); CHECK(ret, FAIL, "H5Pclose"); - ret = H5Pclose(fapl); - CHECK(ret, FAIL, "H5Pclose"); ret = H5Fclose(fid1); CHECK(ret, FAIL, "H5Fclose"); @@ -2358,7 +2369,7 @@ test_file_double_file_dataset_open(hbool_t new_format) */ /* First file open */ - fid1 = H5Fopen(FILE1, H5F_ACC_RDWR, H5P_DEFAULT); + fid1 = H5Fopen(filename, H5F_ACC_RDWR, fapl); CHECK(fid1, FAIL, "H5Fopen"); /* First file's dataset open */ @@ -2373,7 +2384,7 @@ test_file_double_file_dataset_open(hbool_t new_format) CHECK(ret, FAIL, "H5Dwrite"); /* Second file open */ - fid2 = H5Fopen(FILE1, H5F_ACC_RDWR, H5P_DEFAULT); + fid2 = H5Fopen(filename, H5F_ACC_RDWR, fapl); CHECK(fid2, FAIL, "H5Fopen"); /* Second file's dataset open */ @@ -2414,11 +2425,11 @@ test_file_double_file_dataset_open(hbool_t new_format) */ /* First file open */ - fid1 = H5Fopen(FILE1, H5F_ACC_RDONLY, H5P_DEFAULT); + fid1 = H5Fopen(filename, H5F_ACC_RDONLY, fapl); CHECK(fid1, FAIL, "H5Fopen"); /* Second file open */ - fid2 = H5Fopen(FILE1, H5F_ACC_RDONLY, H5P_DEFAULT); + fid2 = H5Fopen(filename, H5F_ACC_RDONLY, fapl); CHECK(fid2, FAIL, "H5Fopen"); /* Second file's dataset open */ @@ -2479,7 +2490,7 @@ test_file_double_file_dataset_open(hbool_t new_format) */ /* First file open */ - fid1 = H5Fopen(FILE1, H5F_ACC_RDONLY, H5P_DEFAULT); + fid1 = H5Fopen(filename, H5F_ACC_RDONLY, fapl); CHECK(fid1, FAIL, "H5Fopen"); /* First file's dataset open */ @@ -2491,7 +2502,7 @@ test_file_double_file_dataset_open(hbool_t new_format) CHECK(size, 0, "H5Dget_storage_size"); /* Second file open */ - fid2 = H5Fopen(FILE1, H5F_ACC_RDONLY, H5P_DEFAULT); + fid2 = H5Fopen(filename, H5F_ACC_RDONLY, fapl); CHECK(fid2, FAIL, "H5Fopen"); /* Second file's dataset open */ @@ -2524,7 +2535,7 @@ test_file_double_file_dataset_open(hbool_t new_format) * from second call to H5Dset_extent->...H5D__earray_idx_remove->H5EA_get...H5EA__iblock_protect...H5AC_protect */ /* First file open */ - fid1 = H5Fopen(FILE1, H5F_ACC_RDWR, H5P_DEFAULT); + fid1 = H5Fopen(filename, H5F_ACC_RDWR, fapl); CHECK(fid1, FAIL, "H5Fopen"); /* First file's dataset open */ @@ -2543,7 +2554,7 @@ test_file_double_file_dataset_open(hbool_t new_format) CHECK(ret, FAIL, "H5Dwrite"); /* Second file open */ - fid2 = H5Fopen(FILE1, H5F_ACC_RDWR, H5P_DEFAULT); + fid2 = H5Fopen(filename, H5F_ACC_RDWR, fapl); CHECK(fid2, FAIL, "H5Fopen"); /* Second file's dataset open */ @@ -2574,6 +2585,9 @@ test_file_double_file_dataset_open(hbool_t new_format) ret = H5Tclose(tid1); CHECK(ret, FAIL, "H5Tclose"); + /* Close FAPL */ + ret = H5Pclose(fapl); + CHECK(ret, FAIL, "H5Pclose"); } /* end test_file_double_dataset_open() */ /**************************************************************** @@ -7142,6 +7156,132 @@ test_incr_filesize(void) /**************************************************************** ** +** test_min_dset_ohdr(): +** Test API calls to toggle dataset object header minimization. +** +** TODO (as separate function?): +** + setting persists between close and (re)open? +** + dataset header sizes created while changing value of toggle +** +****************************************************************/ +static void +test_min_dset_ohdr(void) +{ + const char basename[] = "min_dset_ohdr_testfile"; + char filename[FILENAME_LEN] = ""; + hid_t file_id = -1; + hid_t file2_id = -1; + hbool_t minimize; + herr_t ret; + + MESSAGE(5, ("Testing dataset object header minimization\n")); + + /*********/ + /* SETUP */ + /*********/ + + h5_fixname(basename, H5P_DEFAULT, filename, sizeof(filename)); + + file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + CHECK_I(file_id, "H5Fcreate"); + + /*********/ + /* TESTS */ + /*********/ + + /*---------------------------------------- + * TEST default value + */ + ret = H5Fget_dset_no_attrs_hint(file_id, &minimize); + CHECK(ret, FAIL, "H5Fget_dset_no_attrs_hint"); + VERIFY(minimize, FALSE, "minimize flag"); + + /*---------------------------------------- + * TEST set to TRUE + */ + ret = H5Fset_dset_no_attrs_hint(file_id, TRUE); + CHECK(ret, FAIL, "H5Fset_dset_no_attrs_hint"); + + ret = H5Fget_dset_no_attrs_hint(file_id, &minimize); + CHECK(ret, FAIL, "H5Fget_dset_no_attrs_hint"); + VERIFY(minimize, TRUE, "minimize flag"); + + /*---------------------------------------- + * TEST second file open on same filename + */ + file2_id = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT); + CHECK_I(file2_id, "H5Fopen"); + + /* verify TRUE setting on second open + */ + ret = H5Fget_dset_no_attrs_hint(file_id, &minimize); + CHECK(ret, FAIL, "H5Fget_dset_no_attrs_hint"); + VERIFY(minimize, TRUE, "minimize flag"); + + /* re-set to FALSE on first open + */ + ret = H5Fset_dset_no_attrs_hint(file_id, FALSE); + CHECK(ret, FAIL, "H5Fset_dset_no_attrs_hint"); + + /* verify FALSE set on both opens + */ + ret = H5Fget_dset_no_attrs_hint(file_id, &minimize); + CHECK(ret, FAIL, "H5Fget_dset_no_attrs_hint"); + VERIFY(minimize, FALSE, "minimize flag"); + + ret = H5Fget_dset_no_attrs_hint(file2_id, &minimize); + CHECK(ret, FAIL, "H5Fget_dset_no_attrs_hint"); + VERIFY(minimize, FALSE, "minimize flag"); + + /* re-set to TRUE on second open + */ + ret = H5Fset_dset_no_attrs_hint(file2_id, TRUE); + CHECK(ret, FAIL, "H5Fset_dset_no_attrs_hint"); + + /* verify TRUE set on both opens + */ + ret = H5Fget_dset_no_attrs_hint(file_id, &minimize); + CHECK(ret, FAIL, "H5Fget_dset_no_attrs_hint"); + VERIFY(minimize, TRUE, "minimize flag"); + + ret = H5Fget_dset_no_attrs_hint(file2_id, &minimize); + CHECK(ret, FAIL, "H5Fget_dset_no_attrs_hint"); + VERIFY(minimize, TRUE, "minimize flag"); + + /*---------------------------------------- + * TEST error cases + */ + + /* trying to set with invalid file ID */ + H5E_BEGIN_TRY { + ret = H5Fset_dset_no_attrs_hint(-1, TRUE); + } H5E_END_TRY; + VERIFY(ret, FAIL, "H5Fset_dset_no_attrs_hint"); + + /* trying to get with invalid file ID */ + H5E_BEGIN_TRY { + ret = H5Fget_dset_no_attrs_hint(-1, &minimize); + } H5E_END_TRY; + VERIFY(ret, FAIL, "H5Fget_dset_no_attrs_hint"); + + /* trying to get with invalid pointer */ + H5E_BEGIN_TRY { + ret = H5Fget_dset_no_attrs_hint(file_id, NULL); + } H5E_END_TRY; + VERIFY(ret, FAIL, "H5Fget_dset_no_attrs_hint"); + + /************/ + /* TEARDOWN */ + /************/ + + ret = H5Fclose(file_id); + CHECK(ret, FAIL, "H5Fclose"); + ret = H5Fclose(file2_id); + CHECK(ret, FAIL, "H5Fclose"); +} /* end test_min_dset_ohdr() */ + +/**************************************************************** +** ** test_deprec(): ** Test deprecated functionality. ** @@ -7375,6 +7515,7 @@ test_deprec(void) void test_file(void) { + hbool_t single_file_vfd; /* Whether VFD used is a single file */ const char *env_h5_drvr; /* File Driver value from environment */ /* Output message about test being performed */ @@ -7384,6 +7525,7 @@ test_file(void) env_h5_drvr = HDgetenv("HDF5_DRIVER"); if(env_h5_drvr == NULL) env_h5_drvr = "nomatch"; + single_file_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family")); test_file_create(); /* Test file creation(also creation templates)*/ test_file_open(); /* Test file opening */ @@ -7393,7 +7535,7 @@ test_file(void) test_get_obj_ids(); /* Test H5Fget_obj_ids for Jira Issue 8528 */ test_file_perm(); /* Test file access permissions */ test_file_perm2(); /* Test file access permission again */ - test_file_is_accessible(); /* Test detecting HDF5 files correctly */ + test_file_is_accessible(env_h5_drvr); /* Test detecting HDF5 files correctly */ test_file_open_dot(); /* Test opening objects with "." for a name */ test_file_open_overlap(); /* Test opening files in an overlapping manner */ test_file_getname(); /* Test basic H5Fget_name() functionality */ @@ -7427,8 +7569,12 @@ test_file(void) test_libver_macros(); /* Test the macros for library version comparison */ test_libver_macros2(); /* Test the macros for library version comparison */ test_incr_filesize(); /* Test H5Fincrement_filesize() and H5Fget_eoa() */ + test_min_dset_ohdr(); /* Test datset object header minimization */ #ifndef H5_NO_DEPRECATED_SYMBOLS - test_file_ishdf5(); /* Test detecting HDF5 files correctly */ + if(single_file_vfd) + test_file_ishdf5(); /* Test detecting HDF5 files correctly */ + else + MESSAGE(5, ("Skipping testing detection of HDF5 Files (using deprecated H5Fis_hdf5() call for non-single file VFDs)\n")); test_deprec(); /* Test deprecated routines */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ } /* test_file() */ diff --git a/test/titerate.c b/test/titerate.c index de652a7..8c0ef24 100644 --- a/test/titerate.c +++ b/test/titerate.c @@ -20,6 +20,7 @@ *************************************************************/ #include "testhdf5.h" +#include "H5srcdir.h" #define DATAFILE "titerate.h5" @@ -53,6 +54,17 @@ typedef struct { iter_enum command; /* The type of return value */ } iter_info; +/* Definition for test_corrupted_attnamelen */ +#define CORRUPTED_ATNAMELEN_FILE "memleak_H5O_dtype_decode_helper_H5Odtype.h5" +#define DSET_NAME "image" +typedef struct searched_err_t { + char message[256]; + bool found; +} searched_err_t; + +/* Call back function for test_corrupted_attnamelen */ +static int find_err_msg_cb(unsigned n, const H5E_error2_t *err_desc, void *_client_data); + /* Local functions */ int iter_strcmp(const void *s1, const void *s2); int iter_strcmp2(const void *s1, const void *s2); @@ -104,7 +116,7 @@ liter_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info_t H5_ATTR_ return(count2 > 10 ? 1 : 0); default: - printf("invalid iteration command"); + HDprintf("invalid iteration command"); return(-1); } /* end switch */ } /* end liter_cb() */ @@ -151,7 +163,7 @@ test_iter_group(hid_t fapl, hbool_t new_format) CHECK(filespace, FAIL, "H5Screate"); for(i=0; i< NDATASETS; i++) { - sprintf(name,"Dataset %d",i); + HDsprintf(name,"Dataset %d",i); dataset = H5Dcreate2(file, name, datatype, filespace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK(dataset, FAIL, "H5Dcreate2"); @@ -725,7 +737,7 @@ static void test_grp_memb_funcs(hid_t fapl) CHECK(filespace, FAIL, "H5Screate"); for(i = 0; i < NDATASETS; i++) { - sprintf(name, "Dataset %d", i); + HDsprintf(name, "Dataset %d", i); dataset = H5Dcreate2(file, name, datatype, filespace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK(dataset, FAIL, "H5Dcreate2"); @@ -915,6 +927,92 @@ static void test_links(hid_t fapl) CHECK(ret, FAIL, "H5Fclose"); } /* test_links() */ +/*------------------------------------------------------------------------- + * Function: find_err_msg_cb + * + * Purpose: Callback function to find the given error message. + * Helper function for test_corrupted_attnamelen(). + * + * Return: H5_ITER_STOP when the message is found + * H5_ITER_CONT, otherwise + * + *------------------------------------------------------------------------- + */ +static int +find_err_msg_cb(unsigned n, const H5E_error2_t *err_desc, void *_client_data) +{ + int status = H5_ITER_CONT; + searched_err_t *searched_err = (searched_err_t *)_client_data; + + if (searched_err == NULL) + return -1; + + /* If the searched error message is found, stop the iteration */ + if (err_desc->desc != NULL && strcmp(err_desc->desc, searched_err->message) == 0) + { + searched_err->found = true; + status = H5_ITER_STOP; + } + return status; +} /* end find_err_msg_cb() */ + +/************************************************************************** +** +** test_corrupted_attnamelen(): Test the fix for the JIRA issue HDFFV-10588, +** where corrupted attribute's name length can be +** detected and invalid read can be avoided. +** +**************************************************************************/ +static void test_corrupted_attnamelen(void) +{ + hid_t fid = -1; /* File ID */ + hid_t did = -1; /* Dataset ID */ + searched_err_t err_caught; /* Data to be passed to callback func */ + int err_status; /* Status returned by H5Aiterate2 */ + herr_t ret; /* Return value */ + const char *testfile = H5_get_srcdir_filename(CORRUPTED_ATNAMELEN_FILE); /* Corrected test file name */ + + const char *err_message = "attribute name has different length than stored length"; + /* the error message produced when the failure occurs */ + + /* Output message about test being performed */ + MESSAGE(5, ("Testing the Handling of Corrupted Attribute's Name Length\n")); + + fid = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT); + CHECK(fid, FAIL, "H5Fopen"); + + /* Open the dataset */ + did = H5Dopen2(fid, DSET_NAME, H5P_DEFAULT); + CHECK(did, FAIL, "H5Dopen2"); + + /* Call H5Aiterate2 to trigger the failure in HDFFV-10588. Failure should + occur in the decoding stage, so some arguments are not needed. */ + err_status = H5Aiterate2(did, H5_INDEX_NAME, H5_ITER_INC, NULL, NULL, NULL); + + /* Make sure the intended error was caught */ + if(err_status == -1) + { + /* Initialize client data */ + HDstrcpy(err_caught.message, err_message); + err_caught.found = false; + + /* Look for the correct error message */ + ret = H5Ewalk2(H5E_DEFAULT, H5E_WALK_UPWARD, find_err_msg_cb, &err_caught); + CHECK(ret, FAIL, "H5Ewalk2"); + + /* Fail if the indicated message is not found */ + CHECK(err_caught.found, false, "test_corrupted_attnamelen: Expected error not found"); + } + + /* Close the dataset and file */ + ret = H5Dclose(did); + CHECK(ret, FAIL, "H5Dclose"); + + ret = H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); + +} /* test_corrupted_attnamelen() */ + /**************************************************************** ** ** test_iterate(): Main iteration testing routine. @@ -951,6 +1049,9 @@ test_iterate(void) test_links(new_format ? fapl2 : fapl); /* Test soft and hard link iteration */ } /* end for */ + /* Test the fix for issue HDFFV-10588 */ + test_corrupted_attnamelen(); + /* Close FAPLs */ ret = H5Pclose(fapl); CHECK(ret, FAIL, "H5Pclose"); @@ -976,6 +1077,6 @@ test_iterate(void) void cleanup_iterate(void) { - remove(DATAFILE); + HDremove(DATAFILE); } diff --git a/test/tselect.c b/test/tselect.c index 3c93e7a..424c144 100644 --- a/test/tselect.c +++ b/test/tselect.c @@ -1308,14 +1308,8 @@ test_select_hyper_contig(hid_t dset_type, hid_t xfer_plist) CHECK(ret, FAIL, "H5Dread"); /* Compare data read with data written out */ - if(HDmemcmp(rbuf, wbuf, sizeof(uint16_t) * 30 * 12)) { + if(HDmemcmp(rbuf, wbuf, sizeof(uint16_t) * 30 * 12)) TestErrPrintf("hyperslab values don't match! Line=%d\n",__LINE__); -#ifdef QAK - for(i=0, tbuf=wbuf; i<12; i++) - for(j=0; j<30; j++) - printf("i=%d, j=%d, *wbuf=%u, *rbuf=%u\n",i,j,(unsigned)*(wbuf+i*30+j),(unsigned)*(rbuf+i*30+j)); -#endif /* QAK */ - } /* end if */ /* Close memory dataspace */ ret = H5Sclose(sid2); @@ -1432,14 +1426,8 @@ test_select_hyper_contig2(hid_t dset_type, hid_t xfer_plist) CHECK(ret, FAIL, "H5Dread"); /* Compare data read with data written out */ - if(HDmemcmp(rbuf,wbuf,sizeof(uint16_t)*2*SPACE8_DIM3*SPACE8_DIM2*SPACE8_DIM1)) { + if(HDmemcmp(rbuf,wbuf,sizeof(uint16_t)*2*SPACE8_DIM3*SPACE8_DIM2*SPACE8_DIM1)) TestErrPrintf("Error: hyperslab values don't match!\n"); -#ifdef QAK - for(i=0, tbuf=wbuf; i<12; i++) - for(j=0; j<30; j++) - printf("i=%d, j=%d, *wbuf=%u, *rbuf=%u\n",i,j,(unsigned)*(wbuf+i*30+j),(unsigned)*(rbuf+i*30+j)); -#endif /* QAK */ - } /* end if */ /* Close memory dataspace */ ret = H5Sclose(sid2); @@ -1900,9 +1888,9 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf, /* verify that H5S_select_shape_same() reports the two * selections as having the same shape. */ - check = H5S_select_shape_same_test(small_cube_sid, + check = H5S__select_shape_same_test(small_cube_sid, file_large_cube_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); /* Read selection from disk */ ret = H5Dread(large_cube_dataset, @@ -1977,9 +1965,9 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf, /* verify that H5S_select_shape_same() reports the two * selections as having the same shape. */ - check = H5S_select_shape_same_test(small_cube_sid, + check = H5S__select_shape_same_test(small_cube_sid, mem_large_cube_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); /* Read selection from disk */ @@ -2094,9 +2082,9 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf, * memory slice through the cube selection and the * on disk full small cube selections as having the same shape. */ - check = H5S_select_shape_same_test(small_cube_sid, + check = H5S__select_shape_same_test(small_cube_sid, mem_large_cube_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); /* write the slice from the in memory large cube to the on disk small cube */ @@ -2205,9 +2193,9 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf, * on disk slice through the large cube selection * as having the same shape. */ - check = H5S_select_shape_same_test(small_cube_sid, + check = H5S__select_shape_same_test(small_cube_sid, file_large_cube_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); /* write the cube from memory to the target slice of the disk cube */ @@ -3010,9 +2998,9 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_ /* verify that H5S_select_shape_same() reports the two * selections as having the same shape. */ - check = H5S_select_shape_same_test(mem_small_cube_sid, + check = H5S__select_shape_same_test(mem_small_cube_sid, file_large_cube_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); /* zero the buffer that we will be using for reading */ HDmemset(small_cube_buf_1, 0, sizeof(*small_cube_buf_1) * small_cube_size); @@ -3117,9 +3105,9 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_ /* verify that H5S_select_shape_same() reports the two * selections as having the same shape. */ - check = H5S_select_shape_same_test(file_small_cube_sid, + check = H5S__select_shape_same_test(file_small_cube_sid, mem_large_cube_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); /* zero out the in memory large cube */ @@ -3270,9 +3258,9 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_ /* verify that H5S_select_shape_same() reports the two * selections as having the same shape. */ - check = H5S_select_shape_same_test(file_small_cube_sid, + check = H5S__select_shape_same_test(file_small_cube_sid, mem_large_cube_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); /* write the slice from the in memory large cube to the @@ -3402,9 +3390,9 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_ /* verify that H5S_select_shape_same() reports the two * selections as having the same shape. */ - check = H5S_select_shape_same_test(file_large_cube_sid, + check = H5S__select_shape_same_test(file_large_cube_sid, mem_small_cube_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); /* write the checker board selection of the in memory @@ -3537,13 +3525,13 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_ /**************************************************************** ** -** test_select_hyper_checker_board_dr(): Test H5S (dataspace) -** selection code with checkerboard source and target having +** test_select_hyper_checker_board_dr(): Test H5S (dataspace) +** selection code with checkerboard source and target having ** different ranks but the same shape. We have already -** tested H5S_shape_same in isolation, so now we try to do +** tested H5S_shape_same in isolation, so now we try to do ** I/O. ** -** This is just an initial smoke check, so we will work +** This is just an initial smoke check, so we will work ** with a slice through a cube only. ** ****************************************************************/ @@ -3743,15 +3731,8 @@ test_select_hyper_copy(void) CHECK(ret, FAIL, "H5Dread"); /* Compare data read with data written out */ - if(HDmemcmp(rbuf,rbuf2,sizeof(uint16_t)*SPACE3_DIM1*SPACE3_DIM2)) { + if(HDmemcmp(rbuf,rbuf2,sizeof(uint16_t)*SPACE3_DIM1*SPACE3_DIM2)) TestErrPrintf("hyperslab values don't match! Line=%d\n",__LINE__); -#ifdef QAK - for(i=0; i<SPACE3_DIM1; i++) - for(j=0; j<SPACE3_DIM2; j++) - if((unsigned)*(rbuf+i*SPACE3_DIM2+j)!=(unsigned)*(rbuf2+i*SPACE3_DIM2+j)) - printf("i=%d, j=%d, *rbuf=%u, *rbuf2=%u\n",i,j,(unsigned)*(rbuf+i*SPACE3_DIM2+j),(unsigned)*(rbuf2+i*SPACE3_DIM2+j)); -#endif /* QAK */ - } /* end if */ /* Close memory dataspace */ ret = H5Sclose(sid2); @@ -4929,365 +4910,6 @@ test_select_hyper_union(void) HDfree(rbuf); } /* test_select_hyper_union() */ -#ifdef NEW_HYPERSLAB_API -/**************************************************************** -** -** test_select_hyper_union_stagger(): Test basic H5S (dataspace) selection code. -** Tests unions of staggered hyperslabs. (Uses H5Scombine_hyperslab -** and H5Sselect_select instead of H5Sselect_hyperslab) -** -****************************************************************/ -static void -test_select_hyper_union_stagger(void) -{ - hid_t file_id; /* File ID */ - hid_t dset_id; /* Dataset ID */ - hid_t dataspace; /* File dataspace ID */ - hid_t memspace; /* Memory dataspace ID */ - hid_t tmp_space; /* Temporary dataspace ID */ - hid_t tmp2_space; /* Another emporary dataspace ID */ - hsize_t dimsm[2]={7,7}; /* Memory array dimensions */ - hsize_t dimsf[2]={6,5}; /* File array dimensions */ - hsize_t count[2]={3,1}; /* 1st Hyperslab size */ - hsize_t count2[2]={3,1}; /* 2nd Hyperslab size */ - hsize_t count3[2]={2,1}; /* 3rd Hyperslab size */ - hssize_t offset[2]={0,0}; /* 1st Hyperslab offset */ - hssize_t offset2[2]={2,1}; /* 2nd Hyperslab offset */ - hssize_t offset3[2]={4,2}; /* 3rd Hyperslab offset */ - hsize_t count_out[2]={4,2}; /* Hyperslab size in memory */ - hssize_t offset_out[2]={0,3}; /* Hyperslab offset in memory */ - int data[6][5]; /* Data to write */ - int data_out[7][7]; /* Data read in */ - int input_loc[8][2]={{0,0}, - {1,0}, - {2,0}, - {2,1}, - {3,1}, - {4,1}, - {4,2}, - {5,2}}; - int output_loc[8][2]={{0,3}, - {0,4}, - {1,3}, - {1,4}, - {2,3}, - {2,4}, - {3,3}, - {3,4}}; - int dsetrank=2; /* File Dataset rank */ - int memrank=2; /* Memory Dataset rank */ - int i,j; /* Local counting variables */ - herr_t error; - hsize_t stride[2]={1,1}; - hsize_t block[2]={1,1}; - - /* Initialize data to write */ - for(i=0; i<6; i++) - for(j=0; j<5; j++) - data[i][j] = j*10 + i; - - /* Create file */ - file_id=H5Fcreate(FILENAME,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT); - CHECK(file_id, FAIL, "H5Fcreate"); - - /* Create File Dataspace */ - dataspace=H5Screate_simple(dsetrank,dimsf,NULL); - CHECK(dataspace, FAIL, "H5Screate_simple"); - - /* Create File Dataset */ - dset_id=H5Dcreate2(file_id,"IntArray",H5T_NATIVE_INT,dataspace,H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - CHECK(dset_id, FAIL, "H5Dcreate2"); - - /* Write File Dataset */ - error=H5Dwrite(dset_id,H5T_NATIVE_INT,dataspace,dataspace,H5P_DEFAULT,data); - CHECK(error, FAIL, "H5Dwrite"); - - /* Close things */ - error=H5Sclose(dataspace); - CHECK(error, FAIL, "H5Sclose"); - error = H5Dclose(dset_id); - CHECK(error, FAIL, "H5Dclose"); - error = H5Fclose(file_id); - CHECK(error, FAIL, "H5Fclose"); - - /* Initialize intput buffer */ - memset(data_out, 0, 7 * 7 * sizeof(int)); - - /* Open file */ - file_id = H5Fopen(FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT); - CHECK(file_id, FAIL, "H5Fopen"); - - /* Open dataset */ - dset_id = H5Dopen2(file_id, "IntArray", H5P_DEFAULT); - CHECK(dset_id, FAIL, "H5Dopen2"); - - /* Get the dataspace */ - dataspace = H5Dget_space(dset_id); - CHECK(dataspace, FAIL, "H5Dget_space"); - - /* Select the hyperslabs */ - error = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, offset, stride, count, block); - CHECK(error, FAIL, "H5Sselect_hyperslab"); - tmp_space = H5Scombine_hyperslab(dataspace, H5S_SELECT_OR, offset2, stride, count2, block); - CHECK(tmp_space, FAIL, "H5Scombine_hyperslab"); - - /* Copy the file dataspace and select hyperslab */ - tmp2_space = H5Scopy(dataspace); - CHECK(tmp2_space, FAIL, "H5Scopy"); - error=H5Sselect_hyperslab(tmp2_space,H5S_SELECT_SET,offset3,stride,count3,block); - CHECK(error, FAIL, "H5Sselect_hyperslab"); - - /* Combine the copied dataspace with the temporary dataspace */ - error=H5Sselect_select(tmp_space,H5S_SELECT_OR,tmp2_space); - CHECK(error, FAIL, "H5Sselect_select"); - - /* Create Memory Dataspace */ - memspace=H5Screate_simple(memrank,dimsm,NULL); - CHECK(memspace, FAIL, "H5Screate_simple"); - - /* Select hyperslab in memory */ - error=H5Sselect_hyperslab(memspace,H5S_SELECT_SET,offset_out,stride,count_out,block); - CHECK(error, FAIL, "H5Sselect_hyperslab"); - - /* Read File Dataset */ - error=H5Dread(dset_id,H5T_NATIVE_INT,memspace,tmp_space,H5P_DEFAULT,data_out); - CHECK(error, FAIL, "H5Dread"); - - /* Verify input data */ - for(i=0; i<8; i++) { - if(data[input_loc[i][0]][input_loc[i][1]]!=data_out[output_loc[i][0]][output_loc[i][1]]) { - printf("input data #%d is wrong!\n",i); - printf("input_loc=[%d][%d]\n",input_loc[i][0],input_loc[i][1]); - printf("output_loc=[%d][%d]\n",output_loc[i][0],output_loc[i][1]); - printf("data=%d\n",data[input_loc[i][0]][input_loc[i][1]]); - TestErrPrintf("data_out=%d\n",data_out[output_loc[i][0]][output_loc[i][1]]); - } /* end if */ - } /* end for */ - - /* Close things */ - error=H5Sclose(tmp2_space); - CHECK(error, FAIL, "H5Sclose"); - error=H5Sclose(tmp_space); - CHECK(error, FAIL, "H5Sclose"); - error=H5Sclose(dataspace); - CHECK(error, FAIL, "H5Sclose"); - error=H5Sclose(memspace); - CHECK(error, FAIL, "H5Sclose"); - error=H5Dclose(dset_id); - CHECK(error, FAIL, "H5Dclose"); - error=H5Fclose(file_id); - CHECK(error, FAIL, "H5Fclose"); -} - -/**************************************************************** -** -** test_select_hyper_union_3d(): Test basic H5S (dataspace) selection code. -** Tests unions of hyperslabs in 3-D (Uses H5Scombine_hyperslab -** and H5Scombine_select instead of H5Sselect_hyperslab) -** -****************************************************************/ -static void -test_select_hyper_union_3d(void) -{ - hid_t fid1; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t sid1,sid2; /* Dataspace ID */ - hid_t tmp_space; /* Temporary Dataspace ID */ - hid_t tmp2_space; /* Another temporary Dataspace ID */ - hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; - hsize_t dims2[] = {SPACE4_DIM1, SPACE4_DIM2, SPACE4_DIM3}; - hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2}; - hsize_t start[SPACE1_RANK]; /* Starting location of hyperslab */ - hsize_t stride[SPACE1_RANK]; /* Stride of hyperslab */ - hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */ - hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */ - struct row_list { - size_t z; - size_t y; - size_t x; - size_t l; - } rows[]= { /* Array of x,y,z coordinates & length for each row written from memory */ - {0,0,0,6}, /* 1st face of 3-D object */ - {0,1,0,6}, - {0,2,0,6}, - {0,3,0,6}, - {0,4,0,6}, - {1,0,0,6}, /* 2nd face of 3-D object */ - {1,1,0,6}, - {1,2,0,6}, - {1,3,0,6}, - {1,4,0,6}, - {2,0,0,6}, /* 3rd face of 3-D object */ - {2,1,0,10}, - {2,2,0,10}, - {2,3,0,10}, - {2,4,0,10}, - {2,5,2,8}, - {2,6,2,8}, - {3,0,0,6}, /* 4th face of 3-D object */ - {3,1,0,10}, - {3,2,0,10}, - {3,3,0,10}, - {3,4,0,10}, - {3,5,2,8}, - {3,6,2,8}, - {4,0,0,6}, /* 5th face of 3-D object */ - {4,1,0,10}, - {4,2,0,10}, - {4,3,0,10}, - {4,4,0,10}, - {4,5,2,8}, - {4,6,2,8}, - {5,1,2,8}, /* 6th face of 3-D object */ - {5,2,2,8}, - {5,3,2,8}, - {5,4,2,8}, - {5,5,2,8}, - {5,6,2,8}, - {6,1,2,8}, /* 7th face of 3-D object */ - {6,2,2,8}, - {6,3,2,8}, - {6,4,2,8}, - {6,5,2,8}, - {6,6,2,8}, - {7,1,2,8}, /* 8th face of 3-D object */ - {7,2,2,8}, - {7,3,2,8}, - {7,4,2,8}, - {7,5,2,8}, - {7,6,2,8}}; - uint8_t *wbuf, /* buffer to write to disk */ - *rbuf, /* buffer read from disk */ - *tbuf, /* temporary buffer pointer */ - *tbuf2; /* temporary buffer pointer */ - int i,j,k; /* Counters */ - herr_t ret; /* Generic return value */ - hsize_t npoints; /* Number of elements in selection */ - - /* Output message about test being performed */ - MESSAGE(5, ("Testing Hyperslab Selection Functions with unions of 3-D hyperslabs\n")); - - /* Allocate write & read buffers */ - wbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE4_DIM1 * SPACE4_DIM2 * SPACE4_DIM3); - CHECK(wbuf, NULL, "HDmalloc"); - rbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), SPACE3_DIM1 * SPACE3_DIM2); - CHECK(rbuf, NULL, "HDcalloc"); - - /* Initialize write buffer */ - for(i=0, tbuf=wbuf; i<SPACE4_DIM1; i++) - for(j=0; j<SPACE4_DIM2; j++) - for(k=0; k<SPACE4_DIM3; k++) - *tbuf++=(uint8_t)((((i*SPACE4_DIM2)+j)*SPACE4_DIM3)+k); - - /* Create file */ - fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - CHECK(fid1, FAIL, "H5Fcreate"); - -/* Test case of two blocks which overlap corners and must be split */ - /* Create dataspace for dataset on disk */ - sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL); - CHECK(sid1, FAIL, "H5Screate_simple"); - - /* Create dataspace for writing buffer */ - sid2 = H5Screate_simple(SPACE4_RANK, dims2, NULL); - CHECK(sid2, FAIL, "H5Screate_simple"); - - /* Select 2x15x13 hyperslab for disk dataset */ - start[0]=1; start[1]=0; start[2]=0; - stride[0]=1; stride[1]=1; stride[2]=1; - count[0]=2; count[1]=15; count[2]=13; - block[0]=1; block[1]=1; block[2]=1; - ret = H5Sselect_hyperslab(sid1,H5S_SELECT_SET,start,stride,count,block); - CHECK(ret, FAIL, "H5Sselect_hyperslab"); - - /* Select 5x5x6 hyperslab for memory dataset */ - start[0]=0; start[1]=0; start[2]=0; - stride[0]=1; stride[1]=1; stride[2]=1; - count[0]=5; count[1]=5; count[2]=6; - block[0]=1; block[1]=1; block[2]=1; - ret = H5Sselect_hyperslab(sid2,H5S_SELECT_SET,start,stride,count,block); - CHECK(ret, FAIL, "H5Sselect_hyperslab"); - - /* Union overlapping 15x20 hyperslab for memory dataset (forming a irregularly shaped region) */ - start[0]=2; start[1]=1; start[2]=2; - stride[0]=1; stride[1]=1; stride[2]=1; - count[0]=6; count[1]=6; count[2]=8; - block[0]=1; block[1]=1; block[2]=1; - tmp_space = H5Scombine_hyperslab(sid2,H5S_SELECT_SET,start,stride,count,block); - CHECK(tmp_space, FAIL, "H5Sselect_hyperslab"); - - /* Combine dataspaces and create new dataspace */ - tmp2_space = H5Scombine_select(sid2,H5S_SELECT_OR,tmp_space); - CHECK(tmp2_space, FAIL, "H5Scombin_select"); - - npoints = H5Sget_select_npoints(tmp2_space); - VERIFY(npoints, 15*26, "H5Sget_select_npoints"); - - /* Create a dataset */ - dataset = H5Dcreate2(fid1, SPACE1_NAME, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - CHECK(dataset, FAIL, "H5Dcreate2"); - - /* Write selection to disk */ - ret=H5Dwrite(dataset,H5T_NATIVE_UCHAR,tmp2_space,sid1,H5P_DEFAULT,wbuf); - CHECK(ret, FAIL, "H5Dwrite"); - - /* Close temporary dataspaces */ - ret = H5Sclose(tmp_space); - CHECK(ret, FAIL, "H5Sclose"); - ret = H5Sclose(tmp2_space); - CHECK(ret, FAIL, "H5Sclose"); - - /* Close memory dataspace */ - ret = H5Sclose(sid2); - CHECK(ret, FAIL, "H5Sclose"); - - /* Create dataspace for reading buffer */ - sid2 = H5Screate_simple(SPACE3_RANK, dims3, NULL); - CHECK(sid2, FAIL, "H5Screate_simple"); - - /* Select 15x26 hyperslab for reading memory dataset */ - start[0]=0; start[1]=0; - stride[0]=1; stride[1]=1; - count[0]=15; count[1]=26; - block[0]=1; block[1]=1; - ret = H5Sselect_hyperslab(sid2,H5S_SELECT_SET,start,stride,count,block); - CHECK(ret, FAIL, "H5Sselect_hyperslab"); - - /* Read selection from disk */ - ret=H5Dread(dataset,H5T_NATIVE_UCHAR,sid2,sid1,H5P_DEFAULT,rbuf); - CHECK(ret, FAIL, "H5Dread"); - - /* Compare data read with data written out */ - for(i=0,tbuf2=rbuf; i<(int)(sizeof(rows)/sizeof(struct row_list)); i++) { - tbuf=wbuf+(rows[i].z*SPACE4_DIM3*SPACE4_DIM2)+(rows[i].y*SPACE4_DIM3)+rows[i].x; - for(j=0; j<(int)rows[i].l; j++, tbuf++, tbuf2++) { - if(*tbuf!=*tbuf2) - TestErrPrintf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%d, *tbuf2=%d\n",__LINE__,i,j,(int)*tbuf,(int)*tbuf2); - } /* end for */ - } /* end for */ - - /* Close memory dataspace */ - ret = H5Sclose(sid2); - CHECK(ret, FAIL, "H5Sclose"); - - /* Close disk dataspace */ - ret = H5Sclose(sid1); - CHECK(ret, FAIL, "H5Sclose"); - - /* Close Dataset */ - ret = H5Dclose(dataset); - CHECK(ret, FAIL, "H5Dclose"); - - /* Close file */ - ret = H5Fclose(fid1); - CHECK(ret, FAIL, "H5Fclose"); - - /* Free memory buffers */ - HDfree(wbuf); - HDfree(rbuf); -} /* test_select_hyper_union_3d() */ -#endif /* NEW_HYPERSLAB_API */ - /**************************************************************** ** ** test_select_hyper_and_2d(): Test basic H5S (dataspace) selection code. @@ -5902,42 +5524,29 @@ test_select_hyper_union_random_5d(hid_t read_plist) CHECK(sid2, FAIL, "H5Screate_simple"); /* Get initial random # seed */ - seed=(unsigned)time(NULL)+(unsigned)clock(); + seed = (unsigned)HDtime(NULL) + (unsigned)HDclock(); /* Crunch through a bunch of random hyperslab reads from the file dataset */ for(test_num=0; test_num<NRAND_HYPER; test_num++) { /* Save random # seed for later use */ /* (Used in case of errors, to regenerate the hyperslab sequence) */ -#ifndef QAK - seed+=(unsigned)clock(); -#else /* QAK */ - seed=987909620; -#endif /* QAK */ + seed += (unsigned)HDclock(); HDsrandom(seed); -#ifdef QAK -printf("test_num=%d, seed=%u\n",test_num,seed); -#endif /* QAK */ -#ifndef QAK for(i=0; i<NHYPERSLABS; i++) { -#else /* QAK */ - for(i=0; i<2; i++) { -#endif /* QAK */ -#ifdef QAK -printf("hyperslab=%d\n",i); -#endif /* QAK */ /* Select random hyperslab location & size for selection */ for(j=0; j<SPACE5_RANK; j++) { start[j] = ((hsize_t)HDrandom() % dims1[j]); count[j] = (((hsize_t)HDrandom() % (dims1[j] - start[j])) + 1); -#ifdef QAK -printf("start[%d]=%d, count[%d]=%d (end[%d]=%d)\n",j,(int)start[j],j,(int)count[j],j,(int)(start[j]+count[j]-1)); -#endif /* QAK */ } /* end for */ /* Select hyperslab */ ret = H5Sselect_hyperslab(sid1, (i == 0 ? H5S_SELECT_SET : H5S_SELECT_OR), start, NULL, count, NULL); CHECK(ret, FAIL, "H5Sselect_hyperslab"); + if(ret < 0) { + TestErrPrintf("Random hyperslabs for seed %u failed!\n", seed); + break; + } /* end if */ } /* end for */ /* Get the number of elements selected */ @@ -5953,49 +5562,21 @@ printf("start[%d]=%d, count[%d]=%d (end[%d]=%d)\n",j,(int)start[j],j,(int)count[ npoints2 = H5Sget_select_npoints(sid2); VERIFY(npoints, npoints2, "H5Sget_select_npoints"); -#ifdef QAK -printf("random I/O, before H5Dread(), npoints=%lu\n",(unsigned long)npoints); -{ - hsize_t blocks[128][2][SPACE5_RANK]; - hssize_t nblocks; - int k; - - nblocks=H5Sget_select_hyper_nblocks(sid1); - printf("nblocks=%d\n",(int)nblocks); - H5Sget_select_hyper_blocklist(sid1,0,nblocks,blocks); - for(j=0; j<nblocks; j++) { - printf("Block #%d, start = {",j); - for(k=0; k<SPACE5_RANK; k++) { - printf("%d",blocks[j][0][k]); - if(k<(SPACE5_RANK-1)) - printf(", "); - else - printf("}, end = {"); - } /* end for */ - for(k=0; k<SPACE5_RANK; k++) { - printf("%d",blocks[j][1][k]); - if(k<(SPACE5_RANK-1)) - printf(", "); - else - printf("}\n"); - } /* end for */ - } /* end for */ -} -#endif /* QAK */ /* Read selection from disk */ ret=H5Dread(dataset,H5T_NATIVE_INT,sid2,sid1,read_plist,rbuf); CHECK(ret, FAIL, "H5Dread"); -#ifdef QAK -printf("random I/O, after H5Dread()\n"); -#endif /* QAK */ + if(ret < 0) { + TestErrPrintf("Random hyperslabs for seed %u failed!\n", seed); + break; + } /* end if */ /* Compare data read with data written out */ tbuf=rbuf; ret = H5Diterate(wbuf,H5T_NATIVE_INT,sid1,test_select_hyper_iter2,&tbuf); - if(ret<0) { - TestErrPrintf("Random hyperslabs for seed %u failed!\n",seed); + if(ret < 0) { + TestErrPrintf("Random hyperslabs for seed %u failed!\n", seed); break; - } + } /* end if */ /* Set the read buffer back to all zeroes */ HDmemset(rbuf, 0, (size_t)SPACE6_DIM1); @@ -6282,9 +5863,6 @@ test_select_point_chunk(void) herr_t ret; /* Generic return value */ unsigned *data_out; /* output buffer */ -#ifdef LATER - unsigned *tmpdata_out; /* output buffer */ -#endif /* LATER */ hsize_t start[SPACE7_RANK]; /* hyperslab offset */ hsize_t count[SPACE7_RANK]; /* size of the hyperslab */ @@ -6653,7 +6231,7 @@ test_select_combine(void) hsize_t dims[SPACE7_RANK]={SPACE7_DIM1,SPACE7_DIM2}; /* Dimensions of dataspace */ H5S_sel_type sel_type; /* Selection type */ hssize_t nblocks; /* Number of hyperslab blocks */ - hsize_t blocks[128][2][SPACE7_RANK]; /* List of blocks */ + hsize_t blocks[16][2][SPACE7_RANK]; /* List of blocks */ herr_t error; /* Output message about test being performed */ @@ -8155,290 +7733,290 @@ test_shape_same(void) /* Compare "all" selection to all the selections created */ /* Compare against itself */ - check=H5S_select_shape_same_test(all_sid,all_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(all_sid,all_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); /* Compare against copy of itself */ tmp_sid=H5Scopy(all_sid); CHECK(tmp_sid, FAIL, "H5Scopy"); - check=H5S_select_shape_same_test(all_sid,tmp_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(all_sid,tmp_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); ret = H5Sclose(tmp_sid); CHECK(ret, FAIL, "H5Sclose"); /* Compare against "none" selection */ - check=H5S_select_shape_same_test(all_sid,none_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(all_sid,none_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against single point selection */ - check=H5S_select_shape_same_test(all_sid,single_pt_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(all_sid,single_pt_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against multiple point selection */ - check=H5S_select_shape_same_test(all_sid,mult_pt_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(all_sid,mult_pt_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "plain" single hyperslab selection */ - check=H5S_select_shape_same_test(all_sid,single_hyper_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(all_sid,single_hyper_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "all" single hyperslab selection */ - check=H5S_select_shape_same_test(all_sid,single_hyper_all_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(all_sid,single_hyper_all_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); /* Compare against "single point" single hyperslab selection */ - check=H5S_select_shape_same_test(all_sid,single_hyper_pt_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(all_sid,single_hyper_pt_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against regular, strided hyperslab selection */ - check=H5S_select_shape_same_test(all_sid,regular_hyper_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(all_sid,regular_hyper_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against irregular hyperslab selection */ - check=H5S_select_shape_same_test(all_sid,irreg_hyper_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(all_sid,irreg_hyper_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "no" hyperslab selection */ - check=H5S_select_shape_same_test(all_sid,none_hyper_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(all_sid,none_hyper_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against scalar "all" hyperslab selection */ - check = H5S_select_shape_same_test(all_sid, scalar_all_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(all_sid, scalar_all_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against scalar "none" hyperslab selection */ - check = H5S_select_shape_same_test(all_sid, scalar_none_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(all_sid, scalar_none_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare "none" selection to all the selections created */ /* Compare against itself */ - check=H5S_select_shape_same_test(none_sid,none_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(none_sid,none_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); /* Compare against copy of itself */ tmp_sid=H5Scopy(none_sid); CHECK(tmp_sid, FAIL, "H5Scopy"); - check=H5S_select_shape_same_test(none_sid,tmp_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(none_sid,tmp_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); ret = H5Sclose(tmp_sid); CHECK(ret, FAIL, "H5Sclose"); /* Compare against "all" selection */ - check=H5S_select_shape_same_test(none_sid,all_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(none_sid,all_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against single point selection */ - check=H5S_select_shape_same_test(none_sid,single_pt_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(none_sid,single_pt_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against multiple point selection */ - check=H5S_select_shape_same_test(none_sid,mult_pt_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(none_sid,mult_pt_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "plain" single hyperslab selection */ - check=H5S_select_shape_same_test(none_sid,single_hyper_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(none_sid,single_hyper_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "all" single hyperslab selection */ - check=H5S_select_shape_same_test(none_sid,single_hyper_all_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(none_sid,single_hyper_all_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "single point" single hyperslab selection */ - check=H5S_select_shape_same_test(none_sid,single_hyper_pt_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(none_sid,single_hyper_pt_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against regular, strided hyperslab selection */ - check=H5S_select_shape_same_test(none_sid,regular_hyper_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(none_sid,regular_hyper_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against irregular hyperslab selection */ - check=H5S_select_shape_same_test(none_sid,irreg_hyper_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(none_sid,irreg_hyper_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "no" hyperslab selection */ - check=H5S_select_shape_same_test(none_sid,none_hyper_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(none_sid,none_hyper_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); /* Compare against scalar "all" hyperslab selection */ - check = H5S_select_shape_same_test(none_sid, scalar_all_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(none_sid, scalar_all_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against scalar "none" hyperslab selection */ - check = H5S_select_shape_same_test(none_sid, scalar_none_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(none_sid, scalar_none_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); /* Compare single point selection to all the selections created */ /* Compare against itself */ - check=H5S_select_shape_same_test(single_pt_sid,single_pt_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_pt_sid,single_pt_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); /* Compare against copy of itself */ tmp_sid=H5Scopy(single_pt_sid); CHECK(tmp_sid, FAIL, "H5Scopy"); - check=H5S_select_shape_same_test(single_pt_sid,tmp_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_pt_sid,tmp_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); ret = H5Sclose(tmp_sid); CHECK(ret, FAIL, "H5Sclose"); /* Compare against "all" selection */ - check=H5S_select_shape_same_test(single_pt_sid,all_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_pt_sid,all_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "none" selection */ - check=H5S_select_shape_same_test(single_pt_sid,none_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_pt_sid,none_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against multiple point selection */ - check=H5S_select_shape_same_test(single_pt_sid,mult_pt_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_pt_sid,mult_pt_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "plain" single hyperslab selection */ - check=H5S_select_shape_same_test(single_pt_sid,single_hyper_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_pt_sid,single_hyper_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "all" single hyperslab selection */ - check=H5S_select_shape_same_test(single_pt_sid,single_hyper_all_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_pt_sid,single_hyper_all_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "single point" single hyperslab selection */ - check=H5S_select_shape_same_test(single_pt_sid,single_hyper_pt_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_pt_sid,single_hyper_pt_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); /* Compare against regular, strided hyperslab selection */ - check=H5S_select_shape_same_test(single_pt_sid,regular_hyper_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_pt_sid,regular_hyper_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against irregular hyperslab selection */ - check=H5S_select_shape_same_test(single_pt_sid,irreg_hyper_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_pt_sid,irreg_hyper_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "no" hyperslab selection */ - check=H5S_select_shape_same_test(single_pt_sid,none_hyper_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_pt_sid,none_hyper_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against scalar "all" hyperslab selection */ - check = H5S_select_shape_same_test(single_pt_sid, scalar_all_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_pt_sid, scalar_all_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); /* Compare against scalar "none" hyperslab selection */ - check = H5S_select_shape_same_test(single_pt_sid, scalar_none_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_pt_sid, scalar_none_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare multiple point selection to all the selections created */ /* Compare against itself */ - check=H5S_select_shape_same_test(mult_pt_sid,mult_pt_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(mult_pt_sid,mult_pt_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); /* Compare against copy of itself */ tmp_sid=H5Scopy(mult_pt_sid); CHECK(tmp_sid, FAIL, "H5Scopy"); - check=H5S_select_shape_same_test(mult_pt_sid,tmp_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(mult_pt_sid,tmp_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); ret = H5Sclose(tmp_sid); CHECK(ret, FAIL, "H5Sclose"); /* Compare against "all" selection */ - check=H5S_select_shape_same_test(mult_pt_sid,all_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(mult_pt_sid,all_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "none" selection */ - check=H5S_select_shape_same_test(mult_pt_sid,none_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(mult_pt_sid,none_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against single point selection */ - check=H5S_select_shape_same_test(mult_pt_sid,single_pt_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(mult_pt_sid,single_pt_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "plain" single hyperslab selection */ - check=H5S_select_shape_same_test(mult_pt_sid,single_hyper_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(mult_pt_sid,single_hyper_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "all" single hyperslab selection */ - check=H5S_select_shape_same_test(mult_pt_sid,single_hyper_all_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(mult_pt_sid,single_hyper_all_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "single point" single hyperslab selection */ - check=H5S_select_shape_same_test(mult_pt_sid,single_hyper_pt_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(mult_pt_sid,single_hyper_pt_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against regular, strided hyperslab selection */ - check=H5S_select_shape_same_test(mult_pt_sid,regular_hyper_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(mult_pt_sid,regular_hyper_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against irregular hyperslab selection */ - check=H5S_select_shape_same_test(mult_pt_sid,irreg_hyper_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(mult_pt_sid,irreg_hyper_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "no" hyperslab selection */ - check=H5S_select_shape_same_test(mult_pt_sid,none_hyper_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(mult_pt_sid,none_hyper_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against scalar "all" hyperslab selection */ - check = H5S_select_shape_same_test(mult_pt_sid, scalar_all_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(mult_pt_sid, scalar_all_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against scalar "none" hyperslab selection */ - check = H5S_select_shape_same_test(mult_pt_sid, scalar_none_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(mult_pt_sid, scalar_none_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare single "normal" hyperslab selection to all the selections created */ /* Compare against itself */ - check=H5S_select_shape_same_test(single_hyper_sid,single_hyper_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_hyper_sid,single_hyper_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); /* Compare against copy of itself */ tmp_sid=H5Scopy(single_hyper_sid); CHECK(tmp_sid, FAIL, "H5Scopy"); - check=H5S_select_shape_same_test(single_hyper_sid,tmp_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_hyper_sid,tmp_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); ret = H5Sclose(tmp_sid); CHECK(ret, FAIL, "H5Sclose"); /* Compare against "all" selection */ - check=H5S_select_shape_same_test(single_hyper_sid,all_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_hyper_sid,all_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "none" selection */ - check=H5S_select_shape_same_test(single_hyper_sid,none_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_hyper_sid,none_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against single point selection */ - check=H5S_select_shape_same_test(single_hyper_sid,single_pt_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_hyper_sid,single_pt_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against multiple point selection */ - check=H5S_select_shape_same_test(single_hyper_sid,mult_pt_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_hyper_sid,mult_pt_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "all" single hyperslab selection */ - check=H5S_select_shape_same_test(single_hyper_sid,single_hyper_all_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_hyper_sid,single_hyper_all_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "single point" single hyperslab selection */ - check=H5S_select_shape_same_test(single_hyper_sid,single_hyper_pt_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_hyper_sid,single_hyper_pt_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against regular, strided hyperslab selection */ - check=H5S_select_shape_same_test(single_hyper_sid,regular_hyper_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_hyper_sid,regular_hyper_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against irregular hyperslab selection */ - check=H5S_select_shape_same_test(single_hyper_sid,irreg_hyper_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_hyper_sid,irreg_hyper_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "no" hyperslab selection */ - check=H5S_select_shape_same_test(single_hyper_sid,none_hyper_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_hyper_sid,none_hyper_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); #ifdef NOT_YET /* In theory, these two selections are the same shape, but the @@ -8462,8 +8040,8 @@ test_shape_same(void) } /* end for */ /* Compare against hyperslab selection */ - check=H5S_select_shape_same_test(single_hyper_sid,tmp_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_hyper_sid,tmp_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); ret = H5Sclose(tmp_sid); CHECK(ret, FAIL, "H5Sclose"); @@ -8489,70 +8067,70 @@ test_shape_same(void) } /* end for */ /* Compare against hyperslab selection */ - check=H5S_select_shape_same_test(single_hyper_sid,tmp_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_hyper_sid,tmp_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); ret = H5Sclose(tmp_sid); CHECK(ret, FAIL, "H5Sclose"); /* Compare against scalar "all" hyperslab selection */ - check = H5S_select_shape_same_test(single_hyper_sid, scalar_all_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_hyper_sid, scalar_all_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against scalar "none" hyperslab selection */ - check = H5S_select_shape_same_test(single_hyper_sid, scalar_none_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_hyper_sid, scalar_none_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare single "all" hyperslab selection to all the selections created */ /* Compare against itself */ - check=H5S_select_shape_same_test(single_hyper_all_sid,single_hyper_all_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_hyper_all_sid,single_hyper_all_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); /* Compare against copy of itself */ tmp_sid=H5Scopy(single_hyper_all_sid); CHECK(tmp_sid, FAIL, "H5Scopy"); - check=H5S_select_shape_same_test(single_hyper_all_sid,tmp_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_hyper_all_sid,tmp_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); ret = H5Sclose(tmp_sid); CHECK(ret, FAIL, "H5Sclose"); /* Compare against "all" selection */ - check=H5S_select_shape_same_test(single_hyper_all_sid,all_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_hyper_all_sid,all_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); /* Compare against "none" selection */ - check=H5S_select_shape_same_test(single_hyper_all_sid,none_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_hyper_all_sid,none_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against single point selection */ - check=H5S_select_shape_same_test(single_hyper_all_sid,single_pt_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_hyper_all_sid,single_pt_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against multiple point selection */ - check=H5S_select_shape_same_test(single_hyper_all_sid,mult_pt_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_hyper_all_sid,mult_pt_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "plain" single hyperslab selection */ - check=H5S_select_shape_same_test(single_hyper_all_sid,single_hyper_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_hyper_all_sid,single_hyper_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "single point" single hyperslab selection */ - check=H5S_select_shape_same_test(single_hyper_all_sid,single_hyper_pt_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_hyper_all_sid,single_hyper_pt_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against regular, strided hyperslab selection */ - check=H5S_select_shape_same_test(single_hyper_all_sid,regular_hyper_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_hyper_all_sid,regular_hyper_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against irregular hyperslab selection */ - check=H5S_select_shape_same_test(single_hyper_all_sid,irreg_hyper_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_hyper_all_sid,irreg_hyper_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "no" hyperslab selection */ - check=H5S_select_shape_same_test(single_hyper_all_sid,none_hyper_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_hyper_all_sid,none_hyper_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); #ifdef NOT_YET /* In theory, these two selections are the same shape, but the @@ -8576,8 +8154,8 @@ test_shape_same(void) } /* end for */ /* Compare against hyperslab selection */ - check=H5S_select_shape_same_test(single_hyper_all_sid,tmp_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_hyper_all_sid,tmp_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); ret = H5Sclose(tmp_sid); CHECK(ret, FAIL, "H5Sclose"); @@ -8603,129 +8181,129 @@ test_shape_same(void) } /* end for */ /* Compare against hyperslab selection */ - check=H5S_select_shape_same_test(single_hyper_all_sid,tmp_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_hyper_all_sid,tmp_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); ret = H5Sclose(tmp_sid); CHECK(ret, FAIL, "H5Sclose"); /* Compare against scalar "all" hyperslab selection */ - check = H5S_select_shape_same_test(single_hyper_all_sid, scalar_all_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_hyper_all_sid, scalar_all_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against scalar "none" hyperslab selection */ - check = H5S_select_shape_same_test(single_hyper_all_sid, scalar_none_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_hyper_all_sid, scalar_none_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare single "point" hyperslab selection to all the selections created */ /* Compare against itself */ - check=H5S_select_shape_same_test(single_hyper_pt_sid,single_hyper_pt_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_hyper_pt_sid,single_hyper_pt_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); /* Compare against copy of itself */ tmp_sid=H5Scopy(single_hyper_pt_sid); CHECK(tmp_sid, FAIL, "H5Scopy"); - check=H5S_select_shape_same_test(single_hyper_pt_sid,tmp_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_hyper_pt_sid,tmp_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); ret = H5Sclose(tmp_sid); CHECK(ret, FAIL, "H5Sclose"); /* Compare against "all" selection */ - check=H5S_select_shape_same_test(single_hyper_pt_sid,all_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_hyper_pt_sid,all_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "none" selection */ - check=H5S_select_shape_same_test(single_hyper_pt_sid,none_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_hyper_pt_sid,none_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against single point selection */ - check=H5S_select_shape_same_test(single_hyper_pt_sid,single_pt_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_hyper_pt_sid,single_pt_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); /* Compare against multiple point selection */ - check=H5S_select_shape_same_test(single_hyper_pt_sid,mult_pt_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_hyper_pt_sid,mult_pt_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "plain" single hyperslab selection */ - check=H5S_select_shape_same_test(single_hyper_pt_sid,single_hyper_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_hyper_pt_sid,single_hyper_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "all" single hyperslab selection */ - check=H5S_select_shape_same_test(single_hyper_pt_sid,single_hyper_all_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_hyper_pt_sid,single_hyper_all_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against regular, strided hyperslab selection */ - check=H5S_select_shape_same_test(single_hyper_pt_sid,regular_hyper_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_hyper_pt_sid,regular_hyper_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against irregular hyperslab selection */ - check=H5S_select_shape_same_test(single_hyper_pt_sid,irreg_hyper_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_hyper_pt_sid,irreg_hyper_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "no" hyperslab selection */ - check=H5S_select_shape_same_test(single_hyper_pt_sid,none_hyper_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_hyper_pt_sid,none_hyper_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against scalar "all" hyperslab selection */ - check = H5S_select_shape_same_test(single_hyper_pt_sid, scalar_all_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_hyper_pt_sid, scalar_all_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); /* Compare against scalar "none" hyperslab selection */ - check = H5S_select_shape_same_test(single_hyper_pt_sid, scalar_none_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_hyper_pt_sid, scalar_none_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare regular, strided hyperslab selection to all the selections created */ /* Compare against itself */ - check=H5S_select_shape_same_test(regular_hyper_sid,regular_hyper_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(regular_hyper_sid,regular_hyper_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); /* Compare against copy of itself */ tmp_sid=H5Scopy(regular_hyper_sid); CHECK(tmp_sid, FAIL, "H5Scopy"); - check=H5S_select_shape_same_test(regular_hyper_sid,tmp_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(regular_hyper_sid,tmp_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); ret = H5Sclose(tmp_sid); CHECK(ret, FAIL, "H5Sclose"); /* Compare against "all" selection */ - check=H5S_select_shape_same_test(regular_hyper_sid,all_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(regular_hyper_sid,all_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "none" selection */ - check=H5S_select_shape_same_test(regular_hyper_sid,none_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(regular_hyper_sid,none_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against single point selection */ - check=H5S_select_shape_same_test(regular_hyper_sid,single_pt_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(regular_hyper_sid,single_pt_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against multiple point selection */ - check=H5S_select_shape_same_test(regular_hyper_sid,mult_pt_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(regular_hyper_sid,mult_pt_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "plain" single hyperslab selection */ - check=H5S_select_shape_same_test(regular_hyper_sid,single_hyper_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(regular_hyper_sid,single_hyper_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "all" single hyperslab selection */ - check=H5S_select_shape_same_test(regular_hyper_sid,single_hyper_all_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(regular_hyper_sid,single_hyper_all_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "single point" single hyperslab selection */ - check=H5S_select_shape_same_test(regular_hyper_sid,single_hyper_pt_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(regular_hyper_sid,single_hyper_pt_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against irregular hyperslab selection */ - check=H5S_select_shape_same_test(regular_hyper_sid,irreg_hyper_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(regular_hyper_sid,irreg_hyper_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "no" hyperslab selection */ - check=H5S_select_shape_same_test(regular_hyper_sid,none_hyper_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(regular_hyper_sid,none_hyper_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Construct point selection which matches regular, strided hyperslab selection */ /* Create dataspace for point selection */ @@ -8742,8 +8320,8 @@ test_shape_same(void) } /* end for */ /* Compare against hyperslab selection */ - check=H5S_select_shape_same_test(regular_hyper_sid,tmp_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(regular_hyper_sid,tmp_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); ret = H5Sclose(tmp_sid); CHECK(ret, FAIL, "H5Sclose"); @@ -8768,8 +8346,8 @@ test_shape_same(void) } /* end for */ /* Compare against hyperslab selection */ - check=H5S_select_shape_same_test(regular_hyper_sid,tmp_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(regular_hyper_sid,tmp_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); ret = H5Sclose(tmp_sid); CHECK(ret, FAIL, "H5Sclose"); @@ -8788,70 +8366,70 @@ test_shape_same(void) CHECK(ret, FAIL, "H5Sselect_hyperslab"); /* Compare against hyperslab selection */ - check=H5S_select_shape_same_test(regular_hyper_sid,tmp_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(regular_hyper_sid,tmp_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); ret = H5Sclose(tmp_sid); CHECK(ret, FAIL, "H5Sclose"); /* Compare against scalar "all" hyperslab selection */ - check = H5S_select_shape_same_test(regular_hyper_sid, scalar_all_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(regular_hyper_sid, scalar_all_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against scalar "none" hyperslab selection */ - check = H5S_select_shape_same_test(regular_hyper_sid, scalar_none_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(regular_hyper_sid, scalar_none_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare irregular hyperslab selection to all the selections created */ /* Compare against itself */ - check=H5S_select_shape_same_test(irreg_hyper_sid,irreg_hyper_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(irreg_hyper_sid,irreg_hyper_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); /* Compare against copy of itself */ tmp_sid=H5Scopy(irreg_hyper_sid); CHECK(tmp_sid, FAIL, "H5Scopy"); - check=H5S_select_shape_same_test(irreg_hyper_sid,tmp_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(irreg_hyper_sid,tmp_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); ret = H5Sclose(tmp_sid); CHECK(ret, FAIL, "H5Sclose"); /* Compare against "all" selection */ - check=H5S_select_shape_same_test(irreg_hyper_sid,all_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(irreg_hyper_sid,all_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "none" selection */ - check=H5S_select_shape_same_test(irreg_hyper_sid,none_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(irreg_hyper_sid,none_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against single point selection */ - check=H5S_select_shape_same_test(irreg_hyper_sid,single_pt_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(irreg_hyper_sid,single_pt_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against multiple point selection */ - check=H5S_select_shape_same_test(irreg_hyper_sid,mult_pt_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(irreg_hyper_sid,mult_pt_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "plain" single hyperslab selection */ - check=H5S_select_shape_same_test(irreg_hyper_sid,single_hyper_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(irreg_hyper_sid,single_hyper_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "all" single hyperslab selection */ - check=H5S_select_shape_same_test(irreg_hyper_sid,single_hyper_all_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(irreg_hyper_sid,single_hyper_all_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "single point" single hyperslab selection */ - check=H5S_select_shape_same_test(irreg_hyper_sid,single_hyper_pt_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(irreg_hyper_sid,single_hyper_pt_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against regular, strided hyperslab selection */ - check=H5S_select_shape_same_test(irreg_hyper_sid,regular_hyper_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(irreg_hyper_sid,regular_hyper_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "no" hyperslab selection */ - check=H5S_select_shape_same_test(irreg_hyper_sid,none_hyper_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(irreg_hyper_sid,none_hyper_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Construct hyperslab selection which matches irregular hyperslab selection */ /* Create dataspace for hyperslab selection */ @@ -8876,141 +8454,141 @@ test_shape_same(void) } /* end for */ /* Compare against hyperslab selection */ - check=H5S_select_shape_same_test(irreg_hyper_sid,tmp_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(irreg_hyper_sid,tmp_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); ret = H5Sclose(tmp_sid); CHECK(ret, FAIL, "H5Sclose"); /* Compare against scalar "all" hyperslab selection */ - check = H5S_select_shape_same_test(irreg_hyper_sid, scalar_all_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(irreg_hyper_sid, scalar_all_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against scalar "none" hyperslab selection */ - check = H5S_select_shape_same_test(irreg_hyper_sid, scalar_none_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(irreg_hyper_sid, scalar_none_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare scalar "all" dataspace with all selections created */ /* Compare against itself */ - check = H5S_select_shape_same_test(scalar_all_sid, scalar_all_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(scalar_all_sid, scalar_all_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); /* Compare against copy of itself */ tmp_sid = H5Scopy(scalar_all_sid); CHECK(tmp_sid, FAIL, "H5Scopy"); - check = H5S_select_shape_same_test(scalar_all_sid, tmp_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(scalar_all_sid, tmp_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); ret = H5Sclose(tmp_sid); CHECK(ret, FAIL, "H5Sclose"); /* Compare against "all" selection */ - check = H5S_select_shape_same_test(scalar_all_sid, all_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(scalar_all_sid, all_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "none" selection */ - check = H5S_select_shape_same_test(scalar_all_sid, none_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(scalar_all_sid, none_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against single point selection */ - check = H5S_select_shape_same_test(scalar_all_sid, single_pt_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(scalar_all_sid, single_pt_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); /* Compare against multiple point selection */ - check = H5S_select_shape_same_test(scalar_all_sid, mult_pt_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(scalar_all_sid, mult_pt_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "plain" single hyperslab selection */ - check = H5S_select_shape_same_test(scalar_all_sid, single_hyper_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(scalar_all_sid, single_hyper_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "all" single hyperslab selection */ - check = H5S_select_shape_same_test(scalar_all_sid, single_hyper_all_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(scalar_all_sid, single_hyper_all_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "single point" single hyperslab selection */ - check = H5S_select_shape_same_test(scalar_all_sid, single_hyper_pt_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(scalar_all_sid, single_hyper_pt_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); /* Compare against regular, strided hyperslab selection */ - check = H5S_select_shape_same_test(scalar_all_sid, regular_hyper_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(scalar_all_sid, regular_hyper_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against irregular hyperslab selection */ - check = H5S_select_shape_same_test(scalar_all_sid, irreg_hyper_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(scalar_all_sid, irreg_hyper_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "no" hyperslab selection */ - check = H5S_select_shape_same_test(scalar_all_sid, none_hyper_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(scalar_all_sid, none_hyper_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against scalar "none" hyperslab selection */ - check = H5S_select_shape_same_test(scalar_all_sid, scalar_none_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(scalar_all_sid, scalar_none_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare scalar "none" dataspace with all selections created */ /* Compare against itself */ - check = H5S_select_shape_same_test(scalar_none_sid, scalar_none_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(scalar_none_sid, scalar_none_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); /* Compare against copy of itself */ tmp_sid = H5Scopy(scalar_none_sid); CHECK(tmp_sid, FAIL, "H5Scopy"); - check = H5S_select_shape_same_test(scalar_none_sid, tmp_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(scalar_none_sid, tmp_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); ret = H5Sclose(tmp_sid); CHECK(ret, FAIL, "H5Sclose"); /* Compare against "all" selection */ - check = H5S_select_shape_same_test(scalar_none_sid, all_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(scalar_none_sid, all_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "none" selection */ - check = H5S_select_shape_same_test(scalar_none_sid, none_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(scalar_none_sid, none_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); /* Compare against single point selection */ - check = H5S_select_shape_same_test(scalar_none_sid, single_pt_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(scalar_none_sid, single_pt_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against multiple point selection */ - check = H5S_select_shape_same_test(scalar_none_sid, mult_pt_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(scalar_none_sid, mult_pt_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "plain" single hyperslab selection */ - check = H5S_select_shape_same_test(scalar_none_sid, single_hyper_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(scalar_none_sid, single_hyper_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "all" single hyperslab selection */ - check = H5S_select_shape_same_test(scalar_none_sid, single_hyper_all_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(scalar_none_sid, single_hyper_all_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "single point" single hyperslab selection */ - check = H5S_select_shape_same_test(scalar_none_sid, single_hyper_pt_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(scalar_none_sid, single_hyper_pt_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against regular, strided hyperslab selection */ - check = H5S_select_shape_same_test(scalar_none_sid, regular_hyper_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(scalar_none_sid, regular_hyper_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against irregular hyperslab selection */ - check = H5S_select_shape_same_test(scalar_none_sid, irreg_hyper_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(scalar_none_sid, irreg_hyper_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "no" hyperslab selection */ - check = H5S_select_shape_same_test(scalar_none_sid, none_hyper_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(scalar_none_sid, none_hyper_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); /* Compare against scalar "all" hyperslab selection */ - check = H5S_select_shape_same_test(scalar_none_sid, scalar_all_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(scalar_none_sid, scalar_all_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Close dataspaces */ @@ -9042,27 +8620,27 @@ test_shape_same(void) /**************************************************************** ** -** test_shape_same_dr__smoke_check_1(): +** test_shape_same_dr__smoke_check_1(): ** -** Create a square, 2 D data space (10 X 10), and select +** Create a square, 2 D data space (10 X 10), and select ** all of it. ** -** Similarly, create nine, 3 D data spaces (10 X 10 X 10), -** and select (10 X 10 X 1) hyper slabs in each, three with -** the slab parallel to the xy plane, three parallel to the +** Similarly, create nine, 3 D data spaces (10 X 10 X 10), +** and select (10 X 10 X 1) hyper slabs in each, three with +** the slab parallel to the xy plane, three parallel to the ** xz plane, and three parallel to the yz plane. ** -** Assuming that z is the fastest changing dimension, -** H5S_select_shape_same() should return TRUE when comparing -** the full 2 D space against any hyperslab parallel to the -** yz plane in the 3 D space, and FALSE when comparing the +** Assuming that z is the fastest changing dimension, +** H5S_select_shape_same() should return TRUE when comparing +** the full 2 D space against any hyperslab parallel to the +** yz plane in the 3 D space, and FALSE when comparing the ** full 2 D space against the other two hyper slabs. ** -** Also create two additional 3 D data spaces (10 X 10 X 10), -** and select a (10 X 10 X 2) hyper slab parallel to the yz -** axis in one of them, and two parallel (10 X 10 X 1) hyper -** slabs parallel to the yz axis in the other. -** H5S_select_shape_same() should return FALSE when comparing +** Also create two additional 3 D data spaces (10 X 10 X 10), +** and select a (10 X 10 X 2) hyper slab parallel to the yz +** axis in one of them, and two parallel (10 X 10 X 1) hyper +** slabs parallel to the yz axis in the other. +** H5S_select_shape_same() should return FALSE when comparing ** each to the 2 D selection. ** ****************************************************************/ @@ -9251,42 +8829,42 @@ test_shape_same_dr__smoke_check_1(void) /* setup is done -- run the tests: */ /* Compare against "xy" selection */ - check = H5S_select_shape_same_test(small_cube_xy_slice_0_sid, small_square_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(small_cube_xy_slice_0_sid, small_square_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); - check = H5S_select_shape_same_test(small_cube_xy_slice_1_sid, small_square_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(small_cube_xy_slice_1_sid, small_square_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); - check = H5S_select_shape_same_test(small_cube_xy_slice_2_sid, small_square_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(small_cube_xy_slice_2_sid, small_square_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "xz" selection */ - check = H5S_select_shape_same_test(small_cube_xz_slice_0_sid, small_square_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(small_cube_xz_slice_0_sid, small_square_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); - check = H5S_select_shape_same_test(small_cube_xz_slice_1_sid, small_square_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(small_cube_xz_slice_1_sid, small_square_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); - check = H5S_select_shape_same_test(small_cube_xz_slice_2_sid, small_square_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(small_cube_xz_slice_2_sid, small_square_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "yz" selection */ - check = H5S_select_shape_same_test(small_cube_yz_slice_0_sid, small_square_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(small_cube_yz_slice_0_sid, small_square_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); - check = H5S_select_shape_same_test(small_cube_yz_slice_1_sid, small_square_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(small_cube_yz_slice_1_sid, small_square_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); - check = H5S_select_shape_same_test(small_cube_yz_slice_2_sid, small_square_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(small_cube_yz_slice_2_sid, small_square_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); - check = H5S_select_shape_same_test(small_cube_yz_slice_3_sid, small_square_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(small_cube_yz_slice_3_sid, small_square_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); - check = H5S_select_shape_same_test(small_cube_yz_slice_4_sid, small_square_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(small_cube_yz_slice_4_sid, small_square_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Close dataspaces */ @@ -9333,9 +8911,9 @@ test_shape_same_dr__smoke_check_1(void) /**************************************************************** ** -** test_shape_same_dr__smoke_check_2(): +** test_shape_same_dr__smoke_check_2(): ** -** Create a square, 2 D data space (10 X 10), and select +** Create a square, 2 D data space (10 X 10), and select ** a "checker board" hyper slab as follows: ** ** * * - - * * - - * * @@ -9349,27 +8927,27 @@ test_shape_same_dr__smoke_check_1(void) ** * * - - * * - - * * ** * * - - * * - - * * ** -** where asterisks indicate selected elements, and dashes +** where asterisks indicate selected elements, and dashes ** indicate unselected elements. ** -** Similarly, create nine, 3 D data spaces (10 X 10 X 10), -** and select similar (10 X 10 X 1) checker board hyper -** slabs in each, three with the slab parallel to the xy -** plane, three parallel to the xz plane, and three parallel +** Similarly, create nine, 3 D data spaces (10 X 10 X 10), +** and select similar (10 X 10 X 1) checker board hyper +** slabs in each, three with the slab parallel to the xy +** plane, three parallel to the xz plane, and three parallel ** to the yz plane. ** -** Assuming that z is the fastest changing dimension, -** H5S_select_shape_same() should return TRUE when comparing -** the 2 D space checker board selection against a checker -** board hyperslab parallel to the yz plane in the 3 D -** space, and FALSE when comparing the 2 D checkerboard -** selection against two hyper slabs parallel to the xy +** Assuming that z is the fastest changing dimension, +** H5S_select_shape_same() should return TRUE when comparing +** the 2 D space checker board selection against a checker +** board hyperslab parallel to the yz plane in the 3 D +** space, and FALSE when comparing the 2 D checkerboard +** selection against two hyper slabs parallel to the xy ** or xz planes. ** -** Also create an additional 3 D data spaces (10 X 10 X 10), -** and select a checker board parallel with the yz axis, -** save with some squares being on different planes. -** H5S_select_shape_same() should return FALSE when +** Also create an additional 3 D data spaces (10 X 10 X 10), +** and select a checker board parallel with the yz axis, +** save with some squares being on different planes. +** H5S_select_shape_same() should return FALSE when ** comparing this selection to the 2 D selection. ** ****************************************************************/ @@ -9652,7 +9230,7 @@ test_shape_same_dr__smoke_check_2(void) start[0] = 4; /* This test gets the right answer, but it fails the shape same - * test in an unexpected point. Bring this up with Quincey, as + * test in an unexpected point. Bring this up with Quincey, as * the oddness looks like it is not related to my code. * -- JRM */ @@ -9664,39 +9242,39 @@ test_shape_same_dr__smoke_check_2(void) /* setup is done -- run the tests: */ /* Compare against "xy" selection */ - check = H5S_select_shape_same_test(small_cube_xy_slice_0_sid, small_square_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(small_cube_xy_slice_0_sid, small_square_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); - check = H5S_select_shape_same_test(small_cube_xy_slice_1_sid, small_square_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(small_cube_xy_slice_1_sid, small_square_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); - check = H5S_select_shape_same_test(small_cube_xy_slice_2_sid, small_square_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(small_cube_xy_slice_2_sid, small_square_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "xz" selection */ - check = H5S_select_shape_same_test(small_cube_xz_slice_0_sid, small_square_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(small_cube_xz_slice_0_sid, small_square_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); - check = H5S_select_shape_same_test(small_cube_xz_slice_1_sid, small_square_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(small_cube_xz_slice_1_sid, small_square_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); - check = H5S_select_shape_same_test(small_cube_xz_slice_2_sid, small_square_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(small_cube_xz_slice_2_sid, small_square_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "yz" selection */ - check = H5S_select_shape_same_test(small_cube_yz_slice_0_sid, small_square_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(small_cube_yz_slice_0_sid, small_square_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); - check = H5S_select_shape_same_test(small_cube_yz_slice_1_sid, small_square_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(small_cube_yz_slice_1_sid, small_square_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); - check = H5S_select_shape_same_test(small_cube_yz_slice_2_sid, small_square_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(small_cube_yz_slice_2_sid, small_square_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); - check = H5S_select_shape_same_test(small_cube_yz_slice_3_sid, small_square_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(small_cube_yz_slice_3_sid, small_square_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Close dataspaces */ @@ -9741,9 +9319,9 @@ test_shape_same_dr__smoke_check_2(void) /**************************************************************** ** -** test_shape_same_dr__smoke_check_3(): +** test_shape_same_dr__smoke_check_3(): ** -** Create a square, 2 D data space (10 X 10), and select an +** Create a square, 2 D data space (10 X 10), and select an ** irregular hyper slab as follows: ** ** y @@ -9759,22 +9337,22 @@ test_shape_same_dr__smoke_check_2(void) ** 0 - - - - - - - - - - ** 0 1 2 3 4 5 6 7 8 9 x ** -** where asterisks indicate selected elements, and dashes +** where asterisks indicate selected elements, and dashes ** indicate unselected elements. ** -** Similarly, create nine, 3 D data spaces (10 X 10 X 10), -** and select similar irregular hyper slabs in each, three -** with the slab parallel to the xy plane, three parallel -** to the xz plane, and three parallel to the yz plane. -** Further, translate the irregular slab in 2/3rds of the +** Similarly, create nine, 3 D data spaces (10 X 10 X 10), +** and select similar irregular hyper slabs in each, three +** with the slab parallel to the xy plane, three parallel +** to the xz plane, and three parallel to the yz plane. +** Further, translate the irregular slab in 2/3rds of the ** cases. ** -** Assuming that z is the fastest changing dimension, -** H5S_select_shape_same() should return TRUE when -** comparing the 2 D irregular hyperslab selection -** against the irregular hyperslab selections parallel -** to the yz plane in the 3 D space, and FALSE when -** comparing it against the irregular hyper slabs +** Assuming that z is the fastest changing dimension, +** H5S_select_shape_same() should return TRUE when +** comparing the 2 D irregular hyperslab selection +** against the irregular hyperslab selections parallel +** to the yz plane in the 3 D space, and FALSE when +** comparing it against the irregular hyper slabs ** selections parallel to the xy or xz planes. ** ****************************************************************/ @@ -10187,36 +9765,36 @@ test_shape_same_dr__smoke_check_3(void) /* setup is done -- run the tests: */ /* Compare against "xy" selection */ - check = H5S_select_shape_same_test(small_cube_xy_slice_0_sid, small_square_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(small_cube_xy_slice_0_sid, small_square_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); - check = H5S_select_shape_same_test(small_cube_xy_slice_1_sid, small_square_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(small_cube_xy_slice_1_sid, small_square_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); - check = H5S_select_shape_same_test(small_cube_xy_slice_2_sid, small_square_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(small_cube_xy_slice_2_sid, small_square_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "xz" selection */ - check = H5S_select_shape_same_test(small_cube_xz_slice_0_sid, small_square_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(small_cube_xz_slice_0_sid, small_square_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); - check = H5S_select_shape_same_test(small_cube_xz_slice_1_sid, small_square_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(small_cube_xz_slice_1_sid, small_square_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); - check = H5S_select_shape_same_test(small_cube_xz_slice_2_sid, small_square_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(small_cube_xz_slice_2_sid, small_square_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "yz" selection */ - check = H5S_select_shape_same_test(small_cube_yz_slice_0_sid, small_square_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(small_cube_yz_slice_0_sid, small_square_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); - check = H5S_select_shape_same_test(small_cube_yz_slice_1_sid, small_square_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(small_cube_yz_slice_1_sid, small_square_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); - check = H5S_select_shape_same_test(small_cube_yz_slice_2_sid, small_square_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(small_cube_yz_slice_2_sid, small_square_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); /* Close dataspaces */ @@ -10258,9 +9836,9 @@ test_shape_same_dr__smoke_check_3(void) /**************************************************************** ** -** test_shape_same_dr__smoke_check_4(): +** test_shape_same_dr__smoke_check_4(): ** -** Create a square, 2 D data space (10 X 10), and select +** Create a square, 2 D data space (10 X 10), and select ** the entire space. ** ** Similarly, create 3 D and 4 D data spaces: @@ -10281,7 +9859,7 @@ test_shape_same_dr__smoke_check_3(void) ** And select these entire spaces as well. ** ** Compare the 2 D space against all the other spaces -** with H5S_select_shape_same(). The (1 X 10 X 10) & +** with H5S_select_shape_same(). The (1 X 10 X 10) & ** (1 X 1 X 10 X 10) should return TRUE. All others ** should return FALSE. ** @@ -10399,39 +9977,39 @@ test_shape_same_dr__smoke_check_4(void) /* setup is done -- run the tests: */ - check = H5S_select_shape_same_test(three_d_space_0_sid, square_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(three_d_space_0_sid, square_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); - check = H5S_select_shape_same_test(three_d_space_1_sid, square_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(three_d_space_1_sid, square_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); - check = H5S_select_shape_same_test(three_d_space_2_sid, square_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(three_d_space_2_sid, square_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); - check = H5S_select_shape_same_test(three_d_space_3_sid, square_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(three_d_space_3_sid, square_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); - check = H5S_select_shape_same_test(four_d_space_0_sid, square_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(four_d_space_0_sid, square_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); - check = H5S_select_shape_same_test(four_d_space_1_sid, square_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(four_d_space_1_sid, square_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); - check = H5S_select_shape_same_test(four_d_space_2_sid, square_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(four_d_space_2_sid, square_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); - check = H5S_select_shape_same_test(four_d_space_3_sid, square_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(four_d_space_3_sid, square_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); - check = H5S_select_shape_same_test(four_d_space_4_sid, square_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(four_d_space_4_sid, square_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); - check = H5S_select_shape_same_test(four_d_space_5_sid, square_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(four_d_space_5_sid, square_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); - check = H5S_select_shape_same_test(four_d_space_6_sid, square_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(four_d_space_6_sid, square_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Close dataspaces */ @@ -10478,12 +10056,12 @@ test_shape_same_dr__smoke_check_4(void) /**************************************************************** ** ** test_shape_same_dr__full_space_vs_slice(): Tests selection -** of a full n-cube data space vs an n-dimensional slice of -** of an m-cube (m > n) in a call to H5S_select_shape_same(). -** Note that this test does not require the n-cube and the +** of a full n-cube data space vs an n-dimensional slice of +** of an m-cube (m > n) in a call to H5S_select_shape_same(). +** Note that this test does not require the n-cube and the ** n-dimensional slice to have the same rank (although -** H5S_select_shape_same() should always return FALSE if -** they don't). +** H5S_select_shape_same() should always return FALSE if +** they don't). ** ** Per Quincey's suggestion, only test up to 5 dimensional ** spaces. @@ -10520,16 +10098,16 @@ test_shape_same_dr__full_space_vs_slice(int test_num, HDassert( large_rank <= SS_DR_MAX_RANK ); HDassert( 0 <= offset ); HDassert( offset < large_rank ); - HDassert( edge_size > 0 ); - HDassert( edge_size <= 1000 ); + HDassert( edge_size > 0 ); + HDassert( edge_size <= 1000 ); - sprintf(test_desc_0, - "\tn-cube slice through m-cube (n <= m) test %d.\n", + sprintf(test_desc_0, + "\tn-cube slice through m-cube (n <= m) test %d.\n", test_num); MESSAGE(7, (test_desc_0)); /* This statement must be updated if SS_DR_MAX_RANK is changed */ - sprintf(test_desc_1, + sprintf(test_desc_1, "\t\tranks: %d/%d offset: %d dim_selected: %d/%d/%d/%d/%d.\n", small_rank, large_rank, offset, (int)dim_selected[0], @@ -10594,7 +10172,7 @@ test_shape_same_dr__full_space_vs_slice(int test_num, /* setup is done -- run the test: */ - check = H5S_select_shape_same_test(n_cube_0_sid, n_cube_1_sid); + check = H5S__select_shape_same_test(n_cube_0_sid, n_cube_1_sid); VERIFY(check, expected_result, "test_shape_same_dr__full_space_vs_slice"); @@ -10610,27 +10188,27 @@ test_shape_same_dr__full_space_vs_slice(int test_num, /**************************************************************** ** -** test_shape_same_dr__run_full_space_vs_slice_tests(): +** test_shape_same_dr__run_full_space_vs_slice_tests(): ** ** Run the est_shape_same_dr__full_space_vs_slice() test ** over a variety of ranks and offsets. ** -** At present, we test H5S_select_shape_same() with +** At present, we test H5S_select_shape_same() with ** fully selected 1, 2, 3, and 4 cubes as one parameter, and ** 1, 2, 3, and 4 dimensional slices through a n-cube of rank -** no more than 5 (and at least the rank of the slice). -** We stop at rank 5, as Quincey suggested that it would be +** no more than 5 (and at least the rank of the slice). +** We stop at rank 5, as Quincey suggested that it would be ** sufficient. ** -** All the n-cubes will have lengths of the same size, so +** All the n-cubes will have lengths of the same size, so ** H5S_select_shape_same() should return true iff: ** -** 1) the rank for the fully selected n cube equals the +** 1) the rank for the fully selected n cube equals the ** number of dimensions selected in the slice through the ** m-cube (m >= n). ** ** 2) The dimensions selected in the slice through the m-cube -** are the dimesnions with the most quickly changing +** are the dimesnions with the most quickly changing ** indices. ** ****************************************************************/ @@ -10736,7 +10314,7 @@ test_shape_same_dr__run_full_space_vs_slice_tests(void) dim_selected, expected_result ); - + z++; } while((z < 2) && (large_rank >= 1)); @@ -10759,15 +10337,15 @@ test_shape_same_dr__run_full_space_vs_slice_tests(void) /**************************************************************** ** -** test_shape_same_dr__checkerboard(): Tests selection of a -** "checker board" subset of a full n-cube data space vs +** test_shape_same_dr__checkerboard(): Tests selection of a +** "checker board" subset of a full n-cube data space vs ** a "checker board" n-dimensional slice of an m-cube (m > n). -** in a call to H5S_select_shape_same(). +** in a call to H5S_select_shape_same(). ** -** Note that this test does not require the n-cube and the +** Note that this test does not require the n-cube and the ** n-dimensional slice to have the same rank (although -** H5S_select_shape_same() should always return FALSE if -** they don't). +** H5S_select_shape_same() should always return FALSE if +** they don't). ** ** Per Quincey's suggestion, only test up to 5 dimensional ** spaces. @@ -10787,11 +10365,11 @@ test_shape_same_dr__checkerboard(int test_num, char test_desc_1[128]; int i; int dims_selected = 0; - hid_t n_cube_0_sid; /* the checker board selected - * hyper cube + hid_t n_cube_0_sid; /* the checker board selected + * hyper cube */ - hid_t n_cube_1_sid; /* the hyper cube in which a - * checkerboard slice is selected + hid_t n_cube_1_sid; /* the hyper cube in which a + * checkerboard slice is selected */ hsize_t dims[SS_DR_MAX_RANK]; hsize_t base_start[2]; @@ -10813,8 +10391,8 @@ test_shape_same_dr__checkerboard(int test_num, HDassert( small_rank <= large_rank ); HDassert( large_rank <= SS_DR_MAX_RANK ); HDassert( 0 < checker_size ); - HDassert( checker_size <= edge_size ); - HDassert( edge_size <= 1000 ); + HDassert( checker_size <= edge_size ); + HDassert( edge_size <= 1000 ); HDassert( 0 <= offset ); HDassert( offset < (int)edge_size ); @@ -10825,13 +10403,13 @@ test_shape_same_dr__checkerboard(int test_num, HDassert( dims_selected >= 0 ); HDassert( dims_selected <= large_rank ); - sprintf(test_desc_0, - "\tcheckerboard n-cube slice through m-cube (n <= m) test %d.\n", + sprintf(test_desc_0, + "\tcheckerboard n-cube slice through m-cube (n <= m) test %d.\n", test_num); MESSAGE(7, (test_desc_0)); /* This statement must be updated if SS_DR_MAX_RANK is changed */ - sprintf(test_desc_1, + sprintf(test_desc_1, "\tranks: %d/%d edge/chkr size: %d/%d offset: %d dim_selected: %d/%d/%d/%d/%d:%d.\n", small_rank, large_rank, (int)edge_size, (int)checker_size, @@ -10871,17 +10449,17 @@ test_shape_same_dr__checkerboard(int test_num, * * * - - * * - - * * * * * - - * * - - * * * - * In both cases, asterisks indicate selected elements, + * In both cases, asterisks indicate selected elements, * and dashes indicate unselected elements. * * 3-D and 4-D ascii art is somewhat painful, so I'll * leave those selections to your imagination. :-) * * Note, that since the edge_size and checker_size are - * parameters that are passed in, the selection need + * parameters that are passed in, the selection need * not look exactly like the selection shown above. - * At present, the function allows checker sizes that - * are not even divisors of the edge size -- thus + * At present, the function allows checker sizes that + * are not even divisors of the edge size -- thus * something like the following is also possible: * * * * * - - - * * * - @@ -10895,14 +10473,14 @@ test_shape_same_dr__checkerboard(int test_num, * * * * - - - * * * - * - - - * * * - - - * * - * As the above pattern can't be selected in one + * As the above pattern can't be selected in one * call to H5Sselect_hyperslab(), and since the * values in the start, stride, count, and block - * arrays will be repeated over all entries in + * arrays will be repeated over all entries in * the selected space case, and over all selected * dimensions in the selected hyperslab case, we - * compute these values first and store them in - * in the base_start, base_stride, base_count, + * compute these values first and store them in + * in the base_start, base_stride, base_count, * and base_block arrays. */ @@ -10912,9 +10490,9 @@ test_shape_same_dr__checkerboard(int test_num, base_stride[0] = 2 * checker_size; base_stride[1] = 2 * checker_size; - /* Note that the following computation depends on the C99 - * requirement that integer division discard any fraction - * (truncation towards zero) to function correctly. As we + /* Note that the following computation depends on the C99 + * requirement that integer division discard any fraction + * (truncation towards zero) to function correctly. As we * now require C99, this shouldn't be a problem, but noting * it may save us some pain if we are ever obliged to support * pre-C99 compilers again. @@ -10931,7 +10509,7 @@ test_shape_same_dr__checkerboard(int test_num, base_block[0] = checker_size; base_block[1] = checker_size; - /* now setup start, stride, count, and block arrays for + /* now setup start, stride, count, and block arrays for * the first call to H5Sselect_hyperslab(). */ for(i = 0; i < SS_DR_MAX_RANK; i++) { @@ -10945,10 +10523,10 @@ test_shape_same_dr__checkerboard(int test_num, start, stride, count, block); CHECK(ret, FAIL, "H5Sselect_hyperslab"); - /* if small_rank == 1, or if edge_size == checker_size, we + /* if small_rank == 1, or if edge_size == checker_size, we * are done, as either there is no added dimension in which * to place offset selected "checkers". - * + * * Otherwise, set up start, stride, count and block, and * make the additional selection. */ @@ -10968,7 +10546,7 @@ test_shape_same_dr__checkerboard(int test_num, /* Wierdness alert: * - * Some how, it seems that selections can extend beyond the + * Some how, it seems that selections can extend beyond the * boundaries of the target data space -- hence the following * code to manually clip the selection back to the data space * proper. @@ -10991,8 +10569,8 @@ test_shape_same_dr__checkerboard(int test_num, /* Now select the checkerboard selection in the (possibly larger) n-cube. - * - * Since we have already calculated the base start, stride, count, + * + * Since we have already calculated the base start, stride, count, * and block, re-use the values in setting up start, stride, count, * and block. */ @@ -11036,10 +10614,10 @@ test_shape_same_dr__checkerboard(int test_num, start_ptr, stride_ptr, count_ptr, block_ptr); CHECK(ret, FAIL, "H5Sselect_hyperslab"); - /* As before, if the number of dimensions selected is less than or - * equal to 1, or if edge_size == checker_size, we are done, as - * either there is no added dimension in which to place offset selected - * "checkers", or the hyperslab is completely occupied by one + /* As before, if the number of dimensions selected is less than or + * equal to 1, or if edge_size == checker_size, we are done, as + * either there is no added dimension in which to place offset selected + * "checkers", or the hyperslab is completely occupied by one * "checker". * * Otherwise, set up start, stride, count and block, and @@ -11069,7 +10647,7 @@ test_shape_same_dr__checkerboard(int test_num, /* Wierdness alert: * - * Again, it seems that selections can extend beyond the + * Again, it seems that selections can extend beyond the * boundaries of the target data space -- hence the following * code to manually clip the selection back to the data space * proper. @@ -11086,7 +10664,7 @@ test_shape_same_dr__checkerboard(int test_num, CHECK(ret, FAIL, "H5Sselect_hyperslab"); /* setup is done -- run the test: */ - check = H5S_select_shape_same_test(n_cube_0_sid, n_cube_1_sid); + check = H5S__select_shape_same_test(n_cube_0_sid, n_cube_1_sid); VERIFY(check, expected_result, "test_shape_same_dr__checkerboard"); @@ -11102,23 +10680,23 @@ test_shape_same_dr__checkerboard(int test_num, /**************************************************************** ** -** test_shape_same_dr__run_checkerboard_tests(): +** test_shape_same_dr__run_checkerboard_tests(): ** -** In this set of tests, we test H5S_select_shape_same() -** with a "checkerboard" selection of 1, 2, 3, and 4 cubes as -** one parameter, and 1, 2, 3, and 4 dimensional checkerboard -** slices through a n-cube of rank no more than 5 (and at -** least the rank of the slice). +** In this set of tests, we test H5S_select_shape_same() +** with a "checkerboard" selection of 1, 2, 3, and 4 cubes as +** one parameter, and 1, 2, 3, and 4 dimensional checkerboard +** slices through a n-cube of rank no more than 5 (and at +** least the rank of the slice). ** -** All the n-cubes will have lengths of the same size, so +** All the n-cubes will have lengths of the same size, so ** H5S_select_shape_same() should return true iff: ** -** 1) the rank of the n cube equals the number of dimensions -** selected in the checker board slice through the m-cube +** 1) the rank of the n cube equals the number of dimensions +** selected in the checker board slice through the m-cube ** (m >= n). ** -** 2) The dimensions selected in the checkerboard slice -** through the m-cube are the dimensions with the most +** 2) The dimensions selected in the checkerboard slice +** through the m-cube are the dimensions with the most ** quickly changing indices. ** ****************************************************************/ @@ -11169,7 +10747,7 @@ test_shape_same_dr__run_checkerboard_tests(void) dim_selected[4] = FALSE; else dim_selected[4] = TRUE; - + /* compute the expected result: */ i = 0; @@ -11373,17 +10951,17 @@ test_shape_same_dr__run_checkerboard_tests(void) /**************************************************************** ** -** test_shape_same_dr__irregular(): +** test_shape_same_dr__irregular(): ** -** Tests selection of an "irregular" subset of a full +** Tests selection of an "irregular" subset of a full ** n-cube data space vs an identical "irregular" subset ** of an n-dimensional slice of an m-cube (m > n). -** in a call to H5S_select_shape_same(). +** in a call to H5S_select_shape_same(). ** -** Note that this test does not require the n-cube and the +** Note that this test does not require the n-cube and the ** n-dimensional slice to have the same rank (although -** H5S_select_shape_same() should always return FALSE if -** they don't). +** H5S_select_shape_same() should always return FALSE if +** they don't). ** ****************************************************************/ static void @@ -11405,7 +10983,7 @@ test_shape_same_dr__irregular(int test_num, hid_t n_cube_0_sid; /* the hyper cube containing * an irregular selection */ - hid_t n_cube_1_sid; /* the hyper cube in which a + hid_t n_cube_1_sid; /* the hyper cube in which a * slice contains an irregular * selection. */ @@ -11441,7 +11019,7 @@ test_shape_same_dr__irregular(int test_num, hsize_t clip_block[SS_DR_MAX_RANK] = {10, 10, 10, 10, 10}; - hsize_t *(starts[SS_DR_MAX_RANK]) = + hsize_t *(starts[SS_DR_MAX_RANK]) = {start_0, start_1, start_2, start_3, start_4}; hsize_t *(strides[SS_DR_MAX_RANK]) = {stride_0, stride_1, stride_2, stride_3, stride_4}; @@ -11464,8 +11042,8 @@ test_shape_same_dr__irregular(int test_num, HDassert( 0 < small_rank ); HDassert( small_rank <= large_rank ); HDassert( large_rank <= SS_DR_MAX_RANK ); - HDassert( 9 <= edge_size ); - HDassert( edge_size <= 1000 ); + HDassert( 9 <= edge_size ); + HDassert( edge_size <= 1000 ); HDassert( 0 <= slice_offset ); HDassert( slice_offset < edge_size ); HDassert( -2 <= pattern_offset ); @@ -11478,16 +11056,16 @@ test_shape_same_dr__irregular(int test_num, HDassert( dims_selected >= 0 ); HDassert( dims_selected <= large_rank ); - sprintf(test_desc_0, - "\tirregular sub set of n-cube slice through m-cube (n <= m) test %d.\n", + sprintf(test_desc_0, + "\tirregular sub set of n-cube slice through m-cube (n <= m) test %d.\n", test_num); MESSAGE(7, (test_desc_0)); /* This statement must be updated if SS_DR_MAX_RANK is changed */ - sprintf(test_desc_1, + sprintf(test_desc_1, "\tranks: %d/%d edge: %d s/p offset: %d/%d dim_selected: %d/%d/%d/%d/%d:%d.\n", small_rank, large_rank, - edge_size, + edge_size, slice_offset, pattern_offset, (int)dim_selected[0], (int)dim_selected[1], @@ -11506,11 +11084,11 @@ test_shape_same_dr__irregular(int test_num, CHECK(n_cube_0_sid, FAIL, "H5Screate_simple"); /* Select an "irregular" pattern in the small n-cube. This - * pattern can be though of a set of four 3 x 2 x 2 X 2 - * four dimensional prisims, each parallel to one of the - * axies and none of them intersecting with the other. + * pattern can be though of a set of four 3 x 2 x 2 X 2 + * four dimensional prisims, each parallel to one of the + * axies and none of them intersecting with the other. * - * In the lesser dimensional cases, this 4D pattern is + * In the lesser dimensional cases, this 4D pattern is * projected onto the lower dimensional space. * * In the 1-D case, the projection of the pattern looks @@ -11535,12 +11113,12 @@ test_shape_same_dr__irregular(int test_num, * 0 - - - - - - - - - - * 0 1 2 3 4 5 6 7 8 9 x * - * In both cases, asterisks indicate selected elements, + * In both cases, asterisks indicate selected elements, * and dashes indicate unselected elements. * * Note that is this case, since the edge size is fixed, - * the pattern does not change. However, we do use the - * displacement parameter to allow it to be moved around + * the pattern does not change. However, we do use the + * displacement parameter to allow it to be moved around * within the n-cube or hyper slab. */ @@ -11555,7 +11133,7 @@ test_shape_same_dr__irregular(int test_num, CHECK(ret, FAIL, "H5Sselect_hyperslab"); } /* end for */ - /* finally, clip the selection to ensure that it lies fully + /* finally, clip the selection to ensure that it lies fully * within the n-cube. */ ret = H5Sselect_hyperslab(n_cube_0_sid, H5S_SELECT_AND, @@ -11594,8 +11172,8 @@ test_shape_same_dr__irregular(int test_num, /* Now select the irregular selection in the (possibly larger) n-cube. - * - * Basic idea is to project the pattern used in the smaller n-cube + * + * Basic idea is to project the pattern used in the smaller n-cube * onto the dimensions selected in the larger n-cube, with the displacement * specified. */ @@ -11632,7 +11210,7 @@ test_shape_same_dr__irregular(int test_num, /* setup is done -- run the test: */ - check = H5S_select_shape_same_test(n_cube_0_sid, n_cube_1_sid); + check = H5S__select_shape_same_test(n_cube_0_sid, n_cube_1_sid); VERIFY(check, expected_result, "test_shape_same_dr__checkerboard"); @@ -11648,25 +11226,25 @@ test_shape_same_dr__irregular(int test_num, /**************************************************************** ** -** test_shape_same_dr__run_irregular_tests(): +** test_shape_same_dr__run_irregular_tests(): ** -** In this set of tests, we test H5S_select_shape_same() -** with an "irregular" subselection of 1, 2, 3, and 4 cubes as -** one parameter, and irregular subselections of 1, 2, 3, -** and 4 dimensional slices through a n-cube of rank no more -** than 5 (and at least the rank of the slice) as the other. -** Note that the "irregular" selection may be offset between +** In this set of tests, we test H5S_select_shape_same() +** with an "irregular" subselection of 1, 2, 3, and 4 cubes as +** one parameter, and irregular subselections of 1, 2, 3, +** and 4 dimensional slices through a n-cube of rank no more +** than 5 (and at least the rank of the slice) as the other. +** Note that the "irregular" selection may be offset between ** the n-cube and the slice. ** ** All the irregular selections will be identical (modulo rank) ** so H5S_select_shape_same() should return true iff: ** -** 1) the rank of the n cube equals the number of dimensions -** selected in the irregular slice through the m-cube +** 1) the rank of the n cube equals the number of dimensions +** selected in the irregular slice through the m-cube ** (m >= n). ** -** 2) The dimensions selected in the irregular slice -** through the m-cube are the dimensions with the most +** 2) The dimensions selected in the irregular slice +** through the m-cube are the dimensions with the most ** quickly changing indices. ** ****************************************************************/ @@ -11717,7 +11295,7 @@ test_shape_same_dr__run_irregular_tests(void) dim_selected[4] = FALSE; else dim_selected[4] = TRUE; - + /* compute the expected result: */ i = 0; @@ -11863,8 +11441,8 @@ test_shape_same_dr__run_irregular_tests(void) /**************************************************************** ** -** test_shape_same_dr(): Tests selections on dataspace with -** different ranks, to verify that "shape same" routine +** test_shape_same_dr(): Tests selections on dataspace with +** different ranks, to verify that "shape same" routine ** is now handling this case correctly. ** ****************************************************************/ @@ -11981,8 +11559,8 @@ test_space_rebuild(void) CHECK(ret, FAIL, "H5Sselect_hyperslab"); rebuild_stat = FALSE; - rebuild_stat = H5S_get_rebuild_status_test(sid_reg1); - assert(rebuild_stat!=FAIL); + rebuild_stat = H5S__get_rebuild_status_test(sid_reg1); + HDassert(rebuild_stat!=FAIL); /* In this case, rebuild_stat should be TRUE. */ if(!rebuild_stat){ ret = FAIL; @@ -11990,7 +11568,7 @@ test_space_rebuild(void) } else { /* In this case, rebuild_check should be TRUE. */ - rebuild_check = H5S_select_shape_same_test(sid_reg1,sid_reg_ori1); + rebuild_check = H5S__select_shape_same_test(sid_reg1,sid_reg_ori1); CHECK(rebuild_check,FALSE,"H5S_hyper_rebuild"); } @@ -12013,7 +11591,7 @@ test_space_rebuild(void) CHECK(ret, FAIL, "H5Sselect_hyperslab"); rebuild_stat = TRUE; - rebuild_stat = H5S_get_rebuild_status_test(sid_irreg1); + rebuild_stat = H5S__get_rebuild_status_test(sid_irreg1); assert(rebuild_stat!=FAIL); /* In this case, rebuild_stat should be FALSE. */ if(rebuild_stat){ @@ -12060,8 +11638,8 @@ test_space_rebuild(void) CHECK(ret, FAIL, "H5Sselect_hyperslab"); rebuild_stat = FALSE; - rebuild_stat = H5S_get_rebuild_status_test(sid_reg2); - assert(rebuild_stat!=FAIL); + rebuild_stat = H5S__get_rebuild_status_test(sid_reg2); + HDassert(rebuild_stat!=FAIL); /* In this case, rebuild_stat should be TRUE. */ if(!rebuild_stat){ ret = FAIL; @@ -12069,7 +11647,7 @@ test_space_rebuild(void) } else { /* In this case, rebuild_check should be TRUE. */ - rebuild_check = H5S_select_shape_same_test(sid_reg2,sid_reg_ori2); + rebuild_check = H5S__select_shape_same_test(sid_reg2,sid_reg_ori2); CHECK(rebuild_check,FALSE,"H5S_hyper_rebuild"); } @@ -12097,8 +11675,8 @@ test_space_rebuild(void) CHECK(ret, FAIL, "H5Sselect_hyperslab"); rebuild_stat = TRUE; - rebuild_stat = H5S_get_rebuild_status_test(sid_irreg2); - assert(rebuild_stat!=FAIL); + rebuild_stat = H5S__get_rebuild_status_test(sid_irreg2); + HDassert(rebuild_stat!=FAIL); /* In this case, rebuild_stat should be FALSE. */ if(rebuild_stat){ ret = FAIL; @@ -12149,8 +11727,8 @@ test_space_rebuild(void) CHECK(ret, FAIL, "H5Sselect_hyperslab"); rebuild_stat = FALSE; - rebuild_stat = H5S_get_rebuild_status_test(sid_reg3); - assert(rebuild_stat!=FAIL); + rebuild_stat = H5S__get_rebuild_status_test(sid_reg3); + HDassert(rebuild_stat!=FAIL); /* In this case, rebuild_stat should be TRUE. */ if(!rebuild_stat){ @@ -12159,7 +11737,7 @@ test_space_rebuild(void) } else { /* In this case, rebuild_check should be TRUE. */ - rebuild_check = H5S_select_shape_same_test(sid_reg3,sid_reg_ori3); + rebuild_check = H5S__select_shape_same_test(sid_reg3,sid_reg_ori3); CHECK(rebuild_check,FALSE,"H5S_hyper_rebuild"); } @@ -12192,8 +11770,8 @@ test_space_rebuild(void) CHECK(ret, FAIL, "H5Sselect_hyperslab"); rebuild_stat = TRUE; - rebuild_stat = H5S_get_rebuild_status_test(sid_irreg3); - assert(rebuild_stat!=FAIL); + rebuild_stat = H5S__get_rebuild_status_test(sid_irreg3); + HDassert(rebuild_stat!=FAIL); /* In this case, rebuild_stat should be FALSE. */ if(rebuild_stat){ ret = FAIL; @@ -12252,8 +11830,8 @@ test_space_rebuild(void) rebuild_stat = FALSE; - rebuild_stat = H5S_get_rebuild_status_test(sid_reg4); - assert(rebuild_stat!=FAIL); + rebuild_stat = H5S__get_rebuild_status_test(sid_reg4); + HDassert(rebuild_stat!=FAIL); /* In this case, rebuild_stat should be TRUE. */ if(!rebuild_stat){ ret = FAIL; @@ -12261,7 +11839,7 @@ test_space_rebuild(void) } else { /* In this case, rebuild_check should be TRUE. */ - rebuild_check = H5S_select_shape_same_test(sid_reg4,sid_reg_ori4); + rebuild_check = H5S__select_shape_same_test(sid_reg4,sid_reg_ori4); CHECK(rebuild_check,FALSE,"H5S_hyper_rebuild"); } @@ -12305,8 +11883,8 @@ test_space_rebuild(void) CHECK(ret, FAIL, "H5Sselect_hyperslab"); rebuild_stat = TRUE; - rebuild_stat = H5S_get_rebuild_status_test(sid_irreg4); - assert(rebuild_stat!=FAIL); + rebuild_stat = H5S__get_rebuild_status_test(sid_irreg4); + HDassert(rebuild_stat!=FAIL); /* In this case, rebuild_stat should be FALSE. */ if(rebuild_stat){ ret = FAIL; @@ -12369,8 +11947,8 @@ test_space_rebuild(void) rebuild_stat = FALSE; - rebuild_stat = H5S_get_rebuild_status_test(sid_reg5); - assert(rebuild_stat!=FAIL); + rebuild_stat = H5S__get_rebuild_status_test(sid_reg5); + HDassert(rebuild_stat!=FAIL); /* In this case, rebuild_stat should be TRUE. */ if(!rebuild_stat){ ret = FAIL; @@ -12378,7 +11956,7 @@ test_space_rebuild(void) } else { /* In this case, rebuild_check should be TRUE. */ - rebuild_check = H5S_select_shape_same_test(sid_reg5,sid_reg_ori5); + rebuild_check = H5S__select_shape_same_test(sid_reg5,sid_reg_ori5); CHECK(rebuild_check,FALSE,"H5S_hyper_rebuild"); } @@ -12427,8 +12005,8 @@ test_space_rebuild(void) CHECK(ret, FAIL, "H5Sselect_hyperslab"); rebuild_stat = TRUE; - rebuild_stat = H5S_get_rebuild_status_test(sid_irreg5); - assert(rebuild_stat!=FAIL); + rebuild_stat = H5S__get_rebuild_status_test(sid_irreg5); + HDassert(rebuild_stat!=FAIL); /* In this case, rebuild_stat should be FALSE. */ if(rebuild_stat){ ret = FAIL; @@ -12468,7 +12046,7 @@ test_space_rebuild(void) ret = H5Sselect_hyperslab(sid_spec,H5S_SELECT_SET,start5,stride5,count5,block5); CHECK(ret, FAIL, "H5Sselect_hyperslab"); rebuild_stat = FALSE; - rebuild_stat = H5S_get_rebuild_status_test(sid_spec); + rebuild_stat = H5S__get_rebuild_status_test(sid_spec); /* In this case, rebuild_stat should be TRUE. */ if(!rebuild_stat){ ret = FAIL; @@ -12490,8 +12068,8 @@ test_space_rebuild(void) CHECK(ret, FAIL, "H5Sselect_hyperslab"); rebuild_stat = TRUE; - rebuild_stat = H5S_get_rebuild_status_test(sid_spec); - assert(rebuild_stat!=FAIL); + rebuild_stat = H5S__get_rebuild_status_test(sid_spec); + HDassert(rebuild_stat!=FAIL); /* In this case, rebuild_stat should be FALSE. */ if(rebuild_stat){ ret = FAIL; @@ -12513,8 +12091,8 @@ test_space_rebuild(void) CHECK(ret, FAIL, "H5Sselect_hyperslab"); rebuild_stat = FALSE; - rebuild_stat = H5S_get_rebuild_status_test(sid_spec); - assert(rebuild_stat!=FAIL); + rebuild_stat = H5S__get_rebuild_status_test(sid_spec); + HDassert(rebuild_stat!=FAIL); /* In this case, rebuild_stat should be FALSE. */ if(!rebuild_stat){ ret = FAIL; @@ -12929,9 +12507,9 @@ test_select_bounds(void) /* Get bounds for 'none' selection */ H5E_BEGIN_TRY { ret = H5Sget_select_bounds(sid, low_bounds, high_bounds); - } H5E_END_TRY; - VERIFY(ret, FAIL, "H5Sget_select_bo unds"); - + } H5E_END_TRY; + VERIFY(ret, FAIL, "H5Sget_select_bo unds"); + /* Set point selection */ coord[0][0] = 3; coord[0][1] = 3; coord[1][0] = 3; coord[1][1] = 96; @@ -13108,14 +12686,14 @@ test_hyper_regular(void) /* Query if 'all' selection is regular hyperslab (should fail) */ H5E_BEGIN_TRY { is_regular = H5Sis_regular_hyperslab(sid); - } H5E_END_TRY; - VERIFY(is_regular, FAIL, "H5Sis_regular_hyperslab"); + } H5E_END_TRY; + VERIFY(is_regular, FAIL, "H5Sis_regular_hyperslab"); /* Query regular hyperslab selection info (should fail) */ H5E_BEGIN_TRY { ret = H5Sget_regular_hyperslab(sid, q_start, q_stride, q_count, q_block); - } H5E_END_TRY; - VERIFY(ret, FAIL, "H5Sget_regular_hyperslab"); + } H5E_END_TRY; + VERIFY(ret, FAIL, "H5Sget_regular_hyperslab"); /* Set 'none' selection */ ret = H5Sselect_none(sid); @@ -13124,14 +12702,14 @@ test_hyper_regular(void) /* Query if 'none' selection is regular hyperslab (should fail) */ H5E_BEGIN_TRY { is_regular = H5Sis_regular_hyperslab(sid); - } H5E_END_TRY; - VERIFY(is_regular, FAIL, "H5Sis_regular_hyperslab"); + } H5E_END_TRY; + VERIFY(is_regular, FAIL, "H5Sis_regular_hyperslab"); /* Query regular hyperslab selection info (should fail) */ H5E_BEGIN_TRY { ret = H5Sget_regular_hyperslab(sid, q_start, q_stride, q_count, q_block); - } H5E_END_TRY; - VERIFY(ret, FAIL, "H5Sget_regular_hyperslab"); + } H5E_END_TRY; + VERIFY(ret, FAIL, "H5Sget_regular_hyperslab"); /* Set point selection */ coord[0][0] = 3; coord[0][1] = 3; coord[0][2] = 3; @@ -13144,14 +12722,14 @@ test_hyper_regular(void) /* Query if 'point' selection is regular hyperslab (should fail) */ H5E_BEGIN_TRY { is_regular = H5Sis_regular_hyperslab(sid); - } H5E_END_TRY; - VERIFY(is_regular, FAIL, "H5Sis_regular_hyperslab"); + } H5E_END_TRY; + VERIFY(is_regular, FAIL, "H5Sis_regular_hyperslab"); /* Query regular hyperslab selection info (should fail) */ H5E_BEGIN_TRY { ret = H5Sget_regular_hyperslab(sid, q_start, q_stride, q_count, q_block); - } H5E_END_TRY; - VERIFY(ret, FAIL, "H5Sget_regular_hyperslab"); + } H5E_END_TRY; + VERIFY(ret, FAIL, "H5Sget_regular_hyperslab"); /* Set "regular" hyperslab selection */ start[0] = 2; start[1] = 2; start[2] = 2; @@ -13163,7 +12741,7 @@ test_hyper_regular(void) /* Query if 'hyperslab' selection is regular hyperslab (should be TRUE) */ is_regular = H5Sis_regular_hyperslab(sid); - VERIFY(is_regular, TRUE, "H5Sis_regular_hyperslab"); + VERIFY(is_regular, TRUE, "H5Sis_regular_hyperslab"); /* Retrieve the hyperslab parameters */ ret = H5Sget_regular_hyperslab(sid, q_start, q_stride, q_count, q_block); @@ -13189,13 +12767,13 @@ test_hyper_regular(void) /* Query if 'hyperslab' selection is regular hyperslab (should be FALSE) */ is_regular = H5Sis_regular_hyperslab(sid); - VERIFY(is_regular, FALSE, "H5Sis_regular_hyperslab"); + VERIFY(is_regular, FALSE, "H5Sis_regular_hyperslab"); /* Query regular hyperslab selection info (should fail) */ H5E_BEGIN_TRY { ret = H5Sget_regular_hyperslab(sid, q_start, q_stride, q_count, q_block); - } H5E_END_TRY; - VERIFY(ret, FAIL, "H5Sget_regular_hyperslab"); + } H5E_END_TRY; + VERIFY(ret, FAIL, "H5Sget_regular_hyperslab"); /* 'XOR' in the point again, to remove it, which should make it regular again */ t_start[0] = 0; t_start[1] = 0; t_start[2] = 0; @@ -13205,7 +12783,7 @@ test_hyper_regular(void) /* Query if 'hyperslab' selection is regular hyperslab (should be TRUE) */ is_regular = H5Sis_regular_hyperslab(sid); - VERIFY(is_regular, TRUE, "H5Sis_regular_hyperslab"); + VERIFY(is_regular, TRUE, "H5Sis_regular_hyperslab"); /* Retrieve the hyperslab parameters */ ret = H5Sget_regular_hyperslab(sid, q_start, q_stride, q_count, q_block); @@ -13729,10 +13307,6 @@ test_select(void) test_select_hyper_offset2();/* Test more selection offset code with hyperslabs */ test_select_point_offset(); /* Test selection offset code with elements */ test_select_hyper_union(); /* Test hyperslab union code */ -#ifdef NEW_HYPERSLAB_API - test_select_hyper_union_stagger(); /* Test hyperslab union code for staggered slabs */ - test_select_hyper_union_3d(); /* Test hyperslab union code for 3-D dataset */ -#endif /* NEW_HYPERSLAB_API */ test_select_hyper_and_2d(); /* Test hyperslab intersection (AND) code for 2-D dataset */ test_select_hyper_xor_2d(); /* Test hyperslab XOR code for 2-D dataset */ test_select_hyper_notb_2d(); /* Test hyperslab NOTB code for 2-D dataset */ @@ -13848,6 +13422,6 @@ test_select(void) void cleanup_select(void) { - remove(FILENAME); + HDremove(FILENAME); } diff --git a/test/tsohm.c b/test/tsohm.c index 718b12f..5c3707f 100644 --- a/test/tsohm.c +++ b/test/tsohm.c @@ -13,7 +13,7 @@ /*********************************************************** * -* Test program: tsohm +* Test program: tsohm * * Test Shared Object Header Messages * @@ -25,9 +25,9 @@ * This file needs to access private information from the H5F package. * This file also needs to access the file testing code. */ -#define H5F_FRIEND /*suppress error about including H5Fpkg */ +#define H5F_FRIEND /* suppress error about including H5Fpkg */ #define H5F_TESTING -#include "H5Fpkg.h" /* File access */ +#include "H5Fpkg.h" /* File access */ /* Default SOHM values */ #define DEF_NUM_INDEXES 0 @@ -178,40 +178,39 @@ static void test_sohm_extlink(void); /**************************************************************** ** -** check_fcpl_values(): Helper function for test_sohm_fcpl. -** Verifies that the *_in and *_out parameters are equal. +** verify_fcpl_values(): Verifies that FCPL is set as expected. ** ****************************************************************/ -static void check_fcpl_values(hid_t fcpl_id, const unsigned nindexes_in, - const unsigned *flags_in, const unsigned *minsizes_in, - unsigned l2b, unsigned b2l) +static void +verify_fcpl_values(hid_t fcpl_id, const unsigned nindexes_expected, const unsigned *flags_expected, const unsigned *minsizes_expected, unsigned l2b, unsigned b2l) { - unsigned num_indexes; - unsigned index_flags, min_mesg_size; - unsigned list_size, btree_size; - unsigned x; - herr_t ret; - - /* Verify number of indexes is set to default */ - ret = H5Pget_shared_mesg_nindexes(fcpl_id, &num_indexes); + unsigned nindexes_actual; + unsigned list_size; + unsigned btree_size; + unsigned x; + herr_t ret; + + /* Number of indexes */ + ret = H5Pget_shared_mesg_nindexes(fcpl_id, &nindexes_actual); CHECK_I(ret, "H5Pget_shared_mesg_nindexes"); - VERIFY(num_indexes, nindexes_in, "H5Pget_shared_mesg_nindexes"); + VERIFY(nindexes_actual, nindexes_expected, "H5Pget_shared_mesg_nindexes"); - /* Verify index flags and minsizes are set */ - for(x=0; x<num_indexes; ++x) - { - ret = H5Pget_shared_mesg_index(fcpl_id, x, &index_flags, &min_mesg_size); + /* Index flags and minsizes */ + for(x=0; x<nindexes_actual; ++x) { + unsigned flags_i; + unsigned min_mesg_size; + ret = H5Pget_shared_mesg_index(fcpl_id, x, &flags_i, &min_mesg_size); CHECK_I(ret, "H5Pget_shared_mesg_index"); - VERIFY(index_flags, flags_in[x], "H5Pget_shared_mesg_index"); - VERIFY(min_mesg_size, minsizes_in[x], "H5Pget_shared_mesg_index"); + VERIFY(flags_i, flags_expected[x], "H5Pget_shared_mesg_index"); + VERIFY(min_mesg_size, minsizes_expected[x], "H5Pget_shared_mesg_index"); } - /* Check list-to-btree and btree-to-list values */ + /* List-to-btree and btree-to-list values */ ret = H5Pget_shared_mesg_phase_change(fcpl_id, &list_size, &btree_size); CHECK_I(ret, "H5Pset_shared_mesg_phase_change"); VERIFY(list_size, l2b, "H5Pset_shared_mesg_phase_change"); VERIFY(btree_size, b2l, "H5Pset_shared_mesg_phase_change"); -} +} /* verify_fcpl_values */ /**************************************************************** @@ -219,22 +218,21 @@ static void check_fcpl_values(hid_t fcpl_id, const unsigned nindexes_in, ** test_sohm_fcpl(): Test File Creation Property Lists. ** ****************************************************************/ -static void test_sohm_fcpl(void) +static void +test_sohm_fcpl(void) { - hid_t fid = -1; - hid_t fcpl_id = -1; - hid_t fcpl2_id = -1; - unsigned x; - herr_t ret; /* Generic return value */ + hid_t fid = -1; + hid_t fcpl_id = -1; + hid_t fcpl2_id = -1; + unsigned x; + herr_t ret; - /* Output message about test being performed */ MESSAGE(5, ("Testing File Creation Properties for Shared Messages\n")); fcpl_id = H5Pcreate(H5P_FILE_CREATE); CHECK_I(fcpl_id, "H5Pcreate"); - /* Verify fcpl values */ - check_fcpl_values(fcpl_id, DEF_NUM_INDEXES, def_type_flags, def_minsizes, DEF_L2B, DEF_B2L); + verify_fcpl_values(fcpl_id, DEF_NUM_INDEXES, def_type_flags, def_minsizes, DEF_L2B, DEF_B2L); /* Create a file with this fcpl and make sure that all the values can be * retrieved. @@ -245,8 +243,7 @@ static void test_sohm_fcpl(void) fcpl2_id = H5Fget_create_plist(fid); CHECK_I(fcpl2_id, "H5Fcreate"); - /* Verify fcpl values */ - check_fcpl_values(fcpl2_id, DEF_NUM_INDEXES, def_type_flags, def_minsizes, DEF_L2B, DEF_B2L); + verify_fcpl_values(fcpl2_id, DEF_NUM_INDEXES, def_type_flags, def_minsizes, DEF_L2B, DEF_B2L); ret = H5Pclose(fcpl2_id); CHECK_I(ret, "H5Pclose"); @@ -262,8 +259,7 @@ static void test_sohm_fcpl(void) fcpl2_id = H5Fget_create_plist(fid); CHECK_I(ret, "H5Fcreate"); - /* Verify fcpl values */ - check_fcpl_values(fcpl2_id, DEF_NUM_INDEXES, def_type_flags, def_minsizes, DEF_L2B, DEF_B2L); + verify_fcpl_values(fcpl2_id, DEF_NUM_INDEXES, def_type_flags, def_minsizes, DEF_L2B, DEF_B2L); /* Clean up */ ret = H5Pclose(fcpl2_id); @@ -289,7 +285,7 @@ static void test_sohm_fcpl(void) ret = H5Pset_shared_mesg_phase_change(fcpl_id, TEST_L2B, TEST_B2L); CHECK_I(ret, "H5Pset_shared_mesg_phase_change"); - check_fcpl_values(fcpl_id, TEST_NUM_INDEXES, test_type_flags, test_minsizes, TEST_L2B, TEST_B2L); + verify_fcpl_values(fcpl_id, TEST_NUM_INDEXES, test_type_flags, test_minsizes, TEST_L2B, TEST_B2L); /* Use the fcpl to create a file and get it back again */ fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT); @@ -297,8 +293,7 @@ static void test_sohm_fcpl(void) fcpl2_id = H5Fget_create_plist(fid); CHECK_I(fcpl2_id, "H5Fcreate"); - /* Verify fcpl values */ - check_fcpl_values(fcpl2_id, TEST_NUM_INDEXES, test_type_flags, test_minsizes, TEST_L2B, TEST_B2L); + verify_fcpl_values(fcpl2_id, TEST_NUM_INDEXES, test_type_flags, test_minsizes, TEST_L2B, TEST_B2L); ret = H5Pclose(fcpl2_id); CHECK_I(ret, "H5Pclose"); @@ -314,8 +309,7 @@ static void test_sohm_fcpl(void) fcpl2_id = H5Fget_create_plist(fid); CHECK_I(ret, "H5Fcreate"); - /* Verify fcpl values */ - check_fcpl_values(fcpl2_id, TEST_NUM_INDEXES, test_type_flags, test_minsizes, TEST_L2B, TEST_B2L); + verify_fcpl_values(fcpl2_id, TEST_NUM_INDEXES, test_type_flags, test_minsizes, TEST_L2B, TEST_B2L); /* Clean up */ ret = H5Pclose(fcpl2_id); @@ -323,7 +317,70 @@ static void test_sohm_fcpl(void) ret = H5Fclose(fid); CHECK_I(ret, "H5Fclose"); - /* Test giving bogus values to H5P* functions */ + /* Actually, the list max can be exactly 1 greater than the + * btree min, but no more. + * Reset the second index. + */ + ret = H5Pset_shared_mesg_index(fcpl_id, 1, test_type_flags[1], 15); + CHECK_I(ret, "H5Pset_shared_mesg_index"); + ret = H5Pset_shared_mesg_phase_change(fcpl_id, 10, 11); + CHECK_I(ret, "H5Pset_shared_mesg_phase_change"); + fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT); + CHECK_I(fid, "H5Fcreate"); + ret = H5Fclose(fid); + CHECK_I(ret, "H5Fclose"); + + /* Test edge cases: + * H5O_SHMESG_MAX_NINDEXES and H5O_SHMESG_MAX_LIST_SIZE should be valid + * values. + * Creating a file with uninitialized indexes should work. (TODO: not implemented?) + */ + ret = H5Pset_shared_mesg_nindexes(fcpl_id, H5O_SHMESG_MAX_NINDEXES); + CHECK_I(ret, "H5Pset_shared_mesg_nindexes"); + ret = H5Pset_shared_mesg_phase_change(fcpl_id, H5O_SHMESG_MAX_LIST_SIZE, H5O_SHMESG_MAX_LIST_SIZE); + CHECK_I(ret, "H5Pset_shared_mesg_phase_change"); + fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT); + CHECK_I(fid, "H5Fcreate"); + + /* Clean up */ + ret = H5Pclose(fcpl_id); + CHECK_I(ret, "H5Pclose"); + ret = H5Fclose(fid); + CHECK_I(ret, "H5Fclose"); +} /* test_sohm_fcpl */ + + +/**************************************************************** +** +** test_sohm_fcpl_errors(): Test bogus FCPL settings for SOHMs +** +****************************************************************/ +static void +test_sohm_fcpl_errors(void) +{ + hid_t fcpl_id = -1; + hid_t fid = -1; + unsigned x; + herr_t ret; + + MESSAGE(5, ("Testing bogus file creation properties for shared messages\n")); + + fcpl_id = H5Pcreate(H5P_FILE_CREATE); + CHECK_I(fcpl_id, "H5Pcreate"); + + /* Set up index values */ + ret = H5Pset_shared_mesg_nindexes(fcpl_id, TEST_NUM_INDEXES); + CHECK_I(ret, "H5Pset_shared_mesg_nindexes"); + for(x = 0; x < TEST_NUM_INDEXES; ++x) { + ret = H5Pset_shared_mesg_index(fcpl_id, x, test_type_flags[x], test_minsizes[x]); + CHECK_I(ret, "H5Pset_shared_mesg_index"); + } + + ret = H5Pset_shared_mesg_phase_change(fcpl_id, TEST_L2B, TEST_B2L); + CHECK_I(ret, "H5Pset_shared_mesg_phase_change"); + + verify_fcpl_values(fcpl_id, TEST_NUM_INDEXES, test_type_flags, test_minsizes, TEST_L2B, TEST_B2L); + H5E_BEGIN_TRY { /* Trying to create too many indexes should fail */ ret = H5Pset_shared_mesg_nindexes(fcpl_id, H5O_SHMESG_MAX_NINDEXES + 1); @@ -370,40 +427,7 @@ static void test_sohm_fcpl(void) ret = H5Pset_shared_mesg_phase_change(fcpl_id, H5O_SHMESG_MAX_LIST_SIZE, H5O_SHMESG_MAX_LIST_SIZE+1); VERIFY(ret, -1, "H5Pset_shared_mesg_phase_change"); } H5E_END_TRY - - - /* Actually, the list max can be exactly 1 greater than the - * btree min, but no more. Also, the errors above shouldn't - * have corrupted the fcpl, although we do need to reset the - * second index that we changed above. - */ - ret = H5Pset_shared_mesg_index(fcpl_id, 1, test_type_flags[1], 15); - CHECK_I(ret, "H5Pset_shared_mesg_index"); - ret = H5Pset_shared_mesg_phase_change(fcpl_id, 10, 11); - CHECK_I(ret, "H5Pset_shared_mesg_phase_change"); - fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT); - CHECK_I(fid, "H5Fcreate"); - ret = H5Fclose(fid); - CHECK_I(ret, "H5Fclose"); - - /* Test edge cases; H5O_SHMESG_MAX_NINDEXES and H5O_SHMESG_MAX_LIST_SIZE should be - * valid values. Also, creating a file with uninitialized indexes - * (indexes 3-5) should work. - */ - ret = H5Pset_shared_mesg_nindexes(fcpl_id, H5O_SHMESG_MAX_NINDEXES); - CHECK_I(ret, "H5Pset_shared_mesg_nindexes"); - ret = H5Pset_shared_mesg_phase_change(fcpl_id, H5O_SHMESG_MAX_LIST_SIZE, H5O_SHMESG_MAX_LIST_SIZE); - CHECK_I(ret, "H5Pset_shared_mesg_phase_change"); - fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT); - CHECK_I(fid, "H5Fcreate"); - - - /* Clean up */ - ret = H5Pclose(fcpl_id); - CHECK_I(ret, "H5Pclose"); - ret = H5Fclose(fid); - CHECK_I(ret, "H5Fclose"); -} +} /* test_sohm_fcpl_errors */ /*------------------------------------------------------------------------- @@ -455,7 +479,8 @@ error: H5Tclose(dtype1_id); } H5E_END_TRY return -1; -} +} /* make_dtype1 */ + /*------------------------------------------------------------------------- * Function: make_dtype_2 @@ -518,9 +543,9 @@ error: H5Tclose(int_id); } H5E_END_TRY return -1; -} - +} /* make_dtype2 */ + /*------------------------------------------------------------------------- * Function: close_reopen_file * @@ -540,16 +565,16 @@ error: static hid_t close_reopen_file(hid_t file, const char* filename, hid_t fapl_id) { - hid_t fid; - - if(H5Fclose(file) < 0) FAIL_STACK_ERROR - if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0) FAIL_STACK_ERROR - - return(fid); + if (H5Fclose(file) < 0) + FAIL_STACK_ERROR + file = H5Fopen(filename, H5F_ACC_RDWR, fapl_id); + if (file < 0) + FAIL_STACK_ERROR + return(file); error: return -1; -} +} /* close_reopen_file */ /*------------------------------------------------------------------------- @@ -557,7 +582,6 @@ error: * * Purpose: Creates object headers that use a large datatype message. * - * Used in test_sohm_basic. Should close the file ID passed in. * Set test_file_closing to 1 to add file closing and reopening * whenever possible (to test that SOHMs are written correctly * on disk and not just in memory). @@ -571,7 +595,7 @@ error: *------------------------------------------------------------------------- */ static hid_t -size1_helper(hid_t file, const char* filename, hid_t fapl_id, int test_file_closing) +size1_helper(hid_t file, const char *filename, hid_t fapl_id, int test_file_closing) { dtype1_struct wdata; dtype1_struct rdata; @@ -581,6 +605,32 @@ size1_helper(hid_t file, const char* filename, hid_t fapl_id, int test_file_clos hsize_t dim1[1]; int x; +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + * Macro: TSOHM_S1H_VERIFY_DATA + * + * Purpose: Encapsulate a common pattern: + * Reads the dataset and verifies that [a subset of] the data + * are as expected. + * + * Programmer: Jacob Smith + * 2018 November 1 + * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + */ +#define TSOHM_S1H_VERIFY_DATA(dset_id, dtype_id) \ +{ \ + HDmemset(&rdata, 0, sizeof(rdata)); \ + if (0 > H5Dread((dset_id), (dtype_id), H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata)) { \ + H5_FAILED(); AT(); \ + HDprintf("Can't read data\n"); \ + goto error; \ + } \ + if ((rdata.i1 != wdata.i1) || (rdata.i2 != wdata.i2) || HDstrcmp(rdata.str, wdata.str)) { \ + H5_FAILED(); AT(); \ + HDprintf("incorrect read data\n"); \ + goto error; \ + } \ +} /* TSOHM_S1H_VERIFY_DATA() definition */ + /* Closing and re-opening the file takes a long time on systems without * local disks. Don't close and reopen if express testing is enabled. */ @@ -603,107 +653,68 @@ size1_helper(hid_t file, const char* filename, hid_t fapl_id, int test_file_clos /* Intialize rdata */ HDmemset(&rdata, 0, sizeof(rdata)); - if((dtype1_id = make_dtype_1()) < 0) TEST_ERROR + dtype1_id = make_dtype_1(); + if(dtype1_id < 0) TEST_ERROR - /* Create the dataspace and dataset */ dim1[0] = 1; - if((space_id = H5Screate_simple(1, dim1, NULL)) < 0) TEST_ERROR + space_id = H5Screate_simple(1, dim1, NULL); + if(space_id < 0) TEST_ERROR - if((dset_id = H5Dcreate2(file, DSETNAME[0], dtype1_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + dset_id = H5Dcreate2(file, DSETNAME[0], dtype1_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + if(dset_id < 0) FAIL_STACK_ERROR /* Test writing and reading */ if(H5Dwrite(dset_id, dtype1_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wdata) < 0) FAIL_STACK_ERROR - - if(H5Dread(dset_id, dtype1_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0) FAIL_STACK_ERROR - - if(rdata.i1 != wdata.i1 || rdata.i2 != wdata.i2 || HDstrcmp(rdata.str, wdata.str)) { - H5_FAILED(); AT(); - printf("incorrect read data\n"); - goto error; - } /* end if */ + TSOHM_S1H_VERIFY_DATA(dset_id, dtype1_id) if(H5Dclose(dset_id) < 0) FAIL_STACK_ERROR - /* Close and re-open the file if requested*/ if(test_file_closing) if((file = close_reopen_file(file, filename, fapl_id)) < 0) TEST_ERROR - /* Create more datasets with the same datatype */ - if((dset_id = H5Dcreate2(file, DSETNAME[1], dtype1_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if(H5Dclose(dset_id) < 0) FAIL_STACK_ERROR + /* Create 3 more datasets with the same datatype/dataspace */ + for (x = 1; x < 4; x++) { + dset_id = H5Dcreate2(file, DSETNAME[x], dtype1_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + if (0 > dset_id) FAIL_STACK_ERROR + if (x == 3) + if(H5Dwrite(dset_id, dtype1_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wdata) < 0) TEST_ERROR + if (H5Dclose(dset_id) < 0) FAIL_STACK_ERROR - /* Close and re-open the file if requested*/ - if(test_file_closing) - if((file = close_reopen_file(file, filename, fapl_id)) < 0) TEST_ERROR - - if((dset_id = H5Dcreate2(file, DSETNAME[2], dtype1_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Dclose(dset_id) < 0) TEST_ERROR - - /* Close and re-open the file if requested*/ - if(test_file_closing) - if((file = close_reopen_file(file, filename, fapl_id)) < 0) TEST_ERROR - - if((dset_id = H5Dcreate2(file,DSETNAME[3],dtype1_id,space_id,H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - - /* Write data to dataset 3 for later */ - if(H5Dwrite(dset_id, dtype1_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wdata) < 0) TEST_ERROR + if (test_file_closing) + if((file = close_reopen_file(file, filename, fapl_id)) < 0) TEST_ERROR + } - if(H5Dclose(dset_id) < 0) TEST_ERROR if(H5Tclose(dtype1_id) < 0) TEST_ERROR - /* Close and re-open the file if requested*/ - if(test_file_closing) - if((file = close_reopen_file(file, filename, fapl_id)) < 0) TEST_ERROR - /* Make sure the data has been written successfully */ - if((dset_id = H5Dopen2(file, DSETNAME[0], H5P_DEFAULT)) < 0) TEST_ERROR - if((dtype1_id = H5Dget_type(dset_id)) < 0) TEST_ERROR - - /* Read data back again */ - HDmemset(&rdata, 0, sizeof(rdata)); - if(H5Dread(dset_id, dtype1_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0) { - H5_FAILED(); AT(); - printf("Can't read data\n"); - goto error; - } /* end if */ - - if(rdata.i1 != wdata.i1 || rdata.i2 != wdata.i2 || HDstrcmp(rdata.str, wdata.str)) { - H5_FAILED(); AT(); - printf("incorrect read data\n"); - goto error; - } /* end if */ + dset_id = H5Dopen2(file, DSETNAME[0], H5P_DEFAULT); + if(dset_id < 0) TEST_ERROR + dtype1_id = H5Dget_type(dset_id); + if(dtype1_id < 0) TEST_ERROR + TSOHM_S1H_VERIFY_DATA(dset_id, dtype1_id) if(H5Dclose(dset_id) < 0) TEST_ERROR - /* Create several copies of the dataset (this increases the amount of space saved by sharing the datatype message) */ + /* Create several copies of the dataset + * this increases the amount of space saved by sharing the datatype message + */ for(x = 0; x < SOHM_HELPER_NUM_EX_DSETS; x++) { - if((dset_id = H5Dcreate2(file, EXTRA_DSETNAME[x], dtype1_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + dset_id = H5Dcreate2(file, EXTRA_DSETNAME[x], dtype1_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + if(dset_id < 0) TEST_ERROR if(H5Dclose(dset_id) < 0) TEST_ERROR - /* Close and re-open the file if requested*/ if(test_file_closing) if((file = close_reopen_file(file, filename, fapl_id)) < 0) TEST_ERROR - } /* end for */ + } if(H5Tclose(dtype1_id) < 0) TEST_ERROR if(H5Sclose(space_id) < 0) TEST_ERROR /* Ensure that we can still read data back from dataset 3 */ - if((dset_id = H5Dopen2(file, DSETNAME[3], H5P_DEFAULT)) < 0) TEST_ERROR - if((dtype1_id = H5Dget_type(dset_id)) < 0) TEST_ERROR - - /* Read data back again */ - HDmemset(&rdata, 0, sizeof(rdata)); - if(H5Dread(dset_id, dtype1_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0) { - H5_FAILED(); AT(); - printf("Can't read data\n"); - goto error; - } /* end if */ - - if(rdata.i1 != wdata.i1 || rdata.i2 != wdata.i2 || HDstrcmp(rdata.str, wdata.str)) { - H5_FAILED(); AT(); - printf("incorrect read data\n"); - goto error; - } /* end if */ + dset_id = H5Dopen2(file, DSETNAME[3], H5P_DEFAULT); + if(dset_id < 0) TEST_ERROR + dtype1_id = H5Dget_type(dset_id); + if(dtype1_id < 0) TEST_ERROR + TSOHM_S1H_VERIFY_DATA(dset_id, dtype1_id) if(H5Dclose(dset_id) < 0) TEST_ERROR if(H5Tclose(dtype1_id) < 0) TEST_ERROR @@ -717,7 +728,42 @@ size1_helper(hid_t file, const char* filename, hid_t fapl_id, int test_file_clos H5Fclose(file); } H5E_END_TRY return -1; -} +#undef TSOHM_S1H_VERIFY_DATA /* macro is exclusive to this function */ +} /* size1_helper */ + + +/*---------------------------------------------------------------------------- + * Function: getsize_testsize1 + * + * Purpose: Creates a test file, populates it, and returns its file size. + * Oject header information from the "first" dataset in the file + * is stored in pointer `oinfo`. + * + * Programmer: Jacob Smith + * 2018 November 1 + *---------------------------------------------------------------------------- + */ +static h5_stat_size_t +getsize_testsize1(const char *filename, hid_t fcpl_id, hid_t fapl_id, unsigned open_close, H5O_info_t *oinfo) +{ + hid_t file = -1; + herr_t ret; + + file = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, fapl_id); + CHECK_I(file, "H5Fcreate"); + + file = size1_helper(file, FILENAME, fapl_id, open_close); + CHECK_I(file, "size1_helper"); + + ret = H5Oget_info_by_name2(file, DSETNAME[0], oinfo, H5O_INFO_HDR, H5P_DEFAULT); + CHECK_I(ret, "H5Oget_info_by_name"); + + ret = H5Fclose(file); + CHECK_I(ret, "H5Fclose"); + + return h5_get_file_size(FILENAME, fapl_id); +} /* getsize_testsize1 */ + /*------------------------------------------------------------------------- * Function: test_sohm_size1 @@ -727,17 +773,26 @@ size1_helper(hid_t file, const char* filename, hid_t fapl_id, int test_file_clos * Programmer: James Laird * Monday, April 10, 2006 * - * Modifications: - * *------------------------------------------------------------------------- */ -static void test_sohm_size1(void) +static void +test_sohm_size1(void) { hid_t file = -1; hid_t fcpl_id = -1; hid_t fapl_id = -1; - hsize_t sohm_oh_size; - hsize_t sohm_btree_oh_size; + + unsigned use_shared = 0; + unsigned use_btree = 0; + unsigned open_close = 0; + h5_stat_size_t file_sizes[9]; + unsigned size_index = 0; + hsize_t oh_sizes[3]; + unsigned oh_size_index = 0; + + hsize_t norm_oh_size; + hsize_t sohm_oh_size; + hsize_t sohm_btree_oh_size; h5_stat_size_t norm_empty_filesize; h5_stat_size_t sohm_empty_filesize; h5_stat_size_t sohm_btree_empty_filesize; @@ -747,6 +802,7 @@ static void test_sohm_size1(void) h5_stat_size_t norm_final_filesize2; h5_stat_size_t sohm_final_filesize2; h5_stat_size_t sohm_btree_final_filesize2; + H5O_info_t oinfo; unsigned num_indexes = 1; unsigned index_flags = H5O_SHMESG_DTYPE_FLAG; @@ -757,177 +813,103 @@ static void test_sohm_size1(void) MESSAGE(5, ("Testing that shared datatypes save space\n")); - /* Create a FAPL with "semi" close degree, to detect dangling IDs */ fapl_id = H5Pcreate(H5P_FILE_ACCESS); CHECK_I(fapl_id, "H5Pcreate"); - ret = H5Pset_fclose_degree(fapl_id, H5F_CLOSE_SEMI); CHECK_I(ret, "H5Pset_fclose_degree"); - /* Create a file with SOHMs disabled and get its size */ - fcpl_id = H5Pcreate(H5P_FILE_CREATE); - CHECK_I(fcpl_id, "H5Pcreate"); - - ret = H5Pset_shared_mesg_nindexes(fcpl_id, 0); - CHECK_I(ret, "H5Pset_shared_mesg_nindexes"); - - file = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, fapl_id); - CHECK_I(file, "H5Fcreate"); - - ret = H5Fclose(file); - CHECK_I(ret, "H5Fclose"); - - /* Get the file size */ - norm_empty_filesize = h5_get_file_size(FILENAME, fapl_id); - - /* Add a bunch of large datatypes to the file */ - file = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl_id); - CHECK_I(file, "H5Fopen"); - file = size1_helper(file, FILENAME, fapl_id, 0); - CHECK_I(file, "size1_helper"); - ret = H5Fclose(file); - CHECK_I(ret, "H5Fclose"); - - /* Get the new file size */ - norm_final_filesize = h5_get_file_size(FILENAME, fapl_id); - - /* Use the same property list to create a new file. */ - file = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, fapl_id); - CHECK_I(file, "H5Fcreate"); - - ret = H5Pclose(fcpl_id); - CHECK_I(ret, "H5Pclose"); - - /* Add the same large datatypes, but keep closing and re-opening the file */ - file = size1_helper(file, FILENAME, fapl_id, 1); - CHECK_I(file, "size1_helper"); - ret = H5Fclose(file); - CHECK_I(ret, "H5Fclose"); - - /* Get the file size */ - norm_final_filesize2 = h5_get_file_size(FILENAME, fapl_id); - - - - /* Now do the same thing for a file with SOHMs enabled */ - /* Create FCPL with SOHMs enabled */ - fcpl_id = H5Pcreate(H5P_FILE_CREATE); - CHECK_I(fcpl_id, "H5Pcreate"); - - /* Tests one index holding only datatype messages */ - ret = H5Pset_shared_mesg_nindexes(fcpl_id, num_indexes); - CHECK_I(ret, "H5Pset_shared_mesg_nindexes"); - ret = H5Pset_shared_mesg_index(fcpl_id, 0, index_flags, min_mesg_size); - CHECK_I(ret, "H5Pset_shared_mesg_index"); - ret = H5Pset_shared_mesg_phase_change(fcpl_id, list_max, btree_min); - CHECK_I(ret, "H5Pset_shared_mesg_phase_change"); - - /* Create a file */ - file = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, fapl_id); - CHECK_I(file, "H5Fcreate"); - - ret = H5Fclose(file); - CHECK_I(ret, "H5Fclose"); - - sohm_empty_filesize = h5_get_file_size(FILENAME, fapl_id); - - /* Add a bunch of datatypes to this file */ - file = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl_id); - CHECK_I(file, "H5Fopen"); - file = size1_helper(file, FILENAME, fapl_id, 0); - CHECK_I(file, "size1_helper"); + /* ---------------------------------------- + * Run operations, accumulating file sizes to compare later. + */ + + for (use_shared = 0; use_shared < 2; use_shared++) { + for (use_btree = 0; use_btree < 2; use_btree++) { + + /* cannot use btree indexing without shared messages; skip case */ + if (use_btree && !use_shared) + continue; + + fcpl_id = H5Pcreate(H5P_FILE_CREATE); + CHECK_I(fcpl_id, "H5Pcreate"); + + if (use_shared) { + /* Tests one index holding only datatype messages */ + ret = H5Pset_shared_mesg_nindexes(fcpl_id, num_indexes); + CHECK_I(ret, "H5Pset_shared_mesg_nindexes"); + ret = H5Pset_shared_mesg_index(fcpl_id, 0, index_flags, min_mesg_size); + CHECK_I(ret, "H5Pset_shared_mesg_index"); + + if (use_btree) { + ret = H5Pset_shared_mesg_phase_change(fcpl_id, 0, 0); + } else { + ret = H5Pset_shared_mesg_phase_change(fcpl_id, list_max, btree_min); + } + CHECK_I(ret, "H5Pset_shared_mesg_phase_change"); + } else { + ret = H5Pset_shared_mesg_nindexes(fcpl_id, 0); + CHECK_I(ret, "H5Pset_shared_mesg_nindexes"); + } + + file = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, fapl_id); + CHECK_I(file, "H5Fcreate"); + ret = H5Fclose(file); + CHECK_I(ret, "H5Fclose"); - /* Get the size of a dataset object header */ - ret = H5Oget_info_by_name2(file, DSETNAME[0], &oinfo, H5O_INFO_HDR, H5P_DEFAULT); - CHECK_I(ret, "H5Oget_info_by_name"); - ret = H5Fclose(file); - CHECK_I(ret, "H5Fclose"); - sohm_oh_size = oinfo.hdr.space.total; + /* size of empty file */ + file_sizes[size_index++] = h5_get_file_size(FILENAME, fapl_id); - /* Get the new file size */ - sohm_final_filesize = h5_get_file_size(FILENAME, fapl_id); + /* size of populated file, with different populating behaviors */ + for (open_close = 0; open_close < 2; open_close++) + file_sizes[size_index++] = getsize_testsize1(FILENAME, fcpl_id, fapl_id, open_close, &oinfo); + oh_sizes[oh_size_index++] = oinfo.hdr.space.total; - /* Use the same property list to create a new file. */ - file = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, fapl_id); - CHECK_I(file, "H5Fcreate"); + ret = H5Pclose(fcpl_id); + CHECK_I(ret, "H5Pclose"); + } /* for btree/listed messages */ + } /* for normal/shared messages */ - ret = H5Pclose(fcpl_id); + ret = H5Pclose(fapl_id); CHECK_I(ret, "H5Pclose"); - /* Add the same large datatypes, but keep closing and re-opening the file */ - file = size1_helper(file, FILENAME, fapl_id, 1); - CHECK_I(file, "size1_helper"); - ret = H5Fclose(file); - CHECK_I(ret, "H5Fclose"); - - /* Get the file size */ - sohm_final_filesize2 = h5_get_file_size(FILENAME, fapl_id); - - - - /* Create FCPL with SOHMs enabled that uses a B-tree index */ - fcpl_id = H5Pcreate(H5P_FILE_CREATE); - CHECK_I(fcpl_id, "H5Pcreate"); - - /* Tests one index holding only datatype messages */ - ret = H5Pset_shared_mesg_nindexes(fcpl_id, num_indexes); - CHECK_I(ret, "H5Pset_shared_mesg_nindexes"); - ret = H5Pset_shared_mesg_index(fcpl_id, 0, index_flags, min_mesg_size); - CHECK_I(ret, "H5Pset_shared_mesg_index"); - ret = H5Pset_shared_mesg_phase_change(fcpl_id, 0, 0); - CHECK_I(ret, "H5Pset_shared_mesg_phase_change"); - - /* Create a file */ - file = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, fapl_id); - CHECK_I(file, "H5Fcreate"); - - ret = H5Fclose(file); - CHECK_I(ret, "H5Fclose"); + /* sanity-check state of arrays */ + VERIFY(9, size_index, "size_index"); + VERIFY(3, oh_size_index, "oh_size_index"); - sohm_btree_empty_filesize = h5_get_file_size(FILENAME, fapl_id); - - /* Add a bunch of datatypes to this file */ - file = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl_id); - CHECK_I(file, "H5Fopen"); - file = size1_helper(file, FILENAME, fapl_id, 0); - CHECK_I(file, "size1_helper"); - - /* Get the size of a dataset object header */ - ret = H5Oget_info_by_name2(file, DSETNAME[0], &oinfo, H5O_INFO_HDR, H5P_DEFAULT); - CHECK_I(ret, "H5Oget_info_by_name"); - ret = H5Fclose(file); - CHECK_I(ret, "H5Fclose"); - sohm_btree_oh_size = oinfo.hdr.space.total; - - /* Get the new file size */ - sohm_btree_final_filesize = h5_get_file_size(FILENAME, fapl_id); - - /* Use the same property list to create a new file. */ - file = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, fapl_id); - CHECK_I(file, "H5Fcreate"); - - ret = H5Pclose(fcpl_id); - CHECK_I(ret, "H5Pclose"); + /* ---------------------------------------- + * Check that all sizes make sense. + */ - /* Add the same large datatypes, but keep closing and re-opening the file */ - file = size1_helper(file, FILENAME, fapl_id, 1); - CHECK_I(file, "size1_helper"); - ret = H5Fclose(file); - CHECK_I(ret, "H5Fclose"); + /* Put result sizes into human-readable symbolic names. + * Order dependent on loop execution above. + */ + norm_empty_filesize = file_sizes[0]; + norm_final_filesize = file_sizes[1]; + norm_final_filesize2 = file_sizes[2]; + norm_oh_size = oh_sizes[0]; - /* Get the file size */ - sohm_btree_final_filesize2 = h5_get_file_size(FILENAME, fapl_id); + sohm_empty_filesize = file_sizes[3]; + sohm_final_filesize = file_sizes[4]; + sohm_final_filesize2 = file_sizes[5]; + sohm_oh_size = oh_sizes[1]; + sohm_btree_empty_filesize = file_sizes[6]; + sohm_btree_final_filesize = file_sizes[7]; + sohm_btree_final_filesize2 = file_sizes[8]; + sohm_btree_oh_size = oh_sizes[2]; + /* How the SOHM messages are stored shouldn't affect the + * size of the object header. + */ + VERIFY(sohm_btree_oh_size, sohm_oh_size, "H5Oget_info_by_name"); - /* Check that all sizes make sense */ +#if 0 /* TBD: lying comment or bug. See Jira HDFFV-10646 */ /* Object headers in SOHM files should be smaller than normal object - * headers. How the SOHM messages are stored shouldn't affect the - * size of the object header. + * headers. */ - if(sohm_oh_size != sohm_btree_oh_size) - VERIFY(sohm_btree_oh_size, 1, "H5Oget_info_by_name"); + if (sohm_oh_size >= norm_oh_size) + VERIFY(norm_oh_size, 1, "H5Oget_info_by_name"); +#endif /* Jira HDFFV-10646 */ /* Both sohm files should be bigger than a normal file when empty. * It's hard to say whether a B-tree with no nodes allocated should be @@ -942,23 +924,127 @@ static void test_sohm_size1(void) VERIFY(sohm_btree_empty_filesize, 1, "h5_get_file_size"); /* When full, the sohm btree file should be smaller than the normal file. - * The sohm list file should be at least as small, since it doesn't need the - * overhead of a B-tree. + * The sohm list file should be at least as small, since it doesn't need + * the overhead of a B-tree. */ if(sohm_btree_final_filesize >= norm_final_filesize) VERIFY(sohm_btree_final_filesize, 1, "h5_get_file_size"); if(sohm_final_filesize > sohm_btree_final_filesize) VERIFY(sohm_final_filesize, 1, "h5_get_file_size"); - /* This shouldn't change even if we open and close the file */ + /* Comparative sizes shouldn't change even if we open and close the file + */ if(sohm_btree_final_filesize2 >= norm_final_filesize2) VERIFY(sohm_btree_final_filesize2, 1, "h5_get_file_size"); if(sohm_final_filesize2 > sohm_btree_final_filesize2) VERIFY(sohm_final_filesize2, 1, "h5_get_file_size"); +} /* test_sohm_size1 */ + + +/*--------------------------------------------------------------------------- + * Function: test_sohm_size_consistency_open_create + * + * Purpose: Tests that header size is different depending on file open + * procedure? + * Uses "size1_helper" for file setup directed to a specific + * file handle. + * + * Programmer: Jacob Smith + * 2018 November 1 + * + *--------------------------------------------------------------------------- + */ +static void +test_sohm_size_consistency_open_create(void) +{ + hid_t file = -1; + hid_t fcpl_id = -1; + hid_t fapl_id = -1; + unsigned use_btree; + hsize_t oh_size_open; + hsize_t oh_size_create; + H5O_info_t oinfo; + unsigned num_indexes = 1; + unsigned index_flags = H5O_SHMESG_DTYPE_FLAG; + unsigned min_mesg_size = 50; + unsigned list_max = 11; + unsigned btree_min = 10; + herr_t ret; + + MESSAGE(5, \ + ("Testing that header size is consistent between H5Fopen and H5Fcreate\n")); + + /* Create a FAPL with "semi" close degree, to detect dangling IDs */ + fapl_id = H5Pcreate(H5P_FILE_ACCESS); + CHECK_I(fapl_id, "H5Pcreate"); + ret = H5Pset_fclose_degree(fapl_id, H5F_CLOSE_SEMI); + CHECK_I(ret, "H5Pset_fclose_degree"); + + for (use_btree = 0; use_btree < 2; use_btree++) { + /* Create FCPL with SOHMs enabled + */ + fcpl_id = H5Pcreate(H5P_FILE_CREATE); + CHECK_I(fcpl_id, "H5Pcreate"); + ret = H5Pset_shared_mesg_nindexes(fcpl_id, num_indexes); + CHECK_I(ret, "H5Pset_shared_mesg_nindexes"); + ret = H5Pset_shared_mesg_index(fcpl_id, 0, index_flags, min_mesg_size); + CHECK_I(ret, "H5Pset_shared_mesg_index"); + if (use_btree) { + MESSAGE(5, ("----testing with btree index----\n")); + ret = H5Pset_shared_mesg_phase_change(fcpl_id, 0, 0); + CHECK_I(ret, "H5Pset_shared_mesg_phase_change"); + } else { + MESSAGE(5, ("----testing with normal index----\n")); + ret = H5Pset_shared_mesg_phase_change(fcpl_id, list_max, btree_min); + CHECK_I(ret, "H5Pset_shared_mesg_phase_change"); + } + + /* Create empty file */ + file = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, fapl_id); + CHECK_I(file, "H5Fcreate"); + ret = H5Fclose(file); + CHECK_I(ret, "H5Fclose"); + + /* Test Open/Write + * Add messages to previously-created file */ + file = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl_id); + CHECK_I(file, "H5Fopen"); + file = size1_helper(file, FILENAME, fapl_id, 0); + CHECK_I(file, "size1_helper"); + + /* Get the size of a dataset object header */ + ret = H5Oget_info_by_name2(file, DSETNAME[0], &oinfo, H5O_INFO_HDR, H5P_DEFAULT); + CHECK_I(ret, "H5Oget_info_by_name"); + oh_size_open = oinfo.hdr.space.total; + + ret = H5Fclose(file); + CHECK_I(ret, "H5Fclose"); + + /* Test Create/Write + * Add messages to a newly-created file */ + file = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, fapl_id); + CHECK_I(file, "H5Fcreate"); + file = size1_helper(file, FILENAME, fapl_id, 0); + CHECK_I(file, "size1_helper"); + + /* Get the size of a dataset object header */ + ret = H5Oget_info_by_name2(file, DSETNAME[0], &oinfo, H5O_INFO_HDR, H5P_DEFAULT); + CHECK_I(ret, "H5Oget_info_by_name"); + oh_size_create = oinfo.hdr.space.total; + + ret = H5Fclose(file); + CHECK_I(ret, "H5Fclose"); + + VERIFY(oh_size_create, oh_size_open, "H5Oget_info_by_name2"); + + ret = H5Pclose(fcpl_id); + CHECK_I(ret, "H5Pclose"); + } /* for normal/btree indexing */ + ret = H5Pclose(fapl_id); CHECK_I(ret, "H5Pclose"); -} +} /* test_sohm_size_consistency_open_create */ /*------------------------------------------------------------------------- @@ -966,149 +1052,110 @@ static void test_sohm_size1(void) * * Purpose: Given an fcpl, tests creating attributes with and without * committed datatypes. + * Verify that an attribute can be written and read back. + * Tests attribute on a Group. + * Tests committed and non-committed datatypes. + * Tests attribute access through `H5Aopen()`. * * Programmer: James Laird * Thursday, November 30, 2006 * *------------------------------------------------------------------------- */ -static void sohm_attr_helper(hid_t fcpl_id) +static void +sohm_attr_helper(hid_t fcpl_id) { hid_t file_id; - hid_t type_id; hid_t space_id; - hid_t group_id; - hid_t attr_id, attr_id2; hsize_t dims = 2; int wdata[2] = {7, 42}; int rdata[2]; herr_t ret; size_t x; + unsigned op_index=0; +#define TSOHM_SAH_OP_COUNT 3 + const char *groupnames[TSOHM_SAH_OP_COUNT] = { + "group_for_nothing_special", + "group_for_commited_dtype", + "group_for_commited_dtype_and_other_ID_access", + }; - /*---------------------------------------------------------------------------- - * Test attribute with transient datatype - */ - /* Create a file using the fcpl */ file_id = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT); CHECK_I(file_id, "H5Fcreate"); - /* Create a normal datatype and dataset */ - type_id = H5Tcopy(H5T_NATIVE_INT); - CHECK_I(type_id, "H5Tcopy"); space_id = H5Screate_simple(1, &dims, &dims); CHECK_I(space_id, "H5Screate_simple"); - /* Create and verify an attribute on a group */ - group_id = H5Gcreate2(file_id, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - CHECK_I(group_id, "H5Gcreate2"); - attr_id = H5Acreate2(group_id, "attribute", type_id, space_id, H5P_DEFAULT, H5P_DEFAULT); - CHECK_I(attr_id, "H5Acreate2"); - ret = H5Awrite(attr_id, H5T_NATIVE_INT, wdata); - CHECK_I(ret, "H5Awrite"); - - /* Close the datatype and group */ - ret = H5Tclose(type_id); - CHECK_I(ret, "H5Tclose"); - ret = H5Gclose(group_id); - CHECK_I(ret, "H5Gclose"); - - /* Flush the file to force data to be written */ - ret = H5Fflush(file_id, H5F_SCOPE_GLOBAL); - CHECK_I(ret, "H5Fflush"); - - /* Verify */ - HDmemset(rdata, 0, sizeof(rdata)); - ret = H5Aread(attr_id, H5T_NATIVE_INT, rdata); - CHECK_I(ret, "H5Aread"); - for(x = 0; x < (size_t)dims; ++x) - VERIFY(rdata[x], wdata[x], "H5Aread"); - - /* Cleanup */ - ret = H5Aclose(attr_id); - CHECK_I(ret, "H5Aclose"); - - /*---------------------------------------------------------------------------- - * Test attribute with committed datatype + /* loop: + * 0 - nothing special + * 1 - committed datatype + * 2 - committed datatype, read through second ID */ - /* Repeat with a committed datatype */ - type_id = H5Tcopy(H5T_NATIVE_INT); - CHECK_I(type_id, "H5Tcopy"); - ret = H5Tcommit2(file_id, "datatype", type_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - CHECK_I(ret, "H5Tcommit2"); + for (op_index = 0; op_index < TSOHM_SAH_OP_COUNT; op_index++) { + hid_t type_id = -1; + hid_t group_id = -1; + hid_t attr_id = -1; + hid_t attr_id2 = -1; + hid_t attr_read_id; - /* Create and verify an attribute */ - group_id = H5Gcreate2(file_id, "another_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - CHECK_I(group_id, "H5Gcreate2"); - attr_id = H5Acreate2(group_id, "attribute", type_id, space_id, H5P_DEFAULT, H5P_DEFAULT); - CHECK_I(attr_id, "H5Acreate2"); - ret = H5Awrite(attr_id, H5T_NATIVE_INT, wdata); - CHECK_I(ret, "H5Awrite"); - - /* Close the datatype and group */ - ret = H5Tclose(type_id); - CHECK_I(ret, "H5Tclose"); - ret = H5Gclose(group_id); - CHECK_I(ret, "H5Gclose"); + /* create group in file with name unique to op_index */ + group_id = H5Gcreate2(file_id, groupnames[op_index], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK_I(group_id, "H5Gcreate2"); - /* Flush the file to force data to be written */ - ret = H5Fflush(file_id, H5F_SCOPE_GLOBAL); - CHECK_I(ret, "H5Fflush"); + type_id = H5Tcopy(H5T_NATIVE_INT); + CHECK_I(type_id, "H5Tcopy"); - /* Verify */ - HDmemset(rdata, 0, sizeof(rdata)); - ret = H5Aread(attr_id, H5T_NATIVE_INT, rdata); - CHECK_I(ret, "H5Aread"); - for(x = 0; x < (size_t)dims; ++x) - VERIFY(rdata[x], wdata[x], "H5Aread"); - - /* Cleanup */ - ret = H5Aclose(attr_id); - CHECK_I(ret, "H5Aclose"); - - /*---------------------------------------------------------------------------- - * Test attribute operation with two ID handles - */ - /* Create and verify an attribute */ - group_id = H5Gcreate2(file_id, "yet_another_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - CHECK_I(group_id, "H5Gcreate2"); - - attr_id = H5Acreate2(group_id, "attribute", H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT); - CHECK_I(attr_id, "H5Acreate2"); + /* Commit the datatype for the latter iterations. + * Only do this ONCE. + */ + if (op_index == 1) { + ret = H5Tcommit2(file_id, "datatype", type_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK_I(ret, "H5Tcommit2"); + } - /* Open the attribute to get another handle */ - attr_id2 = H5Aopen(group_id, "attribute", H5P_DEFAULT); - CHECK_I(attr_id2, "H5Aopen"); + attr_id = H5Acreate2(group_id, "attribute", type_id, space_id, H5P_DEFAULT, H5P_DEFAULT); + CHECK_I(attr_id, "H5Acreate2"); - ret = H5Awrite(attr_id, H5T_NATIVE_INT, wdata); - CHECK_I(ret, "H5Awrite"); + if (op_index == 2) { + /* Open the attribute to get another handle */ + attr_id2 = H5Aopen(group_id, "attribute", H5P_DEFAULT); + CHECK_I(attr_id2, "H5Aopen"); + } - /* Close the group */ - ret = H5Gclose(group_id); - CHECK_I(ret, "H5Gclose"); + ret = H5Awrite(attr_id, H5T_NATIVE_INT, wdata); + CHECK_I(ret, "H5Awrite"); - /* Flush the file to force data to be written */ - ret = H5Fflush(file_id, H5F_SCOPE_GLOBAL); - CHECK_I(ret, "H5Fflush"); + ret = H5Gclose(group_id); + CHECK_I(ret, "H5Gclose"); + ret = H5Tclose(type_id); + CHECK_I(ret, "H5Tclose"); - /* Verify the data with another ID handle */ - HDmemset(rdata, 0, sizeof(rdata)); - ret = H5Aread(attr_id2, H5T_NATIVE_INT, rdata); - CHECK_I(ret, "H5Aread"); + /* Flush the file to force data to be written */ + ret = H5Fflush(file_id, H5F_SCOPE_GLOBAL); + CHECK_I(ret, "H5Fflush"); - for(x = 0; x < (size_t)dims; ++x) - VERIFY(rdata[x], wdata[x], "H5Aread"); + /* Verify */ + attr_read_id = (op_index == 2) ? attr_id2 : attr_id; + HDmemset(rdata, 0, sizeof(rdata)); + ret = H5Aread(attr_read_id, H5T_NATIVE_INT, rdata); + CHECK_I(ret, "H5Aread"); + for(x = 0; x < (size_t)dims; ++x) + VERIFY(rdata[x], wdata[x], "H5Aread"); - /* Cleanup */ - ret = H5Aclose(attr_id); - CHECK_I(ret, "H5Aclose"); - ret = H5Aclose(attr_id2); - CHECK_I(ret, "H5Aclose"); + ret = H5Aclose(attr_id); + CHECK_I(ret, "H5Aclose"); + if (attr_id2 > -1 ) { + ret = H5Aclose(attr_id2); + CHECK_I(ret, "H5Aclose"); + } + } /* for each attribute operation */ ret = H5Sclose(space_id); CHECK_I(ret, "H5Sclose"); ret = H5Fclose(file_id); CHECK_I(ret, "H5Fclose"); -} +#undef TSOHM_SAH_OP_COUNT +} /* sohm_attr_helper */ /*------------------------------------------------------------------------- @@ -1125,101 +1172,160 @@ static void sohm_attr_helper(hid_t fcpl_id) * *------------------------------------------------------------------------- */ -static void test_sohm_attrs(void) +static void +test_sohm_attrs(void) { hid_t fcpl_id; + unsigned i = 0; +#define TSOHM_TSA_NFLAGS_1 7 + unsigned flags1[TSOHM_TSA_NFLAGS_1] = { + H5O_SHMESG_ATTR_FLAG, + H5O_SHMESG_SDSPACE_FLAG, + H5O_SHMESG_DTYPE_FLAG, + H5O_SHMESG_ATTR_FLAG | H5O_SHMESG_SDSPACE_FLAG, + H5O_SHMESG_SDSPACE_FLAG | H5O_SHMESG_DTYPE_FLAG, + H5O_SHMESG_ATTR_FLAG | H5O_SHMESG_DTYPE_FLAG, + H5O_SHMESG_ATTR_FLAG | H5O_SHMESG_SDSPACE_FLAG | H5O_SHMESG_DTYPE_FLAG, + }; +#define TSOHM_TSA_NFLAGS_2 6 + unsigned flags2[TSOHM_TSA_NFLAGS_2][2] = { + { H5O_SHMESG_ATTR_FLAG, + H5O_SHMESG_SDSPACE_FLAG | H5O_SHMESG_DTYPE_FLAG, + }, + { H5O_SHMESG_SDSPACE_FLAG, + H5O_SHMESG_ATTR_FLAG | H5O_SHMESG_DTYPE_FLAG, + }, + { H5O_SHMESG_DTYPE_FLAG, + H5O_SHMESG_ATTR_FLAG | H5O_SHMESG_SDSPACE_FLAG, + }, + { H5O_SHMESG_SDSPACE_FLAG | H5O_SHMESG_DTYPE_FLAG, + H5O_SHMESG_ATTR_FLAG, + }, + { H5O_SHMESG_ATTR_FLAG | H5O_SHMESG_DTYPE_FLAG, + H5O_SHMESG_SDSPACE_FLAG, + }, + { H5O_SHMESG_ATTR_FLAG | H5O_SHMESG_SDSPACE_FLAG, + H5O_SHMESG_DTYPE_FLAG, + }, + }; +#define TSOHM_TSA_NFLAGS_3 5 + unsigned flags3[TSOHM_TSA_NFLAGS_3][3] = { + { H5O_SHMESG_ATTR_FLAG, + H5O_SHMESG_SDSPACE_FLAG, + H5O_SHMESG_DTYPE_FLAG, + }, + { H5O_SHMESG_DTYPE_FLAG, + H5O_SHMESG_ATTR_FLAG, + H5O_SHMESG_SDSPACE_FLAG, + }, + { H5O_SHMESG_SDSPACE_FLAG, + H5O_SHMESG_DTYPE_FLAG, + H5O_SHMESG_ATTR_FLAG, + }, + { 0, /* first index does not hold a shared message type? */ + H5O_SHMESG_SDSPACE_FLAG | H5O_SHMESG_DTYPE_FLAG, + H5O_SHMESG_ATTR_FLAG, + }, + { 0, /* missing SDSPACE flag */ + H5O_SHMESG_DTYPE_FLAG, + H5O_SHMESG_ATTR_FLAG, + }, + }; herr_t ret; MESSAGE(5, ("Testing that shared messages work with attributes\n")); - /* Create an fcpl with no shared messages */ + /* No shared messages + */ fcpl_id = H5Pcreate(H5P_FILE_CREATE); CHECK_I(fcpl_id, "H5Pcreate"); ret = H5Pset_shared_mesg_nindexes(fcpl_id, 0); CHECK_I(ret, "H5Pset_shared_mesg_nindexes"); - /* Make sure attributes can be read with these settings (they'd better!) */ - sohm_attr_helper(fcpl_id); - - - /* Run tests with only one kind of message to be shared */ - ret = H5Pset_shared_mesg_nindexes(fcpl_id, 1); - CHECK_I(ret, "H5Pset_shared_mesg_nindexes"); - ret = H5Pset_shared_mesg_index(fcpl_id, 0, H5O_SHMESG_ATTR_FLAG, 2); - CHECK_I(ret, "H5Pset_shared_mesg_nindexes"); - - /* Verify */ - sohm_attr_helper(fcpl_id); - - ret = H5Pset_shared_mesg_index(fcpl_id, 0, H5O_SHMESG_SDSPACE_FLAG, 2); - CHECK_I(ret, "H5Pset_shared_mesg_nindexes"); - - sohm_attr_helper(fcpl_id); - - ret = H5Pset_shared_mesg_index(fcpl_id, 0, H5O_SHMESG_DTYPE_FLAG, 2); - CHECK_I(ret, "H5Pset_shared_mesg_nindexes"); - - sohm_attr_helper(fcpl_id); - - - /* Run with any two types shared */ - ret = H5Pset_shared_mesg_index(fcpl_id, 0, H5O_SHMESG_SDSPACE_FLAG | H5O_SHMESG_DTYPE_FLAG, 2); - CHECK_I(ret, "H5Pset_shared_mesg_nindexes"); - sohm_attr_helper(fcpl_id); - ret = H5Pset_shared_mesg_index(fcpl_id, 0, H5O_SHMESG_ATTR_FLAG | H5O_SHMESG_DTYPE_FLAG, 2); - CHECK_I(ret, "H5Pset_shared_mesg_nindexes"); - - sohm_attr_helper(fcpl_id); - - ret = H5Pset_shared_mesg_index(fcpl_id, 0, H5O_SHMESG_SDSPACE_FLAG | H5O_SHMESG_ATTR_FLAG, 2); - CHECK_I(ret, "H5Pset_shared_mesg_nindexes"); - - sohm_attr_helper(fcpl_id); - - - /* Run test with all three kinds of message shared */ - ret = H5Pset_shared_mesg_index(fcpl_id, 0, H5O_SHMESG_SDSPACE_FLAG | H5O_SHMESG_DTYPE_FLAG | H5O_SHMESG_ATTR_FLAG, 2); - CHECK_I(ret, "H5Pset_shared_mesg_nindexes"); + ret = H5Pclose(fcpl_id); + CHECK_I(ret, "H5Pclose"); - sohm_attr_helper(fcpl_id); + /* One shared message index + */ + for (i=0; i < TSOHM_TSA_NFLAGS_1; i++) { + fcpl_id = H5Pcreate(H5P_FILE_CREATE); + CHECK_I(fcpl_id, "H5Pcreate"); + ret = H5Pset_shared_mesg_nindexes(fcpl_id, 1); + CHECK_I(ret, "H5Pset_shared_mesg_nindexes"); + ret = H5Pset_shared_mesg_index(fcpl_id, 0, flags1[i], 2); + CHECK_I(ret, "H5Pset_shared_mesg_nindexes"); + sohm_attr_helper(fcpl_id); - /* Try using two indexes */ - ret = H5Pset_shared_mesg_nindexes(fcpl_id, 2); - CHECK_I(ret, "H5Pset_shared_mesg_nindexes"); - ret = H5Pset_shared_mesg_index(fcpl_id, 0, H5O_SHMESG_ATTR_FLAG | H5O_SHMESG_DTYPE_FLAG, 2); - CHECK_I(ret, "H5Pset_shared_mesg_nindexes"); - ret = H5Pset_shared_mesg_index(fcpl_id, 1, H5O_SHMESG_SDSPACE_FLAG, 2); - CHECK_I(ret, "H5Pset_shared_mesg_nindexes"); + ret = H5Pclose(fcpl_id); + CHECK_I(ret, "H5Pclose"); + } - sohm_attr_helper(fcpl_id); + /* two shared message indices + */ + for (i=0; i < TSOHM_TSA_NFLAGS_2; i++) { + fcpl_id = H5Pcreate(H5P_FILE_CREATE); + CHECK_I(fcpl_id, "H5Pcreate"); + ret = H5Pset_shared_mesg_nindexes(fcpl_id, 2); + CHECK_I(ret, "H5Pset_shared_mesg_nindexes"); + ret = H5Pset_shared_mesg_index(fcpl_id, 0, flags2[i][0], 2); + CHECK_I(ret, "H5Pset_shared_mesg_nindexes"); + ret = H5Pset_shared_mesg_index(fcpl_id, 1, flags2[i][1], 2); + CHECK_I(ret, "H5Pset_shared_mesg_nindexes"); - ret = H5Pset_shared_mesg_index(fcpl_id, 0, H5O_SHMESG_DTYPE_FLAG, 2); - CHECK_I(ret, "H5Pset_shared_mesg_nindexes"); + sohm_attr_helper(fcpl_id); - sohm_attr_helper(fcpl_id); + ret = H5Pclose(fcpl_id); + CHECK_I(ret, "H5Pclose"); + } - ret = H5Pset_shared_mesg_index(fcpl_id, 1, H5O_SHMESG_ATTR_FLAG, 2); - CHECK_I(ret, "H5Pset_shared_mesg_nindexes"); + /* duplicate flags in separate indices causes problems + */ + H5E_BEGIN_TRY { + fcpl_id = H5Pcreate(H5P_FILE_CREATE); + CHECK_I(fcpl_id, "H5Pcreate"); + ret = H5Pset_shared_mesg_nindexes(fcpl_id, 2); + CHECK_I(ret, "H5Pset_shared_mesg_nindexes"); + ret = H5Pset_shared_mesg_index(fcpl_id, 0, H5O_SHMESG_ATTR_FLAG, 2); + CHECK_I(ret, "H5Pset_shared_mesg_nindexes"); + ret = H5Pset_shared_mesg_index(fcpl_id, 1, H5O_SHMESG_ATTR_FLAG, 2); + CHECK_I(ret, "H5Pset_shared_mesg_nindexes"); + + ret = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT); + VERIFY(ret, -1, "H5Fcreate"); + + ret = H5Pclose(fcpl_id); + CHECK_I(ret, "H5Pclose"); + } H5E_END_TRY; - sohm_attr_helper(fcpl_id); + /* three shared message indices + */ + for (i=0; i < TSOHM_TSA_NFLAGS_3; i++) { + fcpl_id = H5Pcreate(H5P_FILE_CREATE); + CHECK_I(fcpl_id, "H5Pcreate"); + ret = H5Pset_shared_mesg_nindexes(fcpl_id, 3); + CHECK_I(ret, "H5Pset_shared_mesg_nindexes"); + ret = H5Pset_shared_mesg_index(fcpl_id, 0, flags3[i][0], 2); + CHECK_I(ret, "H5Pset_shared_mesg_nindexes"); + ret = H5Pset_shared_mesg_index(fcpl_id, 1, flags3[i][1], 2); + CHECK_I(ret, "H5Pset_shared_mesg_nindexes"); + ret = H5Pset_shared_mesg_index(fcpl_id, 2, flags3[i][2], 2); + CHECK_I(ret, "H5Pset_shared_mesg_nindexes"); + sohm_attr_helper(fcpl_id); - /* One index for each kind of message */ - ret = H5Pset_shared_mesg_nindexes(fcpl_id, 3); - CHECK_I(ret, "H5Pset_shared_mesg_nindexes"); - ret = H5Pset_shared_mesg_index(fcpl_id, 2, H5O_SHMESG_SDSPACE_FLAG, 2); - CHECK_I(ret, "H5Pset_shared_mesg_nindexes"); + ret = H5Pclose(fcpl_id); + CHECK_I(ret, "H5Pclose"); + } - sohm_attr_helper(fcpl_id); +#undef TSOHM_TSA_NFLAGS_1 +#undef TSOHM_TSA_NFLAGS_2 +#undef TSOHM_TSA_NFLAGS_3 +} /* test_sohm_attrs */ - /* Close the FCPL */ - ret = H5Pclose(fcpl_id); - CHECK_I(ret, "H5Pclose"); -} /*------------------------------------------------------------------------- * Function: size2_verify_plist1 @@ -1233,7 +1339,8 @@ static void test_sohm_attrs(void) * *------------------------------------------------------------------------- */ -static void size2_verify_plist1(hid_t plist) +static void +size2_verify_plist1(hid_t plist) { size_t cd_nelmts; unsigned int cd_value; @@ -1276,12 +1383,13 @@ static void size2_verify_plist1(hid_t plist) ret = H5Pget_fill_value(plist, dtype1_id, &fill1); CHECK_I(ret, "H5Pget_fill_value"); - ret = memcmp(&fill1, &fill1_correct, sizeof(fill1_correct)); + ret = HDmemcmp(&fill1, &fill1_correct, sizeof(fill1_correct)); VERIFY(ret, 0, "memcmp"); ret = H5Tclose(dtype1_id); CHECK_I(ret, "H5Tclose"); -} +} /* size2_verify_plist1 */ + /*------------------------------------------------------------------------- * Function: size2_verify_plist2 @@ -1295,7 +1403,8 @@ static void size2_verify_plist1(hid_t plist) * *------------------------------------------------------------------------- */ -static void size2_verify_plist2(hid_t plist) +static void +size2_verify_plist2(hid_t plist) { size_t cd_nelmts; unsigned int cd_value; @@ -1352,7 +1461,7 @@ static void size2_verify_plist2(hid_t plist) ret = H5Tclose(dtype2_id); CHECK_I(ret, "H5Tclose"); -} +} /* size2_verify_plist2 */ #ifdef NOT_NOW @@ -1373,16 +1482,16 @@ static void size2_verify_plist2(hid_t plist) static void size2_dump_struct(const char *name, size2_helper_struct *sizes) { - puts(name); - printf(" empty size: %llu\n", (unsigned long long)sizes->empty_size); - printf(" first dataset: %llu \tdelta: %llu\n", (unsigned long long)sizes->first_dset, (unsigned long long)(sizes->first_dset - sizes->empty_size)); - printf("second dataset: %llu \tdelta: %llu\n", (unsigned long long)sizes->second_dset, (unsigned long long)(sizes->second_dset - sizes->first_dset)); - printf(" dsets 1: %llu \tdelta: %llu\n", (unsigned long long)sizes->dsets1, (unsigned long long)(sizes->dsets1 - sizes->second_dset)); - printf(" dsets 2: %llu \tdelta: %llu\n", (unsigned long long)sizes->dsets2, (unsigned long long)(sizes->dsets2 - sizes->dsets1)); - printf(" interleaved: %llu \tdelta: %llu\n", (unsigned long long)sizes->interleaved, (unsigned long long)(sizes->interleaved - sizes->dsets2)); - printf(" attributes: %llu \tdelta: %llu\n", (unsigned long long)sizes->attrs1, (unsigned long long)(sizes->attrs1 - sizes->interleaved)); - printf(" attributes 2: %llu \tdelta: %llu\n", (unsigned long long)sizes->attrs2, (unsigned long long)(sizes->attrs2 - sizes->attrs1)); -} + HDputs(name); + HDprintf(" empty size: %llu\n", (unsigned long long)sizes->empty_size); + HDprintf(" first dataset: %llu \tdelta: %llu\n", (unsigned long long)sizes->first_dset, (unsigned long long)(sizes->first_dset - sizes->empty_size)); + HDprintf("second dataset: %llu \tdelta: %llu\n", (unsigned long long)sizes->second_dset, (unsigned long long)(sizes->second_dset - sizes->first_dset)); + HDprintf(" dsets 1: %llu \tdelta: %llu\n", (unsigned long long)sizes->dsets1, (unsigned long long)(sizes->dsets1 - sizes->second_dset)); + HDprintf(" dsets 2: %llu \tdelta: %llu\n", (unsigned long long)sizes->dsets2, (unsigned long long)(sizes->dsets2 - sizes->dsets1)); + HDprintf(" interleaved: %llu \tdelta: %llu\n", (unsigned long long)sizes->interleaved, (unsigned long long)(sizes->interleaved - sizes->dsets2)); + HDprintf(" attributes: %llu \tdelta: %llu\n", (unsigned long long)sizes->attrs1, (unsigned long long)(sizes->attrs1 - sizes->interleaved)); + HDprintf(" attributes 2: %llu \tdelta: %llu\n", (unsigned long long)sizes->attrs2, (unsigned long long)(sizes->attrs2 - sizes->attrs1)); +} /* size2_dump_struct */ #endif /* NOT_NOW */ @@ -1573,15 +1682,14 @@ size2_helper(hid_t fcpl_id, int test_file_closing, size2_helper_struct *ret_size ret_sizes->dsets1 = h5_get_file_size(FILENAME, H5P_DEFAULT); - /* Now create a new group filled with datasets that use all different messages */ + /* Create new group filled with datasets that use all different messages */ file_id = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT); CHECK_I(file_id, "H5Fopen"); group_id = H5Gcreate2(file_id, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK_I(group_id, "H5Gcreate2"); /* Create NUM_DATASETS datasets in the new group */ - for(x=0; x<NUM_DATASETS; ++x) - { + for(x=0; x<NUM_DATASETS; ++x) { dset_id = H5Dcreate2(group_id, DSETNAME[x], dtype2_id, dspace2_id, H5P_DEFAULT, dcpl2_id, H5P_DEFAULT); CHECK_I(dset_id, "H5Dcreate2"); @@ -1768,7 +1876,7 @@ size2_helper(hid_t fcpl_id, int test_file_closing, size2_helper_struct *ret_size CHECK_I(ret, "H5Pclose"); return 0; -} +} /* size2_helper */ /*------------------------------------------------------------------------- @@ -1785,7 +1893,8 @@ size2_helper(hid_t fcpl_id, int test_file_closing, size2_helper_struct *ret_size * *------------------------------------------------------------------------- */ -static void size2_verify(void) +static void +size2_verify(void) { hid_t file_id = -1; hid_t dset_id=-1; @@ -1968,7 +2077,7 @@ static void size2_verify(void) CHECK_I(ret, "H5Gclose"); ret = H5Fclose(file_id); CHECK_I(ret, "H5Fclose"); -} +} /* size2_verify */ /*------------------------------------------------------------------------- @@ -1993,7 +2102,8 @@ static void size2_verify(void) * *------------------------------------------------------------------------- */ -static void test_sohm_size2(int close_reopen) +static void +test_sohm_size2(int close_reopen) { hid_t fcpl_id = -1; /* Sizes for file with no shared messages at all */ @@ -2585,7 +2695,7 @@ static void test_sohm_size2(int close_reopen) VERIFY(0, 1, "h5_get_file_size"); if((h5_stat_size_t)((float)share_tiny_index.attrs2 * OVERHEAD_ALLOWED) < type_space_index.attrs2) VERIFY(0, 1, "h5_get_file_size"); -} /* end test_sohm_size2() */ +} /* test_sohm_size2 */ /*------------------------------------------------------------------------- @@ -2601,27 +2711,22 @@ static void test_sohm_size2(int close_reopen) * *------------------------------------------------------------------------- */ -static void delete_helper_write(hid_t file_id, hid_t *dspace_id, hid_t *dcpl_id, int x) +static void +delete_helper_write(hid_t file_id, hid_t *dspace_id, hid_t *dcpl_id, int x) { - hid_t dset_id = -1; - hid_t attr_id = -1; - char wdata; + hid_t dset_id = -1; + hid_t attr_id = -1; + char wdata; herr_t ret; - /* Create dataset */ dset_id = H5Dcreate2(file_id, DSETNAME[x], H5T_NATIVE_CHAR, dspace_id[x], H5P_DEFAULT, dcpl_id[x], H5P_DEFAULT); CHECK_I(dset_id, "H5Dcreate2"); - - /* Write data to dataset */ wdata = (char)(x + 'a'); ret = H5Dwrite(dset_id, H5T_NATIVE_CHAR, dspace_id[x], dspace_id[x], H5P_DEFAULT, &wdata); CHECK_I(ret, "H5Dwrite"); - /* Create an attribute on the dataset. */ attr_id = H5Acreate2(dset_id, "attr_name", H5T_NATIVE_CHAR, dspace_id[x], H5P_DEFAULT, H5P_DEFAULT); CHECK_I(attr_id, "H5Acreate2"); - - /* Write to attribute */ ret = H5Awrite(attr_id, H5T_NATIVE_CHAR, &wdata); CHECK_I(ret, "H5Awrite"); @@ -2629,7 +2734,7 @@ static void delete_helper_write(hid_t file_id, hid_t *dspace_id, hid_t *dcpl_id, CHECK_I(ret, "H5Aclose"); ret = H5Dclose(dset_id); CHECK_I(ret, "H5Dclose"); -} +} /* delete_helper_write */ /*------------------------------------------------------------------------- @@ -2645,39 +2750,33 @@ static void delete_helper_write(hid_t file_id, hid_t *dspace_id, hid_t *dcpl_id, * *------------------------------------------------------------------------- */ -static void delete_helper_read(hid_t file_id, hid_t *dspace_id, int x) +static void +delete_helper_read(hid_t file_id, hid_t *dspace_id, int x) { hid_t dset_id = -1; hid_t attr_id = -1; char rdata; herr_t ret; - /* Open dataset */ dset_id = H5Dopen2(file_id, DSETNAME[x], H5P_DEFAULT); CHECK_I(dset_id, "H5Dopen2"); - - /* Read */ rdata = '\0'; ret = H5Dread(dset_id, H5T_NATIVE_CHAR, dspace_id[x], dspace_id[x], H5P_DEFAULT, &rdata); CHECK_I(ret, "H5Dread"); VERIFY(rdata, (x + 'a'), "H5Dread"); - /* Open attribute */ attr_id = H5Aopen(dset_id, "attr_name", H5P_DEFAULT); CHECK_I(attr_id, "H5Aopen"); - - /* Read */ rdata = '\0'; ret = H5Aread(attr_id, H5T_NATIVE_CHAR, &rdata); CHECK_I(ret, "H5Dread"); VERIFY(rdata, (x + 'a'), "H5Dread"); - /* Cleanup */ ret = H5Aclose(attr_id); CHECK_I(ret, "H5Aclose"); ret = H5Dclose(dset_id); CHECK_I(ret, "H5Dclose"); -} +} /* delete_helper_read */ /*------------------------------------------------------------------------- @@ -2701,7 +2800,8 @@ static void delete_helper_read(hid_t file_id, hid_t *dspace_id, int x) * *------------------------------------------------------------------------- */ -static void delete_helper(hid_t fcpl_id, hid_t *dspace_id, hid_t *dcpl_id) +static void +delete_helper(hid_t fcpl_id, hid_t *dspace_id, hid_t *dcpl_id) { hid_t file_id=-1; int x; @@ -2765,7 +2865,7 @@ static void delete_helper(hid_t fcpl_id, hid_t *dspace_id, hid_t *dcpl_id) VERIFY(norm_filesize, deleted_filesize, "h5_get_file_size"); if(deleted_filesize > (h5_stat_size_t)((float)norm_filesize * OVERHEAD_ALLOWED)) VERIFY(deleted_filesize, norm_filesize, "h5_get_file_size"); -} +} /* delete_helper */ /*------------------------------------------------------------------------- @@ -2799,6 +2899,8 @@ test_sohm_delete(void) hsize_t dims[] = DELETE_DIMS; herr_t ret; + MESSAGE(5, ("Testing deletion of SOHMs\n")); + /* Create a number of different dataspaces. * For simplicity, each dataspace has only one element. */ @@ -2910,17 +3012,18 @@ test_sohm_delete(void) ret = H5Pclose(dcpl_id[x]); CHECK_I(ret, "H5Pclose"); } /* end for */ -} /* end test_sohm_delete() */ +} /* test_sohm_delete */ /*------------------------------------------------------------------------- - * Function: test_sohm_delete_revert_helper + * Function: verify_dset_create_and_delete_does_not_grow_file * * Purpose: Tests that shared object header message deletion returns * the file to its previous state using the supplied FCPL. * - * Creates shared messages and then deletes them. Ensures - * that the file has not grown in size. + * Creates a file according to the supplied FCPL, + * then creates datasets and deletes them. + * Done in two passes: once with one dataset, once with two. * * Programmer: James Laird * Wednesday, January 3, 2007 @@ -2930,7 +3033,7 @@ test_sohm_delete(void) *------------------------------------------------------------------------- */ static int -test_sohm_delete_revert_helper(hid_t fcpl_id) +verify_dset_create_and_delete_does_not_grow_file(hid_t fcpl_id) { hid_t file_id; hid_t dspace_id; @@ -3017,13 +3120,14 @@ test_sohm_delete_revert_helper(hid_t fcpl_id) return(0); else return(-1); -} /* test_sohm_delete_revert_helper() */ +} /* verify_dset_create_and_delete_does_not_grow_file */ /*------------------------------------------------------------------------- * Function: test_sohm_delete_revert * - * Purpose: Calls test_sohm_delete_revert_helper with different FCPLs. + * Purpose: Verifies that creation and deletion of datasets with shared + * message headers will not increase file size. * * Programmer: James Laird * Wednesday, January 3, 2007 @@ -3038,6 +3142,8 @@ test_sohm_delete_revert(void) hid_t fcpl_id; herr_t ret; + MESSAGE(5, ("Testing that file reverts to original size on SOHM deletion\n")); + /* Create an fcpl with messages in two indexes */ fcpl_id = H5Pcreate(H5P_FILE_CREATE); CHECK_I(fcpl_id, "H5Pcreate"); @@ -3049,14 +3155,14 @@ test_sohm_delete_revert(void) CHECK_I(ret, "H5Pset_shared_mesg_index"); /* Call the helper function to test this FCPL. */ - ret = test_sohm_delete_revert_helper(fcpl_id); - CHECK_I(ret, "test_sohm_delete_revert_helper"); + ret = verify_dset_create_and_delete_does_not_grow_file(fcpl_id); + CHECK_I(ret, "verify_dset_create_and_delete_does_not_grow_file"); /* Try using B-trees */ ret = H5Pset_shared_mesg_phase_change(fcpl_id, 0, 0); CHECK_I(ret, "H5Pset_shared_mesg_phase_change"); - ret = test_sohm_delete_revert_helper(fcpl_id); - CHECK_I(ret, "test_sohm_delete_revert_helper"); + ret = verify_dset_create_and_delete_does_not_grow_file(fcpl_id); + CHECK_I(ret, "verify_dset_create_and_delete_does_not_grow_file"); /* Try sharing all messages */ @@ -3067,14 +3173,14 @@ test_sohm_delete_revert(void) ret = H5Pset_shared_mesg_phase_change(fcpl_id, 10, 5); CHECK_I(ret, "H5Pset_shared_mesg_phase_change"); - ret = test_sohm_delete_revert_helper(fcpl_id); - CHECK_I(ret, "test_sohm_delete_revert_helper"); + ret = verify_dset_create_and_delete_does_not_grow_file(fcpl_id); + CHECK_I(ret, "verify_dset_create_and_delete_does_not_grow_file"); /* Try using B-trees */ ret = H5Pset_shared_mesg_phase_change(fcpl_id, 0, 0); CHECK_I(ret, "H5Pset_shared_mesg_phase_change"); - ret = test_sohm_delete_revert_helper(fcpl_id); - CHECK_I(ret, "test_sohm_delete_revert_helper"); + ret = verify_dset_create_and_delete_does_not_grow_file(fcpl_id); + CHECK_I(ret, "verify_dset_create_and_delete_does_not_grow_file"); /* There should be at least two messages in the test (datatype and * dataspace). Use an index that will transition from a list to @@ -3082,8 +3188,8 @@ test_sohm_delete_revert(void) */ ret = H5Pset_shared_mesg_phase_change(fcpl_id, 1, 2); CHECK_I(ret, "H5Pset_shared_mesg_phase_change"); - ret = test_sohm_delete_revert_helper(fcpl_id); - CHECK_I(ret, "test_sohm_delete_revert_helper"); + ret = verify_dset_create_and_delete_does_not_grow_file(fcpl_id); + CHECK_I(ret, "verify_dset_create_and_delete_does_not_grow_file"); /* Try with shared messages enabled, but when messages are too big @@ -3091,16 +3197,16 @@ test_sohm_delete_revert(void) */ ret = H5Pset_shared_mesg_index(fcpl_id, 0, H5O_SHMESG_ALL_FLAG, 35); CHECK_I(ret, "H5Pset_shared_mesg_phase_change"); - ret = test_sohm_delete_revert_helper(fcpl_id); - CHECK_I(ret, "test_sohm_delete_revert_helper"); + ret = verify_dset_create_and_delete_does_not_grow_file(fcpl_id); + CHECK_I(ret, "verify_dset_create_and_delete_does_not_grow_file"); ret = H5Pclose(fcpl_id); CHECK_I(ret, "H5Pclose"); -} +} /* test_sohm_delete_revert */ /*------------------------------------------------------------------------- - * Function: test_sohm_extlink_helper + * Function: verify_dset_create_and_open_through_extlink_with_sohm * * Purpose: Tests that a dataset created through an external link can * be opened (that shared messages were created or not and @@ -3113,7 +3219,8 @@ test_sohm_delete_revert(void) * *------------------------------------------------------------------------- */ -static void test_sohm_extlink_helper(hid_t src_fcpl_id, hid_t dst_fcpl_id) +static void +verify_dset_create_and_open_through_extlink_with_sohm(hid_t src_fcpl_id, hid_t dst_fcpl_id) { hid_t src_file_id = -1; hid_t dst_file_id = -1; @@ -3164,7 +3271,7 @@ static void test_sohm_extlink_helper(hid_t src_fcpl_id, hid_t dst_fcpl_id) CHECK_I(ret, "H5Dclose"); ret = H5Fclose(dst_file_id); CHECK_I(ret, "H5Fclose"); -} +} /* verify_dset_create_and_open_through_extlink_with_sohm */ /*------------------------------------------------------------------------- @@ -3186,7 +3293,8 @@ test_sohm_extlink(void) hid_t fcpl_id = -1; herr_t ret; - /* Create fcpl */ + MESSAGE(5, ("Testing SOHM creation through external links\n")); + fcpl_id = H5Pcreate(H5P_FILE_CREATE); CHECK_I(fcpl_id, "H5Pcreate"); ret = H5Pset_shared_mesg_nindexes(fcpl_id, 1); @@ -3194,20 +3302,17 @@ test_sohm_extlink(void) ret = H5Pset_shared_mesg_index(fcpl_id, 0, H5O_SHMESG_ALL_FLAG, 16); CHECK_I(ret, "H5Pset_shared_mesg_index"); - /* Test using external links when the source or destination file uses - * shared messages - */ - test_sohm_extlink_helper(fcpl_id, H5P_DEFAULT); - test_sohm_extlink_helper(H5P_DEFAULT, fcpl_id); - test_sohm_extlink_helper(fcpl_id, fcpl_id); + verify_dset_create_and_open_through_extlink_with_sohm(fcpl_id, H5P_DEFAULT); + verify_dset_create_and_open_through_extlink_with_sohm(H5P_DEFAULT, fcpl_id); + verify_dset_create_and_open_through_extlink_with_sohm(fcpl_id, fcpl_id); ret = H5Pclose(fcpl_id); CHECK_I(ret, "H5Pclose"); -} +} /* test_sohm_extlink */ /*------------------------------------------------------------------------- - * Function: test_sohm_extend_dset_helper + * Function: verify_dataset_extension * * Purpose: Tests extending a dataset's dataspace when sharing is * enabled. @@ -3223,7 +3328,7 @@ test_sohm_extlink(void) *------------------------------------------------------------------------- */ static int -test_sohm_extend_dset_helper(hid_t fcpl_id, hbool_t close_reopen) +verify_dataset_extension(hid_t fcpl_id, hbool_t close_reopen) { hid_t file_id = -1; hid_t orig_space_id = -1; @@ -3236,13 +3341,98 @@ test_sohm_extend_dset_helper(hid_t fcpl_id, hbool_t close_reopen) hsize_t out_dims[2]; hsize_t out_maxdims[2]; int x; - int old_nerrs; /* Number of errors when entering this routine */ + int old_nerrs; /* Number of errors when entering this routine */ herr_t ret; - /* Retrieve the current # of reported errors */ + hsize_t *space_dims[3]; + +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + * Macro: TSOHM_VDE_VERIFY_SPACES + * + * Purpose: Encapsulate a common pattern + * Open, read-verify, and close the dataspaces for datasets 1-3 + * + * Programmer: Jacob Smith + * 2018 November 5 + * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + */ +#define TSOHM_VDE_VERIFY_SPACES(dims) \ +{ \ + /* Open dataspaces \ + */ \ + space1_id = H5Dget_space(dset1_id); \ + CHECK_I(space1_id, "H5Dget_space"); \ + space2_id = H5Dget_space(dset2_id); \ + CHECK_I(space2_id, "H5Dget_space"); \ + space3_id = H5Dget_space(dset3_id); \ + CHECK_I(space3_id, "H5Dget_space"); \ + /* Verify dataspaces \ + */ \ + ret = H5Sget_simple_extent_dims(space1_id, out_dims, out_maxdims); \ + CHECK_I(ret, "H5Sget_simple_extent_dims"); \ + for(x=0; x<EXTEND_NDIMS; ++x) { \ + VERIFY(out_dims[x], (dims)[0][x], "H5Sget_simple_extent_dims"); \ + VERIFY(out_maxdims[x], max_dims[x], "H5Sget_simple_extent_dims"); \ + } \ + ret = H5Sget_simple_extent_dims(space2_id, out_dims, out_maxdims); \ + CHECK_I(ret, "H5Sget_simple_extent_dims"); \ + for(x=0; x<EXTEND_NDIMS; ++x) { \ + VERIFY(out_dims[x], (dims)[1][x], "H5Sget_simple_extent_dims"); \ + VERIFY(out_maxdims[x], max_dims[x], "H5Sget_simple_extent_dims"); \ + } \ + ret = H5Sget_simple_extent_dims(space3_id, out_dims, out_maxdims); \ + CHECK_I(ret, "H5Sget_simple_extent_dims"); \ + for(x=0; x<EXTEND_NDIMS; ++x) { \ + VERIFY(out_dims[x], (dims)[2][x], "H5Sget_simple_extent_dims"); \ + VERIFY(out_maxdims[x], max_dims[x], "H5Sget_simple_extent_dims"); \ + } \ + /* Close dataspaces \ + */ \ + CHECK_I(H5Sclose(space1_id), "H5Sclose"); \ + CHECK_I(H5Sclose(space2_id), "H5Sclose"); \ + CHECK_I(H5Sclose(space3_id), "H5Sclose"); \ +} /* define TSOHM_VDE_VERIFY_SPACES */ + +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + * Macro: TSOHM_VDE_CLOSE_REOPEN_FILE_AND_DSETS() + * + * Purpose: Encapsulate a common pattern + * Wrapper to close and reopen file and datasets: + * + "dataset" (dset_id) + * + if n > 1 then include "dataset2" (dset_id2) + * + if n > 2 then include "dataset3" (dset_id3) + * + file (file_id) + * + * Programmer: Jacob Smith + * 2018 November 5 + * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + */ +#define TSOHM_VDE_CLOSE_REOPEN_FILE_AND_DSETS(n) \ +{ \ + CHECK_I(H5Dclose(dset1_id), "H5Dclose"); \ + if ((n) > 1) \ + CHECK_I(H5Dclose(dset2_id), "H5Dclose"); \ + if ((n) > 2) \ + CHECK_I(H5Dclose(dset3_id), "H5Dclose"); \ + CHECK_I(H5Fclose(file_id), "H5Fclose"); \ + \ + file_id = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT); \ + CHECK_I(file_id, "H5Fopen"); \ + dset1_id = H5Dopen2(file_id, "dataset", H5P_DEFAULT); \ + CHECK_I(dset1_id, "H5Dopen2"); \ + if ((n) > 1) { \ + dset2_id = H5Dopen2(file_id, "dataset2", H5P_DEFAULT); \ + CHECK_I(dset2_id, "H5Dopen2"); \ + } \ + if ((n) > 2) { \ + dset3_id = H5Dopen2(file_id, "dataset3", H5P_DEFAULT); \ + CHECK_I(dset3_id, "H5Dopen2"); \ + } \ +} /* define TSOHM_VDE_CLOSE_REOPEN_FILE_AND_DSETS */ + + /* Remember the current # of reported errors */ old_nerrs = GetTestNumErrs(); - /* Create file */ file_id = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT); CHECK_I(file_id, "H5Fcreate"); @@ -3257,251 +3447,49 @@ test_sohm_extend_dset_helper(hid_t fcpl_id, hbool_t close_reopen) CHECK_I(orig_space_id, "H5Screate_simple"); dset1_id = H5Dcreate2(file_id, "dataset", H5T_NATIVE_LONG, orig_space_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT); CHECK_I(dset1_id, "H5Dcreate2"); - - if(close_reopen) { - /* If requested, close all open IDs and reopen them */ - ret = H5Dclose(dset1_id); - CHECK_I(ret, "H5Dclose"); - ret = H5Fclose(file_id); - CHECK_I(ret, "H5Fclose"); - - file_id = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT); - CHECK_I(file_id, "H5Fopen"); - dset1_id = H5Dopen2(file_id, "dataset", H5P_DEFAULT); - CHECK_I(dset1_id, "H5Dopen2"); - } + if(close_reopen) + TSOHM_VDE_CLOSE_REOPEN_FILE_AND_DSETS(1); /* Create another dataset starting with the same dataspace */ dset2_id = H5Dcreate2(file_id, "dataset2", H5T_NATIVE_LONG, orig_space_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT); CHECK_I(dset2_id, "H5Dcreate2"); - - if(close_reopen) { - /* If requested, close all open IDs and reopen them */ - ret = H5Dclose(dset1_id); - CHECK_I(ret, "H5Dclose"); - ret = H5Dclose(dset2_id); - CHECK_I(ret, "H5Dclose"); - ret = H5Fclose(file_id); - CHECK_I(ret, "H5Fclose"); - - file_id = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT); - CHECK_I(file_id, "H5Fopen"); - dset1_id = H5Dopen2(file_id, "dataset", H5P_DEFAULT); - CHECK_I(dset1_id, "H5Dopen2"); - dset2_id = H5Dopen2(file_id, "dataset2", H5P_DEFAULT); - CHECK_I(dset2_id, "H5Dopen2"); - } + if (close_reopen) + TSOHM_VDE_CLOSE_REOPEN_FILE_AND_DSETS(2); /* Create a third dataset with the same dataspace */ dset3_id = H5Dcreate2(file_id, "dataset3", H5T_NATIVE_LONG, orig_space_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT); CHECK_I(dset3_id, "H5Dcreate2"); - - if(close_reopen) { - /* If requested, close all open IDs and reopen them */ - ret = H5Dclose(dset1_id); - CHECK_I(ret, "H5Dclose"); - ret = H5Dclose(dset2_id); - CHECK_I(ret, "H5Dclose"); - ret = H5Dclose(dset3_id); - CHECK_I(ret, "H5Dclose"); - ret = H5Fclose(file_id); - CHECK_I(ret, "H5Fclose"); - - file_id = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT); - CHECK_I(file_id, "H5Fopen"); - dset1_id = H5Dopen2(file_id, "dataset", H5P_DEFAULT); - CHECK_I(dset1_id, "H5Dopen2"); - dset2_id = H5Dopen2(file_id, "dataset2", H5P_DEFAULT); - CHECK_I(dset2_id, "H5Dopen2"); - dset3_id = H5Dopen2(file_id, "dataset3", H5P_DEFAULT); - CHECK_I(dset3_id, "H5Dopen2"); - } + if (close_reopen) + TSOHM_VDE_CLOSE_REOPEN_FILE_AND_DSETS(3); /* Extend the first dataset */ ret = H5Dset_extent(dset1_id, dims2); CHECK_I(ret, "H5Dset_extent"); - if(close_reopen) { - /* If requested, close all open IDs and reopen them */ - ret = H5Dclose(dset1_id); - CHECK_I(ret, "H5Dclose"); - ret = H5Dclose(dset2_id); - CHECK_I(ret, "H5Dclose"); - ret = H5Dclose(dset3_id); - CHECK_I(ret, "H5Dclose"); - ret = H5Fclose(file_id); - CHECK_I(ret, "H5Fclose"); - - file_id = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT); - CHECK_I(file_id, "H5Fopen"); - dset1_id = H5Dopen2(file_id, "dataset", H5P_DEFAULT); - CHECK_I(dset1_id, "H5Dopen2"); - dset2_id = H5Dopen2(file_id, "dataset2", H5P_DEFAULT); - CHECK_I(dset2_id, "H5Dopen2"); - dset3_id = H5Dopen2(file_id, "dataset3", H5P_DEFAULT); - CHECK_I(dset3_id, "H5Dopen2"); - } + if (close_reopen) + TSOHM_VDE_CLOSE_REOPEN_FILE_AND_DSETS(3); - /* Get the dataspaces from the datasets */ - space1_id = H5Dget_space(dset1_id); - CHECK_I(space1_id, "H5Dget_space"); - space2_id = H5Dget_space(dset2_id); - CHECK_I(space2_id, "H5Dget_space"); - space3_id = H5Dget_space(dset3_id); - CHECK_I(space3_id, "H5Dget_space"); - - /* Verify the dataspaces */ - ret = H5Sget_simple_extent_dims(space1_id, out_dims, out_maxdims); - CHECK_I(ret, "H5Sget_simple_extent_dims"); - for(x=0; x<EXTEND_NDIMS; ++x) { - VERIFY(out_dims[x], dims2[x], "H5Sget_simple_extent_dims"); - VERIFY(out_maxdims[x], max_dims[x], "H5Sget_simple_extent_dims"); - } - - ret = H5Sget_simple_extent_dims(space2_id, out_dims, out_maxdims); - CHECK_I(ret, "H5Sget_simple_extent_dims"); - for(x=0; x<EXTEND_NDIMS; ++x) { - VERIFY(out_dims[x], dims1[x], "H5Sget_simple_extent_dims"); - VERIFY(out_maxdims[x], max_dims[x], "H5Sget_simple_extent_dims"); - } - - ret = H5Sget_simple_extent_dims(space3_id, out_dims, out_maxdims); - CHECK_I(ret, "H5Sget_simple_extent_dims"); - for(x=0; x<EXTEND_NDIMS; ++x) { - VERIFY(out_dims[x], dims1[x], "H5Sget_simple_extent_dims"); - VERIFY(out_maxdims[x], max_dims[x], "H5Sget_simple_extent_dims"); - } - - /* Close all three dataspaces */ - ret = H5Sclose(space1_id); - CHECK_I(ret, "H5Sclose"); - ret = H5Sclose(space2_id); - CHECK_I(ret, "H5Sclose"); - ret = H5Sclose(space3_id); - CHECK_I(ret, "H5Sclose"); + space_dims[0] = dims2; + space_dims[1] = dims1; + space_dims[2] = dims1; + TSOHM_VDE_VERIFY_SPACES(space_dims); /* Extend the second dataset */ ret = H5Dset_extent(dset2_id, dims2); CHECK_I(ret, "H5Dset_extent"); - if(close_reopen) { - /* If requested, close all open IDs and reopen them */ - ret = H5Dclose(dset1_id); - CHECK_I(ret, "H5Dclose"); - ret = H5Dclose(dset2_id); - CHECK_I(ret, "H5Dclose"); - ret = H5Dclose(dset3_id); - CHECK_I(ret, "H5Dclose"); - ret = H5Fclose(file_id); - CHECK_I(ret, "H5Fclose"); - - file_id = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT); - CHECK_I(file_id, "H5Fopen"); - dset1_id = H5Dopen2(file_id, "dataset", H5P_DEFAULT); - CHECK_I(dset1_id, "H5Dopen2"); - dset2_id = H5Dopen2(file_id, "dataset2", H5P_DEFAULT); - CHECK_I(dset2_id, "H5Dopen2"); - dset3_id = H5Dopen2(file_id, "dataset3", H5P_DEFAULT); - CHECK_I(dset3_id, "H5Dopen2"); - } - - /* Get the dataspaces from the datasets */ - space1_id = H5Dget_space(dset1_id); - CHECK_I(space1_id, "H5Dget_space"); - space2_id = H5Dget_space(dset2_id); - CHECK_I(space2_id, "H5Dget_space"); - space3_id = H5Dget_space(dset3_id); - CHECK_I(space3_id, "H5Dget_space"); - - /* Verify the dataspaces */ - ret = H5Sget_simple_extent_dims(space1_id, out_dims, out_maxdims); - CHECK_I(ret, "H5Sget_simple_extent_dims"); - for(x=0; x<EXTEND_NDIMS; ++x) { - VERIFY(out_dims[x], dims2[x], "H5Sget_simple_extent_dims"); - VERIFY(out_maxdims[x], max_dims[x], "H5Sget_simple_extent_dims"); - } - - ret = H5Sget_simple_extent_dims(space2_id, out_dims, out_maxdims); - CHECK_I(ret, "H5Sget_simple_extent_dims"); - for(x=0; x<EXTEND_NDIMS; ++x) { - VERIFY(out_dims[x], dims2[x], "H5Sget_simple_extent_dims"); - VERIFY(out_maxdims[x], max_dims[x], "H5Sget_simple_extent_dims"); - } + if(close_reopen) + TSOHM_VDE_CLOSE_REOPEN_FILE_AND_DSETS(3); - ret = H5Sget_simple_extent_dims(space3_id, out_dims, out_maxdims); - CHECK_I(ret, "H5Sget_simple_extent_dims"); - for(x=0; x<EXTEND_NDIMS; ++x) { - VERIFY(out_dims[x], dims1[x], "H5Sget_simple_extent_dims"); - VERIFY(out_maxdims[x], max_dims[x], "H5Sget_simple_extent_dims"); - } - - /* Close all three dataspaces */ - ret = H5Sclose(space1_id); - CHECK_I(ret, "H5Sclose"); - ret = H5Sclose(space2_id); - CHECK_I(ret, "H5Sclose"); - ret = H5Sclose(space3_id); - CHECK_I(ret, "H5Sclose"); + space_dims[1] = dims2; + TSOHM_VDE_VERIFY_SPACES(space_dims); /* Extend the third dataset */ ret = H5Dset_extent(dset3_id, dims2); CHECK_I(ret, "H5Dset_extent"); - if(close_reopen) { - /* If requested, close all open IDs and reopen them */ - ret = H5Dclose(dset1_id); - CHECK_I(ret, "H5Dclose"); - ret = H5Dclose(dset2_id); - CHECK_I(ret, "H5Dclose"); - ret = H5Dclose(dset3_id); - CHECK_I(ret, "H5Dclose"); - ret = H5Fclose(file_id); - CHECK_I(ret, "H5Fclose"); - - file_id = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT); - CHECK_I(file_id, "H5Fopen"); - dset1_id = H5Dopen2(file_id, "dataset", H5P_DEFAULT); - CHECK_I(dset1_id, "H5Dopen2"); - dset2_id = H5Dopen2(file_id, "dataset2", H5P_DEFAULT); - CHECK_I(dset2_id, "H5Dopen2"); - dset3_id = H5Dopen2(file_id, "dataset3", H5P_DEFAULT); - CHECK_I(dset3_id, "H5Dopen2"); - } - - /* Get the dataspaces from the datasets */ - space1_id = H5Dget_space(dset1_id); - CHECK_I(space1_id, "H5Dget_space"); - space2_id = H5Dget_space(dset2_id); - CHECK_I(space2_id, "H5Dget_space"); - space3_id = H5Dget_space(dset3_id); - CHECK_I(space3_id, "H5Dget_space"); - - /* Verify the dataspaces */ - ret = H5Sget_simple_extent_dims(space1_id, out_dims, out_maxdims); - CHECK_I(ret, "H5Sget_simple_extent_dims"); - for(x=0; x<EXTEND_NDIMS; ++x) { - VERIFY(out_dims[x], dims2[x], "H5Sget_simple_extent_dims"); - VERIFY(out_maxdims[x], max_dims[x], "H5Sget_simple_extent_dims"); - } - - ret = H5Sget_simple_extent_dims(space2_id, out_dims, out_maxdims); - CHECK_I(ret, "H5Sget_simple_extent_dims"); - for(x=0; x<EXTEND_NDIMS; ++x) { - VERIFY(out_dims[x], dims2[x], "H5Sget_simple_extent_dims"); - VERIFY(out_maxdims[x], max_dims[x], "H5Sget_simple_extent_dims"); - } - - ret = H5Sget_simple_extent_dims(space3_id, out_dims, out_maxdims); - CHECK_I(ret, "H5Sget_simple_extent_dims"); - for(x=0; x<EXTEND_NDIMS; ++x) { - VERIFY(out_dims[x], dims2[x], "H5Sget_simple_extent_dims"); - VERIFY(out_maxdims[x], max_dims[x], "H5Sget_simple_extent_dims"); - } + if(close_reopen) + TSOHM_VDE_CLOSE_REOPEN_FILE_AND_DSETS(3); - /* Close all three dataspaces */ - ret = H5Sclose(space1_id); - CHECK_I(ret, "H5Sclose"); - ret = H5Sclose(space2_id); - CHECK_I(ret, "H5Sclose"); - ret = H5Sclose(space3_id); - CHECK_I(ret, "H5Sclose"); + space_dims[2] = dims2; + TSOHM_VDE_VERIFY_SPACES(space_dims); /* Close the datasets and file */ ret = H5Dclose(dset1_id); @@ -3523,164 +3511,44 @@ test_sohm_extend_dset_helper(hid_t fcpl_id, hbool_t close_reopen) CHECK_I(file_id, "H5Fcreate"); dset1_id = H5Dcreate2(file_id, "dataset", H5T_NATIVE_LONG, orig_space_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT); CHECK_I(dset1_id, "H5Dcreate2"); - if(close_reopen) { - /* If requested, close all open IDs and reopen them */ - ret = H5Dclose(dset1_id); - CHECK_I(ret, "H5Dclose"); - ret = H5Fclose(file_id); - CHECK_I(ret, "H5Fclose"); - - file_id = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT); - CHECK_I(file_id, "H5Fopen"); - dset1_id = H5Dopen2(file_id, "dataset", H5P_DEFAULT); - CHECK_I(dset1_id, "H5Dopen2"); - } + if (close_reopen) + TSOHM_VDE_CLOSE_REOPEN_FILE_AND_DSETS(1); /* Extend the first dataset */ ret = H5Dset_extent(dset1_id, dims2); CHECK_I(ret, "H5Dset_extent"); - if(close_reopen) { - /* If requested, close all open IDs and reopen them */ - ret = H5Dclose(dset1_id); - CHECK_I(ret, "H5Dclose"); - ret = H5Fclose(file_id); - CHECK_I(ret, "H5Fclose"); - - file_id = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT); - CHECK_I(file_id, "H5Fopen"); - dset1_id = H5Dopen2(file_id, "dataset", H5P_DEFAULT); - CHECK_I(dset1_id, "H5Dopen2"); - } + if (close_reopen) + TSOHM_VDE_CLOSE_REOPEN_FILE_AND_DSETS(1); /* Create the second dataset. Its dataspace will be unshared and then * become shared when extended. */ dset2_id = H5Dcreate2(file_id, "dataset2", H5T_NATIVE_LONG, orig_space_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT); CHECK_I(dset2_id, "H5Dcreate2"); - if(close_reopen) { - /* If requested, close all open IDs and reopen them */ - ret = H5Dclose(dset1_id); - CHECK_I(ret, "H5Dclose"); - ret = H5Dclose(dset2_id); - CHECK_I(ret, "H5Dclose"); - ret = H5Fclose(file_id); - CHECK_I(ret, "H5Fclose"); - - file_id = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT); - CHECK_I(file_id, "H5Fopen"); - dset1_id = H5Dopen2(file_id, "dataset", H5P_DEFAULT); - CHECK_I(dset1_id, "H5Dopen2"); - dset2_id = H5Dopen2(file_id, "dataset2", H5P_DEFAULT); - CHECK_I(dset2_id, "H5Dopen2"); - } + if (close_reopen) + TSOHM_VDE_CLOSE_REOPEN_FILE_AND_DSETS(2); /* Extend the second dataset */ ret = H5Dset_extent(dset2_id, dims2); CHECK_I(ret, "H5Dset_extent"); - if(close_reopen) { - /* If requested, close all open IDs and reopen them */ - ret = H5Dclose(dset1_id); - CHECK_I(ret, "H5Dclose"); - ret = H5Dclose(dset2_id); - CHECK_I(ret, "H5Dclose"); - ret = H5Fclose(file_id); - CHECK_I(ret, "H5Fclose"); - - file_id = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT); - CHECK_I(file_id, "H5Fopen"); - dset1_id = H5Dopen2(file_id, "dataset", H5P_DEFAULT); - CHECK_I(dset1_id, "H5Dopen2"); - dset2_id = H5Dopen2(file_id, "dataset2", H5P_DEFAULT); - CHECK_I(dset2_id, "H5Dopen2"); - } + if (close_reopen) + TSOHM_VDE_CLOSE_REOPEN_FILE_AND_DSETS(2); /* Create the third dataset. Its dataspace will be unshared and then * become shared when extended. */ dset3_id = H5Dcreate2(file_id, "dataset3", H5T_NATIVE_LONG, orig_space_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT); CHECK_I(dset3_id, "H5Dcreate2"); - if(close_reopen) { - /* If requested, close all open IDs and reopen them */ - ret = H5Dclose(dset1_id); - CHECK_I(ret, "H5Dclose"); - ret = H5Dclose(dset2_id); - CHECK_I(ret, "H5Dclose"); - ret = H5Dclose(dset3_id); - CHECK_I(ret, "H5Dclose"); - ret = H5Fclose(file_id); - CHECK_I(ret, "H5Fclose"); - - file_id = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT); - CHECK_I(file_id, "H5Fopen"); - dset1_id = H5Dopen2(file_id, "dataset", H5P_DEFAULT); - CHECK_I(dset1_id, "H5Dopen2"); - dset2_id = H5Dopen2(file_id, "dataset2", H5P_DEFAULT); - CHECK_I(dset2_id, "H5Dopen2"); - dset3_id = H5Dopen2(file_id, "dataset3", H5P_DEFAULT); - CHECK_I(dset3_id, "H5Dopen2"); - } + if(close_reopen) + TSOHM_VDE_CLOSE_REOPEN_FILE_AND_DSETS(3); /* Extend the third dataset */ ret = H5Dset_extent(dset3_id, dims2); CHECK_I(ret, "H5Dset_extent"); - if(close_reopen) { - /* If requested, close all open IDs and reopen them */ - ret = H5Dclose(dset1_id); - CHECK_I(ret, "H5Dclose"); - ret = H5Dclose(dset2_id); - CHECK_I(ret, "H5Dclose"); - ret = H5Dclose(dset3_id); - CHECK_I(ret, "H5Dclose"); - ret = H5Fclose(file_id); - CHECK_I(ret, "H5Fclose"); - - file_id = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT); - CHECK_I(file_id, "H5Fopen"); - dset1_id = H5Dopen2(file_id, "dataset", H5P_DEFAULT); - CHECK_I(dset1_id, "H5Dopen2"); - dset2_id = H5Dopen2(file_id, "dataset2", H5P_DEFAULT); - CHECK_I(dset2_id, "H5Dopen2"); - dset3_id = H5Dopen2(file_id, "dataset3", H5P_DEFAULT); - CHECK_I(dset3_id, "H5Dopen2"); - } + if(close_reopen) + TSOHM_VDE_CLOSE_REOPEN_FILE_AND_DSETS(3); - /* Get the dataspaces from the datasets */ - space1_id = H5Dget_space(dset1_id); - CHECK_I(space1_id, "H5Dget_space"); - space2_id = H5Dget_space(dset2_id); - CHECK_I(space2_id, "H5Dget_space"); - space3_id = H5Dget_space(dset3_id); - CHECK_I(space3_id, "H5Dget_space"); - - /* Verify the dataspaces */ - ret = H5Sget_simple_extent_dims(space1_id, out_dims, out_maxdims); - CHECK_I(ret, "H5Sget_simple_extent_dims"); - for(x=0; x<EXTEND_NDIMS; ++x) { - VERIFY(out_dims[x], dims2[x], "H5Sget_simple_extent_dims"); - VERIFY(out_maxdims[x], max_dims[x], "H5Sget_simple_extent_dims"); - } - - ret = H5Sget_simple_extent_dims(space2_id, out_dims, out_maxdims); - CHECK_I(ret, "H5Sget_simple_extent_dims"); - for(x=0; x<EXTEND_NDIMS; ++x) { - VERIFY(out_dims[x], dims2[x], "H5Sget_simple_extent_dims"); - VERIFY(out_maxdims[x], max_dims[x], "H5Sget_simple_extent_dims"); - } - - ret = H5Sget_simple_extent_dims(space3_id, out_dims, out_maxdims); - CHECK_I(ret, "H5Sget_simple_extent_dims"); - for(x=0; x<EXTEND_NDIMS; ++x) { - VERIFY(out_dims[x], dims2[x], "H5Sget_simple_extent_dims"); - VERIFY(out_maxdims[x], max_dims[x], "H5Sget_simple_extent_dims"); - } - - /* Close all three dataspaces */ - ret = H5Sclose(space1_id); - CHECK_I(ret, "H5Sclose"); - ret = H5Sclose(space2_id); - CHECK_I(ret, "H5Sclose"); - ret = H5Sclose(space3_id); - CHECK_I(ret, "H5Sclose"); + TSOHM_VDE_VERIFY_SPACES(space_dims); /* Close the datasets and file */ ret = H5Dclose(dset1_id); @@ -3698,12 +3566,15 @@ test_sohm_extend_dset_helper(hid_t fcpl_id, hbool_t close_reopen) ret = H5Pclose(dcpl_id); CHECK_I(ret, "H5Pclose"); - /* Retrieve current # of errors */ + /* Complain if this test generated errors */ if(old_nerrs == GetTestNumErrs()) return(0); else return(-1); -} /* end test_sohm_extend_dset_helper() */ +/* macros are exclusive to this function */ +#undef TSOHM_VDE_CLOSE_REOPEN_FILE_AND_DSETS +#undef TSOHM_VDE_VERIFY_SPACES +} /* verify_dataset_extension */ /*------------------------------------------------------------------------- @@ -3726,74 +3597,71 @@ test_sohm_extend_dset(void) hid_t fcpl_id = -1; herr_t ret; - /* Create fcpl */ + MESSAGE(5, ("Testing extending shared dataspaces\n")); + fcpl_id = H5Pcreate(H5P_FILE_CREATE); CHECK_I(fcpl_id, "H5Pcreate"); - - /* Test extending datasets with different FCPLs */ ret = H5Pset_shared_mesg_nindexes(fcpl_id, 1); CHECK_I(ret, "H5Pset_shared_mesg_nindexes"); /* No shared messages */ - ret = test_sohm_extend_dset_helper(fcpl_id, FALSE); - CHECK_I(ret, "test_sohm_extend_dset_helper"); - ret = test_sohm_extend_dset_helper(fcpl_id, TRUE); - CHECK_I(ret, "test_sohm_extend_dset_helper"); + ret = verify_dataset_extension(fcpl_id, FALSE); + CHECK_I(ret, "verify_dataset_extension"); + ret = verify_dataset_extension(fcpl_id, TRUE); + CHECK_I(ret, "verify_dataset_extension"); /* Only dataspaces */ ret = H5Pset_shared_mesg_index(fcpl_id, 0, H5O_SHMESG_SDSPACE_FLAG, 16); CHECK_I(ret, "H5Pset_shared_mesg_index"); - ret = test_sohm_extend_dset_helper(fcpl_id, FALSE); - CHECK_I(ret, "test_sohm_extend_dset_helper"); - ret = test_sohm_extend_dset_helper(fcpl_id, TRUE); - CHECK_I(ret, "test_sohm_extend_dset_helper"); + ret = verify_dataset_extension(fcpl_id, FALSE); + CHECK_I(ret, "verify_dataset_extension"); + ret = verify_dataset_extension(fcpl_id, TRUE); + CHECK_I(ret, "verify_dataset_extension"); /* All messages */ - ret = H5Pset_shared_mesg_nindexes(fcpl_id, 1); - CHECK_I(ret, "H5Pset_shared_mesg_nindexes"); ret = H5Pset_shared_mesg_index(fcpl_id, 0, H5O_SHMESG_ALL_FLAG, 16); CHECK_I(ret, "H5Pset_shared_mesg_index"); - ret = test_sohm_extend_dset_helper(fcpl_id, FALSE); - CHECK_I(ret, "test_sohm_extend_dset_helper"); - ret = test_sohm_extend_dset_helper(fcpl_id, TRUE); - CHECK_I(ret, "test_sohm_extend_dset_helper"); + ret = verify_dataset_extension(fcpl_id, FALSE); + CHECK_I(ret, "verify_dataset_extension"); + ret = verify_dataset_extension(fcpl_id, TRUE); + CHECK_I(ret, "verify_dataset_extension"); /* All messages in lists */ ret = H5Pset_shared_mesg_phase_change(fcpl_id, 100, 50); CHECK_I(ret, "H5Pset_shared_mesg_phase_change"); - ret = test_sohm_extend_dset_helper(fcpl_id, FALSE); - CHECK_I(ret, "test_sohm_extend_dset_helper"); - ret = test_sohm_extend_dset_helper(fcpl_id, TRUE); - CHECK_I(ret, "test_sohm_extend_dset_helper"); + ret = verify_dataset_extension(fcpl_id, FALSE); + CHECK_I(ret, "verify_dataset_extension"); + ret = verify_dataset_extension(fcpl_id, TRUE); + CHECK_I(ret, "verify_dataset_extension"); /* All messages in lists converted to B-trees */ ret = H5Pset_shared_mesg_phase_change(fcpl_id, 1, 0); CHECK_I(ret, "H5Pset_shared_mesg_phase_change"); - ret = test_sohm_extend_dset_helper(fcpl_id, FALSE); - CHECK_I(ret, "test_sohm_extend_dset_helper"); - ret = test_sohm_extend_dset_helper(fcpl_id, TRUE); - CHECK_I(ret, "test_sohm_extend_dset_helper"); + ret = verify_dataset_extension(fcpl_id, FALSE); + CHECK_I(ret, "verify_dataset_extension"); + ret = verify_dataset_extension(fcpl_id, TRUE); + CHECK_I(ret, "verify_dataset_extension"); /* All messages in B-trees */ ret = H5Pset_shared_mesg_phase_change(fcpl_id, 0, 0); CHECK_I(ret, "H5Pset_shared_mesg_phase_change"); - ret = test_sohm_extend_dset_helper(fcpl_id, FALSE); - CHECK_I(ret, "test_sohm_extend_dset_helper"); - ret = test_sohm_extend_dset_helper(fcpl_id, TRUE); - CHECK_I(ret, "test_sohm_extend_dset_helper"); + ret = verify_dataset_extension(fcpl_id, FALSE); + CHECK_I(ret, "verify_dataset_extension"); + ret = verify_dataset_extension(fcpl_id, TRUE); + CHECK_I(ret, "verify_dataset_extension"); ret = H5Pclose(fcpl_id); CHECK_I(ret, "H5Pclose"); -} +} /* test_sohm_extend_dset */ /*------------------------------------------------------------------------- @@ -3827,37 +3695,31 @@ test_sohm_external_dtype(void) unsigned x, i; herr_t ret; + MESSAGE(5, ("Testing shared external datatype\n")); + fcpl = H5Pcreate(H5P_FILE_CREATE); CHECK_I(fcpl, "H5Pcreate"); - - /* Set up index values for sohm */ ret = H5Pset_shared_mesg_nindexes(fcpl, TEST_NUM_INDEXES); CHECK_I(ret, "H5Pset_shared_mesg_nindexes"); - - for(x=0; x<TEST_NUM_INDEXES; ++x) - { + for(x=0; x<TEST_NUM_INDEXES; ++x) { ret = H5Pset_shared_mesg_index(fcpl, x, test_type_flags[x], test_minsizes[x]); CHECK_I(ret, "H5Pset_shared_mesg_index"); } - ret = H5Pset_shared_mesg_phase_change(fcpl, TEST_L2B, TEST_B2L); CHECK_I(ret, "H5Pset_shared_mesg_phase_change"); - /* Create the data space */ space = H5Screate_simple(2, dims, NULL); CHECK_I(space, "H5Screate_simple"); - /* Create a data type for s1_t */ s1_tid = H5Tcreate(H5T_COMPOUND, sizeof(s1_t)); CHECK_I(s1_tid, "H5Tcreate"); - ret = H5Tinsert(s1_tid, "a", HOFFSET(s1_t,a), H5T_NATIVE_INT); CHECK_I(ret, "H5Tinsert"); - ret = H5Tinsert (s1_tid, "b", HOFFSET(s1_t,b), H5T_NATIVE_INT); CHECK_I(ret, "H5Tinsert"); - /* Create the first file for this test */ + /* Set up dataset in first file + */ file1 = H5Fcreate(FILENAME_SRC, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT); CHECK_I(file1, "H5Fcreate"); @@ -3866,7 +3728,6 @@ test_sohm_external_dtype(void) CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); VERIFY(dmsg_count, 0, "H5F__get_sohm_mesg_count_test"); - /* Create data set */ dataset1 = H5Dcreate2(file1, "dataset_1", s1_tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK_I(dataset1, "H5Dcreate2"); @@ -3876,26 +3737,26 @@ test_sohm_external_dtype(void) CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); VERIFY(dmsg_count, 1, "H5F__get_sohm_mesg_count_test"); - /* Retieve the dataset's datatype */ dset1_tid = H5Dget_type(dataset1); CHECK_I(dset1_tid, "H5Dget_type"); /* Allocate space and initialize data */ orig = (s1_t*)HDmalloc(NX * NY * sizeof(s1_t)); + if (orig == NULL) + CHECK_I(-1, "HDmalloc"); for(i=0; i<NX*NY; i++) { s_ptr = (s1_t*)orig + i; s_ptr->a = (int)(i * 3 + 1); s_ptr->b = (int)(i * 3 + 2); } - /* Write the data to the dataset1 */ ret = H5Dwrite(dataset1, s1_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig); CHECK_I(ret, "H5Dwrite"); - ret = H5Dclose(dataset1); CHECK_I(ret, "H5Dclose"); - /* Create the second file for this test */ + /* Create dataset in second file using datatype from dataset in the first file + */ file2 = H5Fcreate(FILENAME_DST, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT); CHECK_I(file2, "H5Fcreate"); @@ -3904,7 +3765,6 @@ test_sohm_external_dtype(void) CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); VERIFY(dmsg_count, 0, "H5F__get_sohm_mesg_count_test"); - /* Create a data set using the datatype of the dataset in the first file. */ dataset2 = H5Dcreate2(file2, "dataset_2", dset1_tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK_I(dataset2, "H5Dcreate2"); @@ -3914,54 +3774,44 @@ test_sohm_external_dtype(void) CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); VERIFY(dmsg_count, 1, "H5F__get_sohm_mesg_count_test"); - /* Write the data to the dataset2 */ ret = H5Dwrite(dataset2, s1_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig); CHECK_I(ret, "H5Dwrite"); + /* Close references to the first file */ ret = H5Dclose(dataset2); CHECK_I(ret, "H5Dclose"); - - /* Close file 1 and the dataset's datatype in file 1. Verify that the datatype in - * file 2 is still accessible. */ ret = H5Tclose(dset1_tid); CHECK_I(ret, "H5Tclose"); - ret = H5Fclose(file1); CHECK_I(ret, "H5Fclose"); - /* Open the dataset in file 2 */ + /* Verify that datatype details are still accessible by second file + */ dataset2 = H5Dopen2(file2, "dataset_2", H5P_DEFAULT); CHECK_I(dataset2, "H5Dopen2"); - /* Retieve the dataset's datatype */ dset2_tid = H5Dget_type(dataset2); CHECK_I(dset2_tid, "H5Dget_type"); - /* Verify the datatype is compound */ dtype_class = H5Tget_class(dset2_tid); VERIFY(dtype_class, H5T_COMPOUND, "H5Tget_class"); + /* Cleanup + */ ret = H5Tclose(dset2_tid); CHECK_I(ret, "H5Tclose"); - ret = H5Dclose(dataset2); CHECK_I(ret, "H5Dclose"); - - /* Finishing test and release resources */ ret = H5Sclose(space); CHECK_I(ret, "H5Sclose"); - ret = H5Tclose(s1_tid); CHECK_I(ret, "H5Tclose"); - ret = H5Pclose(fcpl); CHECK_I(ret, "H5Pclose"); - ret = H5Fclose(file2); CHECK_I(ret, "H5Fclose"); - HDfree(orig); -} +} /* test_sohm_external_dtype */ /**************************************************************** @@ -3972,11 +3822,14 @@ test_sohm_external_dtype(void) void test_sohm(void) { - /* Output message about test being performed */ MESSAGE(5, ("Testing Shared Object Header Messages\n")); - test_sohm_fcpl(); /* Test SOHMs and file creation plists */ + test_sohm_fcpl(); /* Test SOHMs and file creation plists */ + test_sohm_fcpl_errors(); /* Bogus H5P* calls for SOHMs */ test_sohm_size1(); /* Tests the sizes of files with one SOHM */ +#if 0 /* TODO: REVEALS BUG TO BE FIXED - SEE JIRA HDFFV-10645 */ + test_sohm_size_consistency_open_create(); +#endif /* Jira HDFFV-10645 */ test_sohm_attrs(); /* Tests shared messages in attributes */ test_sohm_size2(0); /* Tests the sizes of files with multiple SOHMs */ test_sohm_size2(1); /* Tests the sizes of files with multiple @@ -3989,17 +3842,17 @@ test_sohm(void) test_sohm_extend_dset(); /* Test extending shared datasets */ test_sohm_external_dtype(); /* Test using datatype in another file */ -} /* test_sohm() */ +} /* test_sohm */ /*------------------------------------------------------------------------- - * Function: cleanup_sohm + * Function: cleanup_sohm * - * Purpose: Cleanup temporary test files + * Purpose: Cleanup temporary test files * - * Return: none + * Return: none * - * Programmer: James Laird + * Programmer: James Laird * October 9, 2006 * * Modifications: @@ -4009,8 +3862,8 @@ test_sohm(void) void cleanup_sohm(void) { - remove(FILENAME); - remove(FILENAME_SRC); - remove(FILENAME_DST); -} + HDremove(FILENAME); + HDremove(FILENAME_SRC); + HDremove(FILENAME_DST); +} /* cleanup_sohm */ diff --git a/test/ttime.c b/test/ttime.c index 48c9ba8..5b3436d 100644 --- a/test/ttime.c +++ b/test/ttime.c @@ -178,13 +178,13 @@ test_time_io(void) tid = H5Dget_type(dsid); CHECK(tid, FAIL, "H5Dget_type"); if( H5Tget_class (tid) == H5T_TIME) - fprintf(stderr,"datatype class is H5T_TIME\n"); + HDfprintf(stderr,"datatype class is H5T_TIME\n"); status = H5Tclose (tid); CHECK(status, FAIL, "H5Tclose"); status = H5Dread (dsid, H5T_UNIX_D32LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &timethen); CHECK(status, FAIL, "H5Dread"); -fprintf(stderr,"time written was: %s\n", HDctime(&timethen)); +HDfprintf(stderr,"time written was: %s\n", HDctime(&timethen)); status = H5Dclose(dsid); CHECK(status, FAIL, "H5Dclose"); @@ -231,6 +231,6 @@ test_time(void) void cleanup_time(void) { - remove(DATAFILE); + HDremove(DATAFILE); } diff --git a/test/tunicode.c b/test/tunicode.c index 5a60036..255dc50 100644 --- a/test/tunicode.c +++ b/test/tunicode.c @@ -854,7 +854,7 @@ void test_unicode(void) */ void cleanup_unicode(void) { - remove(FILENAME); + HDremove(FILENAME); } diff --git a/test/tvlstr.c b/test/tvlstr.c index 68d1070..77589bb 100644 --- a/test/tvlstr.c +++ b/test/tvlstr.c @@ -183,7 +183,7 @@ test_vlstrings_basic(void) /* Count the actual number of bytes used by the strings */ for(i=0,str_used=0; i<SPACE1_DIM1; i++) - str_used+=HDstrlen(wdata[i])+1; + str_used += HDstrlen(wdata[i])+1; /* Compare against the strings actually written */ VERIFY(size,(hsize_t)str_used,"H5Dvlen_get_buf_size"); @@ -198,7 +198,7 @@ test_vlstrings_basic(void) /* Compare data read in */ 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)strlen(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])); continue; } /* end if */ if(HDstrcmp(wdata[i], rdata[i]) != 0 ) { @@ -300,7 +300,7 @@ test_vlstrings_special(void) /* Compare data read in */ 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)strlen(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])); continue; } /* end if */ if((wdata[i] == NULL && rdata[i] != NULL) || (rdata[i] == NULL && wdata[i] != NULL)) { @@ -527,7 +527,7 @@ test_compact_vlstring(void) /* Compare data read in */ 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)strlen(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])); continue; } /* end if */ if(HDstrcmp(wdata[i], rdata[i]) != 0) { @@ -802,33 +802,33 @@ static void test_vl_rewrite(void) /* Create in file 1 */ for(i=0; i<REWRITE_NDATASETS; i++) { - sprintf(name, "/set_%d", i); + HDsprintf(name, "/set_%d", i); write_scalar_dset(file1, type, space, name, name); } /* Effectively copy data from file 1 to 2 */ for(i=0; i<REWRITE_NDATASETS; i++) { - sprintf(name, "/set_%d", i); + HDsprintf(name, "/set_%d", i); read_scalar_dset(file1, type, space, name, name); write_scalar_dset(file2, type, space, name, name); } /* Read back from file 2 */ for(i = 0; i < REWRITE_NDATASETS; i++) { - sprintf(name, "/set_%d", i); + HDsprintf(name, "/set_%d", i); read_scalar_dset(file2, type, space, name, name); } /* end for */ /* Remove from file 2. */ for(i = 0; i < REWRITE_NDATASETS; i++) { - sprintf(name, "/set_%d", i); + HDsprintf(name, "/set_%d", i); ret = H5Ldelete(file2, name, H5P_DEFAULT); CHECK(ret, FAIL, "H5Ldelete"); } /* end for */ /* Effectively copy from file 1 to file 2 */ for(i = 0; i < REWRITE_NDATASETS; i++) { - sprintf(name, "/set_%d", i); + HDsprintf(name, "/set_%d", i); read_scalar_dset(file1, type, space, name, name); write_scalar_dset(file2, type, space, name, name); } /* end for */ @@ -880,7 +880,7 @@ static void test_write_same_element(void) fspace = H5Screate_simple(SPACE1_RANK, fdim, NULL); CHECK(fspace, FAIL, "H5Screate_simple"); - dataset1 = H5Dcreate(file1, DATASET, dtype, fspace, H5P_DEFAULT, + dataset1 = H5Dcreate2(file1, DATASET, dtype, fspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK(dataset1, FAIL, "H5Dcreate"); @@ -905,7 +905,7 @@ static void test_write_same_element(void) file1 = H5Fopen(DATAFILE3, H5F_ACC_RDWR, H5P_DEFAULT); CHECK(file1, FAIL, "H5Fopen"); - dataset1 = H5Dopen(file1, DATASET, H5P_DEFAULT); + dataset1 = H5Dopen2(file1, DATASET, H5P_DEFAULT); CHECK(dataset1, FAIL, "H5Dopen"); fspace = H5Dget_space(dataset1); @@ -378,7 +378,7 @@ test_api_get_ex_dcpl(test_api_config_t config, hid_t fapl, hid_t dcpl, TEST_ERROR if(config == TEST_API_REOPEN_FILE) { if(oinfo.meta_size.obj.heap_size != exp_meta_size) { - printf("VDS metadata size: %llu Expected: %llu\n", (long long unsigned)oinfo.meta_size.obj.heap_size, (long long unsigned)exp_meta_size); + HDprintf("VDS metadata size: %llu Expected: %llu\n", (long long unsigned)oinfo.meta_size.obj.heap_size, (long long unsigned)exp_meta_size); TEST_ERROR } } @@ -11619,7 +11619,7 @@ main(void) for(test_api_config = (int)TEST_API_BASIC; test_api_config < (int)TEST_API_NTESTS; test_api_config++) nerrors += test_api((test_api_config_t)test_api_config, fapl); for(bit_config = 0; bit_config < TEST_IO_NTESTS; bit_config++) { - printf("Config: %s%s%s\n", bit_config & TEST_IO_CLOSE_SRC ? "closed source dataset, " : "", bit_config & TEST_IO_DIFFERENT_FILE ? "different source file" : "same source file", bit_config & TEST_IO_REOPEN_VIRT ? ", reopen virtual file" : ""); + HDprintf("Config: %s%s%s\n", bit_config & TEST_IO_CLOSE_SRC ? "closed source dataset, " : "", bit_config & TEST_IO_DIFFERENT_FILE ? "different source file" : "same source file", bit_config & TEST_IO_REOPEN_VIRT ? ", reopen virtual file" : ""); nerrors += test_basic_io(bit_config, fapl); nerrors += test_vds_prefix(bit_config, fapl); nerrors += test_unlim(bit_config, fapl); @@ -11634,14 +11634,14 @@ main(void) if(nerrors) goto error; - printf("All virtual dataset tests passed.\n"); + HDprintf("All virtual dataset tests passed.\n"); h5_cleanup(FILENAME, fapl); return EXIT_SUCCESS; error: nerrors = MAX(1, nerrors); - printf("***** %d VIRTUAL DATASET TEST%s FAILED! *****\n", + HDprintf("***** %d VIRTUAL DATASET TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S"); return EXIT_FAILURE; } /* end main() */ @@ -412,8 +412,8 @@ test_core(void) for(j = 0; j < CORE_DSET_DIM2; j++) if(*pr++ != *pw++) { H5_FAILED(); - printf(" Read different values than written in data set.\n"); - printf(" At index %d,%d\n", i, j); + HDprintf(" Read different values than written in data set.\n"); + HDprintf(" At index %d,%d\n", i, j); TEST_ERROR; } /* end if */ @@ -480,8 +480,8 @@ test_core(void) for(j = 0; j < CORE_DSET_DIM2; j++) if(*pw++ != *pr++) { H5_FAILED(); - printf(" Read different values than written in data set.\n"); - printf(" At index %d,%d\n", i, j); + HDprintf(" Read different values than written in data set.\n"); + HDprintf(" At index %d,%d\n", i, j); TEST_ERROR; } /* end if */ @@ -597,7 +597,7 @@ test_direct(void) if(file<0) { H5Pclose (fapl); SKIPPED(); - printf(" Probably the file system doesn't support Direct I/O\n"); + HDprintf(" Probably the file system doesn't support Direct I/O\n"); return 0; } @@ -674,8 +674,8 @@ test_direct(void) for(j = 0; j < DSET1_DIM2; j++) if(*p1++ != *p2++) { H5_FAILED(); - printf(" Read different values than written in data set 1.\n"); - printf(" At index %d,%d\n", i, j); + HDprintf(" Read different values than written in data set 1.\n"); + HDprintf(" At index %d,%d\n", i, j); TEST_ERROR; } /* end if */ @@ -706,8 +706,8 @@ test_direct(void) for(i = 0; i < DSET2_DIM; i++) if(wdata2[i] != rdata2[i]) { H5_FAILED(); - printf(" Read different values than written in data set 2.\n"); - printf(" At index %d\n", i); + HDprintf(" Read different values than written in data set 2.\n"); + HDprintf(" At index %d\n", i); TEST_ERROR; } /* end if */ @@ -1199,19 +1199,19 @@ test_multi(void) memb_map[H5FD_MEM_BTREE] = H5FD_MEM_BTREE; memb_map[H5FD_MEM_GHEAP] = H5FD_MEM_GHEAP; - sprintf(sv[H5FD_MEM_SUPER], "%%s-%c.h5", 's'); + HDsprintf(sv[H5FD_MEM_SUPER], "%%s-%c.h5", 's'); memb_name[H5FD_MEM_SUPER] = sv[H5FD_MEM_SUPER]; memb_addr[H5FD_MEM_SUPER] = 0; - sprintf(sv[H5FD_MEM_BTREE], "%%s-%c.h5", 'b'); + HDsprintf(sv[H5FD_MEM_BTREE], "%%s-%c.h5", 'b'); memb_name[H5FD_MEM_BTREE] = sv[H5FD_MEM_BTREE]; memb_addr[H5FD_MEM_BTREE] = HADDR_MAX/4; - sprintf(sv[H5FD_MEM_DRAW], "%%s-%c.h5", 'r'); + HDsprintf(sv[H5FD_MEM_DRAW], "%%s-%c.h5", 'r'); memb_name[H5FD_MEM_DRAW] = sv[H5FD_MEM_DRAW]; memb_addr[H5FD_MEM_DRAW] = HADDR_MAX/2; - sprintf(sv[H5FD_MEM_GHEAP], "%%s-%c.h5", 'g'); + HDsprintf(sv[H5FD_MEM_GHEAP], "%%s-%c.h5", 'g'); memb_name[H5FD_MEM_GHEAP] = sv[H5FD_MEM_GHEAP]; memb_addr[H5FD_MEM_GHEAP] = (HADDR_MAX/4)*3; @@ -1431,12 +1431,12 @@ test_multi_compat(void) memb_map[H5FD_MEM_DRAW] = H5FD_MEM_DRAW; memb_fapl[H5FD_MEM_SUPER] = H5P_DEFAULT; - sprintf(sv[H5FD_MEM_SUPER], "%%s-%c.h5", 's'); + HDsprintf(sv[H5FD_MEM_SUPER], "%%s-%c.h5", 's'); memb_name[H5FD_MEM_SUPER] = sv[H5FD_MEM_SUPER]; memb_addr[H5FD_MEM_SUPER] = 0; memb_fapl[H5FD_MEM_DRAW] = H5P_DEFAULT; - sprintf(sv[H5FD_MEM_DRAW], "%%s-%c.h5", 'r'); + HDsprintf(sv[H5FD_MEM_DRAW], "%%s-%c.h5", 'r'); memb_name[H5FD_MEM_DRAW] = sv[H5FD_MEM_DRAW]; memb_addr[H5FD_MEM_DRAW] = HADDR_MAX/2; @@ -1446,17 +1446,19 @@ test_multi_compat(void) h5_fixname(FILENAME[9], fapl, newname, sizeof newname); /* Make copy for the data file in the build directory, to protect the - * original file in the source directory */ - sprintf(filename_s, "%s-%c.h5", MULTI_COMPAT_BASENAME, 's'); - sprintf(newname_s, "%s-%c.h5", FILENAME[9], 's'); + * original file in the source directory + */ + HDsprintf(filename_s, "%s-%c.h5", MULTI_COMPAT_BASENAME, 's'); + HDsprintf(newname_s, "%s-%c.h5", FILENAME[9], 's'); h5_make_local_copy(filename_s, newname_s); - sprintf(filename_r, "%s-%c.h5", MULTI_COMPAT_BASENAME, 'r'); - sprintf(newname_r, "%s-%c.h5", FILENAME[9], 'r'); + HDsprintf(filename_r, "%s-%c.h5", MULTI_COMPAT_BASENAME, 'r'); + HDsprintf(newname_r, "%s-%c.h5", FILENAME[9], 'r'); h5_make_local_copy(filename_r, newname_r); /* Reopen the file for read only. Verify 1.8 library can open file - * created with 1.6 library. */ + * created with 1.6 library. + */ if((file=H5Fopen(newname, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR; @@ -20,8 +20,12 @@ #include "h5test.h" +/* Filename */ +const char *FILENAME[] = { + "native_vol_test", + NULL +}; -#define NATIVE_VOL_TEST_FILENAME "native_vol_test" #define NATIVE_VOL_TEST_GROUP_NAME "test_group" #define NATIVE_VOL_TEST_DATASET_NAME "test_dataset" #define NATIVE_VOL_TEST_ATTRIBUTE_NAME "test_dataset" @@ -45,16 +49,20 @@ static const H5VL_class_t fake_vol_g = { 0, /* capability flags */ NULL, /* initialize */ NULL, /* terminate */ - (size_t)0, /* info size */ - NULL, /* info copy */ - NULL, /* info compare */ - NULL, /* info free */ - NULL, /* info to str */ - NULL, /* str to info */ - NULL, /* get_object */ - NULL, /* get_wrap_ctx */ - NULL, /* wrap_object */ - NULL, /* free_wrap_ctx */ + { /* info_cls */ + (size_t)0, /* size */ + NULL, /* copy */ + NULL, /* compare */ + NULL, /* free */ + NULL, /* to_str */ + NULL, /* from_str */ + }, + { /* wrap_cls */ + NULL, /* get_object */ + NULL, /* get_wrap_ctx */ + NULL, /* wrap_object */ + NULL, /* free_wrap_ctx */ + }, { /* attribute_cls */ NULL, /* create */ NULL, /* open */ @@ -237,7 +245,7 @@ error: *------------------------------------------------------------------------- */ static herr_t -test_basic_file_operation(void) +test_basic_file_operation(const char *env_h5_drvr) { hid_t fid = H5I_INVALID_HID; hid_t fid_reopen = H5I_INVALID_HID; @@ -245,6 +253,7 @@ test_basic_file_operation(void) hid_t fapl_id2 = H5I_INVALID_HID; hid_t fcpl_id = H5I_INVALID_HID; + char filename[1024]; ssize_t obj_count; hid_t obj_id_list[1]; hsize_t file_size; @@ -257,6 +266,7 @@ test_basic_file_operation(void) /* Retrieve the file access property for testing */ fapl_id = h5_fileaccess(); + h5_fixname(FILENAME[0], fapl_id, filename, sizeof filename); /* Set the file close degree to a non-default value, to make the H5Pequal * work out. This is kinda odd, but the library's current behavior with @@ -273,7 +283,7 @@ test_basic_file_operation(void) FAIL_STACK_ERROR /* H5Fcreate */ - if ((fid = H5Fcreate(NATIVE_VOL_TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) + if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) TEST_ERROR; /* H5Fget_obj_count */ @@ -290,13 +300,16 @@ test_basic_file_operation(void) if ((obj_count = H5Fget_obj_ids((hid_t)H5F_OBJ_ALL, H5F_OBJ_DATASET, 2, obj_id_list)) < 0) TEST_ERROR; - /* H5Fget_access_plist */ - if ((fapl_id2 = H5Fget_access_plist(fid)) < 0) - TEST_ERROR; - if (H5Pequal(fapl_id, fapl_id2) != TRUE) - TEST_ERROR; - if (H5Pclose(fapl_id2) < 0) - TEST_ERROR; + /* Can't compare VFD properties for split / multi / family VFDs */ + if((hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family"))) { + /* H5Fget_access_plist */ + if ((fapl_id2 = H5Fget_access_plist(fid)) < 0) + TEST_ERROR; + if (H5Pequal(fapl_id, fapl_id2) != TRUE) + TEST_ERROR; + if (H5Pclose(fapl_id2) < 0) + TEST_ERROR; + } /* end if */ /* H5Fget_create_plist */ if ((fcpl_id = H5Fget_create_plist(fid)) < 0) @@ -308,9 +321,12 @@ test_basic_file_operation(void) if (H5Fget_filesize(fid, &file_size) < 0) TEST_ERROR; - /* H5Fget_vfd_handle */ - if (H5Fget_vfd_handle(fid, H5P_DEFAULT, &os_file_handle) < 0) - TEST_ERROR; + /* Can't retrieve VFD handle for split / multi / family VFDs */ + if((hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family"))) { + /* H5Fget_vfd_handle */ + if (H5Fget_vfd_handle(fid, H5P_DEFAULT, &os_file_handle) < 0) + TEST_ERROR; + } /* end if */ /* H5Fget_intent */ if (H5Fget_intent(fid, &intent) < 0) @@ -337,43 +353,49 @@ test_basic_file_operation(void) TEST_ERROR; /* H5Fis_accessible */ - if (H5Fis_accessible(NATIVE_VOL_TEST_FILENAME, fapl_id) < 0) + if (H5Fis_accessible(filename, fapl_id) < 0) TEST_ERROR; /* H5Fopen */ - if ((fid = H5Fopen(NATIVE_VOL_TEST_FILENAME, H5F_ACC_RDWR, fapl_id)) < 0) + if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0) TEST_ERROR; - /* H5Fget_access_plist */ - if ((fapl_id2 = H5Fget_access_plist(fid)) < 0) - TEST_ERROR; - if (H5Pequal(fapl_id, fapl_id2) != TRUE) - TEST_ERROR; - if (H5Pclose(fapl_id2) < 0) - TEST_ERROR; + /* Can't compare VFD properties for split / multi / family VFDs */ + if((hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family"))) { + /* H5Fget_access_plist */ + if((fapl_id2 = H5Fget_access_plist(fid)) < 0) + TEST_ERROR; + if(H5Pequal(fapl_id, fapl_id2) != TRUE) + TEST_ERROR; + if(H5Pclose(fapl_id2) < 0) + TEST_ERROR; + } /* end if */ if ((fid_reopen = H5Freopen(fid)) < 0) TEST_ERROR; - /* H5Fget_access_plist */ - if ((fapl_id2 = H5Fget_access_plist(fid_reopen)) < 0) - TEST_ERROR; - if (H5Pequal(fapl_id, fapl_id2) != TRUE) - TEST_ERROR; - if (H5Pclose(fapl_id2) < 0) - TEST_ERROR; + /* Can't compare VFD properties for split / multi / family VFDs */ + if((hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family"))) { + /* H5Fget_access_plist */ + if((fapl_id2 = H5Fget_access_plist(fid_reopen)) < 0) + TEST_ERROR; + if(H5Pequal(fapl_id, fapl_id2) != TRUE) + TEST_ERROR; + if(H5Pclose(fapl_id2) < 0) + TEST_ERROR; + } /* end if */ if (H5Fclose(fid) < 0) TEST_ERROR; if (H5Fclose(fid_reopen) < 0) TEST_ERROR; + h5_delete_test_file(FILENAME[0], fapl_id); + /* H5Pclose */ if (H5Pclose(fapl_id) < 0) TEST_ERROR; - HDremove(NATIVE_VOL_TEST_FILENAME); - PASSED(); return SUCCEED; @@ -404,14 +426,20 @@ static herr_t test_basic_group_operation(void) { hid_t fid = H5I_INVALID_HID; + hid_t fapl_id = H5I_INVALID_HID; hid_t gid = H5I_INVALID_HID; hid_t gid_a = H5I_INVALID_HID; hid_t gcpl_id = H5I_INVALID_HID; + char filename[1024]; H5G_info_t info; TESTING("Basic VOL group operations"); - if ((fid = H5Fcreate(NATIVE_VOL_TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + /* Retrieve the file access property for testing */ + fapl_id = h5_fileaccess(); + h5_fixname(FILENAME[0], fapl_id, filename, sizeof filename); + + if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) TEST_ERROR; /* H5Gcreate */ @@ -465,7 +493,11 @@ test_basic_group_operation(void) if (H5Fclose(fid) < 0) TEST_ERROR; - HDremove(NATIVE_VOL_TEST_FILENAME); + h5_delete_test_file(FILENAME[0], fapl_id); + + /* H5Pclose */ + if (H5Pclose(fapl_id) < 0) + TEST_ERROR; PASSED(); return SUCCEED; @@ -474,6 +506,7 @@ error: H5E_BEGIN_TRY { H5Fclose(fid); H5Gclose(gid); + H5Pclose(fapl_id); H5Pclose(gcpl_id); } H5E_END_TRY; @@ -495,6 +528,7 @@ static herr_t test_basic_dataset_operation(void) { hid_t fid = H5I_INVALID_HID; + hid_t fapl_id = H5I_INVALID_HID; hid_t dcpl_id = H5I_INVALID_HID; hid_t dapl_id = H5I_INVALID_HID; hid_t did = H5I_INVALID_HID; @@ -502,6 +536,8 @@ test_basic_dataset_operation(void) hid_t sid = H5I_INVALID_HID; hid_t tid = H5I_INVALID_HID; + char filename[1024]; + hsize_t curr_dims = 0; hsize_t max_dims = H5S_UNLIMITED; @@ -516,7 +552,11 @@ test_basic_dataset_operation(void) TESTING("Basic VOL dataset operations"); - if ((fid = H5Fcreate(NATIVE_VOL_TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + /* Retrieve the file access property for testing */ + fapl_id = h5_fileaccess(); + h5_fixname(FILENAME[0], fapl_id, filename, sizeof filename); + + if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) TEST_ERROR; for (i = 0; i < N_ELEMENTS; i++) { in_buf[i] = i; @@ -630,7 +670,11 @@ test_basic_dataset_operation(void) if (H5Fclose(fid) < 0) TEST_ERROR; - HDremove(NATIVE_VOL_TEST_FILENAME); + h5_delete_test_file(FILENAME[0], fapl_id); + + /* H5Pclose */ + if (H5Pclose(fapl_id) < 0) + TEST_ERROR; PASSED(); return SUCCEED; @@ -642,6 +686,7 @@ error: H5Dclose(did_a); H5Sclose(sid); H5Tclose(tid); + H5Pclose(fapl_id); H5Pclose(dapl_id); H5Pclose(dcpl_id); } H5E_END_TRY; @@ -664,11 +709,14 @@ static herr_t test_basic_attribute_operation(void) { hid_t fid = H5I_INVALID_HID; + hid_t fapl_id = H5I_INVALID_HID; hid_t gid = H5I_INVALID_HID; hid_t aid = H5I_INVALID_HID; hid_t aid_name = H5I_INVALID_HID; hid_t sid = H5I_INVALID_HID; + char filename[1024]; + hsize_t dims = 1; int data_in = 42; @@ -676,7 +724,11 @@ test_basic_attribute_operation(void) TESTING("Basic VOL attribute operations"); - if ((fid = H5Fcreate(NATIVE_VOL_TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + /* Retrieve the file access property for testing */ + fapl_id = h5_fileaccess(); + h5_fixname(FILENAME[0], fapl_id, filename, sizeof filename); + + if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) TEST_ERROR; if ((gid = H5Gcreate2(fid, NATIVE_VOL_TEST_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; @@ -730,7 +782,11 @@ test_basic_attribute_operation(void) if (H5Fclose(fid) < 0) TEST_ERROR; - HDremove(NATIVE_VOL_TEST_FILENAME); + h5_delete_test_file(FILENAME[0], fapl_id); + + /* H5Pclose */ + if (H5Pclose(fapl_id) < 0) + TEST_ERROR; PASSED(); return SUCCEED; @@ -738,6 +794,7 @@ test_basic_attribute_operation(void) error: H5E_BEGIN_TRY { H5Fclose(fid); + H5Pclose(fapl_id); H5Gclose(gid); H5Sclose(sid); H5Aclose(aid); @@ -762,14 +819,20 @@ static herr_t test_basic_object_operation(void) { hid_t fid = H5I_INVALID_HID; + hid_t fapl_id = H5I_INVALID_HID; hid_t gid = H5I_INVALID_HID; hid_t oid = H5I_INVALID_HID; + char filename[1024]; H5O_info_t object_info; TESTING("Basic VOL object operations"); - if ((fid = H5Fcreate(NATIVE_VOL_TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + /* Retrieve the file access property for testing */ + fapl_id = h5_fileaccess(); + h5_fixname(FILENAME[0], fapl_id, filename, sizeof filename); + + if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) TEST_ERROR; if ((gid = H5Gcreate2(fid, NATIVE_VOL_TEST_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; @@ -797,7 +860,12 @@ test_basic_object_operation(void) if (H5Gclose(gid) < 0) TEST_ERROR; - HDremove(NATIVE_VOL_TEST_FILENAME); + h5_delete_test_file(FILENAME[0], fapl_id); + + /* H5Pclose */ + if (H5Pclose(fapl_id) < 0) + TEST_ERROR; + PASSED(); return SUCCEED; @@ -805,6 +873,7 @@ test_basic_object_operation(void) error: H5E_BEGIN_TRY { H5Fclose(fid); + H5Pclose(fapl_id); H5Gclose(gid); } H5E_END_TRY; @@ -827,10 +896,16 @@ test_basic_link_operation(void) { hid_t fid = H5I_INVALID_HID; hid_t gid = H5I_INVALID_HID; + hid_t fapl_id = H5I_INVALID_HID; + char filename[1024]; TESTING("Basic VOL link operations"); - if ((fid = H5Fcreate(NATIVE_VOL_TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + /* Retrieve the file access property for testing */ + fapl_id = h5_fileaccess(); + h5_fixname(FILENAME[0], fapl_id, filename, sizeof filename); + + if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) TEST_ERROR; if ((gid = H5Gcreate2(fid, NATIVE_VOL_TEST_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; @@ -862,7 +937,12 @@ test_basic_link_operation(void) if (H5Gclose(gid) < 0) TEST_ERROR; - HDremove(NATIVE_VOL_TEST_FILENAME); + h5_delete_test_file(FILENAME[0], fapl_id); + + /* H5Pclose */ + if (H5Pclose(fapl_id) < 0) + TEST_ERROR; + PASSED(); return SUCCEED; @@ -871,6 +951,7 @@ error: H5E_BEGIN_TRY { H5Fclose(fid); H5Fclose(gid); + H5Pclose(fapl_id); } H5E_END_TRY; return FAIL; @@ -891,13 +972,19 @@ static herr_t test_basic_datatype_operation(void) { hid_t fid = H5I_INVALID_HID; + hid_t fapl_id = H5I_INVALID_HID; hid_t tid = H5I_INVALID_HID; hid_t tid_anon = H5I_INVALID_HID; hid_t tcpl_id = H5I_INVALID_HID; + char filename[1024]; TESTING("Basic VOL datatype operations"); - if ((fid = H5Fcreate(NATIVE_VOL_TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + /* Retrieve the file access property for testing */ + fapl_id = h5_fileaccess(); + h5_fixname(FILENAME[0], fapl_id, filename, sizeof filename); + + if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) TEST_ERROR; if ((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR; @@ -941,7 +1028,11 @@ test_basic_datatype_operation(void) if (H5Fclose(fid) < 0) TEST_ERROR; - HDremove(NATIVE_VOL_TEST_FILENAME); + h5_delete_test_file(FILENAME[0], fapl_id); + + /* H5Pclose */ + if (H5Pclose(fapl_id) < 0) + TEST_ERROR; PASSED(); return SUCCEED; @@ -950,6 +1041,7 @@ error: H5E_BEGIN_TRY { H5Pclose(tcpl_id); H5Fclose(fid); + H5Pclose(fapl_id); H5Tclose(tid); H5Tclose(tid_anon); } H5E_END_TRY; @@ -958,34 +1050,6 @@ error: } /* end test_basic_datatype_operation() */ -#if 0 - -/*------------------------------------------------------------------------- - * Function: test_echo_vol_operation() - * - * Purpose: Uses the echo VOL connector to test basic VOL operations - * via the H5VL public API. - * - * Return: SUCCEED/FAIL - * - *------------------------------------------------------------------------- - */ -static herr_t -test_echo_vol_operation(void) -{ - char name[25]; - - TESTING("Echo VOL operations"); - - PASSED(); - return SUCCEED; - -error: - return FAIL; - -} /* end test_basic_vol_operation() */ -#endif - /*------------------------------------------------------------------------- * Function: main @@ -999,15 +1063,21 @@ error: int main(void) { + const char *env_h5_drvr; /* File driver value from environment */ int nerrors = 0; + /* Get the VFD to use */ + env_h5_drvr = HDgetenv("HDF5_DRIVER"); + if(env_h5_drvr == NULL) + env_h5_drvr = "nomatch"; + h5_reset(); HDputs("Testing basic Virtual Object Layer (VOL) functionality."); nerrors += test_vol_registration() < 0 ? 1 : 0; nerrors += test_native_vol_init() < 0 ? 1 : 0; - nerrors += test_basic_file_operation() < 0 ? 1 : 0; + nerrors += test_basic_file_operation(env_h5_drvr) < 0 ? 1 : 0; nerrors += test_basic_group_operation() < 0 ? 1 : 0; nerrors += test_basic_dataset_operation() < 0 ? 1 : 0; nerrors += test_basic_attribute_operation() < 0 ? 1 : 0; diff --git a/test/vol_plugin.c b/test/vol_plugin.c new file mode 100644 index 0000000..236a67e --- /dev/null +++ b/test/vol_plugin.c @@ -0,0 +1,291 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Purpose: Tests basic VOL plugin operations (registration, etc.). + * Uses the null VOL connector (built with the testing code) + * which is loaded as a dynamic plugin. + * + * TO DO: Adapt the null VOL connector to do something interesting with + * the property list. + */ + +#include "h5test.h" + +#include "null_vol_connector.h" + + +/*------------------------------------------------------------------------- + * Function: test_registration_by_value() + * + * Purpose: Tests if we can load, register, and close a VOL + * connector by value. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +test_registration_by_value(void) +{ + htri_t is_registered = FAIL; + hid_t vol_id = H5I_INVALID_HID; + + TESTING("VOL registration by value"); + + /* The null VOL connector should not be registered at the start of the test */ + if((is_registered = H5VLis_connector_registered(NULL_VOL_CONNECTOR_NAME)) < 0) + TEST_ERROR; + if(TRUE == is_registered) + FAIL_PUTS_ERROR("NULL VOL connector is inappropriately registered"); + + /* Register the connector by value */ + if((vol_id = H5VLregister_connector_by_value(NULL_VOL_CONNECTOR_VALUE, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* The connector should be registered now */ + if((is_registered = H5VLis_connector_registered(NULL_VOL_CONNECTOR_NAME)) < 0) + TEST_ERROR; + if(FALSE == is_registered) + FAIL_PUTS_ERROR("NULL VOL connector was not registered"); + + /* Unregister the connector */ + if(H5VLunregister_connector(vol_id) < 0) + TEST_ERROR; + + /* The connector should not be registered now */ + if((is_registered = H5VLis_connector_registered(NULL_VOL_CONNECTOR_NAME)) < 0) + TEST_ERROR; + if(TRUE == is_registered) + FAIL_PUTS_ERROR("NULL VOL connector is inappropriately registered"); + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5VLunregister_connector(vol_id); + } H5E_END_TRY; + return FAIL; + +} /* end test_registration_by_value() */ + + +/*------------------------------------------------------------------------- + * Function: test_registration_by_name() + * + * Purpose: Tests if we can load, register, and close a VOL + * connector by name. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +test_registration_by_name(void) +{ + htri_t is_registered = FAIL; + hid_t vol_id = H5I_INVALID_HID; + + TESTING("VOL registration by name"); + + /* The null VOL connector should not be registered at the start of the test */ + if((is_registered = H5VLis_connector_registered(NULL_VOL_CONNECTOR_NAME)) < 0) + TEST_ERROR; + if(TRUE == is_registered) + FAIL_PUTS_ERROR("NULL VOL connector is inappropriately registered"); + + /* Register the connector by name */ + if((vol_id = H5VLregister_connector_by_name(NULL_VOL_CONNECTOR_NAME, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* The connector should be registered now */ + if((is_registered = H5VLis_connector_registered(NULL_VOL_CONNECTOR_NAME)) < 0) + TEST_ERROR; + if(FALSE == is_registered) + FAIL_PUTS_ERROR("NULL VOL connector was not registered"); + + /* Unregister the connector */ + if(H5VLunregister_connector(vol_id) < 0) + TEST_ERROR; + + /* The connector should not be registered now */ + if((is_registered = H5VLis_connector_registered(NULL_VOL_CONNECTOR_NAME)) < 0) + TEST_ERROR; + if(TRUE == is_registered) + FAIL_PUTS_ERROR("NULL VOL connector is inappropriately registered"); + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5VLunregister_connector(vol_id); + } H5E_END_TRY; + return FAIL; + +} /* end test_registration_by_name() */ + + +/*------------------------------------------------------------------------- + * Function: test_multiple_registration() + * + * Purpose: Tests if we can register a VOL connector multiple times. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +#define N_REGISTRATIONS 10 +static herr_t +test_multiple_registration(void) +{ + htri_t is_registered = FAIL; + hid_t vol_ids[N_REGISTRATIONS]; + int i; + + TESTING("registering a VOL connector multiple times"); + + /* The null VOL connector should not be registered at the start of the test */ + if((is_registered = H5VLis_connector_registered(NULL_VOL_CONNECTOR_NAME)) < 0) + TEST_ERROR; + if(TRUE == is_registered) + FAIL_PUTS_ERROR("NULL VOL connector is inappropriately registered"); + + /* Register the connector multiple times */ + for(i = 0; i < N_REGISTRATIONS; i++) { + if((vol_ids[i] = H5VLregister_connector_by_name(NULL_VOL_CONNECTOR_NAME, H5P_DEFAULT)) < 0) + TEST_ERROR; + } + + /* The connector should be registered now */ + if((is_registered = H5VLis_connector_registered(NULL_VOL_CONNECTOR_NAME)) < 0) + TEST_ERROR; + if(FALSE == is_registered) + FAIL_PUTS_ERROR("NULL VOL connector was not registered"); + + /* Unregister the connector */ + for(i = 0; i < N_REGISTRATIONS; i++) { + if(H5VLunregister_connector(vol_ids[i]) < 0) + TEST_ERROR; + /* Also test close on some of the IDs. This call currently works + * identically to unregister. + */ + i++; + if(H5VLclose(vol_ids[i]) < 0) + TEST_ERROR; + } + + /* The connector should not be registered now */ + if((is_registered = H5VLis_connector_registered(NULL_VOL_CONNECTOR_NAME)) < 0) + TEST_ERROR; + if(TRUE == is_registered) + FAIL_PUTS_ERROR("NULL VOL connector is inappropriately registered"); + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + for(i = 0; i < N_REGISTRATIONS; i++) + H5VLunregister_connector(vol_ids[i]); + } H5E_END_TRY; + return FAIL; + +} /* end test_multiple_registration() */ + + +/*------------------------------------------------------------------------- + * Function: test_getters() + * + * Purpose: Tests H5VL getters + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +test_getters(void) +{ + htri_t is_registered = FAIL; + hid_t vol_id = H5I_INVALID_HID; + hid_t vol_id_out = H5I_INVALID_HID; + + TESTING("VOL getters"); + + /* The null VOL connector should not be registered at the start of the test */ + if((is_registered = H5VLis_connector_registered(NULL_VOL_CONNECTOR_NAME)) < 0) + TEST_ERROR; + if(TRUE == is_registered) + FAIL_PUTS_ERROR("NULL VOL connector is inappropriately registered"); + + /* Register the connector by name */ + if((vol_id = H5VLregister_connector_by_name(NULL_VOL_CONNECTOR_NAME, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* Get the connector's ID */ + if((vol_id_out = H5VLget_connector_id(NULL_VOL_CONNECTOR_NAME)) < 0) + TEST_ERROR; + if(vol_id != vol_id_out) + FAIL_PUTS_ERROR("VOL connector IDs don't match"); + + /* Unregister the connector */ + if(H5VLunregister_connector(vol_id) < 0) + TEST_ERROR; + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5VLunregister_connector(vol_id); + } H5E_END_TRY; + return FAIL; + +} /* end test_getters() */ + + +/*------------------------------------------------------------------------- + * Function: main + * + * Purpose: Tests VOL connector plugin operations + * + * Return: EXIT_SUCCESS/EXIT_FAILURE + * + *------------------------------------------------------------------------- + */ +int +main(void) +{ + int nerrors = 0; + + h5_reset(); + + HDputs("Testing VOL connector plugin functionality."); + + nerrors += test_registration_by_name() < 0 ? 1 : 0; + nerrors += test_registration_by_value() < 0 ? 1 : 0; + nerrors += test_multiple_registration() < 0 ? 1 : 0; + nerrors += test_getters() < 0 ? 1 : 0; + + if(nerrors) { + HDprintf("***** %d VOL connector plugin TEST%s FAILED! *****\n", + nerrors, nerrors > 1 ? "S" : ""); + HDexit(EXIT_FAILURE); + } + + HDputs("All VOL connector plugin tests passed."); + + HDexit(EXIT_SUCCESS); + +} /* end main() */ + |