summaryrefslogtreecommitdiffstats
path: root/tools/h5dump
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2011-05-11 20:45:54 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2011-05-11 20:45:54 (GMT)
commitf49dc381271ac53a508628856787463668789772 (patch)
treed424cac8fb50120d9080086d54fd8d98a0977d03 /tools/h5dump
parent2e7d42a43c60753d99d3bed37d121ca30ac5db1c (diff)
downloadhdf5-f49dc381271ac53a508628856787463668789772.zip
hdf5-f49dc381271ac53a508628856787463668789772.tar.gz
hdf5-f49dc381271ac53a508628856787463668789772.tar.bz2
[svn-r20796] Refactor print_data_region_blocks/ponts to remove context passed in by value. The print functions needed an independent context with only the current indent level passed in by argument. Also synched the two routines logical flows and corrected a mem_space error.
h5dump (and h5stat, h5jam/h5unjam) help option not tested. Added h5dump parse_command_line technique for h5stat and h5jam/unjam and created testfiles. Tested: local linux
Diffstat (limited to 'tools/h5dump')
-rw-r--r--tools/h5dump/CMakeLists.txt27
-rw-r--r--tools/h5dump/h5dump.c20
2 files changed, 38 insertions, 9 deletions
diff --git a/tools/h5dump/CMakeLists.txt b/tools/h5dump/CMakeLists.txt
index 9da1203..a176ba0 100644
--- a/tools/h5dump/CMakeLists.txt
+++ b/tools/h5dump/CMakeLists.txt
@@ -216,6 +216,7 @@ IF (BUILD_TESTING)
tvlstr.h5.xml
)
SET (HDF5_REFERENCE_TEST_FILES
+ h5dump-help.txt
tbin1.ddl
tbin1.ddl
tbin2.ddl
@@ -475,6 +476,29 @@ IF (BUILD_TESTING)
##############################################################################
##############################################################################
+ MACRO (ADD_HELP_TEST testname resultcode)
+ # If using memchecker add tests without using scripts
+ IF (HDF5_ENABLE_USING_MEMCHECKER)
+ ADD_TEST (NAME H5DUMP-${testname} COMMAND $<TARGET_FILE:h5dump> ${ARGN})
+ ELSE (HDF5_ENABLE_USING_MEMCHECKER)
+ ADD_TEST (
+ NAME H5DUMP-${testname}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_ARGS:STRING=${ARGN}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_OUTPUT=h5dump-${testname}.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=h5dump-${testname}.txt"
+ -P "${HDF5_RESOURCES_DIR}/runTest.cmake"
+ )
+ ENDIF (HDF5_ENABLE_USING_MEMCHECKER)
+ IF (NOT "${last_test}" STREQUAL "")
+ SET_TESTS_PROPERTIES (H5DUMP-${testname} PROPERTIES DEPENDS ${last_test})
+ ENDIF (NOT "${last_test}" STREQUAL "")
+ SET (last_test "H5DUMP-${testname}")
+ ENDMACRO (ADD_HELP_TEST)
+
MACRO (ADD_SKIP_H5_TEST skipresultfile skipresultcode testtype)
IF (${testtype} STREQUAL "SKIP")
IF (NOT HDF5_ENABLE_USING_MEMCHECKER)
@@ -616,6 +640,7 @@ IF (BUILD_TESTING)
NAME H5DUMP-clearall-objects
COMMAND ${CMAKE_COMMAND}
-E remove
+ h5dump-help.out
filter_fail.out
filter_fail.out.err
packedbits.out
@@ -854,6 +879,8 @@ IF (BUILD_TESTING)
ENDIF (NOT "${last_test}" STREQUAL "")
SET (last_test "H5DUMP-clearall-objects")
+ ADD_HELP_TEST(help 0 -h)
+
# test for signed/unsigned datasets
ADD_H5_TEST (packedbits 0 packedbits.h5)
# test for displaying groups
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c
index 05ec369..cfeaaef 100644
--- a/tools/h5dump/h5dump.c
+++ b/tools/h5dump/h5dump.c
@@ -4560,7 +4560,7 @@ error:
if (hand) {
free_handler(hand, argc);
hand = NULL;
-}
+ }
h5tools_setstatus(EXIT_FAILURE);
return hand;
@@ -4630,7 +4630,6 @@ main(int argc, const char *argv[])
/* Initialize h5tools lib */
h5tools_init();
if((hand = parse_command_line(argc, argv))==NULL) {
- h5tools_setstatus(EXIT_FAILURE);
goto done;
}
@@ -4834,14 +4833,17 @@ done:
/* Free tables for objects */
table_list_free();
- if (H5Fclose(fid) < 0)
- h5tools_setstatus(EXIT_FAILURE);
-
- if(hand)
- free_handler(hand, argc);
+ if(hand)
+ free_handler(hand, argc);
- HDfree(prefix);
- HDfree(fname);
+ if(fid >=0)
+ if (H5Fclose(fid) < 0)
+ h5tools_setstatus(EXIT_FAILURE);
+
+ if(prefix)
+ HDfree(prefix);
+ if(fname)
+ HDfree(fname);
/* To Do: clean up XML table */