Merge pull request #448 in HDFFV/hdf5 from ~BYRN/hdf5_adb:develop to develop

* commit '9a7b106d3776a8454b5cb9443f11aae2873cc617':
  Correct test options to match autotools script
  Updates to CMake for the changes in the autotools script
This commit is contained in:
Allen Byrne 2017-04-20 15:49:20 -05:00
commit 4a70b0d7dc
2 changed files with 102 additions and 35 deletions

View File

@ -17,6 +17,13 @@ INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib)
set_target_properties (h5repart_gentest PROPERTIES FOLDER generator/tools) set_target_properties (h5repart_gentest PROPERTIES FOLDER generator/tools)
#add_test (NAME h5repart_gentest COMMAND $<TARGET_FILE:h5repart_gentest>) #add_test (NAME h5repart_gentest COMMAND $<TARGET_FILE:h5repart_gentest>)
add_executable (h5clear_gentest ${HDF5_TOOLS_TEST_MISC_SOURCE_DIR}/h5clear_gentest.c)
TARGET_NAMING (h5clear_gentest STATIC)
TARGET_C_PROPERTIES (h5clear_gentest STATIC " " " ")
target_link_libraries (h5clear_gentest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
set_target_properties (h5clear_gentest PROPERTIES FOLDER tools)
#add_test (NAME H5CLEAR-h5clear_gentest COMMAND $<TARGET_FILE:h5clear_gentest>)
add_subdirectory (${HDF5_TOOLS_TEST_MISC_SOURCE_DIR}/vds) add_subdirectory (${HDF5_TOOLS_TEST_MISC_SOURCE_DIR}/vds)
endif () endif ()
@ -27,12 +34,6 @@ INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib)
target_link_libraries (h5repart_test ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) target_link_libraries (h5repart_test ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
set_target_properties (h5repart_test PROPERTIES FOLDER tools) set_target_properties (h5repart_test PROPERTIES FOLDER tools)
add_executable (h5clear_gentest ${HDF5_TOOLS_TEST_MISC_SOURCE_DIR}/h5clear_gentest.c)
TARGET_NAMING (h5clear_gentest STATIC)
TARGET_C_PROPERTIES (h5clear_gentest STATIC " " " ")
target_link_libraries (h5clear_gentest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
set_target_properties (h5clear_gentest PROPERTIES FOLDER tools)
add_executable (clear_open_chk ${HDF5_TOOLS_TEST_MISC_SOURCE_DIR}/clear_open_chk.c) add_executable (clear_open_chk ${HDF5_TOOLS_TEST_MISC_SOURCE_DIR}/clear_open_chk.c)
TARGET_NAMING (clear_open_chk STATIC) TARGET_NAMING (clear_open_chk STATIC)
TARGET_C_PROPERTIES (clear_open_chk STATIC " " " ") TARGET_C_PROPERTIES (clear_open_chk STATIC " " " ")

View File

@ -8,20 +8,32 @@
# -------------------------------------------------------------------- # --------------------------------------------------------------------
# Copy all the HDF5 files from the source directory into the test directory # Copy all the HDF5 files from the source directory into the test directory
# -------------------------------------------------------------------- # --------------------------------------------------------------------
set (HDF5_TEST_FILES
h5clear_log_v3.h5
h5clear_mdc_image.h5
mod_h5clear_mdc_image.h5
latest_h5clear_log_v3.h5
latest_h5clear_sec2_v3.h5
)
set (HDF5_SEC2_TEST_FILES
h5clear_sec2_v0.h5
h5clear_sec2_v2.h5
h5clear_sec2_v3.h5
)
set (HDF5_REFERENCE_TEST_FILES set (HDF5_REFERENCE_TEST_FILES
h5clear_usage.ddl h5clear_usage.ddl
h5clear_open_fail.ddl h5clear_open_fail.ddl
h5clear_missing_file.ddl h5clear_missing_file.ddl
h5clear_no_mdc_image.ddl h5clear_no_mdc_image.ddl
orig_h5clear_sec2_v0.h5
orig_h5clear_sec2_v2.h5
orig_h5clear_sec2_v3.h5
mod_h5clear_mdc_image.h5
) )
foreach (h5_file ${HDF5_REFERENCE_TEST_FILES}) foreach (h5_file ${HDF5_TEST_FILES} ${HDF5_SEC2_TEST_FILES} ${HDF5_REFERENCE_TEST_FILES})
HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/testfiles/${h5_file}" "${PROJECT_BINARY_DIR}/testfiles/${h5_file}" "h5clear_files") HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/testfiles/${h5_file}" "${PROJECT_BINARY_DIR}/testfiles/${h5_file}" "h5clear_files")
endforeach () endforeach ()
# make second copy of h5clear_sec2.h5
foreach (h5_file ${HDF5_SEC2_TEST_FILES})
HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/testfiles/${h5_file}" "${PROJECT_BINARY_DIR}/testfiles/orig_${h5_file}" "h5clear_files")
endforeach ()
# make second copy of mod_h5clear_mdc_image.h5 # make second copy of mod_h5clear_mdc_image.h5
HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/testfiles/mod_h5clear_mdc_image.h5" "${PROJECT_BINARY_DIR}/testfiles/mod_h5clear_mdc_image2.h5" "h5clear_files") HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/testfiles/mod_h5clear_mdc_image.h5" "${PROJECT_BINARY_DIR}/testfiles/mod_h5clear_mdc_image2.h5" "h5clear_files")
add_custom_target(h5clear_files ALL COMMENT "Copying files needed by h5clear tests" DEPENDS ${h5clear_files_list}) add_custom_target(h5clear_files ALL COMMENT "Copying files needed by h5clear tests" DEPENDS ${h5clear_files_list})
@ -73,6 +85,16 @@
macro (ADD_H5_TEST testname resultcode) macro (ADD_H5_TEST testname resultcode)
if (NOT HDF5_ENABLE_USING_MEMCHECKER) if (NOT HDF5_ENABLE_USING_MEMCHECKER)
add_test (
NAME H5CLEAR-clear_open_chk-copy_${testname}.h5
COMMAND ${CMAKE_COMMAND}
-E copy_if_different
"${PROJECT_SOURCE_DIR}/testfiles/${testname}.h5" "${PROJECT_BINARY_DIR}/testfiles/${testname}.h5"
)
if (NOT "${last_test}" STREQUAL "")
set_tests_properties (H5CLEAR-clear_open_chk-copy_${testname}.h5 PROPERTIES DEPENDS ${last_test})
endif ()
set (last_test "H5CLEAR-clear_open_chk-copy_${testname}.h5")
# Initial file open fails OR # Initial file open fails OR
# File open succeeds because the library does not check status_flags for file with < v3 superblock # File open succeeds because the library does not check status_flags for file with < v3 superblock
add_test (NAME H5CLEAR-clear_open_chk-${testname}_${resultcode} COMMAND $<TARGET_FILE:clear_open_chk> ${testname}.h5) add_test (NAME H5CLEAR-clear_open_chk-${testname}_${resultcode} COMMAND $<TARGET_FILE:clear_open_chk> ${testname}.h5)
@ -101,6 +123,7 @@
# #
# #
# The following are tests to verify the status_flags field is cleared properly: # The following are tests to verify the status_flags field is cleared properly:
if (HDF5_ENABLE_USING_MEMCHECKER)
# Remove any output file left over from previous test run # Remove any output file left over from previous test run
add_test ( add_test (
NAME H5CLEAR-clearall-objects NAME H5CLEAR-clearall-objects
@ -111,34 +134,81 @@
h5clear_sec2_v0.h5 h5clear_sec2_v0.h5
h5clear_sec2_v2.h5 h5clear_sec2_v2.h5
h5clear_sec2_v3.h5 h5clear_sec2_v3.h5
orig_h5clear_sec2_v0.h5
orig_h5clear_sec2_v2.h5
orig_h5clear_sec2_v3.h5
latest_h5clear_log_v3.h5 latest_h5clear_log_v3.h5
latest_h5clear_sec2_v3.h5 latest_h5clear_sec2_v3.h5
mod_h5clear_mdc_image.h5
mod_h5clear_mdc_image2.h5
) )
if (NOT "${last_test}" STREQUAL "") if (NOT "${last_test}" STREQUAL "")
set_tests_properties (H5CLEAR-clearall-objects PROPERTIES DEPENDS ${last_test}) set_tests_properties (H5CLEAR-clearall-objects PROPERTIES DEPENDS ${last_test})
endif () endif ()
set (last_test "H5CLEAR-clearall-objects") set (last_test "H5CLEAR-clearall-objects")
# create the output files to be used. foreach (h5_file ${HDF5_TEST_FILES} ${HDF5_SEC2_TEST_FILES})
add_test (NAME H5CLEAR-h5clear_gentest COMMAND $<TARGET_FILE:h5clear_gentest>) add_test (
set_tests_properties (H5CLEAR-h5clear_gentest PROPERTIES DEPENDS "H5CLEAR-clearall-objects") NAME H5CLEAR-copy_${h5_file}
set_tests_properties (H5CLEAR-h5clear_gentest PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") COMMAND ${CMAKE_COMMAND}
set (last_test "H5CLEAR-h5clear_gentest") -E copy_if_different
"${PROJECT_SOURCE_DIR}/testfiles/${h5_file}" "${PROJECT_BINARY_DIR}/testfiles/${h5_file}"
)
if (NOT "${last_test}" STREQUAL "")
set_tests_properties (H5CLEAR-copy_${h5_file} PROPERTIES DEPENDS ${last_test})
endif ()
set (last_test "H5CLEAR-copy_${h5_file}")
endforeach ()
# make second copy of h5clear_sec2.h5
foreach (h5_file ${HDF5_SEC2_TEST_FILES})
add_test (
NAME H5CLEAR-copy_orig_${h5_file}
COMMAND ${CMAKE_COMMAND}
-E copy_if_different
"${PROJECT_SOURCE_DIR}/testfiles/${h5_file}" "${PROJECT_BINARY_DIR}/testfiles/orig_${h5_file}"
)
if (NOT "${last_test}" STREQUAL "")
set_tests_properties (H5CLEAR-copy_orig_${h5_file} PROPERTIES DEPENDS ${last_test})
endif ()
set (last_test "H5CLEAR-copy_orig_${h5_file}")
endforeach ()
add_test (
NAME H5CLEAR-copy_mod_h5clear_mdc_image.h5
COMMAND ${CMAKE_COMMAND}
-E copy_if_different
"${PROJECT_SOURCE_DIR}/testfiles/mod_h5clear_mdc_image.h5" "${PROJECT_BINARY_DIR}/testfiles/mod_h5clear_mdc_image.h5"
)
if (NOT "${last_test}" STREQUAL "")
set_tests_properties (H5CLEAR-copy_mod_h5clear_mdc_image.h5 PROPERTIES DEPENDS ${last_test})
endif ()
set (last_test "H5CLEAR-copy_mod_h5clear_mdc_image.h5")
# make second copy of mod_h5clear_mdc_image.h5
add_test (
NAME H5CLEAR-copy_mod_h5clear_mdc_image2.h5
COMMAND ${CMAKE_COMMAND}
-E copy_if_different
"${PROJECT_SOURCE_DIR}/testfiles/mod_h5clear_mdc_image.h5" "${PROJECT_BINARY_DIR}/testfiles/mod_h5clear_mdc_image2.h5"
)
if (NOT "${last_test}" STREQUAL "")
set_tests_properties (H5CLEAR-copy_mod_h5clear_mdc_image2.h5 PROPERTIES DEPENDS ${last_test})
endif ()
set (last_test "H5CLEAR-copy_mod_h5clear_mdc_image2.h5")
endif()
# #
# #
# #
# The following are tests to verify the expected output from h5clear # The following are tests to verify the expected output from h5clear
# "h5clear -h" # "h5clear -h"
# "h5clear" (no options, no file) # "h5clear" (no options, no file)
# "h5clear junk.h5" (no options, nonexisting file) # "h5clear junk.h5" (no options, nonexisting file)
# "h5clear orig_h5clear_sec2_v3.h5" (no options, existing file) # "h5clear orig_h5clear_sec2_v3.h5" (no options, existing file)
# "h5clear -m" (valid 1 option, no file) # "h5clear -m" (valid 1 option, no file)
# "h5clear -s junk.h5" (valid 1 option, nonexisting file) # "h5clear -s junk.h5" (valid 1 option, nonexisting file)
# "h5clear -m -s junk.h5" (valid 2 options, no file) # "h5clear -m -s" (valid 2 options, no file)
# "h5clear -m -s junk.h5" (valid 2 options, nonexisting file) # "h5clear -m -s junk.h5" (valid 2 options, nonexisting file)
# "h5clear -m orig_h5clear_sec2_v2.h5" (valid 1 option, existing file, no cache image) # "h5clear -m orig_h5clear_sec2_v2.h5" (valid 1 option, existing file, no cache image)
# "h5clear -s -m orig_h5clear_sec2_v0.h5" (valid 2 options, existing file, no cache image) # "h5clear -s -m orig_h5clear_sec2_v0.h5" (valid 2 options, existing file, no cache image)
ADD_H5_CMP (h5clear_usage_h h5clear_usage 0 "-h") ADD_H5_CMP (h5clear_usage_h h5clear_usage 0 "-h")
ADD_H5_CMP (h5clear_usage h5clear_usage 1 "") ADD_H5_CMP (h5clear_usage h5clear_usage 1 "")
ADD_H5_CMP (h5clear_usage_junk h5clear_usage 1 "" junk.h5) ADD_H5_CMP (h5clear_usage_junk h5clear_usage 1 "" junk.h5)
@ -148,7 +218,7 @@
ADD_H5_CMP (h5clear_missing_file_ms h5clear_missing_file 1 "-m" "-s") ADD_H5_CMP (h5clear_missing_file_ms h5clear_missing_file 1 "-m" "-s")
ADD_H5_CMP (h5clear_open_fail_ms h5clear_open_fail 1 "-m" "-s" junk.h5) ADD_H5_CMP (h5clear_open_fail_ms h5clear_open_fail 1 "-m" "-s" junk.h5)
ADD_H5_CMP (h5clear_no_mdc_image_m h5clear_no_mdc_image 0 "-m" orig_h5clear_sec2_v2.h5) ADD_H5_CMP (h5clear_no_mdc_image_m h5clear_no_mdc_image 0 "-m" orig_h5clear_sec2_v2.h5)
ADD_H5_CMP (h5clear_no_mdc_image_ms h5clear_no_mdc_image 0 "-m" "-s" orig_h5clear_sec2_v0.h5) ADD_H5_CMP (h5clear_no_mdc_image_ms h5clear_no_mdc_image 0 "-s" "-m" orig_h5clear_sec2_v0.h5)
# #
# #
# #
@ -160,9 +230,9 @@
# "h5clear -l h5clear_sec2_v2.h5" (invalid 1 option, existing file, fail exit code) # "h5clear -l h5clear_sec2_v2.h5" (invalid 1 option, existing file, fail exit code)
# "h5clear -m -k" (valid/invalid 2 options, nofile, fail exit code) # "h5clear -m -k" (valid/invalid 2 options, nofile, fail exit code)
# "h5clear -l -m" (invalid/valid 2 options, nofile, fail exit code) # "h5clear -l -m" (invalid/valid 2 options, nofile, fail exit code)
# "h5clear -m -k junk.h5" (valid/invalid 2 options, nonexisting file, fail exit code) # "h5clear -m -l junk.h5" (valid/invalid 2 options, nonexisting file, fail exit code)
# "h5clear -l -m junk.h5" (invalid/valid 2 options, nonexisting file, fail exit code) # "h5clear -l -m junk.h5" (invalid/valid 2 options, nonexisting file, fail exit code)
# "h5clear -m -k h5clear_sec2_v0.h5" (valid/invalid 2 options, existing file, fail exit code) # "h5clear -m -l h5clear_sec2_v0.h5" (valid/invalid 2 options, existing file, fail exit code)
# "h5clear -l -m h5clear_sec2_v0.h5" (invalid/valid 2 options, existing file, fail exit code) # "h5clear -l -m h5clear_sec2_v0.h5" (invalid/valid 2 options, existing file, fail exit code)
ADD_H5_RETTEST (h5clear_mdc_image "false" "-m" h5clear_mdc_image.h5) ADD_H5_RETTEST (h5clear_mdc_image "false" "-m" h5clear_mdc_image.h5)
ADD_H5_RETTEST (h5clear_vers "false" "--vers") ADD_H5_RETTEST (h5clear_vers "false" "--vers")
@ -173,14 +243,14 @@
ADD_H5_RETTEST (h5clear_lm "true" "-l" "-m") ADD_H5_RETTEST (h5clear_lm "true" "-l" "-m")
ADD_H5_RETTEST (h5clear_ml_junk "true" "-m" "-l" junk.h5) ADD_H5_RETTEST (h5clear_ml_junk "true" "-m" "-l" junk.h5)
ADD_H5_RETTEST (h5clear_lm_junk "true" "-l" "-m" junk.h5) ADD_H5_RETTEST (h5clear_lm_junk "true" "-l" "-m" junk.h5)
ADD_H5_RETTEST (h5clear_ml_sec2 "true" "-m" "-l" h5clear_sec2_v2.h5) ADD_H5_RETTEST (h5clear_ml_sec2 "true" "-m" "-l" h5clear_sec2_v0.h5)
ADD_H5_RETTEST (h5clear_lm_sec2 "true" "-l" "-m" h5clear_sec2_v2.h5) ADD_H5_RETTEST (h5clear_lm_sec2 "true" "-l" "-m" h5clear_sec2_v0.h5)
# #
# #
# #
# h5clear_mdc_image.h5 already has cache image removed earlier, verify the expected warning from h5clear: # h5clear_mdc_image.h5 already has cache image removed earlier, verify the expected warning from h5clear:
ADD_H5_CMP (h5clear_mdc_image_m h5clear_no_mdc_image 0 "-m" mod_h5clear_mdc_image.h5) ADD_H5_CMP (h5clear_mdc_image_m h5clear_no_mdc_image 0 "-m" mod_h5clear_mdc_image.h5)
ADD_H5_CMP (h5clear_mdc_image_sm h5clear_no_mdc_image 0 "-m" "-s" mod_h5clear_mdc_image2.h5) ADD_H5_CMP (h5clear_mdc_image_sm h5clear_no_mdc_image 0 "-s" "-m" mod_h5clear_mdc_image2.h5)
# #
# #
# #
@ -191,7 +261,3 @@
ADD_H5_TEST (latest_h5clear_log_v3 "true") ADD_H5_TEST (latest_h5clear_log_v3 "true")
ADD_H5_TEST (h5clear_sec2_v0 "false") ADD_H5_TEST (h5clear_sec2_v0 "false")
ADD_H5_TEST (h5clear_sec2_v2 "false") ADD_H5_TEST (h5clear_sec2_v2 "false")
set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES}
h5clear_gentest
)