summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2018-03-13 17:34:56 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2018-03-13 17:34:56 (GMT)
commit2ab4276084a65114ec0802ff951a2e9814e65d5a (patch)
treec2b9af1f8deb7288384f0217956db0d57f15fa40
parentf0238d0346cdd2e34200e8b30f5760290a813a05 (diff)
parent6287bac6e5916d69f1df3f3907f2c530c8ba5ada (diff)
downloadhdf5-2ab4276084a65114ec0802ff951a2e9814e65d5a.zip
hdf5-2ab4276084a65114ec0802ff951a2e9814e65d5a.tar.gz
hdf5-2ab4276084a65114ec0802ff951a2e9814e65d5a.tar.bz2
Merge pull request #949 in HDFFV/hdf5 from ~BYRN/hdf5_adb:develop to develop
* commit '6287bac6e5916d69f1df3f3907f2c530c8ba5ada': Rework new tests into one macro Fix CMake test names
-rw-r--r--tools/test/misc/CMakeTestsClear.cmake141
1 files changed, 114 insertions, 27 deletions
diff --git a/tools/test/misc/CMakeTestsClear.cmake b/tools/test/misc/CMakeTestsClear.cmake
index 5efce0a..a51d0e9 100644
--- a/tools/test/misc/CMakeTestsClear.cmake
+++ b/tools/test/misc/CMakeTestsClear.cmake
@@ -108,6 +108,42 @@
endif ()
endmacro ()
+ macro (ADD_H5_CMP_WITH_COPY testname resultcode resultfile testfile)
+ if (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (
+ NAME H5CLEAR_CMP-${testname}-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ testfiles/${testname}.out
+ testfiles/${testname}.out.err
+ testfiles/${testfile}
+ )
+ if (NOT "${last_test}" STREQUAL "")
+ set_tests_properties (H5CLEAR_CMP-${testname}-clear-objects PROPERTIES DEPENDS ${last_test})
+ endif ()
+ add_test (
+ NAME H5CLEAR_CMP-copy_${testname}
+ COMMAND ${CMAKE_COMMAND}
+ -E copy_if_different
+ "${PROJECT_SOURCE_DIR}/testfiles/${testfile}" "${PROJECT_BINARY_DIR}/testfiles/${testfile}"
+ )
+ set_tests_properties (H5CLEAR_CMP-copy_${testname} PROPERTIES DEPENDS H5CLEAR_CMP-${testname}-clear-objects)
+ add_test (
+ NAME H5CLEAR_CMP-${testname}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5clear>"
+ -D "TEST_ARGS:STRING=${ARGN};${testfile}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
+ -D "TEST_OUTPUT=${testname}.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=${resultfile}.ddl"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ set_tests_properties (H5CLEAR_CMP-${testname} PROPERTIES DEPENDS H5CLEAR_CMP-copy_${testname})
+ set (last_test "H5CLEAR_CMP-${testname}")
+ endif ()
+ endmacro ()
+
macro (ADD_H5_RETTEST testname resultcode)
if (NOT HDF5_ENABLE_USING_MEMCHECKER)
add_test (
@@ -123,6 +159,70 @@
endif ()
endmacro ()
+ macro (ADD_H5_FILESIZE_TEST testname resultcode resultfile incr_size)
+ if (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (
+ NAME H5CLEAR_FILESIZE_TEST-${testname}-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ testfiles/${testname}_before_size.out
+ testfiles/${testname}_before_size.out.err
+ testfiles/${testname}_after_size.out
+ testfiles/${testname}_after_size.out.err
+ testfiles/${testname}.h5
+ )
+ if (NOT "${last_test}" STREQUAL "")
+ set_tests_properties (H5CLEAR_FILESIZE_TEST-${testname}-clear-objects PROPERTIES DEPENDS ${last_test})
+ endif ()
+ add_test (
+ NAME H5CLEAR_FILESIZE_TEST-copy_${testname}
+ COMMAND ${CMAKE_COMMAND}
+ -E copy_if_different
+ "${PROJECT_SOURCE_DIR}/testfiles/${testname}.h5" "${PROJECT_BINARY_DIR}/testfiles/${testname}.h5"
+ )
+ set_tests_properties (H5CLEAR_FILESIZE_TEST-copy_${testname} PROPERTIES DEPENDS H5CLEAR_FILESIZE_TEST-${testname}-clear-objects)
+ add_test (
+ NAME H5CLEAR_FILESIZE_CMP-${testname}_before_size
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5clear>"
+ -D "TEST_ARGS:STRING=--filesize;${testname}.h5"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
+ -D "TEST_OUTPUT=${testname}_before_size.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=${resultfile}_before_size.ddl"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ set_tests_properties (H5CLEAR_FILESIZE_CMP-${testname}_before_size PROPERTIES DEPENDS H5CLEAR_FILESIZE_TEST-copy_${testname})
+ if (NOT ${incr_size} MATCHES "NONE")
+ add_test (
+ NAME H5CLEAR_FILESIZE_INCR-${testname}
+ COMMAND $<TARGET_FILE:h5clear> --increment=${incr_size} ${testname}.h5
+ )
+ else ()
+ add_test (
+ NAME H5CLEAR_FILESIZE_INCR-${testname}
+ COMMAND $<TARGET_FILE:h5clear> --increment ${testname}.h5
+ )
+ endif ()
+ set_tests_properties (H5CLEAR_FILESIZE_INCR-${testname} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
+ set_tests_properties (H5CLEAR_FILESIZE_INCR-${testname} PROPERTIES WILL_FAIL "${resultcode}")
+ set_tests_properties (H5CLEAR_FILESIZE_INCR-${testname} PROPERTIES DEPENDS H5CLEAR_FILESIZE_CMP-${testname}_before_size)
+ add_test (
+ NAME H5CLEAR_FILESIZE_CMP-${testname}_after_size
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5clear>"
+ -D "TEST_ARGS:STRING=--filesize;${testname}.h5"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
+ -D "TEST_OUTPUT=${testname}_after_size.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=${resultfile}_after_size.ddl"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ set_tests_properties (H5CLEAR_FILESIZE_CMP-${testname}_after_size PROPERTIES DEPENDS H5CLEAR_FILESIZE_INCR-${testname})
+ set (last_test "H5CLEAR_FILESIZE_CMP-${testname}_after_size")
+ endif ()
+ endmacro ()
+
macro (ADD_H5_TEST testname testfile resultcode)
if (NOT HDF5_ENABLE_USING_MEMCHECKER)
add_test (
@@ -183,6 +283,7 @@ if (HDF5_ENABLE_USING_MEMCHECKER)
latest_h5clear_sec2_v3.h5
mod_h5clear_mdc_image.h5
mod_h5clear_mdc_image2.h5
+ ${HDF5_TEST_FILES}
)
if (NOT "${last_test}" STREQUAL "")
set_tests_properties (H5CLEAR-clearall-objects PROPERTIES DEPENDS ${last_test})
@@ -303,64 +404,50 @@ endif()
# "h5clear -s --increment=0 h5clear_status_noclose.h5" (clear status_flag, EOA = MAX(EOA, EOF) + 0)
# (no output, check exit code)
# "h5clear --filesize h5clear_status_noclose.h5" (print EOA/EOF after the last action)
- ADD_H5_CMP (h5clr_open_fail_s h5clear_open_fail 1 "--filesize" h5clear_status_noclose.h5)
- ADD_H5_RETTEST (h5clr_mdc_image "false" "-s" "--increment=0" h5clear_status_noclose.h5)
- ADD_H5_CMP (h5clr_no_mdc_image_m h5clear_status_noclose_after_size 0 "--filesize" h5clear_status_noclose.h5)
+ ADD_H5_CMP_WITH_COPY (h5clr_open_fail_nc_s 1 h5clear_open_fail h5clear_status_noclose.h5 "--filesize")
+ ADD_H5_RETTEST (h5clr_mdc_image_nc "false" "-s" "--increment=0" h5clear_status_noclose.h5)
+ ADD_H5_CMP (h5clr_no_mdc_image_nc_m h5clear_status_noclose_after_size 0 "--filesize" h5clear_status_noclose.h5)
#
# (2) h5clear_fsm_persist_noclose.h5
# "h5clear --filesize h5clear_fsm_persist_noclose.h5" (print EOA/EOF before the next action)
# "h5clear --increment=0 h5clear_fsm_persist_noclose.h5" (EOA = MAX(EOA, EOF)) (no output, just check exit code)
# "h5clear --filesize h5clear_fsm_persist_noclose.h5" (print EOA/EOF after the last action)
- ADD_H5_CMP (h5clr_open_fail_s h5clear_noclose_before_size 0 "--filesize" h5clear_fsm_persist_noclose.h5)
- ADD_H5_RETTEST (h5clr_mdc_image "false" "--increment=0" h5clear_fsm_persist_noclose.h5)
- ADD_H5_CMP (h5clr_no_mdc_image_m h5clear_noclose_after_size 0 "--filesize" h5clear_fsm_persist_noclose.h5)
+ ADD_H5_FILESIZE_TEST (h5clear_fsm_persist_noclose 0 h5clear_noclose 0)
#
# (3) h5clear_fsm_persist_equal.h5
# "h5clear --filesize h5clear_fsm_persist_equal.h5" (print EOA/EOF before the next action)
# "h5clear --increment h5clear_fsm_persist_equal.h5" (EOA = MAX(EOA, EOF) + 1M) (no output, check exit code)
# "h5clear --filesize h5clear_fsm_persist_equal.h5" (print EOA/EOF after the last action)
- ADD_H5_CMP (h5clr_equal_before_size h5clear_equal_before_size 0 "--filesize" h5clear_fsm_persist_equal.h5)
- ADD_H5_RETTEST (h5clr_equal_incr "false" "--increment" h5clear_fsm_persist_equal.h5)
- ADD_H5_CMP (h5clr_equal_after_size h5clear_equal_after_size 0 "--filesize" h5clear_fsm_persist_equal.h5)
+ ADD_H5_FILESIZE_TEST (h5clear_fsm_persist_equal 0 h5clear_equal NONE)
#
# (4) h5clear_fsm_persist_greater.h5
# "h5clear --filesize h5clear_fsm_persist_greater.h5" (print EOA/EOF before the next action)
# "h5clear --increment=0 h5clear_fsm_persist_greater.h5" (EOA = MAX(EOA, EOF) + 0) (no output, check exit code)
# "h5clear --filesize h5clear_fsm_persist_greater.h5" (print EOA/EOF after the last action)
- ADD_H5_CMP (h5clr_greater_before_size h5clear_greater_before_size 0 "--filesize" h5clear_fsm_persist_greater.h5)
- ADD_H5_RETTEST (h5clr_greater_incr "false" "--increment=0" h5clear_fsm_persist_greater.h5)
- ADD_H5_CMP (h5clr_greater_after_size h5clear_greater_after_size 0 "--filesize" h5clear_fsm_persist_greater.h5)
+ ADD_H5_FILESIZE_TEST (h5clear_fsm_persist_greater 0 h5clear_greater 0)
#
# (5) h5clear_fsm_persist_less.h5
# "h5clear --filesize h5clear_fsm_persist_less.h5" (print EOA/EOF before the next action)
# "h5clear --increment=200 h5clear_fsm_persist_less.h5" (EOA = MAX(EOA, EOF) + 200) (no output, check exit code)
# "h5clear --filesize h5clear_fsm_persist_less.h5" (print EOA/EOF after the last action)
- ADD_H5_CMP (h5clr_less_before_size h5clear_less_before_size 0 "--filesize" h5clear_fsm_persist_less.h5)
- ADD_H5_RETTEST (h5clr_less_incr "false" "--increment=200" h5clear_fsm_persist_less.h5)
- ADD_H5_CMP (h5clr_less_after_size h5clear_less_after_size 0 "--filesize" h5clear_fsm_persist_less.h5)
+ ADD_H5_FILESIZE_TEST (h5clear_fsm_persist_less 0 h5clear_less 200)
#
# (6) h5clear_fsm_persist_user_equal.h5
# "h5clear --filesize h5clear_fsm_persist_user_equal.h5" (print EOA/EOF before the next action)
# "h5clear --increment h5clear_fsm_persist_user_equal.h5" (EOA = MAX(EOA, EOF) + 1M) (no output, check exit code)
# "h5clear --filesize h5clear_fsm_persist_user_equal.h5" (print EOA/EOF after the last action)
- ADD_H5_CMP (h5clr_user_equal_before_size h5clear_user_equal_before_size 0 "--filesize" h5clear_fsm_persist_user_equal.h5)
- ADD_H5_RETTEST (h5clr_user_equal_incr "false" "--increment" h5clear_fsm_persist_user_equal.h5)
- ADD_H5_CMP (h5clr_user_equal_after_size h5clear_user_equal_after_size 0 "--filesize" h5clear_fsm_persist_user_equal.h5)
+ ADD_H5_FILESIZE_TEST (h5clear_fsm_persist_user_equal 0 h5clear_user_equal NONE)
#
# (7) h5clear_fsm_persist_user_greater.h5
# "h5clear --filesize h5clear_fsm_persist_user_greater.h5" (print EOA/EOF before the next action)
# "h5clear --increment=0 h5clear_fsm_persist_user_greater.h5" (EOA = MAX(EOA, EOF) + 0) (no output, check exit code)
# "h5clear --filesize h5clear_fsm_persist_user_greater.h5" (print EOA/EOF after the last action)
- ADD_H5_CMP (h5clr_user_greater_before_size h5clear_user_greater_before_size 0 "--filesize" h5clear_fsm_persist_user_greater.h5)
- ADD_H5_RETTEST (h5clr_user_greater_incr "false" "--increment=0" h5clear_fsm_persist_user_greater.h5)
- ADD_H5_CMP (h5clr_user_greater_after_size h5clear_user_greater_after_size 0 "--filesize" h5clear_fsm_persist_user_greater.h5)
+ ADD_H5_FILESIZE_TEST (h5clear_fsm_persist_user_greater 0 h5clear_user_greater 0)
#
# (8) h5clear_fsm_persist_user_less.h5
-# "h5clear --filesize h5clear_fsm_persist_user_greater.h5" (print EOA/EOF before the next action)
-# "h5clear --increment=0 h5clear_fsm_persist_user_greater.h5" (EOA = MAX(EOA, EOF) + 0) (no output, check exit code)
-# "h5clear --filesize h5clear_fsm_persist_user_greater.h5" (print EOA/EOF after the last action)
- ADD_H5_CMP (h5clr_user_less_before_size h5clear_user_less_before_size 0 "--filesize" h5clear_fsm_persist_user_less.h5)
- ADD_H5_RETTEST (h5clr_user_less_incr "false" "--increment=0" h5clear_fsm_persist_user_less.h5)
- ADD_H5_CMP (h5clr_user_less_after_size h5clear_user_less_after_size 0 "--filesize" h5clear_fsm_persist_user_less.h5)
+# "h5clear --filesize h5clear_fsm_persist_user_less.h5" (print EOA/EOF before the next action)
+# "h5clear --increment=200 h5clear_fsm_persist_user_less.h5" (EOA = MAX(EOA, EOF) + 200) (no output, check exit code)
+# "h5clear --filesize h5clear_fsm_persist_user_less.h5" (print EOA/EOF after the last action)
+ ADD_H5_FILESIZE_TEST (h5clear_fsm_persist_user_less 0 h5clear_user_less 200)
#
#