diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2016-06-14 23:07:03 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2016-06-14 23:07:03 (GMT) |
commit | d3396a79532601bf22e385f94b12e55dfb2c3bd0 (patch) | |
tree | dedf3566ea2ebf40c2d7475e8a50a3f2f0d57774 /tools | |
parent | 7a9e13afdb134bafc070cf8bd2087a84fd0d2334 (diff) | |
download | hdf5-d3396a79532601bf22e385f94b12e55dfb2c3bd0.zip hdf5-d3396a79532601bf22e385f94b12e55dfb2c3bd0.tar.gz hdf5-d3396a79532601bf22e385f94b12e55dfb2c3bd0.tar.bz2 |
[svn-r30075] Description:
Bring object/dataset/group/named datatype features from revise_chunks
branch to trunk. Also CMake support for h5format_convert and a bunch of
misc. cleanups.
Tested on:
MacOSX/64 10.11.5 (amazon) w/serial, parallel & production
(h5committest forthcoming)
Diffstat (limited to 'tools')
-rw-r--r-- | tools/CMakeLists.txt | 3 | ||||
-rw-r--r-- | tools/h5format_convert/CMakeLists.txt | 59 | ||||
-rw-r--r-- | tools/h5format_convert/CMakeTests.cmake | 473 | ||||
-rw-r--r-- | tools/h5format_convert/h5format_convert.c | 10 | ||||
-rw-r--r-- | tools/h5format_convert/testfiles/h5fc_d_file.ddl | 10 | ||||
-rw-r--r-- | tools/h5format_convert/testfiles/h5fc_dname.ddl | 10 | ||||
-rw-r--r-- | tools/h5format_convert/testfiles/h5fc_help.ddl | 10 | ||||
-rw-r--r-- | tools/h5format_convert/testfiles/h5fc_nooption.ddl | 10 | ||||
-rw-r--r-- | tools/h5jam/h5jam.c | 35 | ||||
-rw-r--r-- | tools/h5jam/h5jamgentest.c | 27 | ||||
-rw-r--r-- | tools/h5repack/h5repack_main.c | 44 | ||||
-rw-r--r-- | tools/lib/h5diff.c | 13 | ||||
-rw-r--r-- | tools/lib/h5diff_attr.c | 14 | ||||
-rw-r--r-- | tools/perform/iopipe.c | 9 |
14 files changed, 656 insertions, 71 deletions
diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index fd47379..0b6faa8 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -45,5 +45,8 @@ add_subdirectory (${HDF5_TOOLS_SOURCE_DIR}/h5stat) #-- Add the h5dump and test executables add_subdirectory (${HDF5_TOOLS_SOURCE_DIR}/h5dump) +#-- Add the h5dump and test executables +add_subdirectory (${HDF5_TOOLS_SOURCE_DIR}/h5format_convert) + #-- Add the perform and test executables add_subdirectory (${HDF5_TOOLS_SOURCE_DIR}/perform) diff --git a/tools/h5format_convert/CMakeLists.txt b/tools/h5format_convert/CMakeLists.txt new file mode 100644 index 0000000..4f6fdea --- /dev/null +++ b/tools/h5format_convert/CMakeLists.txt @@ -0,0 +1,59 @@ +cmake_minimum_required (VERSION 3.1.0) +PROJECT (HDF5_TOOLS_H5FC) + +#----------------------------------------------------------------------------- +# Setup include Directories +#----------------------------------------------------------------------------- +INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib) + +# -------------------------------------------------------------------- +# Add the h5format_convert executables +# -------------------------------------------------------------------- +add_executable (h5format_convert ${HDF5_TOOLS_H5FC_SOURCE_DIR}/h5format_convert.c) +TARGET_NAMING (h5format_convert STATIC) +TARGET_C_PROPERTIES (h5format_convert STATIC " " " ") +target_link_libraries (h5format_convert ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) +set_target_properties (h5format_convert PROPERTIES FOLDER tools) + +set (H5_DEP_EXECUTABLES h5format_convert) + +if (BUILD_TESTING) + # -------------------------------------------------------------------- + # Add the h5format_convert test executables + # -------------------------------------------------------------------- + add_executable (h5fc_chk_idx ${HDF5_TOOLS_H5FC_SOURCE_DIR}/h5fc_chk_idx.c) + TARGET_NAMING (h5fc_chk_idx STATIC) + TARGET_C_PROPERTIES (h5fc_chk_idx STATIC " " " ") + target_link_libraries (h5fc_chk_idx ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) + set_target_properties (h5fc_chk_idx PROPERTIES FOLDER tools) + + if (HDF5_BUILD_GENERATORS) + add_executable (h5fc_gentest ${HDF5_TOOLS_H5FC_SOURCE_DIR}/h5fc_gentest.c) + TARGET_NAMING (h5fc_gentest STATIC) + TARGET_C_PROPERTIES (h5fc_gentest STATIC " " " ") + target_link_libraries (h5fc_gentest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) + set_target_properties (h5fc_gentest PROPERTIES FOLDER generator/tools) + + #add_test (NAME h5fc_gentest COMMAND $<TARGET_FILE:h5fc_gentest>) + endif (HDF5_BUILD_GENERATORS) + + include (CMakeTests.cmake) +endif (BUILD_TESTING) + +############################################################################## +############################################################################## +### I N S T A L L A T I O N ### +############################################################################## +############################################################################## + +#----------------------------------------------------------------------------- +# Rules for Installation of tools using make Install target +#----------------------------------------------------------------------------- + +#INSTALL_PROGRAM_PDB (h5format_convert ${HDF5_INSTALL_BIN_DIR} toolsapplications) + +install ( + TARGETS + h5format_convert + RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications +) diff --git a/tools/h5format_convert/CMakeTests.cmake b/tools/h5format_convert/CMakeTests.cmake new file mode 100644 index 0000000..0621b30 --- /dev/null +++ b/tools/h5format_convert/CMakeTests.cmake @@ -0,0 +1,473 @@ + +############################################################################## +############################################################################## +### T E S T I N G ### +############################################################################## +############################################################################## + + # -------------------------------------------------------------------- + # Copy all the HDF5 files from the test directory into the source directory + # -------------------------------------------------------------------- + set (HDF5_REFERENCE_FILES + h5fc_help.ddl + h5fc_nooption.ddl + h5fc_nonexistfile.ddl + h5fc_d_file.ddl + h5fc_dname.ddl + h5fc_nonexistdset_file.ddl + h5fc_v_non_chunked.ddl + h5fc_v_bt1.ddl + h5fc_v_ndata_bt1.ddl + h5fc_v_all.ddl + h5fc_v_n_1d.ddl + h5fc_v_n_all.ddl + h5fc_ext1_i.ddl + h5fc_ext1_s.ddl + h5fc_ext1_f.ddl + h5fc_ext2_if.ddl + h5fc_ext2_is.ddl + h5fc_ext2_sf.ddl + h5fc_ext3_isf.ddl + old_h5fc_ext1_i.ddl + old_h5fc_ext1_s.ddl + old_h5fc_ext1_f.ddl + old_h5fc_ext2_if.ddl + old_h5fc_ext2_is.ddl + old_h5fc_ext2_sf.ddl + old_h5fc_ext3_isf.ddl + h5fc_v_err.ddl + ) + set (HDF5_REFERENCE_TEST_FILES + h5fc_non_v3.h5 + h5fc_edge_v3.h5 + h5fc_ext_none.h5 + old_h5fc_ext_none.h5 + h5fc_ext1_i.h5 + h5fc_ext1_s.h5 + h5fc_ext1_f.h5 + h5fc_ext2_if.h5 + h5fc_ext2_is.h5 + h5fc_ext2_sf.h5 + h5fc_ext3_isf.h5 + old_h5fc_ext1_i.h5 + old_h5fc_ext1_s.h5 + old_h5fc_ext1_f.h5 + old_h5fc_ext2_if.h5 + old_h5fc_ext2_is.h5 + old_h5fc_ext2_sf.h5 + old_h5fc_ext3_isf.h5 + h5fc_err_level.h5 + ) + + file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") + add_custom_target(h5fc-files ALL COMMENT "Copying files needed by h5fc tests") + + foreach (ddl_file ${HDF5_REFERENCE_FILES}) + set (ddldest "${PROJECT_BINARY_DIR}/testfiles/${ddl_file}") + #message (STATUS " Translating ${ddl_file}") + add_custom_command ( + TARGET h5fc-files + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different ${HDF5_TOOLS_H5FC_SOURCE_DIR}/testfiles/${ddl_file} ${ddldest} + ) + endforeach (ddl_file ${HDF5_REFERENCE_FILES}) + + foreach (h5_file ${HDF5_REFERENCE_TEST_FILES}) + set (dest "${PROJECT_BINARY_DIR}/testfiles/${h5_file}") + #message (STATUS " Copying ${h5_file}") + add_custom_command ( + TARGET h5fc-files + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different ${HDF5_TOOLS_H5FC_SOURCE_DIR}/testfiles/${h5_file} ${dest} + ) + endforeach (h5_file ${HDF5_REFERENCE_TEST_FILES}) + +############################################################################## +############################################################################## +### T H E T E S T S M A C R O S ### +############################################################################## +############################################################################## + + MACRO (ADD_H5_OUTPUT testname resultfile resultcode testfile) + # If using memchecker add tests without using scripts + if (NOT HDF5_ENABLE_USING_MEMCHECKER) + add_test ( + NAME H5FC-${testname}-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove ./testfiles/${testname}.out ./testfiles/${testname}.out.err ./testfiles/outtmp.h5 + ) + if (NOT "${last_test}" STREQUAL "") + set_tests_properties (H5FC-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) + endif (NOT "${last_test}" STREQUAL "") + if (NOT "${testfile}" STREQUAL "") + add_test ( + NAME H5FC-${testname}-${testfile}-tmpfile + COMMAND ${CMAKE_COMMAND} + -E copy_if_different ${HDF5_TOOLS_H5FC_SOURCE_DIR}/testfiles/${testfile} ./testfiles/outtmp.h5 + ) + set_tests_properties (H5FC-${testname}-${testfile}-tmpfile PROPERTIES DEPENDS "H5FC-${testname}-clear-objects") + add_test ( + NAME H5FC-${testname}-${testfile} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$<TARGET_FILE:h5format_convert>" + -D "TEST_ARGS=${ARGN};outtmp.h5" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" + -D "TEST_OUTPUT=${testname}.out" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_REFERENCE=${resultfile}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + set_tests_properties (H5FC-${testname}-${testfile} PROPERTIES DEPENDS "H5FC-${testname}-${testfile}-tmpfile") + set (last_test "H5FC-${testname}-${testfile}") + else (NOT "${testfile}" STREQUAL "") + add_test ( + NAME H5FC-${testname}-NA + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$<TARGET_FILE:h5format_convert>" + -D "TEST_ARGS=${ARGN}" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" + -D "TEST_OUTPUT=${testname}.out" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_REFERENCE=${resultfile}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + set_tests_properties (H5FC-${testname}-NA PROPERTIES DEPENDS "H5FC-${testname}-clear-objects") + set (last_test "H5FC-${testname}-NA") + endif (NOT "${testfile}" STREQUAL "") + endif (NOT HDF5_ENABLE_USING_MEMCHECKER) + ENDMACRO (ADD_H5_OUTPUT) + + MACRO (ADD_H5_TEST testname resultcode testfile) + # If using memchecker add tests without using scripts + if (NOT HDF5_ENABLE_USING_MEMCHECKER) + add_test ( + NAME H5FC-${testname}-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove ./testfiles/${testname}.out ./testfiles/${testname}.out.err ./testfiles/tmp.h5 + ) + if (NOT "${last_test}" STREQUAL "") + set_tests_properties (H5FC-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) + endif (NOT "${last_test}" STREQUAL "") + add_test ( + NAME H5FC-${testname}-tmpfile + COMMAND ${CMAKE_COMMAND} + -E copy_if_different ${HDF5_TOOLS_H5FC_SOURCE_DIR}/testfiles/${testfile} testfiles/tmp.h5 + ) + set_tests_properties (H5FC-${testname}-tmpfile PROPERTIES DEPENDS "H5FC-${testname}-clear-objects") + add_test ( + NAME H5FC-${testname} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$<TARGET_FILE:h5format_convert>" + -D "TEST_ARGS=${ARGN};./testfiles/tmp.h5" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -D "TEST_OUTPUT=testfiles/${testname}.out" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_EXPECT=${resultcode}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + set_tests_properties (H5FC-${testname} PROPERTIES DEPENDS "H5FC-${testname}-tmpfile") + set (last_test "H5FC-${testname}") + endif (NOT HDF5_ENABLE_USING_MEMCHECKER) + ENDMACRO (ADD_H5_TEST) + + MACRO (ADD_H5_CHECK_IDX dependtest testname) + # If using memchecker add tests without using scripts + if (NOT HDF5_ENABLE_USING_MEMCHECKER) + add_test ( + NAME H5FC_CHECK_IDX-${testname} + COMMAND "$<TARGET_FILE:h5fc_chk_idx>" "./testfiles/tmp.h5" "${ARGN}" + ) + set_tests_properties (H5FC_CHECK_IDX-${testname} PROPERTIES DEPENDS "H5FC-${dependtest}") + endif (NOT HDF5_ENABLE_USING_MEMCHECKER) + ENDMACRO (ADD_H5_CHECK_IDX) + + MACRO (ADD_H5_TEST_CHECK_IDX testname resultcode testfile) + # If using memchecker add tests without using scripts + if (NOT HDF5_ENABLE_USING_MEMCHECKER) + add_test ( + NAME H5FC-${testname}-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove ./testfiles/${testname}.out ./testfiles/${testname}.out.err ./testfiles/chktmp.h5 + ) + if (NOT "${last_test}" STREQUAL "") + set_tests_properties (H5FC-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) + endif (NOT "${last_test}" STREQUAL "") + add_test ( + NAME H5FC-${testname}-tmpfile + COMMAND ${CMAKE_COMMAND} + -E copy_if_different ${HDF5_TOOLS_H5FC_SOURCE_DIR}/testfiles/${testfile} testfiles/chktmp.h5 + ) + set_tests_properties (H5FC-${testname}-tmpfile PROPERTIES DEPENDS "H5FC-${testname}-clear-objects") + add_test ( + NAME H5FC-${testname} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$<TARGET_FILE:h5format_convert>" + -D "TEST_ARGS=-d;${ARGN};./testfiles/chktmp.h5" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -D "TEST_OUTPUT=testfiles/${testname}.out" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_EXPECT=${resultcode}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + set_tests_properties (H5FC-${testname} PROPERTIES DEPENDS "H5FC-${testname}-tmpfile") + add_test ( + NAME H5FC_CHECK_IDX-${testname} + COMMAND "$<TARGET_FILE:h5fc_chk_idx>" "./testfiles/chktmp.h5" "${ARGN}" + ) + set_tests_properties (H5FC_CHECK_IDX-${testname} PROPERTIES DEPENDS "H5FC-${testname}") + set (last_test "H5FC_CHECK_IDX-${testname}") + endif (NOT HDF5_ENABLE_USING_MEMCHECKER) + ENDMACRO (ADD_H5_TEST_CHECK_IDX) + + MACRO (ADD_H5_H5DUMP_CHECK testname) + # If using memchecker add tests without using scripts + if (NOT HDF5_ENABLE_USING_MEMCHECKER) + add_test ( + NAME H5FC-${testname}-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove ./testfiles/${testname}.out ./testfiles/${testname}.out.err ./testfiles/dmptmp.h5 + ) + if (NOT "${last_test}" STREQUAL "") + set_tests_properties (H5FC-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) + endif (NOT "${last_test}" STREQUAL "") + add_test ( + NAME H5FC-${testname}-tmpfile + COMMAND ${CMAKE_COMMAND} + -E copy_if_different ${HDF5_TOOLS_H5FC_SOURCE_DIR}/testfiles/${testname}.h5 testfiles/dmptmp.h5 + ) + set_tests_properties (H5FC-${testname}-tmpfile PROPERTIES DEPENDS "H5FC-${testname}-clear-objects") + add_test ( + NAME H5FC-${testname} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$<TARGET_FILE:h5format_convert>" + -D "TEST_ARGS=${ARGN};./testfiles/dmptmp.h5" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -D "TEST_OUTPUT=testfiles/${testname}.out" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_EXPECT=0" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + set_tests_properties (H5FC-${testname} PROPERTIES DEPENDS "H5FC-${testname}-tmpfile") + add_test ( + NAME H5FC_CHECK_DUMP-${testname} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>" + -D "TEST_ARGS:STRING=-BH;./testfiles/dmptmp.h5" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -D "TEST_OUTPUT=testfiles/${testname}.out" + -D "TEST_EXPECT=0" + -D "TEST_REFERENCE=testfiles/${testname}.ddl" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + set_tests_properties (H5FC_CHECK_DUMP-${testname} PROPERTIES DEPENDS "H5FC-${testname}") + set (last_test "H5FC_CHECK_DUMP-${testname}") + endif (NOT HDF5_ENABLE_USING_MEMCHECKER) + ENDMACRO (ADD_H5_H5DUMP_CHECK) + +############################################################################## +############################################################################## +### T H E T E S T S ### +############################################################################## +############################################################################## + + if (HDF5_ENABLE_USING_MEMCHECKER) + # Remove any output file left over from previous test run + add_test ( + NAME H5FC-clearall-objects + COMMAND ${CMAKE_COMMAND} + -E remove + h5fc_help.out + h5fc_help.out.err + h5fc_nooption.out + h5fc_nooption.out.err + h5fc_nonexistfile.out + h5fc_nonexistfile.out.err + h5fc_d_file.out + h5fc_d_file.out.err + h5fc_d_file-d.out + h5fc_d_file-d.out.err + h5fc_dname.out + h5fc_dname.out.err + h5fc_nonexistdset_file.out + h5fc_nonexistdset_file.out.err + h5fc_v_non_chunked.out + h5fc_v_non_chunked.out.err + h5fc_v_bt1.out + h5fc_v_bt1.out.err + h5fc_v_ndata_bt1.out + h5fc_v_ndata_bt1.out.err + h5fc_v_all.out + h5fc_v_all.out.err + h5fc_v_n_1d.out + h5fc_v_n_1d.out.err + h5fc_v_n_all.out + h5fc_v_n_all.out.err + h5fc_ext1_i.out + h5fc_ext1_i.out.err + h5fc_ext1_s.out + h5fc_ext1_s.out.err + h5fc_ext1_f.out + h5fc_ext1_f.out.err + h5fc_ext2_if.out + h5fc_ext2_if.out.err + h5fc_ext2_is.out + h5fc_ext2_is.out.err + h5fc_ext2_sf.out + h5fc_ext2_sf.out.err + h5fc_ext3_isf.out + h5fc_ext3_isf.out.err + old_h5fc_ext1_i.out + old_h5fc_ext1_i.out.err + old_h5fc_ext1_s.out + old_h5fc_ext1_s.out.err + old_h5fc_ext1_f.out + old_h5fc_ext1_f.out.err + old_h5fc_ext2_if.out + old_h5fc_ext2_is.out.err + old_h5fc_ext2_is.out + old_h5fc_ext2_sf.out.err + old_h5fc_ext3_isf.out + old_h5fc_ext3_isf.out.err + outtmp.h5 + tmp.h5 + chktmp.h5 + dmptmp.h5 + ) + if (NOT "${last_test}" STREQUAL "") + set_tests_properties (H5FC-clearall-objects PROPERTIES DEPENDS ${last_test}) + endif (NOT "${last_test}" STREQUAL "") + set (last_test "H5FC-clearall-objects") + endif (HDF5_ENABLE_USING_MEMCHECKER) + +# h5format_convert --help +# h5format_convert (no options) +# h5format_convert nonexist.h5 (no options, file does not exist) + ADD_H5_OUTPUT (h5fc_help h5fc_help.ddl 0 "" --help) + ADD_H5_OUTPUT (h5fc_nooption h5fc_nooption.ddl 1 "") + ADD_H5_OUTPUT (h5fc_nonexistfile h5fc_nonexistfile.ddl 1 "" nonexist.h5) +# +# +# h5format_convert -d old_h5fc_ext_none.h5 (just -d option, file exists) +# h5format_convert --dname old_h5fc_ext_none.h5 (just --dname option, file exists) +# h5format_convert --dname (just --dname option) +# h5format_convert --dname=nonexist old_h5fc_ext_none.h5 (dataset does not exist, file exists) + ADD_H5_OUTPUT (h5fc_d_file-d h5fc_d_file.ddl 1 old_h5fc_ext_none.h5 -d) + ADD_H5_OUTPUT (h5fc_d_file h5fc_d_file.ddl 1 old_h5fc_ext_none.h5 --dname) + ADD_H5_OUTPUT (h5fc_dname h5fc_dname.ddl 1 "" --dname) + ADD_H5_OUTPUT (h5fc_nonexistdset_file h5fc_nonexistdset_file.ddl 1 old_h5fc_ext_none.h5 --dname=nonexist) +# +# +# +# h5format_convert -d /DSET_CONTIGUOUS -v old_h5fc_ext_none.h5 (verbose, contiguous dataset) +# h5format_convert -d /GROUP/DSET_BT2 --verbose old_h5fc_ext_none.h5 (verbose, bt1 dataset) +# h5format_convert -d /DSET_NDATA_BT2 -v -n old_h5fc_ext_none.h5 (verbose, noop, bt1+nodata dataset) +# h5format_convert -v old_h5fc_ext_none.h5 (verbose, all datasets) + ADD_H5_OUTPUT (h5fc_v_non_chunked h5fc_v_non_chunked.ddl 0 old_h5fc_ext_none.h5 -d /DSET_CONTIGUOUS -v) + ADD_H5_OUTPUT (h5fc_v_bt1 h5fc_v_bt1.ddl 0 old_h5fc_ext_none.h5 -d /GROUP/DSET_BT2 --verbose) + ADD_H5_OUTPUT (h5fc_v_ndata_bt1 h5fc_v_ndata_bt1.ddl 0 old_h5fc_ext_none.h5 -d /DSET_NDATA_BT2 -v -n) + ADD_H5_OUTPUT (h5fc_v_all h5fc_v_all.ddl 0 old_h5fc_ext_none.h5 -v) +# +# +# +# h5format_convert -d /DSET_EA -v -n h5fc_ext_none.h5 (verbose, noop, one ea dataset) +# h5format_convert -v -n h5fc_non_v3.h5 (verbose, noop, all datasets) + ADD_H5_OUTPUT (h5fc_v_n_1d h5fc_v_n_1d.ddl 0 h5fc_ext_none.h5 -d /DSET_EA -v -n) + ADD_H5_OUTPUT (h5fc_v_n_all h5fc_v_n_all.ddl 0 h5fc_non_v3.h5 -v -n) +# +# +# +# h5format_convert -v h5fc_err_level.h5 (error encountered in converting the dataset) + ADD_H5_OUTPUT (h5fc_v_err h5fc_v_err.ddl 1 h5fc_err_level.h5 -v) +# +# +# +# No output from tests +# 1) Use the tool to convert the dataset +# 2) Verify the chunk indexing type is correct +# h5format_convert -d /DSET_EA h5fc_ext_none.h5 +# h5format_convert -d /GROUP/DSET_NDATA_EA h5fc_ext_none.h5 +# h5format_convert -d /GROUP/DSET_BT2 h5fc_ext_none.h5 +# h5format_convert -d /DSET_NDATA_BT2 h5fc_ext_none.h5 +# h5format_convert -d /DSET_FA h5fc_ext_none.h5 +# h5format_convert -d /GROUP/DSET_FA h5fc_ext_none.h5 +# h5format_convert -d /DSET_NONE h5fc_ext_none.h5 +# h5format_convert -d /GROUP/DSET_NDATA_NONE h5fc_ext_none.h5 + ADD_H5_TEST_CHECK_IDX (h5fc_ext_none_EA 0 h5fc_ext_none.h5 /DSET_EA) +# + ADD_H5_TEST_CHECK_IDX (h5fc_ext_none_ND_EA 0 h5fc_ext_none.h5 /GROUP/DSET_NDATA_EA) +# + ADD_H5_TEST_CHECK_IDX (h5fc_ext_none_BT 0 h5fc_ext_none.h5 /GROUP/DSET_BT2) +# + ADD_H5_TEST_CHECK_IDX (h5fc_ext_none_ND_BT 0 h5fc_ext_none.h5 /DSET_NDATA_BT2) +# + ADD_H5_TEST_CHECK_IDX (h5fc_ext_none_FA 0 h5fc_ext_none.h5 /DSET_FA) +# + ADD_H5_TEST_CHECK_IDX (h5fc_ext_none_ND_FA 0 h5fc_ext_none.h5 /GROUP/DSET_NDATA_FA) +# + ADD_H5_TEST_CHECK_IDX (h5fc_ext_none_NONE 0 h5fc_ext_none.h5 /DSET_NONE) +# + ADD_H5_TEST_CHECK_IDX (h5fc_ext_none_ND_NONE 0 h5fc_ext_none.h5 /GROUP/DSET_NDATA_NONE) +# +# +# +# No output from tests: just check exit code +# h5format_convert -d /DSET_NDATA_BT2 old_h5fc_ext_none.h5 (v1-btree dataset) +# h5format_convert -d /DSET_CONTIGUOUS h5fc_non_v3.h5 (non-chunked dataset) + ADD_H5_TEST (old_h5fc_ext_none 0 old_h5fc_ext_none.h5 -d /DSET_NDATA_BT2) + ADD_H5_TEST (old_h5fc_ext_none_CONT 0 h5fc_non_v3.h5 -d /DSET_CONTIGUOUS) +# +# +# +# No output from tests: just check exit code +# h5format_convert -d /GROUP/DSET_BT2 -n h5fc_non_v3.h5 (noop, one dataset) +# h5format_convert -n h5fc_non_v3.h5 (noop, all datasets) + ADD_H5_TEST (h5fc_non_v3_BT 0 h5fc_non_v3.h5 -d /GROUP/DSET_BT2 -n) + ADD_H5_TEST (h5fc_non_v3-n 0 h5fc_non_v3.h5 -n) +# +# +# +# No output from tests: just check exit code +# h5format_convert h5fc_non_v3.h5 +# 1) convert all datasets +# 2) verify indexing types + ADD_H5_TEST (h5fc_non_v3 0 h5fc_non_v3.h5) + ADD_H5_CHECK_IDX (h5fc_non_v3 h5fc_non_v3-NEA /DSET_NDATA_EA) + ADD_H5_CHECK_IDX (h5fc_non_v3 h5fc_non_v3-NBT /DSET_NDATA_BT2) + ADD_H5_CHECK_IDX (h5fc_non_v3 h5fc_non_v3-BT /GROUP/DSET_BT2) + ADD_H5_CHECK_IDX (h5fc_non_v3 h5fc_non_v3-EA /GROUP/DSET_EA) +# +# +# +# No output from test: just check exit code +# h5format_convert h5fc_edge_v3.h5 +# 1) convert the chunked dataset (filter, no-filter-edge-chunk) +# 2) verify the indexing type + ADD_H5_TEST_CHECK_IDX (h5fc_edge_v3 0 h5fc_edge_v3.h5 /DSET_EDGE) +# +# + +# The following test files have messages in the superblock extension. +# Verify h5dump output for correctness after conversion + ADD_H5_H5DUMP_CHECK (h5fc_ext1_i) + ADD_H5_H5DUMP_CHECK (h5fc_ext1_s) + ADD_H5_H5DUMP_CHECK (h5fc_ext1_f) +# + ADD_H5_H5DUMP_CHECK (h5fc_ext2_if) + ADD_H5_H5DUMP_CHECK (h5fc_ext2_is) + ADD_H5_H5DUMP_CHECK (h5fc_ext2_sf) +# + ADD_H5_H5DUMP_CHECK (h5fc_ext3_isf) +# +# +# + ADD_H5_H5DUMP_CHECK (old_h5fc_ext1_i) + ADD_H5_H5DUMP_CHECK (old_h5fc_ext1_s) + ADD_H5_H5DUMP_CHECK (old_h5fc_ext1_f) +# + ADD_H5_H5DUMP_CHECK (old_h5fc_ext2_if) + ADD_H5_H5DUMP_CHECK (old_h5fc_ext2_is) + ADD_H5_H5DUMP_CHECK (old_h5fc_ext2_sf) +# + ADD_H5_H5DUMP_CHECK (old_h5fc_ext3_isf) diff --git a/tools/h5format_convert/h5format_convert.c b/tools/h5format_convert/h5format_convert.c index dadfd99..8ce28dd 100644 --- a/tools/h5format_convert/h5format_convert.c +++ b/tools/h5format_convert/h5format_convert.c @@ -79,11 +79,11 @@ static void usage(const char *prog) { HDfprintf(stdout, "usage: %s [OPTIONS] file_name\n", prog); HDfprintf(stdout, " OPTIONS\n"); - HDfprintf(stdout, " -h, --help Print a usage message and exit\n"); - HDfprintf(stdout, " -V, --version Print version number and exit\n"); - HDfprintf(stdout, " -v, --verbose Turn on verbose mode\n"); - HDfprintf(stdout, " -d dname, --dname=dataset_name Pathname for the dataset\n"); - HDfprintf(stdout, " -n, --noop Perform all the steps except the actual conversion\n"); + HDfprintf(stdout, " -h, --help Print a usage message and exit\n"); + HDfprintf(stdout, " -V, --version Print version number and exit\n"); + HDfprintf(stdout, " -v, --verbose Turn on verbose mode\n"); + HDfprintf(stdout, " -d dname, --dname=dataset_name Pathname for the dataset\n"); + HDfprintf(stdout, " -n, --noop Perform all the steps except the actual conversion\n"); HDfprintf(stdout, "\n"); HDfprintf(stdout, "Examples of use:\n"); HDfprintf(stdout, "\n"); diff --git a/tools/h5format_convert/testfiles/h5fc_d_file.ddl b/tools/h5format_convert/testfiles/h5fc_d_file.ddl index ad7a2f4..38fc432 100644 --- a/tools/h5format_convert/testfiles/h5fc_d_file.ddl +++ b/tools/h5format_convert/testfiles/h5fc_d_file.ddl @@ -1,10 +1,10 @@ usage: h5format_convert [OPTIONS] file_name OPTIONS - -h, --help Print a usage message and exit - -V, --version Print version number and exit - -v, --verbose Turn on verbose mode - -d dname, --dname=dataset_name Pathname for the dataset - -n, --noop Perform all the steps except the actual conversion + -h, --help Print a usage message and exit + -V, --version Print version number and exit + -v, --verbose Turn on verbose mode + -d dname, --dname=dataset_name Pathname for the dataset + -n, --noop Perform all the steps except the actual conversion Examples of use: diff --git a/tools/h5format_convert/testfiles/h5fc_dname.ddl b/tools/h5format_convert/testfiles/h5fc_dname.ddl index 0de42cb..48564b7 100644 --- a/tools/h5format_convert/testfiles/h5fc_dname.ddl +++ b/tools/h5format_convert/testfiles/h5fc_dname.ddl @@ -1,10 +1,10 @@ usage: h5format_convert [OPTIONS] file_name OPTIONS - -h, --help Print a usage message and exit - -V, --version Print version number and exit - -v, --verbose Turn on verbose mode - -d dname, --dname=dataset_name Pathname for the dataset - -n, --noop Perform all the steps except the actual conversion + -h, --help Print a usage message and exit + -V, --version Print version number and exit + -v, --verbose Turn on verbose mode + -d dname, --dname=dataset_name Pathname for the dataset + -n, --noop Perform all the steps except the actual conversion Examples of use: diff --git a/tools/h5format_convert/testfiles/h5fc_help.ddl b/tools/h5format_convert/testfiles/h5fc_help.ddl index aef8c63..bc0229c 100644 --- a/tools/h5format_convert/testfiles/h5fc_help.ddl +++ b/tools/h5format_convert/testfiles/h5fc_help.ddl @@ -1,10 +1,10 @@ usage: h5format_convert [OPTIONS] file_name OPTIONS - -h, --help Print a usage message and exit - -V, --version Print version number and exit - -v, --verbose Turn on verbose mode - -d dname, --dname=dataset_name Pathname for the dataset - -n, --noop Perform all the steps except the actual conversion + -h, --help Print a usage message and exit + -V, --version Print version number and exit + -v, --verbose Turn on verbose mode + -d dname, --dname=dataset_name Pathname for the dataset + -n, --noop Perform all the steps except the actual conversion Examples of use: diff --git a/tools/h5format_convert/testfiles/h5fc_nooption.ddl b/tools/h5format_convert/testfiles/h5fc_nooption.ddl index aef8c63..bc0229c 100644 --- a/tools/h5format_convert/testfiles/h5fc_nooption.ddl +++ b/tools/h5format_convert/testfiles/h5fc_nooption.ddl @@ -1,10 +1,10 @@ usage: h5format_convert [OPTIONS] file_name OPTIONS - -h, --help Print a usage message and exit - -V, --version Print version number and exit - -v, --verbose Turn on verbose mode - -d dname, --dname=dataset_name Pathname for the dataset - -n, --noop Perform all the steps except the actual conversion + -h, --help Print a usage message and exit + -V, --version Print version number and exit + -v, --verbose Turn on verbose mode + -d dname, --dname=dataset_name Pathname for the dataset + -n, --noop Perform all the steps except the actual conversion Examples of use: diff --git a/tools/h5jam/h5jam.c b/tools/h5jam/h5jam.c index 4509734..ae45714 100644 --- a/tools/h5jam/h5jam.c +++ b/tools/h5jam/h5jam.c @@ -21,7 +21,7 @@ /* Name of tool */ #define PROGRAMNAME "h5jam" -hsize_t write_pad (int, hsize_t); +herr_t write_pad(int ofile, hsize_t old_where, hsize_t *new_where); hsize_t compute_user_block_size (hsize_t); hsize_t copy_some_to_file (int, int, hsize_t, hsize_t, ssize_t); void parse_command_line (int, const char *[]); @@ -380,7 +380,13 @@ main (int argc, const char *argv[]) where = copy_some_to_file (ufid, ofid, (hsize_t) 0, startub, (ssize_t) - 1); /* pad the ub */ - where = write_pad (ofid, where); + if(write_pad(ofid, where, &where) < 0) { + error_msg("Can't pad file \"%s\"\n", output_file); + HDclose (h5fid); + HDclose (ufid); + HDclose (ofid); + leave (EXIT_FAILURE); + } /* end if */ if(ub_file) HDfree (ub_file); @@ -534,25 +540,32 @@ compute_user_block_size(hsize_t ublock_size) /* * Write zeroes to fill the file from 'where' to 512, 1024, etc. bytes. * - * Returns the size of the padded file. + * Sets new_where to the size of the padded file and + * returns SUCCEED/FAIL. */ -hsize_t -write_pad(int ofile, hsize_t where) +herr_t +write_pad(int ofile, hsize_t old_where, hsize_t *new_where) { unsigned int i; char buf[1]; hsize_t psize; + HDassert(new_where); + buf[0] = '\0'; - HDlseek(ofile, (off_t) where, SEEK_SET); + HDlseek(ofile, (off_t)old_where, SEEK_SET); - psize = compute_user_block_size (where); - psize -= where; + psize = compute_user_block_size(old_where); + psize -= old_where; for(i = 0; i < psize; i++) - HDwrite (ofile, buf, 1); + if(HDwrite(ofile, buf, 1) < 0) + return FAIL; - return(where + psize); /* the new size of the file. */ -} + /* Set the new size of the file. */ + *new_where = old_where + psize; + + return SUCCEED; +} /* end write_pad() */ diff --git a/tools/h5jam/h5jamgentest.c b/tools/h5jam/h5jamgentest.c index d3166b5..7ae3169 100644 --- a/tools/h5jam/h5jamgentest.c +++ b/tools/h5jam/h5jamgentest.c @@ -275,20 +275,23 @@ gent_ub(const char * filename, size_t ub_size, size_t ub_fill) /* If a user block is being used, write to it here */ if(ub_size > 0) { - HDassert(ub_size <= BUF_SIZE); + ssize_t nbytes; - fd = HDopen(filename, O_RDWR, 0); - HDassert(fd >= 0); + HDassert(ub_size <= BUF_SIZE); - /* fill buf with pattern */ - HDmemset(buf, '\0', ub_size); - bp = buf; - for (u = 0; u < ub_fill; u++) - *bp++ = pattern[u % 10]; + fd = HDopen(filename, O_RDWR, 0); + HDassert(fd >= 0); - HDwrite(fd, buf, ub_size); + /* fill buf with pattern */ + HDmemset(buf, '\0', ub_size); + bp = buf; + for (u = 0; u < ub_fill; u++) + *bp++ = pattern[u % 10]; - HDclose(fd); + nbytes = HDwrite(fd, buf, ub_size); + HDassert(nbytes >= 0); + + HDclose(fd); } } @@ -299,6 +302,7 @@ create_textfile(const char *name, size_t size) int fd; size_t i; char *bp; + ssize_t nbytes; fd = HDcreat(name,0777); HDassert(fd >= 0); @@ -310,7 +314,8 @@ create_textfile(const char *name, size_t size) for(i = 0; i < size; i++) *bp++ = pattern[i % 10]; - HDwrite(fd, buf, size); + nbytes = HDwrite(fd, buf, size); + HDassert(nbytes >= 0); HDfree(buf); diff --git a/tools/h5repack/h5repack_main.c b/tools/h5repack/h5repack_main.c index 7745860..e903435 100644 --- a/tools/h5repack/h5repack_main.c +++ b/tools/h5repack/h5repack_main.c @@ -264,14 +264,24 @@ int read_info(const char *filename, pack_opt_t *options) { i = 0; c = '0'; while (c != ' ') { - fscanf(fp, "%c", &c); + if(fscanf(fp, "%c", &c) < 0 && HDferror(fp)) { + error_msg("fscanf error\n"); + h5tools_setstatus(EXIT_FAILURE); + ret_value = EXIT_FAILURE; + goto done; + } /* end if */ if (HDfeof(fp)) break; } c = '0'; /* go until end */ while (c != ' ') { - fscanf(fp, "%c", &c); + if(fscanf(fp, "%c", &c) < 0 && HDferror(fp)) { + error_msg("fscanf error\n"); + h5tools_setstatus(EXIT_FAILURE); + ret_value = EXIT_FAILURE; + goto done; + } /* end if */ comp_info[i] = c; i++; if (HDfeof(fp)) @@ -282,10 +292,10 @@ int read_info(const char *filename, pack_opt_t *options) { comp_info[i - 1] = '\0'; /*cut the last " */ if (h5repack_addfilter(comp_info, options) == -1) { - error_msg("could not add compression option\n"); - h5tools_setstatus(EXIT_FAILURE); - ret_value = EXIT_FAILURE; - goto done; + error_msg("could not add compression option\n"); + h5tools_setstatus(EXIT_FAILURE); + ret_value = EXIT_FAILURE; + goto done; } } /*------------------------------------------------------------------------- @@ -298,14 +308,24 @@ int read_info(const char *filename, pack_opt_t *options) { i = 0; c = '0'; while (c != ' ') { - fscanf(fp, "%c", &c); + if(fscanf(fp, "%c", &c) < 0 && HDferror(fp)) { + error_msg("fscanf error\n"); + h5tools_setstatus(EXIT_FAILURE); + ret_value = EXIT_FAILURE; + goto done; + } /* end if */ if (HDfeof(fp)) break; } c = '0'; /* go until end */ while (c != ' ') { - fscanf(fp, "%c", &c); + if(fscanf(fp, "%c", &c) < 0 && HDferror(fp)) { + error_msg("fscanf error\n"); + h5tools_setstatus(EXIT_FAILURE); + ret_value = EXIT_FAILURE; + goto done; + } /* end if */ comp_info[i] = c; i++; if (HDfeof(fp)) @@ -316,10 +336,10 @@ int read_info(const char *filename, pack_opt_t *options) { comp_info[i - 1] = '\0'; /*cut the last " */ if (h5repack_addlayout(comp_info, options) == -1) { - error_msg("could not add chunck option\n"); - h5tools_setstatus(EXIT_FAILURE); - ret_value = EXIT_FAILURE; - goto done; + error_msg("could not add chunck option\n"); + h5tools_setstatus(EXIT_FAILURE); + ret_value = EXIT_FAILURE; + goto done; } } /*------------------------------------------------------------------------- diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index 46dcf6f..b1637a8 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -663,7 +663,8 @@ hsize_t h5diff(const char *fname1, { #ifdef H5_HAVE_ASPRINTF /* Use the asprintf() routine, since it does what we're trying to do below */ - HDasprintf(&obj1fullname, "/%s", objname1); + if(HDasprintf(&obj1fullname, "/%s", objname1) < 0) + goto out; #else /* H5_HAVE_ASPRINTF */ /* (malloc 2 more for "/" and end-of-line) */ obj1fullname = (char*)HDmalloc(HDstrlen(objname1) + 2); @@ -679,7 +680,8 @@ hsize_t h5diff(const char *fname1, { #ifdef H5_HAVE_ASPRINTF /* Use the asprintf() routine, since it does what we're trying to do below */ - HDasprintf(&obj2fullname, "/%s", objname2); + if(HDasprintf(&obj2fullname, "/%s", objname2) < 0) + goto out; #else /* H5_HAVE_ASPRINTF */ /* (malloc 2 more for "/" and end-of-line) */ obj2fullname = (char*)HDmalloc(HDstrlen(objname2) + 2); @@ -1186,7 +1188,8 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, /* make full path for obj1 */ #ifdef H5_HAVE_ASPRINTF /* Use the asprintf() routine, since it does what we're trying to do below */ - HDasprintf(&obj1_fullpath, "%s%s", grp1_path, table->objs[i].name); + if(HDasprintf(&obj1_fullpath, "%s%s", grp1_path, table->objs[i].name) < 0) + goto out; #else /* H5_HAVE_ASPRINTF */ obj1_fullpath = (char*)HDmalloc(HDstrlen(grp1_path) + HDstrlen(table->objs[i].name) + 1); HDstrcpy(obj1_fullpath, grp1_path); @@ -1196,7 +1199,8 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, /* make full path for obj2 */ #ifdef H5_HAVE_ASPRINTF /* Use the asprintf() routine, since it does what we're trying to do below */ - HDasprintf(&obj2_fullpath, "%s%s", grp2_path, table->objs[i].name); + if(HDasprintf(&obj2_fullpath, "%s%s", grp2_path, table->objs[i].name) < 0) + goto out; #else /* H5_HAVE_ASPRINTF */ obj2_fullpath = (char*)HDmalloc(HDstrlen(grp2_path) + HDstrlen(table->objs[i].name) + 1); HDstrcpy(obj2_fullpath, grp2_path); @@ -1493,6 +1497,7 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, } #endif /* H5_HAVE_PARALLEL */ +out: /* free table */ if (table) trav_table_free(table); diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c index 2cda28c..2b6e080 100644 --- a/tools/lib/h5diff_attr.c +++ b/tools/lib/h5diff_attr.c @@ -75,12 +75,14 @@ static void table_attrs_free( table_attrs_t *table ) { unsigned int i; - if (table) { - if (table->attrs) { - for (i = 0; i < table->nattrs; i++) { - if (table->attrs[i].name) { - HDfree(table->attrs[i].name); - } + if (table) + { + if(table->attrs) + { + for(i = 0; i < table->nattrs; i++) + { + if(table->attrs[i].name) + HDfree(table->attrs[i].name ); } /* end for */ HDfree(table->attrs); table->attrs = NULL; diff --git a/tools/perform/iopipe.c b/tools/perform/iopipe.c index a04ef82..6ac7ccb 100644 --- a/tools/perform/iopipe.c +++ b/tools/perform/iopipe.c @@ -135,8 +135,13 @@ synchronize (void) #if defined(H5_HAVE_WIN32_API) && ! defined(__CYGWIN__) _flushall(); #else - HDsystem("sync"); - HDsystem("df >/dev/null"); + int status; + + status = HDsystem("sync"); + HDassert(status >= 0); + + status = HDsystem("df >/dev/null"); + HDassert(status >= 0); #endif #endif } |