diff options
Diffstat (limited to 'tools/test/h5stat')
15 files changed, 60 insertions, 13 deletions
diff --git a/tools/test/h5stat/CMakeTests.cmake b/tools/test/h5stat/CMakeTests.cmake index bd55ac1..9c26a92 100644 --- a/tools/test/h5stat/CMakeTests.cmake +++ b/tools/test/h5stat/CMakeTests.cmake @@ -39,23 +39,30 @@ h5stat_newgrat h5stat_newgrat-UG h5stat_newgrat-UA - h5stat_err1_links h5stat_idx h5stat_links1 h5stat_links2 h5stat_links3 h5stat_links4 h5stat_links5 - h5stat_err1_dims h5stat_dims1 h5stat_dims2 - h5stat_err1_numattrs - h5stat_err2_numattrs h5stat_numattrs1 h5stat_numattrs2 h5stat_numattrs3 h5stat_numattrs4 ) + set (HDF5_REFERENCE_ERR_FILES + h5stat_err_refcount + h5stat_err_old_layout + h5stat_err_old_fill + h5stat_err1_dims + h5stat_err1_links + h5stat_err1_numattrs + h5stat_err2_numattrs + h5stat_notexist + h5stat_nofile + ) set (HDF5_REFERENCE_TEST_FILES h5stat_err_refcount.h5 h5stat_err_old_layout.h5 @@ -71,6 +78,10 @@ HDFTEST_COPY_FILE("${HDF5_TOOLS_TEST_H5STAT_SOURCE_DIR}/testfiles/${ddl_file}.ddl" "${PROJECT_BINARY_DIR}/${ddl_file}.ddl" "h5stat_files") endforeach () + foreach (h5_file ${HDF5_REFERENCE_ERR_FILES}) + HDFTEST_COPY_FILE("${HDF5_TOOLS_TEST_H5STAT_SOURCE_DIR}/testfiles/${h5_file}.err" "${PROJECT_BINARY_DIR}/${h5_file}.err" "h5stat_files") + endforeach () + foreach (h5_file ${HDF5_REFERENCE_TEST_FILES}) HDFTEST_COPY_FILE("${HDF5_TOOLS_TEST_H5STAT_SOURCE_DIR}/testfiles/${h5_file}" "${PROJECT_BINARY_DIR}/${h5_file}" "h5stat_files") endforeach () @@ -118,6 +129,42 @@ endif () endmacro () + macro (ADD_H5_ERR_TEST resultfile resultcode) + # If using memchecker add tests without using scripts + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME H5STAT-${resultfile} COMMAND $<TARGET_FILE:h5stat> ${ARGN}) + if (NOT "${resultcode}" STREQUAL "0") + set_tests_properties (H5STAT-${resultfile} PROPERTIES WILL_FAIL "true") + endif () + if (NOT "${last_test}" STREQUAL "") + set_tests_properties (H5STAT-${resultfile} PROPERTIES DEPENDS ${last_test}) + endif () + else (HDF5_ENABLE_USING_MEMCHECKER) + add_test ( + NAME H5STAT-${resultfile}-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + ${resultfile}.out + ${resultfile}.out.err + ) + if (NOT "${last_test}" STREQUAL "") + set_tests_properties (H5STAT-${resultfile}-clear-objects PROPERTIES DEPENDS ${last_test}) + endif () + add_test ( + NAME H5STAT-${resultfile} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$<TARGET_FILE:h5stat>" + -D "TEST_ARGS=${ARGN}" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -D "TEST_OUTPUT=${resultfile}.out" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_ERRREF=${resultfile}.err" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + set_tests_properties (H5STAT-${resultfile} PROPERTIES DEPENDS H5STAT-${resultfile}-clear-objects) + endif () + endmacro () + ############################################################################## ############################################################################## ### T H E T E S T S ### @@ -173,7 +220,7 @@ # -g -l 8 # --links=8 # --links=20 -g - ADD_H5_TEST (h5stat_err1_links 1 -l 0 h5stat_threshold.h5) + ADD_H5_ERR_TEST (h5stat_err1_links 1 -l 0 h5stat_threshold.h5) ADD_H5_TEST (h5stat_links1 0 -g -l 8 h5stat_threshold.h5) ADD_H5_TEST (h5stat_links2 0 --links=8 h5stat_threshold.h5) ADD_H5_TEST (h5stat_links3 0 --links=20 -g h5stat_threshold.h5) @@ -188,7 +235,7 @@ # -d --dims=-1 (incorrect threshold value) # -gd -m 5 # -d --di=15 - ADD_H5_TEST (h5stat_err1_dims 1 -d --dims=-1 h5stat_threshold.h5) + ADD_H5_ERR_TEST (h5stat_err1_dims 1 -d --dims=-1 h5stat_threshold.h5) ADD_H5_TEST (h5stat_dims1 0 -gd -m 5 h5stat_threshold.h5) ADD_H5_TEST (h5stat_dims2 0 -d --di=15 h5stat_threshold.h5) # @@ -198,8 +245,8 @@ # -AS -a 10 # -a 1 # -A --numattrs=25 - ADD_H5_TEST (h5stat_err1_numattrs 1 -a -2 h5stat_threshold.h5) - ADD_H5_TEST (h5stat_err2_numattrs 1 --numattrs h5stat_threshold.h5) + ADD_H5_ERR_TEST (h5stat_err1_numattrs 1 -a -2 h5stat_threshold.h5) + ADD_H5_ERR_TEST (h5stat_err2_numattrs 1 --numattrs h5stat_threshold.h5) ADD_H5_TEST (h5stat_numattrs1 0 -AS -a 10 h5stat_threshold.h5) ADD_H5_TEST (h5stat_numattrs2 0 -a 1 h5stat_threshold.h5) ADD_H5_TEST (h5stat_numattrs3 0 -A --numattrs=25 h5stat_threshold.h5) diff --git a/tools/test/h5stat/testfiles/h5stat_err1_dims.ddl b/tools/test/h5stat/testfiles/h5stat_err1_dims.err index 86d375b..86d375b 100644 --- a/tools/test/h5stat/testfiles/h5stat_err1_dims.ddl +++ b/tools/test/h5stat/testfiles/h5stat_err1_dims.err diff --git a/tools/test/h5stat/testfiles/h5stat_err1_links.ddl b/tools/test/h5stat/testfiles/h5stat_err1_links.err index d43207c..d43207c 100644 --- a/tools/test/h5stat/testfiles/h5stat_err1_links.ddl +++ b/tools/test/h5stat/testfiles/h5stat_err1_links.err diff --git a/tools/test/h5stat/testfiles/h5stat_err2_numattrs.ddl b/tools/test/h5stat/testfiles/h5stat_err1_numattrs.err index 01b6c18..01b6c18 100644 --- a/tools/test/h5stat/testfiles/h5stat_err2_numattrs.ddl +++ b/tools/test/h5stat/testfiles/h5stat_err1_numattrs.err diff --git a/tools/test/h5stat/testfiles/h5stat_err1_numattrs.ddl b/tools/test/h5stat/testfiles/h5stat_err2_numattrs.err index 01b6c18..01b6c18 100644 --- a/tools/test/h5stat/testfiles/h5stat_err1_numattrs.ddl +++ b/tools/test/h5stat/testfiles/h5stat_err2_numattrs.err diff --git a/tools/test/h5stat/testfiles/h5stat_err_old_fill.ddl b/tools/test/h5stat/testfiles/h5stat_err_old_fill.ddl index e751b7f..5cc1e32 100644 --- a/tools/test/h5stat/testfiles/h5stat_err_old_fill.ddl +++ b/tools/test/h5stat/testfiles/h5stat_err_old_fill.ddl @@ -1,2 +1 @@ Filename: h5stat_err_old_fill.h5 -h5stat error: unable to traverse objects/links in file "h5stat_err_old_fill.h5" diff --git a/tools/test/h5stat/testfiles/h5stat_err_old_fill.err b/tools/test/h5stat/testfiles/h5stat_err_old_fill.err new file mode 100644 index 0000000..8b886d2 --- /dev/null +++ b/tools/test/h5stat/testfiles/h5stat_err_old_fill.err @@ -0,0 +1 @@ +h5stat error: unable to traverse objects/links in file "h5stat_err_old_fill.h5" diff --git a/tools/test/h5stat/testfiles/h5stat_err_old_layout.ddl b/tools/test/h5stat/testfiles/h5stat_err_old_layout.ddl index a3e27e2..112190c 100644 --- a/tools/test/h5stat/testfiles/h5stat_err_old_layout.ddl +++ b/tools/test/h5stat/testfiles/h5stat_err_old_layout.ddl @@ -1,2 +1 @@ Filename: h5stat_err_old_layout.h5 -h5stat error: unable to traverse objects/links in file "h5stat_err_old_layout.h5" diff --git a/tools/test/h5stat/testfiles/h5stat_err_old_layout.err b/tools/test/h5stat/testfiles/h5stat_err_old_layout.err new file mode 100644 index 0000000..7aa2fa7 --- /dev/null +++ b/tools/test/h5stat/testfiles/h5stat_err_old_layout.err @@ -0,0 +1 @@ +h5stat error: unable to traverse objects/links in file "h5stat_err_old_layout.h5" diff --git a/tools/test/h5stat/testfiles/h5stat_err_refcount.ddl b/tools/test/h5stat/testfiles/h5stat_err_refcount.ddl index 1f1b491..41e533e 100644 --- a/tools/test/h5stat/testfiles/h5stat_err_refcount.ddl +++ b/tools/test/h5stat/testfiles/h5stat_err_refcount.ddl @@ -1,2 +1 @@ Filename: h5stat_err_refcount.h5 -h5stat error: unable to traverse objects/links in file "h5stat_err_refcount.h5" diff --git a/tools/test/h5stat/testfiles/h5stat_err_refcount.err b/tools/test/h5stat/testfiles/h5stat_err_refcount.err new file mode 100644 index 0000000..d176996 --- /dev/null +++ b/tools/test/h5stat/testfiles/h5stat_err_refcount.err @@ -0,0 +1 @@ +h5stat error: unable to traverse objects/links in file "h5stat_err_refcount.h5" diff --git a/tools/test/h5stat/testfiles/h5stat_nofile.ddl b/tools/test/h5stat/testfiles/h5stat_nofile.ddl index 7171320..01e39af 100644 --- a/tools/test/h5stat/testfiles/h5stat_nofile.ddl +++ b/tools/test/h5stat/testfiles/h5stat_nofile.ddl @@ -23,4 +23,3 @@ Usage: h5stat [OPTIONS] file -s, --freespace Print free space information -S, --summary Print summary of file space information --enable-error-stack Prints messages from the HDF5 error stack as they occur -h5stat error: missing file name diff --git a/tools/test/h5stat/testfiles/h5stat_nofile.err b/tools/test/h5stat/testfiles/h5stat_nofile.err new file mode 100644 index 0000000..3b7e979 --- /dev/null +++ b/tools/test/h5stat/testfiles/h5stat_nofile.err @@ -0,0 +1 @@ +h5stat error: missing file name diff --git a/tools/test/h5stat/testfiles/h5stat_notexist.ddl b/tools/test/h5stat/testfiles/h5stat_notexist.ddl index cc25e43..7f71941 100644 --- a/tools/test/h5stat/testfiles/h5stat_notexist.ddl +++ b/tools/test/h5stat/testfiles/h5stat_notexist.ddl @@ -1,2 +1 @@ Filename: notexist.h5 -h5stat error: unable to open file "notexist.h5" diff --git a/tools/test/h5stat/testfiles/h5stat_notexist.err b/tools/test/h5stat/testfiles/h5stat_notexist.err new file mode 100644 index 0000000..c1d9e54 --- /dev/null +++ b/tools/test/h5stat/testfiles/h5stat_notexist.err @@ -0,0 +1 @@ +h5stat error: unable to open file "notexist.h5" |