summaryrefslogtreecommitdiffstats
path: root/tools/h5jam
diff options
context:
space:
mode:
Diffstat (limited to 'tools/h5jam')
-rw-r--r--tools/h5jam/CMakeLists.txt534
-rw-r--r--tools/h5jam/Makefile.in2
-rw-r--r--tools/h5jam/h5unjam.c163
-rw-r--r--tools/h5jam/testh5jam.sh.in31
4 files changed, 341 insertions, 389 deletions
diff --git a/tools/h5jam/CMakeLists.txt b/tools/h5jam/CMakeLists.txt
index b44e734..95777b3 100644
--- a/tools/h5jam/CMakeLists.txt
+++ b/tools/h5jam/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 2.8.6)
+cmake_minimum_required (VERSION 2.8.10)
PROJECT (HDF5_TOOLS_H5JAM)
#-----------------------------------------------------------------------------
@@ -112,6 +112,13 @@ IF (BUILD_TESTING)
ENDIF (NOT "${resultcode}" STREQUAL "0")
ELSE (HDF5_ENABLE_USING_MEMCHECKER)
ADD_TEST (
+ NAME H5JAM-${expectfile}-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ ${expectfile}.out
+ ${expectfile}.out.err
+ )
+ ADD_TEST (
NAME H5JAM-${expectfile}
COMMAND "${CMAKE_COMMAND}"
-D "TEST_PROGRAM=$<TARGET_FILE:h5jam>"
@@ -122,6 +129,7 @@ IF (BUILD_TESTING)
-D "TEST_REFERENCE=testfiles/${expectfile}.txt"
-P "${HDF5_RESOURCES_DIR}/runTest.cmake"
)
+ SET_TESTS_PROPERTIES (H5JAM-${expectfile} PROPERTIES DEPENDS H5JAM-${expectfile}-clear-objects)
ENDIF (HDF5_ENABLE_USING_MEMCHECKER)
ENDMACRO (TEST_H5JAM_OUTPUT)
@@ -138,6 +146,13 @@ IF (BUILD_TESTING)
ENDIF (NOT "${resultcode}" STREQUAL "0")
ELSE (HDF5_ENABLE_USING_MEMCHECKER)
ADD_TEST (
+ NAME H5JAM-UNJAM-${expectfile}-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ ${expectfile}.out
+ ${expectfile}.out.err
+ )
+ ADD_TEST (
NAME H5JAM-UNJAM-${expectfile}
COMMAND "${CMAKE_COMMAND}"
-D "TEST_PROGRAM=$<TARGET_FILE:h5unjam>"
@@ -148,50 +163,38 @@ IF (BUILD_TESTING)
-D "TEST_REFERENCE=testfiles/${expectfile}.txt"
-P "${HDF5_RESOURCES_DIR}/runTest.cmake"
)
+ SET_TESTS_PROPERTIES (H5JAM-UNJAM-${expectfile} PROPERTIES DEPENDS H5JAM-UNJAM-${expectfile}-clear-objects)
ENDIF (HDF5_ENABLE_USING_MEMCHECKER)
ENDMACRO (TEST_H5UNJAM_OUTPUT)
- MACRO (CLEANUP testname)
- ADD_TEST (
- NAME H5JAM-CLEANUP-${testname}-clear-objects
- COMMAND ${CMAKE_COMMAND} -E remove ${ARGN}
- )
- IF (NOT "${last_test}" STREQUAL "")
- SET_TESTS_PROPERTIES (H5JAM-CLEANUP-${testname}-clear-objects PROPERTIES DEPENDS ${last_test})
- ENDIF (NOT "${last_test}" STREQUAL "")
- SET (last_test "H5JAM-CLEANUP-${testname}-clear-objects")
- ENDMACRO(CLEANUP testname testfile)
-
- MACRO (CHECKFILE testname expected actual)
+ MACRO (CHECKFILE testname testdepends expected actual)
# If using memchecker add tests without using scripts
IF (NOT HDF5_ENABLE_USING_MEMCHECKER)
ADD_TEST (
- NAME H5JAM-CHECKFILE-${testname}-clear-objects
+ NAME H5JAM-${testname}-CHECKFILE-clear-objects
COMMAND ${CMAKE_COMMAND}
-E remove
- ${expected}.new
- ${expected}.new.err
+ ${actual}.new
+ ${actual}.new.err
${actual}.out
${actual}.out.err
)
- IF (NOT "${last_test}" STREQUAL "")
- SET_TESTS_PROPERTIES (H5JAM-CHECKFILE-${testname}-clear-objects PROPERTIES DEPENDS ${last_test})
- ENDIF (NOT "${last_test}" STREQUAL "")
+ SET_TESTS_PROPERTIES (H5JAM-${testname}-CHECKFILE-clear-objects PROPERTIES DEPENDS ${testdepends})
ADD_TEST (
- NAME H5JAM-CHECKFILE-H5DMP-${testname}
+ NAME H5JAM-${testname}-CHECKFILE-H5DMP
COMMAND "${CMAKE_COMMAND}"
-D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
-D "TEST_ARGS:STRING=testfiles/${expected}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
- -D "TEST_OUTPUT=${expected}.new"
+ -D "TEST_OUTPUT=${actual}.new"
-D "TEST_EXPECT=0"
-D "TEST_FILTER=(^(HDF5)[^\n]*)"
-D "TEST_SKIP_COMPARE=TRUE"
-P "${HDF5_RESOURCES_DIR}/runTest.cmake"
)
- SET_TESTS_PROPERTIES (H5JAM-CHECKFILE-H5DMP-${testname} PROPERTIES DEPENDS H5JAM-CHECKFILE-${testname}-clear-objects)
+ SET_TESTS_PROPERTIES (H5JAM-${testname}-CHECKFILE-H5DMP PROPERTIES DEPENDS H5JAM-${testname}-CHECKFILE-clear-objects)
ADD_TEST (
- NAME H5JAM-CHECKFILE-H5DMP_CMP-${testname}
+ NAME H5JAM-${testname}-CHECKFILE-H5DMP_CMP
COMMAND "${CMAKE_COMMAND}"
-D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
-D "TEST_ARGS:STRING=${actual}"
@@ -199,168 +202,210 @@ IF (BUILD_TESTING)
-D "TEST_OUTPUT=${actual}.out"
-D "TEST_EXPECT=0"
-D "TEST_FILTER=(^(HDF5)[^\n]*)"
- -D "TEST_REFERENCE=${expected}.new"
+ -D "TEST_REFERENCE=${actual}.new"
-P "${HDF5_RESOURCES_DIR}/runTest.cmake"
)
- SET_TESTS_PROPERTIES (H5JAM-CHECKFILE-H5DMP_CMP-${testname} PROPERTIES DEPENDS H5JAM-CHECKFILE-H5DMP-${testname})
- SET (last_test "H5JAM-CHECKFILE-H5DMP_CMP-${testname}")
+ SET_TESTS_PROPERTIES (H5JAM-${testname}-CHECKFILE-H5DMP_CMP PROPERTIES DEPENDS H5JAM-${testname}-CHECKFILE-H5DMP)
ENDIF (NOT HDF5_ENABLE_USING_MEMCHECKER)
- ENDMACRO(CHECKFILE testname expected actual)
-
- MACRO (SETUP testname infile outfile)
- ADD_TEST (
- NAME H5JAM-SETUP-${testname}-clear-objects
- COMMAND ${CMAKE_COMMAND} -E remove ${outfile}
- )
- IF (NOT "${last_test}" STREQUAL "")
- SET_TESTS_PROPERTIES (H5JAM-SETUP-${testname}-clear-objects PROPERTIES DEPENDS ${last_test})
- ENDIF (NOT "${last_test}" STREQUAL "")
- ADD_TEST (
- NAME H5JAM-SETUP-${testname}
- COMMAND ${CMAKE_COMMAND} -E copy_if_different ${HDF5_TOOLS_H5JAM_SOURCE_DIR}/testfiles/${infile} ${PROJECT_BINARY_DIR}/${outfile}
- )
- SET_TESTS_PROPERTIES (H5JAM-SETUP-${testname} PROPERTIES DEPENDS H5JAM-SETUP-${testname}-clear-objects)
- SET (last_test "H5JAM-SETUP-${testname}")
- ENDMACRO(SETUP testname infile outfile)
+ ENDMACRO(CHECKFILE testname testdepends expected actual)
- MACRO (CHECK_UB_1 testname testfile ufile)
+ MACRO (UNJAMTEST testname setfile infile ufile chkfile outfile)
IF (NOT HDF5_ENABLE_USING_MEMCHECKER)
ADD_TEST (
- NAME H5JAM-CHECK_UB_1-${testname}-clear-objects
- COMMAND ${CMAKE_COMMAND}
- -E remove
- ${testfile}.len.txt
- ${testfile}.cmp
- ${ufile}.cmp
+ NAME H5JAM-${testname}-UNJAM-SETUP-clear-objects
+ COMMAND ${CMAKE_COMMAND} -E remove ${infile}
+ )
+ ADD_TEST (
+ NAME H5JAM-${testname}-UNJAM-SETUP
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different ${HDF5_TOOLS_H5JAM_SOURCE_DIR}/testfiles/${setfile} ${PROJECT_BINARY_DIR}/${infile}
+ )
+ SET_TESTS_PROPERTIES (H5JAM-${testname}-UNJAM-SETUP PROPERTIES DEPENDS H5JAM-${testname}-UNJAM-SETUP-clear-objects)
+ ADD_TEST (
+ NAME H5JAM-${testname}-UNJAM-clear-objects
+ COMMAND ${CMAKE_COMMAND} -E remove ${outfile}
)
- IF (NOT "${last_test}" STREQUAL "")
- SET_TESTS_PROPERTIES (H5JAM-CHECK_UB_1-${testname}-clear-objects PROPERTIES DEPENDS ${last_test})
- ENDIF (NOT "${last_test}" STREQUAL "")
+ SET_TESTS_PROPERTIES (H5JAM-${testname}-UNJAM-clear-objects PROPERTIES DEPENDS H5JAM-${testname}-UNJAM-SETUP)
+ IF (NOT "${ufile}" STREQUAL "NONE")
+ ADD_TEST (
+ NAME H5JAM-${testname}-UNJAM_D-clear-objects
+ COMMAND ${CMAKE_COMMAND} -E remove ${ufile}
+ )
+ SET_TESTS_PROPERTIES (H5JAM-${testname}-UNJAM_D-clear-objects PROPERTIES DEPENDS H5JAM-${testname}-UNJAM-clear-objects)
+ ADD_TEST (NAME H5JAM-${testname}-UNJAM COMMAND $<TARGET_FILE:h5unjam> -i ${infile} -u ${ufile} -o ${outfile})
+ SET_TESTS_PROPERTIES (H5JAM-${testname}-UNJAM PROPERTIES DEPENDS H5JAM-${testname}-UNJAM_D-clear-objects)
+ SET (compare_test ${ufile})
+ ELSE (NOT "${ufile}" STREQUAL "NONE")
+ IF (NOT "${ARGN}" STREQUAL "--delete")
+ ADD_TEST (
+ NAME H5JAM-${testname}-UNJAM_D-clear-objects
+ COMMAND ${CMAKE_COMMAND} -E remove ${outfile}.ufile.txt ${outfile}.ufile.txt.err
+ )
+ SET_TESTS_PROPERTIES (H5JAM-${testname}-UNJAM_D-clear-objects PROPERTIES DEPENDS H5JAM-${testname}-UNJAM-clear-objects)
+ ADD_TEST (
+ NAME H5JAM-${testname}-UNJAM
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5unjam>"
+ -D "TEST_ARGS:STRING=-i;${infile};-o;${outfile}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_OUTPUT=${outfile}.ufile.txt"
+ -D "TEST_EXPECT=0"
+ -D "TEST_SKIP_COMPARE=TRUE"
+ -P "${HDF5_RESOURCES_DIR}/runTest.cmake"
+ )
+ SET_TESTS_PROPERTIES (H5JAM-${testname}-UNJAM PROPERTIES DEPENDS H5JAM-${testname}-UNJAM_D-clear-objects)
+ SET (compare_test "${outfile}.ufile.txt")
+ ELSE (NOT "${ARGN}" STREQUAL "--delete")
+ ADD_TEST (NAME H5JAM-${testname}-UNJAM COMMAND $<TARGET_FILE:h5unjam> -i ${infile} -o ${outfile})
+ SET_TESTS_PROPERTIES (H5JAM-${testname}-UNJAM PROPERTIES DEPENDS H5JAM-${testname}-UNJAM-clear-objects)
+ SET (compare_test "")
+ ENDIF (NOT "${ARGN}" STREQUAL "--delete")
+ ENDIF (NOT "${ufile}" STREQUAL "NONE")
+ IF (NOT "${compare_test}" STREQUAL "")
+ ADD_TEST (
+ NAME H5JAM-${testname}-UNJAM-CHECK_UB_1-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ ${infile}.len.txt
+ ${infile}.cmp
+ ${infile}-ub.cmp
+ )
+ SET_TESTS_PROPERTIES (H5JAM-${testname}-UNJAM-CHECK_UB_1-clear-objects PROPERTIES DEPENDS "H5JAM-${testname}-UNJAM")
+ ADD_TEST (
+ NAME H5JAM-${testname}-UNJAM-CHECK_UB_1
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:tellub>"
+ -D "TEST_GET_PROGRAM=$<TARGET_FILE:getub>"
+ -D "TEST_CHECKUB=YES"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_HFILE=${infile}"
+ -D "TEST_UFILE=${compare_test}"
+ -D "TEST_EXPECT=0"
+ -D "TEST_OFILE="
+ -P "${HDF5_RESOURCES_DIR}/userblockTest.cmake"
+ )
+ SET_TESTS_PROPERTIES (H5JAM-${testname}-UNJAM-CHECK_UB_1 PROPERTIES DEPENDS H5JAM-${testname}-UNJAM-CHECK_UB_1-clear-objects)
+ ENDIF (NOT "${compare_test}" STREQUAL "")
+
ADD_TEST (
- NAME H5JAM-CHECK_UB_1-${testname}
+ NAME H5JAM-${testname}-UNJAM-CHECK_NOUB
COMMAND "${CMAKE_COMMAND}"
-D "TEST_PROGRAM=$<TARGET_FILE:tellub>"
-D "TEST_GET_PROGRAM=$<TARGET_FILE:getub>"
- -D "TEST_CHECKUB=YES"
+ -D "TEST_CHECKUB=NO"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
- -D "TEST_HFILE=${testfile}"
- -D "TEST_UFILE=${ufile}"
+ -D "TEST_HFILE=${outfile}"
-D "TEST_EXPECT=0"
- -D "TEST_OFILE=${ARGN}"
+ -D "TEST_UFILE=NULL"
+ -D "TEST_OFILE=NULL"
-P "${HDF5_RESOURCES_DIR}/userblockTest.cmake"
)
- SET_TESTS_PROPERTIES (H5JAM-CHECK_UB_1-${testname} PROPERTIES DEPENDS H5JAM-CHECK_UB_1-${testname}-clear-objects)
- SET (last_test "H5JAM-CHECK_UB_1-${testname}")
+ IF (NOT "${compare_test}" STREQUAL "")
+ SET_TESTS_PROPERTIES (H5JAM-${testname}-UNJAM-CHECK_NOUB PROPERTIES DEPENDS H5JAM-${testname}-UNJAM-CHECK_UB_1)
+ ELSE (NOT "${compare_test}" STREQUAL "")
+ SET_TESTS_PROPERTIES (H5JAM-${testname}-UNJAM-CHECK_NOUB PROPERTIES DEPENDS H5JAM-${testname}-UNJAM)
+ ENDIF (NOT "${compare_test}" STREQUAL "")
+
+ CHECKFILE (${testname} "H5JAM-${testname}-UNJAM-CHECK_NOUB" ${chkfile} ${outfile})
ENDIF (NOT HDF5_ENABLE_USING_MEMCHECKER)
- ENDMACRO(CHECK_UB_1 testname testfile ufile)
+ ENDMACRO(UNJAMTEST testname infile ufile outfile)
- MACRO (CHECK_NOUB testname testfile)
+ MACRO (JAMTEST testname jamfile infile chkfile outfile)
IF (NOT HDF5_ENABLE_USING_MEMCHECKER)
ADD_TEST (
- NAME H5JAM-CHECK_NOUB-${testname}
+ NAME H5JAM-${testname}-clear-objects
+ COMMAND ${CMAKE_COMMAND} -E remove ${outfile} ${infile}.cpy.h5
+ )
+ ENDIF (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ ADD_TEST (NAME H5JAM-${testname} COMMAND $<TARGET_FILE:h5jam> -u testfiles/${jamfile} -i testfiles/${infile} -o ${outfile} ${ARGN})
+ IF (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ SET_TESTS_PROPERTIES (H5JAM-${testname} PROPERTIES DEPENDS H5JAM-${testname}-clear-objects)
+ SET (compare_test ${outfile})
+ SET (compare_orig testfiles/${infile})
+ IF ("${ARGN}" STREQUAL "--clobber")
+ SET (compare_orig "")
+ ENDIF ("${ARGN}" STREQUAL "--clobber")
+
+ ADD_TEST (
+ NAME H5JAM-${testname}-CHECK_UB_1-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ ${compare_test}.len.txt
+ ${compare_test}.cmp
+ ${compare_test}-ub.cmp
+ )
+ SET_TESTS_PROPERTIES (H5JAM-${testname}-CHECK_UB_1-clear-objects PROPERTIES DEPENDS "H5JAM-${testname}")
+ ADD_TEST (
+ NAME H5JAM-${testname}-CHECK_UB_1
COMMAND "${CMAKE_COMMAND}"
-D "TEST_PROGRAM=$<TARGET_FILE:tellub>"
-D "TEST_GET_PROGRAM=$<TARGET_FILE:getub>"
- -D "TEST_CHECKUB=NO"
+ -D "TEST_CHECKUB=YES"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
- -D "TEST_HFILE=${testfile}"
+ -D "TEST_HFILE=${compare_test}"
+ -D "TEST_UFILE=testfiles/${jamfile}"
-D "TEST_EXPECT=0"
- -D "TEST_UFILE=NULL"
- -D "TEST_OFILE=NULL"
+ -D "TEST_OFILE=${compare_orig}"
-P "${HDF5_RESOURCES_DIR}/userblockTest.cmake"
)
- IF (NOT "${last_test}" STREQUAL "")
- SET_TESTS_PROPERTIES (H5JAM-CHECK_NOUB-${testname} PROPERTIES DEPENDS ${last_test})
- ENDIF (NOT "${last_test}" STREQUAL "")
- SET (last_test "H5JAM-CHECK_NOUB-${testname}")
+ SET_TESTS_PROPERTIES (H5JAM-${testname}-CHECK_UB_1 PROPERTIES DEPENDS H5JAM-${testname}-CHECK_UB_1-clear-objects)
+ CHECKFILE (${testname} "H5JAM-${testname}-CHECK_UB_1" ${chkfile} ${outfile})
ENDIF (NOT HDF5_ENABLE_USING_MEMCHECKER)
- ENDMACRO(CHECK_NOUB testname testfile)
+ ENDMACRO (JAMTEST testname jamfile infile outfile)
- MACRO (UNJAMTEST testname infile ufile outfile)
- ADD_TEST (
- NAME H5JAM-UNJAM-${testname}-clear-objects
- COMMAND ${CMAKE_COMMAND} -E remove ${outfile}
- )
- IF (NOT "${last_test}" STREQUAL "")
- SET_TESTS_PROPERTIES (H5JAM-UNJAM-${testname}-clear-objects PROPERTIES DEPENDS ${last_test})
- ENDIF (NOT "${last_test}" STREQUAL "")
- IF (NOT "${ufile}" STREQUAL "NONE")
+ MACRO (JAMTEST_NONE testname jamfile infile setfile chkfile)
+ IF (NOT HDF5_ENABLE_USING_MEMCHECKER)
ADD_TEST (
- NAME H5JAM-UNJAM_D-${testname}-clear-objects
- COMMAND ${CMAKE_COMMAND} -E remove ${ufile}
+ NAME H5JAM-${testname}_NONE-clear-objects
+ COMMAND ${CMAKE_COMMAND} -E remove
+ ${chkfile} ${chkfile}.cpy.h5
)
- SET_TESTS_PROPERTIES (H5JAM-UNJAM_D-${testname}-clear-objects PROPERTIES DEPENDS H5JAM-UNJAM-${testname}-clear-objects)
- ADD_TEST (NAME H5JAM-UNJAM-${testname} COMMAND $<TARGET_FILE:h5unjam> -i ${infile} -u ${ufile} -o ${outfile})
- SET_TESTS_PROPERTIES (H5JAM-UNJAM-${testname} PROPERTIES DEPENDS H5JAM-UNJAM_D-${testname}-clear-objects)
- SET (compare_test ${ufile})
- ELSE (NOT "${ufile}" STREQUAL "NONE")
- IF (NOT "${ARGN}" STREQUAL "--delete")
- ADD_TEST (
- NAME H5JAM-UNJAM_D-${testname}-clear-objects
- COMMAND ${CMAKE_COMMAND} -E remove ${outfile}.ufile.txt ${outfile}.ufile.txt.err
- )
- SET_TESTS_PROPERTIES (H5JAM-UNJAM_D-${testname}-clear-objects PROPERTIES DEPENDS H5JAM-UNJAM-${testname}-clear-objects)
- IF (HDF5_ENABLE_USING_MEMCHECKER)
- ADD_TEST (NAME H5JAM-UNJAM-${testname} COMMAND $<TARGET_FILE:h5unjam> -i ${infile} -o ${outfile})
- ELSE (HDF5_ENABLE_USING_MEMCHECKER)
- ADD_TEST (
- NAME H5JAM-UNJAM-${testname}
- COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5unjam>"
- -D "TEST_ARGS:STRING=-i;${infile};-o;${outfile}"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
- -D "TEST_OUTPUT=${outfile}.ufile.txt"
- -D "TEST_EXPECT=0"
- -D "TEST_SKIP_COMPARE=TRUE"
- -P "${HDF5_RESOURCES_DIR}/runTest.cmake"
- )
- ENDIF (HDF5_ENABLE_USING_MEMCHECKER)
- SET_TESTS_PROPERTIES (H5JAM-UNJAM-${testname} PROPERTIES DEPENDS H5JAM-UNJAM_D-${testname}-clear-objects)
- SET (compare_test "${outfile}.ufile.txt")
- ELSE (NOT "${ARGN}" STREQUAL "--delete")
- ADD_TEST (NAME H5JAM-UNJAM-${testname} COMMAND $<TARGET_FILE:h5unjam> -i ${infile} -o ${outfile})
- SET_TESTS_PROPERTIES (H5JAM-UNJAM-${testname} PROPERTIES DEPENDS H5JAM-UNJAM-${testname}-clear-objects)
- SET (compare_test "")
- ENDIF (NOT "${ARGN}" STREQUAL "--delete")
- ENDIF (NOT "${ufile}" STREQUAL "NONE")
- SET (last_test "H5JAM-UNJAM-${testname}")
- IF (NOT "${compare_test}" STREQUAL "")
- CHECK_UB_1 (${testname} ${infile} ${compare_test})
- ENDIF (NOT "${compare_test}" STREQUAL "")
- CHECK_NOUB (${testname} ${outfile})
- ENDMACRO(UNJAMTEST testname infile ufile outfile)
+ ADD_TEST (
+ NAME H5JAM-${testname}_NONE-SETUP
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different testfiles/${setfile} ${chkfile}
+ )
+ SET_TESTS_PROPERTIES (H5JAM-${testname}_NONE-SETUP PROPERTIES DEPENDS H5JAM-${testname}_NONE-clear-objects)
- MACRO (JAMTEST testname jamfile infile outfile)
- ADD_TEST (
- NAME H5JAM-${testname}-clear-objects
- COMMAND ${CMAKE_COMMAND} -E remove ${outfile} ${infile}.cpy.h5
- )
- IF (NOT "${last_test}" STREQUAL "")
- SET_TESTS_PROPERTIES (H5JAM-${testname}-clear-objects PROPERTIES DEPENDS ${last_test})
- ENDIF (NOT "${last_test}" STREQUAL "")
- SET (last_test "H5JAM-${testname}-clear-objects")
- IF ("${outfile}" STREQUAL "NONE")
ADD_TEST (
- NAME H5JAM-NONE_COPY-${testname}
- COMMAND ${CMAKE_COMMAND} -E copy_if_different ${infile} ${infile}.cpy.h5
+ NAME H5JAM-${testname}_NONE_COPY
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different ${chkfile} ${chkfile}.cpy.h5
)
- SET_TESTS_PROPERTIES (H5JAM-NONE_COPY-${testname} PROPERTIES DEPENDS ${last_test})
- SET (last_test "H5JAM-NONE_COPY-${testname}")
- ADD_TEST (NAME H5JAM-${testname} COMMAND $<TARGET_FILE:h5jam> -u testfiles/${jamfile} -i ${infile} ${ARGN})
- SET (compare_test ${infile})
- SET (compare_orig ${infile}.cpy.h5)
- ELSE ("${outfile}" STREQUAL "NONE")
- ADD_TEST (NAME H5JAM-${testname} COMMAND $<TARGET_FILE:h5jam> -u testfiles/${jamfile} -i testfiles/${infile} -o ${outfile} ${ARGN})
- SET (compare_test ${outfile})
- SET (compare_orig testfiles/${infile})
- ENDIF ("${outfile}" STREQUAL "NONE")
- SET_TESTS_PROPERTIES (H5JAM-${testname} PROPERTIES DEPENDS ${last_test})
- SET (last_test "H5JAM-${testname}")
- IF ("${ARGN}" STREQUAL "--clobber")
- SET (compare_orig "")
- ENDIF ("${ARGN}" STREQUAL "--clobber")
- CHECK_UB_1 (${testname} ${compare_test} testfiles/${jamfile} ${compare_orig})
- ENDMACRO (JAMTEST testname jamfile infile outfile)
+ SET_TESTS_PROPERTIES (H5JAM-${testname}_NONE_COPY PROPERTIES DEPENDS H5JAM-${testname}_NONE-SETUP)
+
+ ADD_TEST (NAME H5JAM-${testname}_NONE COMMAND $<TARGET_FILE:h5jam> -u testfiles/${jamfile} -i ${chkfile} ${ARGN})
+ SET_TESTS_PROPERTIES (H5JAM-${testname}_NONE PROPERTIES DEPENDS H5JAM-${testname}_NONE_COPY)
+
+ SET (compare_test ${chkfile})
+ SET (compare_orig ${chkfile}.cpy.h5)
+ IF ("${ARGN}" STREQUAL "--clobber")
+ SET (compare_orig "")
+ ENDIF ("${ARGN}" STREQUAL "--clobber")
+
+ ADD_TEST (
+ NAME H5JAM-${testname}_NONE-CHECK_UB_1-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ ${compare_test}.len.txt
+ ${compare_test}.cmp
+ ${compare_test}-ub.cmp
+ )
+ SET_TESTS_PROPERTIES (H5JAM-${testname}_NONE-CHECK_UB_1-clear-objects PROPERTIES DEPENDS "H5JAM-${testname}_NONE")
+ ADD_TEST (
+ NAME H5JAM-${testname}_NONE-CHECK_UB_1
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:tellub>"
+ -D "TEST_GET_PROGRAM=$<TARGET_FILE:getub>"
+ -D "TEST_CHECKUB=YES"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_HFILE=${compare_test}"
+ -D "TEST_UFILE=testfiles/${jamfile}"
+ -D "TEST_EXPECT=0"
+ -D "TEST_OFILE=${compare_orig}"
+ -P "${HDF5_RESOURCES_DIR}/userblockTest.cmake"
+ )
+ SET_TESTS_PROPERTIES (H5JAM-${testname}_NONE-CHECK_UB_1 PROPERTIES DEPENDS H5JAM-${testname}_NONE-CHECK_UB_1-clear-objects)
+ CHECKFILE (${testname} "H5JAM-${testname}_NONE-CHECK_UB_1" ${infile} ${chkfile})
+ ENDIF (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ ENDMACRO (JAMTEST_NONE testname jamfile infile setfile chkfile)
##############################################################################
##############################################################################
@@ -377,118 +422,45 @@ IF (BUILD_TESTING)
# don't allow HDF5 format file as an user block file
TEST_H5JAM_OUTPUT(h5jam-ub-nohdf5 1 -i testfiles/tall.h5 -u testfiles/tall.h5 -o tall-tmp.h5)
- JAMTEST (tall_u10 u10.txt tall.h5 ta2.h5)
- CHECKFILE (tall_u10 tall.h5 ta2.h5)
-# CLEANUP (tall_u10 ta2.h5)
- JAMTEST (tall_u511 u511.txt tall.h5 ta3.h5)
- CHECKFILE (tall_u511 tall.h5 ta3.h5)
-# CLEANUP (tall_u511 ta3.h5)
- JAMTEST (tall_u512 u512.txt tall.h5 ta4.h5)
- CHECKFILE (tall_u512 tall.h5 ta4.h5)
-# CLEANUP (tall_u512 ta4.h5)
- JAMTEST (tall_u513 u513.txt tall.h5 ta5.h5)
- CHECKFILE (tall_u513 tall.h5 ta5.h5)
-# CLEANUP (tall_u513 ta5.h5)
-
- SETUP (ta_u10 tall.h5 ta.h5)
- JAMTEST (ta_u10 u10.txt ta.h5 NONE)
- CHECKFILE (ta_u10 tall.h5 ta.h5)
- SETUP (ta_u511 tall.h5 ta.h5 NOCLEAN)
- JAMTEST (ta_u511 u511.txt ta.h5 NONE)
- CHECKFILE (ta_u511 tall.h5 ta.h5)
- SETUP (ta_u512 tall.h5 ta.h5 NOCLEAN)
- JAMTEST (ta_u512 u512.txt ta.h5 NONE)
- CHECKFILE (ta_u512 tall.h5 ta.h5)
- SETUP (ta_u513 tall.h5 ta.h5 NOCLEAN)
- JAMTEST (ta_u513 u513.txt ta.h5 NONE)
- CHECKFILE (ta_u513 tall.h5 ta.h5)
-# CLEANUP (ta ta.h5)
-
- JAMTEST (twithub_u10 u10.txt twithub.h5 tax2.h5)
- CHECKFILE (twithub_u10 tall.h5 tax2.h5)
-# CLEANUP (twithub_u10 tax2.h5)
- JAMTEST (twithub_u511 u511.txt twithub.h5 tax3.h5)
- CHECKFILE (twithub_u511 tall.h5 tax3.h5)
-# CLEANUP (twithub_u511 tax3.h5)
- JAMTEST (twithub_u512 u512.txt twithub.h5 tax4.h5)
- CHECKFILE (twithub_u512 tall.h5 tax4.h5)
-# CLEANUP (twithub_u512 tax4.h5)
- JAMTEST (twithub_u513 u513.txt twithub.h5 tax5.h5)
- CHECKFILE (twithub_u513 tall.h5 tax5.h5)
-# CLEANUP (twithub_u513 tax5.h5)
-
- JAMTEST (twithub513_u10 u10.txt twithub513.h5 tax6.h5)
- CHECKFILE (twithub513_u10 tall.h5 tax6.h5)
-# CLEANUP (twithub513_u10 tax6.h5)
- JAMTEST (twithub513_u511 u511.txt twithub513.h5 tax7.h5)
- CHECKFILE (twithub513_u511 tall.h5 tax7.h5)
-# CLEANUP (twithub513_u511 tax7.h5)
- JAMTEST (twithub513_u512 u512.txt twithub513.h5 tax8.h5)
- CHECKFILE (twithub513_u512 tall.h5 tax8.h5)
-# CLEANUP (twithub513_u512 tax8.h5)
- JAMTEST (twithub513_u513 u513.txt twithub513.h5 tax9.h5)
- CHECKFILE (twithub513_u513 tall.h5 tax9.h5)
-# CLEANUP (twithub513_u513 tax9.h5)
-
- JAMTEST (twithub_u10_c u10.txt twithub.h5 taz2.h5 --clobber)
- CHECKFILE (twithub_u10_c tall.h5 taz2.h5)
-# CLEANUP (twithub_u10_c taz2.h5)
- JAMTEST (twithub_u511_c u511.txt twithub.h5 taz3.h5 --clobber)
- CHECKFILE (twithub_u511_c tall.h5 taz3.h5)
-# CLEANUP (twithub_u511_c taz3.h5)
- JAMTEST (twithub_u512_c u512.txt twithub.h5 taz4.h5 --clobber)
- CHECKFILE (twithub_u512_c tall.h5 taz4.h5)
-# CLEANUP (twithub_u512_c taz4.h5)
- JAMTEST (twithub_u513_c u513.txt twithub.h5 taz5.h5 --clobber)
- CHECKFILE (twithub_u513_c tall.h5 taz5.h5)
-# CLEANUP (twithub_u513_c taz5.h5)
-
- JAMTEST (twithub513_u10_c u10.txt twithub513.h5 taz6.h5 --clobber)
- CHECKFILE (twithub513_u10_c tall.h5 taz6.h5)
-# CLEANUP (twithub513_u10_c taz6.h5)
- JAMTEST (twithub513_u511_c u511.txt twithub513.h5 taz7.h5 --clobber)
- CHECKFILE (twithub513_u511_c tall.h5 taz7.h5)
-# CLEANUP (twithub513_u511_c taz7.h5)
- JAMTEST (twithub513_u512_c u512.txt twithub513.h5 taz8.h5 --clobber)
- CHECKFILE (twithub513_u512_c tall.h5 taz8.h5)
-# CLEANUP (twithub513_u512_c taz8.h5)
- JAMTEST (twithub513_u513_c u513.txt twithub513.h5 taz9.h5 --clobber)
- CHECKFILE (twithub513_u513_c tall.h5 taz9.h5)
-# CLEANUP (twithub513_u513_c taz9.h5)
-
- SETUP (N_twithub_u10_c twithub.h5 tay2.h5)
- JAMTEST (N_twithub_u10_c u10.txt tay2.h5 NONE --clobber)
- CHECKFILE (N_twithub_u10_c tall.h5 tay2.h5)
-# CLEANUP (N_twithub_u10_c tay2.h5)
- SETUP (N_twithub_u511_c twithub.h5 tay3.h5)
- JAMTEST (N_twithub_u511_c u511.txt tay3.h5 NONE --clobber)
- CHECKFILE (N_twithub_u511_c tall.h5 tay3.h5)
-# CLEANUP (N_twithub_u511_c tay3.h5)
- SETUP (N_twithub_u512_c twithub.h5 tay4.h5)
- JAMTEST (N_twithub_u512_c u512.txt tay4.h5 NONE --clobber)
- CHECKFILE (N_twithub_u512_c tall.h5 tay4.h5)
-# CLEANUP (N_twithub_u512_c tay4.h5)
- SETUP (N_twithub_u513_c twithub.h5 tay5.h5)
- JAMTEST (N_twithub_u513_c u513.txt tay5.h5 NONE --clobber)
- CHECKFILE (N_twithub_u513_c tall.h5 tay5.h5)
-# CLEANUP (N_twithub_u513_c tay5.h5)
-
- SETUP (N_twithub513_u10_c twithub513.h5 tay6.h5)
- JAMTEST (N_twithub513_u10_c u10.txt tay6.h5 NONE --clobber)
- CHECKFILE (N_twithub513_u10_c tall.h5 tay6.h5)
-# CLEANUP (N_twithub513_u10_c tay6.h5)
- SETUP (N_twithub513_u511_c twithub513.h5 tay7.h5)
- JAMTEST (N_twithub513_u511_c u511.txt tay7.h5 NONE --clobber)
- CHECKFILE (N_twithub513_u511_c tall.h5 tay7.h5)
-# CLEANUP (N_twithub513_u511_c tay7.h5)
- SETUP (N_twithub513_u512_c twithub513.h5 tay8.h5)
- JAMTEST (N_twithub513_u512_c u512.txt tay8.h5 NONE --clobber)
- CHECKFILE (N_twithub513_u512_c tall.h5 tay8.h5)
-# CLEANUP (N_twithub513_u512_c tay8.h5)
- SETUP (N_twithub513_u513_c twithub513.h5 tay9.h5)
- JAMTEST (N_twithub513_u513_c u513.txt tay9.h5 NONE --clobber)
- CHECKFILE (N_twithub513_u513_c tall.h5 tay9.h5)
-# CLEANUP (N_twithub513_u513_c tay9.h5)
+ JAMTEST (tall_u10 u10.txt tall.h5 tall.h5 ta2.h5)
+ JAMTEST (tall_u511 u511.txt tall.h5 tall.h5 ta3.h5)
+ JAMTEST (tall_u512 u512.txt tall.h5 tall.h5 ta4.h5)
+ JAMTEST (tall_u513 u513.txt tall.h5 tall.h5 ta5.h5)
+
+ JAMTEST_NONE (N_ta_u10 u10.txt tall.h5 tall.h5 ta6.h5)
+ JAMTEST_NONE (N_ta_u511 u511.txt tall.h5 tall.h5 ta7.h5)
+ JAMTEST_NONE (N_ta_u512 u512.txt tall.h5 tall.h5 ta8.h5)
+ JAMTEST_NONE (N_ta_u513 u513.txt tall.h5 tall.h5 ta9.h5)
+
+ JAMTEST (twithub_u10 u10.txt twithub.h5 tall.h5 tax2.h5)
+ JAMTEST (twithub_u511 u511.txt twithub.h5 tall.h5 tax3.h5)
+ JAMTEST (twithub_u512 u512.txt twithub.h5 tall.h5 tax4.h5)
+ JAMTEST (twithub_u513 u513.txt twithub.h5 tall.h5 tax5.h5)
+
+ JAMTEST (twithub513_u10 u10.txt twithub513.h5 tall.h5 tax6.h5)
+ JAMTEST (twithub513_u511 u511.txt twithub513.h5 tall.h5 tax7.h5)
+ JAMTEST (twithub513_u512 u512.txt twithub513.h5 tall.h5 tax8.h5)
+ JAMTEST (twithub513_u513 u513.txt twithub513.h5 tall.h5 tax9.h5)
+
+ JAMTEST (twithub_u10_c u10.txt twithub.h5 tall.h5 taz2.h5 --clobber)
+ JAMTEST (twithub_u511_c u511.txt twithub.h5 tall.h5 taz3.h5 --clobber)
+ JAMTEST (twithub_u512_c u512.txt twithub.h5 tall.h5 taz4.h5 --clobber)
+ JAMTEST (twithub_u513_c u513.txt twithub.h5 tall.h5 taz5.h5 --clobber)
+
+ JAMTEST (twithub513_u10_c u10.txt twithub513.h5 tall.h5 taz6.h5 --clobber)
+ JAMTEST (twithub513_u511_c u511.txt twithub513.h5 tall.h5 taz7.h5 --clobber)
+ JAMTEST (twithub513_u512_c u512.txt twithub513.h5 tall.h5 taz8.h5 --clobber)
+ JAMTEST (twithub513_u513_c u513.txt twithub513.h5 tall.h5 taz9.h5 --clobber)
+
+ JAMTEST_NONE (N_twithub_u10_c u10.txt tall.h5 twithub.h5 tay2.h5 --clobber)
+ JAMTEST_NONE (N_twithub_u511_c u511.txt tall.h5 twithub.h5 tay3.h5 --clobber)
+ JAMTEST_NONE (N_twithub_u512_c u512.txt tall.h5 twithub.h5 tay4.h5 --clobber)
+ JAMTEST_NONE (N_twithub_u513_c u513.txt tall.h5 twithub.h5 tay5.h5 --clobber)
+
+ JAMTEST_NONE (N_twithub513_u10_c u10.txt tall.h5 twithub513.h5 tay6.h5 --clobber)
+ JAMTEST_NONE (N_twithub513_u511_c u511.txt tall.h5 twithub513.h5 tay7.h5 --clobber)
+ JAMTEST_NONE (N_twithub513_u512_c u512.txt tall.h5 twithub513.h5 tay8.h5 --clobber)
+ JAMTEST_NONE (N_twithub513_u513_c u513.txt tall.h5 twithub513.h5 tay9.h5 --clobber)
#-------------------------------
# Testing h5unjam
@@ -496,32 +468,14 @@ IF (BUILD_TESTING)
# help page
TEST_H5UNJAM_OUTPUT(h5unjam-help 0 -h)
- SETUP (twithub_tall twithub.h5 tai1.h5)
- UNJAMTEST (twithub_tall tai1.h5 o10.txt taa1.h5)
- CHECKFILE (twithub_tall tall.h5 taa1.h5)
-# CLEANUP (twithub_tall taa1.h5 tai1.h5 o10.txt)
- SETUP (twithub513_tall twithub513.h5 tai2.h5)
- UNJAMTEST (twithub513_tall tai2.h5 o512.txt taa2.h5)
- CHECKFILE (twithub513_tall tall.h5 taa2.h5)
-# CLEANUP (twithub513_tall taa2.h5 tai2.h5 o512.txt)
-
- SETUP (N_twithub_tall twithub.h5 tai3.h5)
- UNJAMTEST (N_twithub_tall tai3.h5 NONE taa3.h5)
- CHECKFILE (N_twithub_tall tall.h5 taa3.h5)
-# CLEANUP (N_twithub_tall taa3.h5 tai3.h5)
- SETUP (N_twithub513_tall twithub513.h5 tai4.h5)
- UNJAMTEST (N_twithub513_tall tai4.h5 NONE taa4.h5)
- CHECKFILE (N_twithub513_tall tall.h5 taa4.h5)
-# CLEANUP (N_twithub513_tall taa4.h5 tai4.h5)
-
- SETUP (D_twithub_tall twithub.h5 taj2.h5)
- UNJAMTEST (D_twithub_tall taj2.h5 NONE tac2.h5 --delete)
- CHECKFILE (D_twithub_tall tall.h5 tac2.h5)
-# CLEANUP (D_twithub_tall tac2.h5 taj2.h5)
- SETUP (D_twithub513_tall twithub513.h5 taj3.h5)
- UNJAMTEST (D_twithub513_tall taj3.h5 NONE tac3.h5 --delete)
- CHECKFILE (D_twithub513_tall tall.h5 tac3.h5)
-# CLEANUP (D_twithub513_tall tac3.h5 taj3.h5)
+ UNJAMTEST (twithub_tall twithub.h5 tai1.h5 o10.txt tall.h5 taa1.h5)
+ UNJAMTEST (twithub513_tall twithub513.h5 tai2.h5 o512.txt tall.h5 taa2.h5)
+
+ UNJAMTEST (N_twithub_tall twithub.h5 tai3.h5 NONE tall.h5 taa3.h5)
+ UNJAMTEST (N_twithub513_tall twithub513.h5 tai4.h5 NONE tall.h5 taa4.h5)
+
+ UNJAMTEST (D_twithub_tall twithub.h5 taj2.h5 NONE tall.h5 tac2.h5 --delete)
+ UNJAMTEST (D_twithub513_tall twithub513.h5 taj3.h5 NONE tall.h5 tac3.h5 --delete)
ENDIF (BUILD_TESTING)
diff --git a/tools/h5jam/Makefile.in b/tools/h5jam/Makefile.in
index ff8b089..fd170fd 100644
--- a/tools/h5jam/Makefile.in
+++ b/tools/h5jam/Makefile.in
@@ -248,6 +248,7 @@ H5_VERSION = @H5_VERSION@
HADDR_T = @HADDR_T@
HAVE_DMALLOC = @HAVE_DMALLOC@
HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@
+HAVE_PTHREAD = @HAVE_PTHREAD@
HDF5_HL = @HDF5_HL@
HDF5_INTERFACES = @HDF5_INTERFACES@
HDF_CXX = @HDF_CXX@
@@ -299,7 +300,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@
PARALLEL = @PARALLEL@
PATH_SEPARATOR = @PATH_SEPARATOR@
PERL = @PERL@
-PTHREAD = @PTHREAD@
RANLIB = @RANLIB@
ROOT = @ROOT@
RUNPARALLEL = @RUNPARALLEL@
diff --git a/tools/h5jam/h5unjam.c b/tools/h5jam/h5unjam.c
index c304045..691e2f2 100644
--- a/tools/h5jam/h5unjam.c
+++ b/tools/h5jam/h5unjam.c
@@ -43,14 +43,14 @@ static const char *s_opts = "hu:i:o:d:V";
static struct long_options l_opts[] = {
{ "help", no_arg, 'h' },
{ "hel", no_arg, 'h' },
- {"i", require_arg, 'i'}, /* input file */
- {"u", require_arg, 'u'}, /* user block file */
- {"o", require_arg, 'o'}, /* output file */
- {"delete", no_arg, 'd'}, /* delete ub */
- {"delet", no_arg, 'd'},
- {"dele", no_arg, 'd'},
- {"del", no_arg, 'd'},
- {"de", no_arg, 'd'},
+ {"i", require_arg, 'i'}, /* input file */
+ {"u", require_arg, 'u'}, /* user block file */
+ {"o", require_arg, 'o'}, /* output file */
+ {"delete", no_arg, 'd'}, /* delete ub */
+ {"delet", no_arg, 'd'},
+ {"dele", no_arg, 'd'},
+ {"del", no_arg, 'd'},
+ {"de", no_arg, 'd'},
{ NULL, 0, '\0' }
};
@@ -123,86 +123,69 @@ usage(const char *prog)
}
/*-------------------------------------------------------------------------
- * Function: leave
- *
- * Purpose: Shutdown and call exit()
- *
- * Return: Does not return
- *
- *-------------------------------------------------------------------------
- */
-static void
-leave(int ret)
-{
- if (ub_file)
- HDfree (ub_file);
- if (input_file)
- HDfree (input_file);
- if (output_file)
- HDfree (output_file);
-
- h5tools_close();
-
- HDexit(ret);
-}
-
-/*-------------------------------------------------------------------------
* Function: parse_command_line
*
* Purpose: Parse the command line for the h5dumper.
*
- * Return: Success:
+ * Return: Success: EXIT_SUCCESS;
*
- * Failure: Exits program with EXIT_FAILURE value.
- *
- * Programmer:
- *
- * Modifications:
+ * Failure: Exits function with EXIT_FAILURE value.
*
*-------------------------------------------------------------------------
*/
-
-static void
+static int
parse_command_line(int argc, const char *argv[])
{
int opt = FALSE;
/* parse command line options */
while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) {
- switch ((char) opt) {
- case 'o':
- output_file = HDstrdup (opt_arg);
- break;
- case 'i':
- input_file = HDstrdup (opt_arg);
- break;
- case 'u':
- ub_file = HDstrdup (opt_arg);
- break;
- case 'd':
- do_delete = TRUE;
- break;
- case 'h':
- usage(h5tools_getprogname());
- leave(EXIT_SUCCESS);
- case 'V':
- print_version(h5tools_getprogname());
- leave(EXIT_SUCCESS);
- case '?':
- default:
- usage(h5tools_getprogname());
- leave(EXIT_FAILURE);
+ switch((char)opt) {
+ case 'o':
+ output_file = HDstrdup(opt_arg);
+ break;
+
+ case 'i':
+ input_file = HDstrdup(opt_arg);
+ break;
+
+ case 'u':
+ ub_file = HDstrdup(opt_arg);
+ break;
+
+ case 'd':
+ do_delete = TRUE;
+ break;
+
+ case 'h':
+ usage(h5tools_getprogname());
+ h5tools_setstatus(EXIT_SUCCESS);
+ goto done;
+
+ case 'V':
+ print_version (h5tools_getprogname());
+ h5tools_setstatus(EXIT_SUCCESS);
+ goto done;
+
+ case '?':
+ default:
+ usage(h5tools_getprogname());
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
}
}
- /* check for file name to be processed */
-/*
- if (argc <= opt_ind+2) {
- error_msg("missing file name\n");
- usage(h5tools_getprogname());
- HDexit(EXIT_FAILURE);
- }
-*/
+ return EXIT_SUCCESS;
+
+done:
+ if(input_file)
+ HDfree(input_file);
+ if(output_file)
+ HDfree(output_file);
+ if(ub_file)
+ HDfree(ub_file);
+
+ return EXIT_FAILURE;
}
/*-------------------------------------------------------------------------
@@ -246,13 +229,15 @@ main(int argc, const char *argv[])
/* Initialize h5tools lib */
h5tools_init();
- parse_command_line(argc, argv);
+ if(EXIT_FAILURE == parse_command_line(argc, argv))
+ goto done;
if (input_file == NULL) {
/* no user block */
error_msg("missing arguemnt for HDF5 file input.\n");
help_ref_msg(stderr);
- leave (EXIT_FAILURE);
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
}
testval = H5Fis_hdf5(input_file);
@@ -286,8 +271,10 @@ main(int argc, const char *argv[])
goto done;
}
- H5Pclose(plist);
- H5Fclose(ifile);
+ status = H5Pclose(plist);
+ HDassert(status >= 0);
+ status = H5Fclose(ifile);
+ HDassert(status >= 0);
if (usize == 0) {
/* no user block to remove: message? */
@@ -371,17 +358,25 @@ main(int argc, const char *argv[])
}
done:
- if (ub_file) {
- HDfree (ub_file);
- if (ufid >= 0) HDclose(ufid);
+ if(input_file)
+ HDfree(input_file);
+ if(output_file)
+ HDfree(output_file);
+ if(ub_file) {
+ HDfree(ub_file);
+ if(ufid >= 0)
+ status = HDclose(ufid);
+ HDassert(status >= 0);
}
- if (input_file)
- HDfree (input_file);
- if (output_file)
- HDfree (output_file);
- if (h5fid >= 0) HDclose(h5fid);
- if (ifid >= 0) HDclose(ifid);
+ if(h5fid >= 0) {
+ status = HDclose(h5fid);
+ HDassert(status >= 0);
+ }
+ if(ifid >= 0) {
+ status = HDclose(ifid);
+ HDassert(status >= 0);
+ }
return h5tools_getstatus();
}
diff --git a/tools/h5jam/testh5jam.sh.in b/tools/h5jam/testh5jam.sh.in
index b2c6bec..86edbee 100644
--- a/tools/h5jam/testh5jam.sh.in
+++ b/tools/h5jam/testh5jam.sh.in
@@ -377,7 +377,7 @@ JAMTEST() {
compare_orig="xxofile.h5"
cleanup="$cleanup $compare_orig"
else
- # output goes to $4, compare ofile to ubfile
+ # output goes to $3, compare ofile to ubfile
ofile="$3"
compare_test="$ofile"
compare_orig="$ifile"
@@ -539,19 +539,22 @@ JAMTEST $TESTDIR/u513.txt $TESTDIR/tall.h5 ta5.h5
CHECKFILE $TESTDIR/tall.h5 ta5.h5
CLEANUP ta5.h5
-SETUP $TESTDIR/tall.h5 ta.h5
-JAMTEST $TESTDIR/u10.txt ta.h5
-CHECKFILE $TESTDIR/tall.h5 ta.h5
-SETUP $TESTDIR/tall.h5 ta.h5
-JAMTEST $TESTDIR/u511.txt ta.h5
-CHECKFILE $TESTDIR/tall.h5 ta.h5
-SETUP $TESTDIR/tall.h5 ta.h5
-JAMTEST $TESTDIR/u512.txt ta.h5
-CHECKFILE $TESTDIR/tall.h5 ta.h5
-SETUP $TESTDIR/tall.h5 ta.h5
-JAMTEST $TESTDIR/u513.txt ta.h5
-CHECKFILE $TESTDIR/tall.h5 ta.h5
-CLEANUP ta.h5
+SETUP $TESTDIR/tall.h5 ta6.h5
+JAMTEST $TESTDIR/u10.txt ta6.h5
+CHECKFILE $TESTDIR/tall.h5 ta6.h5
+CLEANUP ta6.h5
+SETUP $TESTDIR/tall.h5 ta7.h5
+JAMTEST $TESTDIR/u511.txt ta7.h5
+CHECKFILE $TESTDIR/tall.h5 ta7.h5
+CLEANUP ta7.h5
+SETUP $TESTDIR/tall.h5 ta8.h5
+JAMTEST $TESTDIR/u512.txt ta8.h5
+CHECKFILE $TESTDIR/tall.h5 ta8.h5
+CLEANUP ta8.h5
+SETUP $TESTDIR/tall.h5 ta9.h5
+JAMTEST $TESTDIR/u513.txt ta9.h5
+CHECKFILE $TESTDIR/tall.h5 ta9.h5
+CLEANUP ta9.h5
JAMTEST $TESTDIR/u10.txt $TESTDIR/twithub.h5 tax2.h5
CHECKFILE $TESTDIR/tall.h5 tax2.h5