diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/CMakeLists.txt | 179 | ||||
-rw-r--r-- | test/CMakeTests.cmake | 212 |
2 files changed, 198 insertions, 193 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 0f44452..2f1b70a 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,84 +1,87 @@ -cmake_minimum_required (VERSION 2.8.10) +cmake_minimum_required (VERSION 2.8.11) PROJECT (HDF5_TEST) #----------------------------------------------------------------------------- # Apply Definitions to compiler in this directory and below #----------------------------------------------------------------------------- -ADD_DEFINITIONS (${HDF5_EXTRA_C_FLAGS}) +add_definitions (${HDF5_EXTRA_C_FLAGS}) #----------------------------------------------------------------------------- # Generate the H5srcdir_str.h file containing user settings needed by compilation #----------------------------------------------------------------------------- -SET (srcdir ${CMAKE_CURRENT_SOURCE_DIR}) -CONFIGURE_FILE (${HDF5_TEST_SOURCE_DIR}/H5srcdir_str.h.in H5srcdir_str.h @ONLY) +set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}) +configure_file (${HDF5_TEST_SOURCE_DIR}/H5srcdir_str.h.in H5srcdir_str.h @ONLY) INCLUDE_DIRECTORIES (${CMAKE_CURRENT_BINARY_DIR}) #----------------------------------------------------------------------------- # Define Test Library Sources #----------------------------------------------------------------------------- -SET (TEST_LIB_SRCS +set (TEST_LIB_SRCS ${HDF5_TEST_SOURCE_DIR}/h5test.c ${HDF5_TEST_SOURCE_DIR}/testframe.c ${HDF5_TEST_SOURCE_DIR}/cache_common.c ) -SET (TEST_LIB_HEADERS +set (TEST_LIB_HEADERS ${HDF5_TEST_SOURCE_DIR}/h5test.h ) -ADD_LIBRARY (${HDF5_TEST_LIB_TARGET} ${LIB_TYPE} ${TEST_LIB_SRCS} ${TEST_LIB_HEADERS}) +add_library (${HDF5_TEST_LIB_TARGET} ${LIB_TYPE} ${TEST_LIB_SRCS} ${TEST_LIB_HEADERS}) TARGET_C_PROPERTIES (${HDF5_TEST_LIB_TARGET} " " " ") -IF (MSVC) - TARGET_LINK_LIBRARIES (${HDF5_TEST_LIB_TARGET} "ws2_32.lib") -ENDIF (MSVC) -IF (MINGW) - TARGET_LINK_LIBRARIES (${HDF5_TEST_LIB_TARGET} "wsock32.lib") -ENDIF (MINGW) -TARGET_LINK_LIBRARIES (${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) +if (MSVC) + target_link_libraries (${HDF5_TEST_LIB_TARGET} "ws2_32.lib") +endif (MSVC) +if (MINGW) + target_link_libraries (${HDF5_TEST_LIB_TARGET} "wsock32.lib") +endif (MINGW) +target_link_libraries (${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) H5_SET_LIB_OPTIONS (${HDF5_TEST_LIB_TARGET} ${HDF5_TEST_LIB_NAME} ${LIB_TYPE}) -SET_TARGET_PROPERTIES (${HDF5_TEST_LIB_TARGET} PROPERTIES FOLDER libraries/test) +set_target_properties (${HDF5_TEST_LIB_TARGET} PROPERTIES + FOLDER libraries/test + INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" +) #----------------------------------------------------------------------------- # If plugin library tests can be tested #----------------------------------------------------------------------------- -IF (BUILD_SHARED_LIBS) +if (BUILD_SHARED_LIBS) # make plugins dir - FILE (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/testdir1") - FILE (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/testdir2") + file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/testdir1") + file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/testdir2") #----------------------------------------------------------------------------- # Define Test Library Sources #----------------------------------------------------------------------------- - SET (TEST_PLUGIN_LIBS + set (TEST_PLUGIN_LIBS dynlib1 dynlib3 ) - SET (TEST2_PLUGIN_LIBS + set (TEST2_PLUGIN_LIBS dynlib2 ) - FOREACH (test_lib ${TEST_PLUGIN_LIBS}) - SET (HDF5_TEST_PLUGIN_LIB_CORENAME "${test_lib}") - SET (HDF5_TEST_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TEST_PLUGIN_LIB_CORENAME}") - SET (HDF5_TEST_PLUGIN_LIB_TARGET ${HDF5_TEST_PLUGIN_LIB_CORENAME}) - ADD_DEFINITIONS (${HDF5_EXTRA_C_FLAGS}) + foreach (test_lib ${TEST_PLUGIN_LIBS}) + set (HDF5_TEST_PLUGIN_LIB_CORENAME "${test_lib}") + set (HDF5_TEST_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TEST_PLUGIN_LIB_CORENAME}") + set (HDF5_TEST_PLUGIN_LIB_TARGET ${HDF5_TEST_PLUGIN_LIB_CORENAME}) + add_definitions (${HDF5_EXTRA_C_FLAGS}) INCLUDE_DIRECTORIES (${HDF5_SRC_DIR}) - ADD_LIBRARY (${HDF5_TEST_PLUGIN_LIB_TARGET} ${LIB_TYPE} ${HDF5_TEST_SOURCE_DIR}/${test_lib}.c) + add_library (${HDF5_TEST_PLUGIN_LIB_TARGET} ${LIB_TYPE} ${HDF5_TEST_SOURCE_DIR}/${test_lib}.c) TARGET_C_PROPERTIES (${HDF5_TEST_PLUGIN_LIB_TARGET} " " " ") - TARGET_LINK_LIBRARIES (${HDF5_TEST_PLUGIN_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) + target_link_libraries (${HDF5_TEST_PLUGIN_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) H5_SET_LIB_OPTIONS ( ${HDF5_TEST_PLUGIN_LIB_TARGET} ${HDF5_TEST_PLUGIN_LIB_NAME} ${LIB_TYPE} HDF5_TEST_PLUGIN_LIB_NAME_RELEASE HDF5_TEST_PLUGIN_LIB_NAME_DEBUG ) - SET_TARGET_PROPERTIES (${HDF5_TEST_PLUGIN_LIB_TARGET} PROPERTIES FOLDER libraries/TEST_PLUGIN) + set_target_properties (${HDF5_TEST_PLUGIN_LIB_TARGET} PROPERTIES FOLDER libraries/TEST_PLUGIN) #----------------------------------------------------------------------------- # Copy plugin library to a plugins folder #----------------------------------------------------------------------------- - ADD_CUSTOM_COMMAND ( + add_custom_command ( TARGET ${HDF5_TEST_PLUGIN_LIB_TARGET} POST_BUILD COMMAND ${CMAKE_COMMAND} @@ -86,30 +89,30 @@ IF (BUILD_SHARED_LIBS) "$<TARGET_FILE:${HDF5_TEST_PLUGIN_LIB_TARGET}>" "${CMAKE_BINARY_DIR}/testdir1/$<TARGET_FILE_NAME:${HDF5_TEST_PLUGIN_LIB_TARGET}>" ) - ENDFOREACH (test_lib ${TEST_PLUGIN_LIBS}) + endforeach (test_lib ${TEST_PLUGIN_LIBS}) - FOREACH (test_lib ${TEST2_PLUGIN_LIBS}) - SET (HDF5_TEST_PLUGIN_LIB_CORENAME "${test_lib}") - SET (HDF5_TEST_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TEST_PLUGIN_LIB_CORENAME}") - SET (HDF5_TEST_PLUGIN_LIB_TARGET ${HDF5_TEST_PLUGIN_LIB_CORENAME}) - ADD_DEFINITIONS (${HDF5_EXTRA_C_FLAGS}) + foreach (test_lib ${TEST2_PLUGIN_LIBS}) + set (HDF5_TEST_PLUGIN_LIB_CORENAME "${test_lib}") + set (HDF5_TEST_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TEST_PLUGIN_LIB_CORENAME}") + set (HDF5_TEST_PLUGIN_LIB_TARGET ${HDF5_TEST_PLUGIN_LIB_CORENAME}) + add_definitions (${HDF5_EXTRA_C_FLAGS}) INCLUDE_DIRECTORIES (${HDF5_SRC_DIR}) - ADD_LIBRARY (${HDF5_TEST_PLUGIN_LIB_TARGET} ${LIB_TYPE} ${HDF5_TEST_SOURCE_DIR}/${test_lib}.c) + add_library (${HDF5_TEST_PLUGIN_LIB_TARGET} ${LIB_TYPE} ${HDF5_TEST_SOURCE_DIR}/${test_lib}.c) TARGET_C_PROPERTIES (${HDF5_TEST_PLUGIN_LIB_TARGET} " " " ") - TARGET_LINK_LIBRARIES (${HDF5_TEST_PLUGIN_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) + target_link_libraries (${HDF5_TEST_PLUGIN_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) H5_SET_LIB_OPTIONS ( ${HDF5_TEST_PLUGIN_LIB_TARGET} ${HDF5_TEST_PLUGIN_LIB_NAME} ${LIB_TYPE} HDF5_TEST_PLUGIN_LIB_NAME_RELEASE HDF5_TEST_PLUGIN_LIB_NAME_DEBUG ) - SET_TARGET_PROPERTIES (${HDF5_TEST_PLUGIN_LIB_TARGET} PROPERTIES FOLDER libraries/TEST_PLUGIN) + set_target_properties (${HDF5_TEST_PLUGIN_LIB_TARGET} PROPERTIES FOLDER libraries/TEST_PLUGIN) #----------------------------------------------------------------------------- # Copy plugin library to a plugins folder #----------------------------------------------------------------------------- - ADD_CUSTOM_COMMAND ( + add_custom_command ( TARGET ${HDF5_TEST_PLUGIN_LIB_TARGET} POST_BUILD COMMAND ${CMAKE_COMMAND} @@ -117,10 +120,10 @@ IF (BUILD_SHARED_LIBS) "$<TARGET_FILE:${HDF5_TEST_PLUGIN_LIB_TARGET}>" "${CMAKE_BINARY_DIR}/testdir2/$<TARGET_FILE_NAME:${HDF5_TEST_PLUGIN_LIB_TARGET}>" ) - ENDFOREACH (test_lib ${TEST2_PLUGIN_LIBS}) -ENDIF (BUILD_SHARED_LIBS) + endforeach (test_lib ${TEST2_PLUGIN_LIBS}) +endif (BUILD_SHARED_LIBS) -SET (testhdf5_SRCS +set (testhdf5_SRCS ${HDF5_TEST_SOURCE_DIR}/testhdf5.c ${HDF5_TEST_SOURCE_DIR}/tarray.c ${HDF5_TEST_SOURCE_DIR}/tattr.c @@ -149,21 +152,21 @@ SET (testhdf5_SRCS ) #-- Adding test for testhdf5 -ADD_EXECUTABLE (testhdf5 ${testhdf5_SRCS}) +add_executable (testhdf5 ${testhdf5_SRCS}) TARGET_NAMING (testhdf5 ${LIB_TYPE}) TARGET_C_PROPERTIES (testhdf5 " " " ") -TARGET_LINK_LIBRARIES (testhdf5 ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) -SET_TARGET_PROPERTIES (testhdf5 PROPERTIES FOLDER test) +target_link_libraries (testhdf5 ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) +set_target_properties (testhdf5 PROPERTIES FOLDER test) MACRO (ADD_H5_EXE file) - ADD_EXECUTABLE (${file} ${HDF5_TEST_SOURCE_DIR}/${file}.c) + add_executable (${file} ${HDF5_TEST_SOURCE_DIR}/${file}.c) TARGET_NAMING (${file} ${LIB_TYPE}) TARGET_C_PROPERTIES (${file} " " " ") - TARGET_LINK_LIBRARIES (${file} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) - SET_TARGET_PROPERTIES (${file} PROPERTIES FOLDER test) + target_link_libraries (${file} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) + set_target_properties (${file} PROPERTIES FOLDER test) ENDMACRO (ADD_H5_EXE file) -SET (H5_TESTS +set (H5_TESTS accum lheap ohdr @@ -215,13 +218,13 @@ SET (H5_TESTS file_image unregister ) -IF (NOT CYGWIN) - SET (H5_TESTS ${H5_TESTS} big) -ENDIF (NOT CYGWIN) +if (NOT CYGWIN) + set (H5_TESTS ${H5_TESTS} big) +endif (NOT CYGWIN) -FOREACH (test ${H5_TESTS}) +foreach (test ${H5_TESTS}) ADD_H5_EXE(${test}) -ENDFOREACH (test ${H5_TESTS}) +endforeach (test ${H5_TESTS}) ############################################################################## ############################################################################## @@ -230,21 +233,21 @@ ENDFOREACH (test ${H5_TESTS}) ############################################################################## #-- Adding test for cache -ADD_EXECUTABLE (cache ${HDF5_TEST_SOURCE_DIR}/cache.c ${HDF5_TEST_SOURCE_DIR}/cache_common.c) +add_executable (cache ${HDF5_TEST_SOURCE_DIR}/cache.c ${HDF5_TEST_SOURCE_DIR}/cache_common.c) TARGET_NAMING (cache ${LIB_TYPE}) TARGET_C_PROPERTIES (cache " " " ") -TARGET_LINK_LIBRARIES (cache ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) -SET_TARGET_PROPERTIES (cache PROPERTIES FOLDER test) +target_link_libraries (cache ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) +set_target_properties (cache PROPERTIES FOLDER test) #-- Adding test for cache_api -ADD_EXECUTABLE (cache_api ${HDF5_TEST_SOURCE_DIR}/cache_api.c ${HDF5_TEST_SOURCE_DIR}/cache_common.c) +add_executable (cache_api ${HDF5_TEST_SOURCE_DIR}/cache_api.c ${HDF5_TEST_SOURCE_DIR}/cache_common.c) TARGET_NAMING (cache_api ${LIB_TYPE}) TARGET_C_PROPERTIES (cache_api " " " ") -TARGET_LINK_LIBRARIES (cache_api ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) -SET_TARGET_PROPERTIES (cache_api PROPERTIES FOLDER test) +target_link_libraries (cache_api ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) +set_target_properties (cache_api PROPERTIES FOLDER test) #-- Adding test for ttsafe -ADD_EXECUTABLE (ttsafe +add_executable (ttsafe ${HDF5_TEST_SOURCE_DIR}/ttsafe.c ${HDF5_TEST_SOURCE_DIR}/ttsafe_dcreate.c ${HDF5_TEST_SOURCE_DIR}/ttsafe_error.c @@ -253,53 +256,53 @@ ADD_EXECUTABLE (ttsafe ) TARGET_NAMING (ttsafe ${LIB_TYPE}) TARGET_C_PROPERTIES (ttsafe " " " ") -TARGET_LINK_LIBRARIES (ttsafe ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) -SET_TARGET_PROPERTIES (ttsafe PROPERTIES FOLDER test) +target_link_libraries (ttsafe ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) +set_target_properties (ttsafe PROPERTIES FOLDER test) #-- Adding test for err_compat -IF (HDF5_ENABLE_DEPRECATED_SYMBOLS) - ADD_EXECUTABLE (err_compat ${HDF5_TEST_SOURCE_DIR}/err_compat.c) +if (HDF5_ENABLE_DEPRECATED_SYMBOLS) + add_executable (err_compat ${HDF5_TEST_SOURCE_DIR}/err_compat.c) TARGET_NAMING (err_compat ${LIB_TYPE}) TARGET_C_PROPERTIES (err_compat " " " ") - TARGET_LINK_LIBRARIES (err_compat ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) - SET_TARGET_PROPERTIES (err_compat PROPERTIES FOLDER test) -ENDIF (HDF5_ENABLE_DEPRECATED_SYMBOLS) + target_link_libraries (err_compat ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) + set_target_properties (err_compat PROPERTIES FOLDER test) +endif (HDF5_ENABLE_DEPRECATED_SYMBOLS) #-- Adding test for error_test -ADD_EXECUTABLE (error_test ${HDF5_TEST_SOURCE_DIR}/error_test.c) +add_executable (error_test ${HDF5_TEST_SOURCE_DIR}/error_test.c) TARGET_NAMING (error_test ${LIB_TYPE}) TARGET_C_PROPERTIES (error_test " " " ") -TARGET_LINK_LIBRARIES (error_test ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) -SET_TARGET_PROPERTIES (error_test PROPERTIES FOLDER test) +target_link_libraries (error_test ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) +set_target_properties (error_test PROPERTIES FOLDER test) #-- Adding test for links_env -ADD_EXECUTABLE (links_env ${HDF5_TEST_SOURCE_DIR}/links_env.c) +add_executable (links_env ${HDF5_TEST_SOURCE_DIR}/links_env.c) TARGET_NAMING (links_env ${LIB_TYPE}) TARGET_C_PROPERTIES (links_env " " " ") -TARGET_LINK_LIBRARIES (links_env ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) -SET_TARGET_PROPERTIES (links_env PROPERTIES FOLDER test) +target_link_libraries (links_env ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) +set_target_properties (links_env PROPERTIES FOLDER test) #-- Adding test for libinfo -SET (GREP_RUNNER ${PROJECT_BINARY_DIR}/GrepRunner.cmake) -FILE (WRITE ${GREP_RUNNER} - "FILE (STRINGS \${TEST_PROGRAM} TEST_RESULT REGEX \"SUMMARY OF THE HDF5 CONFIGURATION\") -IF (\${TEST_RESULT} STREQUAL \"0\") - MESSAGE (FATAL_ERROR \"Failed: The output: \${TEST_RESULT} of \${TEST_PROGRAM} did not contain SUMMARY OF THE HDF5 CONFIGURATION\") -ELSE (\${TEST_RESULT} STREQUAL \"0\") - MESSAGE (STATUS \"COMMAND Result: \${TEST_RESULT}\") -ENDIF (\${TEST_RESULT} STREQUAL \"0\") +set (GREP_RUNNER ${PROJECT_BINARY_DIR}/GrepRunner.cmake) +file (WRITE ${GREP_RUNNER} + "file (STRINGS \${TEST_PROGRAM} TEST_RESULT REGEX \"SUMMARY OF THE HDF5 CONFIGURATION\") +if (\${TEST_RESULT} STREQUAL \"0\") + message (FATAL_ERROR \"Failed: The output: \${TEST_RESULT} of \${TEST_PROGRAM} did not contain SUMMARY OF THE HDF5 CONFIGURATION\") +else (\${TEST_RESULT} STREQUAL \"0\") + message (STATUS \"COMMAND Result: \${TEST_RESULT}\") +endif (\${TEST_RESULT} STREQUAL \"0\") " ) ############################################################################## ### P L U G I N T E S T S ############################################################################## -IF (BUILD_SHARED_LIBS) - ADD_EXECUTABLE (plugin ${HDF5_TEST_SOURCE_DIR}/plugin.c) +if (BUILD_SHARED_LIBS) + add_executable (plugin ${HDF5_TEST_SOURCE_DIR}/plugin.c) TARGET_NAMING (plugin ${LIB_TYPE}) TARGET_C_PROPERTIES (plugin " " " ") - TARGET_LINK_LIBRARIES (plugin ${HDF5_TEST_PLUGIN_LIB_TARGET}) - SET_TARGET_PROPERTIES (plugin PROPERTIES FOLDER test) -ENDIF (BUILD_SHARED_LIBS) + target_link_libraries (plugin ${HDF5_TEST_PLUGIN_LIB_TARGET}) + set_target_properties (plugin PROPERTIES FOLDER test) +endif (BUILD_SHARED_LIBS) -INCLUDE (CMakeTests.cmake) +include (CMakeTests.cmake) diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index be79506..95d1917 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -8,25 +8,25 @@ # -------------------------------------------------------------------- # Copy all the HDF5 files from the test directory into the source directory # -------------------------------------------------------------------- -SET (HDF5_TEST_FILES +set (HDF5_TEST_FILES tnullspace.h5 ) -FOREACH (h5_tfile ${HDF5_TEST_FILES}) - SET (dest "${PROJECT_BINARY_DIR}/${h5_tfile}") - #MESSAGE (STATUS " Copying ${h5_tfile}") - ADD_CUSTOM_COMMAND ( +foreach (h5_tfile ${HDF5_TEST_FILES}) + set (dest "${PROJECT_BINARY_DIR}/${h5_tfile}") + #message (STATUS " Copying ${h5_tfile}") + add_custom_command ( TARGET ${HDF5_TEST_LIB_TARGET} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${HDF5_TOOLS_SRC_DIR}/testfiles/${h5_tfile} ${dest} ) -ENDFOREACH (h5_tfile ${HDF5_TEST_FILES}) +endforeach (h5_tfile ${HDF5_TEST_FILES}) # -------------------------------------------------------------------- # Copy all the HDF5 files from the test directory into the source directory # -------------------------------------------------------------------- -SET (HDF5_REFERENCE_FILES +set (HDF5_REFERENCE_FILES err_compat_1 err_compat_2 error_test_1 @@ -34,21 +34,21 @@ SET (HDF5_REFERENCE_FILES links_env.out ) -FOREACH (ref_file ${HDF5_REFERENCE_FILES}) - SET (dest "${PROJECT_BINARY_DIR}/${ref_file}") - #MESSAGE (STATUS " Copying ${h5_file}") - ADD_CUSTOM_COMMAND ( +foreach (ref_file ${HDF5_REFERENCE_FILES}) + set (dest "${PROJECT_BINARY_DIR}/${ref_file}") + #message (STATUS " Copying ${h5_file}") + add_custom_command ( TARGET ${HDF5_TEST_LIB_TARGET} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${HDF5_TEST_SOURCE_DIR}/testfiles/${ref_file} ${dest} ) -ENDFOREACH (ref_file ${HDF5_REFERENCE_FILES}) +endforeach (ref_file ${HDF5_REFERENCE_FILES}) # -------------------------------------------------------------------- #-- Copy all the HDF5 files from the test directory into the source directory # -------------------------------------------------------------------- -SET (HDF5_REFERENCE_TEST_FILES +set (HDF5_REFERENCE_TEST_FILES be_data.h5 be_extlink1.h5 be_extlink2.h5 @@ -83,19 +83,19 @@ SET (HDF5_REFERENCE_TEST_FILES tsizeslheap.h5 ) -FOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES}) - SET (dest "${HDF5_TEST_BINARY_DIR}/${h5_file}") - #MESSAGE (STATUS " Copying ${h5_file} to ${dest}") - ADD_CUSTOM_COMMAND ( +foreach (h5_file ${HDF5_REFERENCE_TEST_FILES}) + set (dest "${HDF5_TEST_BINARY_DIR}/${h5_file}") + #message (STATUS " Copying ${h5_file} to ${dest}") + add_custom_command ( TARGET ${HDF5_TEST_LIB_TARGET} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${HDF5_TEST_SOURCE_DIR}/${h5_file} ${dest} ) -ENDFOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES}) +endforeach (h5_file ${HDF5_REFERENCE_TEST_FILES}) # Remove any output file left over from previous test run -ADD_TEST ( +add_test ( NAME h5test-clear-testhdf5-objects COMMAND ${CMAKE_COMMAND} -E remove @@ -118,23 +118,23 @@ ADD_TEST ( tsohm_src.h5 ) -IF (HDF5_ENABLE_USING_MEMCHECKER) - ADD_TEST (NAME testhdf5-base COMMAND $<TARGET_FILE:testhdf5> -x heap -x file -x select) - SET_TESTS_PROPERTIES(testhdf5-base PROPERTIES DEPENDS h5test-clear-testhdf5-objects) - SET_TESTS_PROPERTIES(testhdf5-base PROPERTIES ENVIRONMENT HDF5_ALARM_SECONDS=3600) - ADD_TEST (NAME testhdf5-heap COMMAND $<TARGET_FILE:testhdf5> -o heap) - SET_TESTS_PROPERTIES(testhdf5-heap PROPERTIES DEPENDS h5test-clear-testhdf5-objects) - SET_TESTS_PROPERTIES(testhdf5-heap PROPERTIES ENVIRONMENT HDF5_ALARM_SECONDS=3600) - ADD_TEST (NAME testhdf5-file COMMAND $<TARGET_FILE:testhdf5> -o file) - SET_TESTS_PROPERTIES(testhdf5-file PROPERTIES DEPENDS h5test-clear-testhdf5-objects) - SET_TESTS_PROPERTIES(testhdf5-file PROPERTIES ENVIRONMENT HDF5_ALARM_SECONDS=3600) - ADD_TEST (NAME testhdf5-select COMMAND $<TARGET_FILE:testhdf5> -o select) - SET_TESTS_PROPERTIES(testhdf5-select PROPERTIES DEPENDS h5test-clear-testhdf5-objects) - SET_TESTS_PROPERTIES(testhdf5-select PROPERTIES ENVIRONMENT HDF5_ALARM_SECONDS=3600) -ELSE (HDF5_ENABLE_USING_MEMCHECKER) - ADD_TEST (NAME testhdf5 COMMAND $<TARGET_FILE:testhdf5>) - SET_TESTS_PROPERTIES(testhdf5 PROPERTIES DEPENDS h5test-clear-testhdf5-objects) -ENDIF (HDF5_ENABLE_USING_MEMCHECKER) +if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME testhdf5-base COMMAND $<TARGET_FILE:testhdf5> -x heap -x file -x select) + set_tests_properties (testhdf5-base PROPERTIES DEPENDS h5test-clear-testhdf5-objects) + set_tests_properties (testhdf5-base PROPERTIES ENVIRONMENT HDF5_ALARM_SECONDS=3600) + add_test (NAME testhdf5-heap COMMAND $<TARGET_FILE:testhdf5> -o heap) + set_tests_properties (testhdf5-heap PROPERTIES DEPENDS h5test-clear-testhdf5-objects) + set_tests_properties (testhdf5-heap PROPERTIES ENVIRONMENT HDF5_ALARM_SECONDS=3600) + add_test (NAME testhdf5-file COMMAND $<TARGET_FILE:testhdf5> -o file) + set_tests_properties (testhdf5-file PROPERTIES DEPENDS h5test-clear-testhdf5-objects) + set_tests_properties (testhdf5-file PROPERTIES ENVIRONMENT HDF5_ALARM_SECONDS=3600) + add_test (NAME testhdf5-select COMMAND $<TARGET_FILE:testhdf5> -o select) + set_tests_properties (testhdf5-select PROPERTIES DEPENDS h5test-clear-testhdf5-objects) + set_tests_properties (testhdf5-select PROPERTIES ENVIRONMENT HDF5_ALARM_SECONDS=3600) +else (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME testhdf5 COMMAND $<TARGET_FILE:testhdf5>) + set_tests_properties (testhdf5 PROPERTIES DEPENDS h5test-clear-testhdf5-objects) +endif (HDF5_ENABLE_USING_MEMCHECKER) ############################################################################## ############################################################################## @@ -143,7 +143,7 @@ ENDIF (HDF5_ENABLE_USING_MEMCHECKER) ############################################################################## # Remove any output file left over from previous test run -ADD_TEST ( +add_test ( NAME h5test-clear-objects COMMAND ${CMAKE_COMMAND} -E remove @@ -206,12 +206,12 @@ ADD_TEST ( unregister_filter_2.h5 ) -FOREACH (test ${H5_TESTS}) - ADD_TEST (NAME ${test} COMMAND $<TARGET_FILE:${test}>) - SET_TESTS_PROPERTIES(${test} PROPERTIES DEPENDS h5test-clear-objects) -ENDFOREACH (test ${H5_TESTS}) +foreach (test ${H5_TESTS}) + add_test (NAME ${test} COMMAND $<TARGET_FILE:${test}>) + set_tests_properties (${test} PROPERTIES DEPENDS h5test-clear-objects) +endforeach (test ${H5_TESTS}) -SET_TESTS_PROPERTIES(flush2 PROPERTIES DEPENDS flush1) +set_tests_properties (flush2 PROPERTIES DEPENDS flush1) ############################################################################## ############################################################################## @@ -220,27 +220,27 @@ SET_TESTS_PROPERTIES(flush2 PROPERTIES DEPENDS flush1) ############################################################################## #-- Adding test for cache -ADD_TEST ( +add_test ( NAME h5test-clear-cache-objects COMMAND ${CMAKE_COMMAND} -E remove cache_test.h5 ) -ADD_TEST (NAME cache COMMAND $<TARGET_FILE:cache>) -SET_TESTS_PROPERTIES(cache PROPERTIES DEPENDS h5test-clear-cache-objects) +add_test (NAME cache COMMAND $<TARGET_FILE:cache>) +set_tests_properties (cache PROPERTIES DEPENDS h5test-clear-cache-objects) #-- Adding test for cache_api -ADD_TEST ( +add_test ( NAME h5test-clear-cache_api-objects COMMAND ${CMAKE_COMMAND} -E remove cache_api_test.h5 ) -ADD_TEST (NAME cache_api COMMAND $<TARGET_FILE:cache_api>) -SET_TESTS_PROPERTIES(cache_api PROPERTIES DEPENDS h5test-clear-cache_api-objects) +add_test (NAME cache_api COMMAND $<TARGET_FILE:cache_api>) +set_tests_properties (cache_api PROPERTIES DEPENDS h5test-clear-cache_api-objects) #-- Adding test for ttsafe -ADD_TEST ( +add_test ( NAME h5test-clear-ttsafe-objects COMMAND ${CMAKE_COMMAND} -E remove @@ -249,19 +249,19 @@ ADD_TEST ( ttsafe_cancel.h5 ttsafe_acreate.h5 ) -ADD_TEST (NAME ttsafe COMMAND $<TARGET_FILE:ttsafe>) -SET_TESTS_PROPERTIES(ttsafe PROPERTIES DEPENDS h5test-clear-ttsafe-objects) +add_test (NAME ttsafe COMMAND $<TARGET_FILE:ttsafe>) +set_tests_properties (ttsafe PROPERTIES DEPENDS h5test-clear-ttsafe-objects) #-- Adding test for err_compat -IF (HDF5_ENABLE_DEPRECATED_SYMBOLS) - ADD_TEST ( +if (HDF5_ENABLE_DEPRECATED_SYMBOLS) + add_test ( NAME h5test-clear-err_compat-objects COMMAND ${CMAKE_COMMAND} -E remove err_compat.txt err_compat.txt.err ) - ADD_TEST (NAME err_compat COMMAND "${CMAKE_COMMAND}" + add_test (NAME err_compat COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$<TARGET_FILE:err_compat>" -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" @@ -271,18 +271,18 @@ IF (HDF5_ENABLE_DEPRECATED_SYMBOLS) -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -P "${HDF5_RESOURCES_DIR}/runTest.cmake" ) - SET_TESTS_PROPERTIES(err_compat PROPERTIES DEPENDS h5test-clear-err_compat-objects) -ENDIF (HDF5_ENABLE_DEPRECATED_SYMBOLS) + set_tests_properties (err_compat PROPERTIES DEPENDS h5test-clear-err_compat-objects) +endif (HDF5_ENABLE_DEPRECATED_SYMBOLS) #-- Adding test for error_test -ADD_TEST ( +add_test ( NAME h5test-clear-error_test-objects COMMAND ${CMAKE_COMMAND} -E remove error_test.txt error_test.txt.err ) -ADD_TEST (NAME error_test COMMAND "${CMAKE_COMMAND}" +add_test (NAME error_test COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$<TARGET_FILE:error_test>" -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" @@ -292,11 +292,11 @@ ADD_TEST (NAME error_test COMMAND "${CMAKE_COMMAND}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -P "${HDF5_RESOURCES_DIR}/runTest.cmake" ) -SET_TESTS_PROPERTIES(error_test PROPERTIES DEPENDS h5test-clear-error_test-objects) -SET_TESTS_PROPERTIES (error_test PROPERTIES ENVIRONMENT "HDF5_PLUGIN_PRELOAD=::") +set_tests_properties (error_test PROPERTIES DEPENDS h5test-clear-error_test-objects) +set_tests_properties (error_test PROPERTIES ENVIRONMENT "HDF5_PLUGIN_PRELOAD=::") #-- Adding test for links_env -ADD_TEST ( +add_test ( NAME h5test-clear-links_env-objects COMMAND ${CMAKE_COMMAND} -E remove @@ -306,7 +306,7 @@ ADD_TEST ( extlinks_env1.h5 tmp/extlinks_env1.h5 ) -ADD_TEST (NAME links_env COMMAND "${CMAKE_COMMAND}" +add_test (NAME links_env COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$<TARGET_FILE:links_env>" -D "TEST_ARGS:STRING=" -D "TEST_ENV_VAR:STRING=HDF5_EXT_PREFIX" @@ -317,31 +317,31 @@ ADD_TEST (NAME links_env COMMAND "${CMAKE_COMMAND}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -P "${HDF5_RESOURCES_DIR}/runTest.cmake" ) -SET_TESTS_PROPERTIES(links_env PROPERTIES DEPENDS h5test-clear-links_env-objects) +set_tests_properties (links_env PROPERTIES DEPENDS h5test-clear-links_env-objects) #-- Adding test for libinfo -ADD_TEST (NAME testlibinfo COMMAND ${CMAKE_COMMAND} -D "TEST_PROGRAM=$<TARGET_FILE:${HDF5_LIB_TARGET}>" -P "${GREP_RUNNER}") +add_test (NAME testlibinfo COMMAND ${CMAKE_COMMAND} -D "TEST_PROGRAM=$<TARGET_FILE:${HDF5_LIB_TARGET}>" -P "${GREP_RUNNER}") ############################################################################## ### P L U G I N T E S T S ############################################################################## -IF (BUILD_SHARED_LIBS) - - IF (WIN32 AND NOT CYGWIN) - SET(CMAKE_SEP "\;") - ELSE (WIN32 AND NOT CYGWIN) - SET(CMAKE_SEP ":") - ENDIF(WIN32 AND NOT CYGWIN) - - ADD_TEST (NAME H5PLUGIN-plugin COMMAND $<TARGET_FILE:plugin>) - SET_TESTS_PROPERTIES (H5PLUGIN-plugin PROPERTIES ENVIRONMENT "HDF5_PLUGIN_PATH=${CMAKE_BINARY_DIR}/testdir1${CMAKE_SEP}${CMAKE_BINARY_DIR}/testdir2") -ELSE (BUILD_SHARED_LIBS) - MESSAGE (STATUS " **** Plugins libraries must be built as shared libraries **** ") - ADD_TEST ( +if (BUILD_SHARED_LIBS) + + if (WIN32 AND NOT CYGWIN) + set (CMAKE_SEP "\;") + else (WIN32 AND NOT CYGWIN) + set (CMAKE_SEP ":") + endif (WIN32 AND NOT CYGWIN) + + add_test (NAME H5PLUGIN-plugin COMMAND $<TARGET_FILE:plugin>) + set_tests_properties (H5PLUGIN-plugin PROPERTIES ENVIRONMENT "HDF5_PLUGIN_PATH=${CMAKE_BINARY_DIR}/testdir1${CMAKE_SEP}${CMAKE_BINARY_DIR}/testdir2") +else (BUILD_SHARED_LIBS) + message (STATUS " **** Plugins libraries must be built as shared libraries **** ") + add_test ( NAME H5PLUGIN-SKIPPED COMMAND ${CMAKE_COMMAND} -E echo "SKIP H5PLUGIN TESTING" ) -ENDIF (BUILD_SHARED_LIBS) +endif (BUILD_SHARED_LIBS) ############################################################################## ############################################################################## @@ -349,9 +349,9 @@ ENDIF (BUILD_SHARED_LIBS) ############################################################################## ############################################################################## -IF (HDF5_TEST_VFD) +if (HDF5_TEST_VFD) - SET (VFD_LIST + set (VFD_LIST sec2 stdio core @@ -360,7 +360,7 @@ IF (HDF5_TEST_VFD) family ) - SET (H5_VFD_TESTS + set (H5_VFD_TESTS testhdf5 accum lheap @@ -412,17 +412,17 @@ IF (HDF5_TEST_VFD) links_env unregister ) - IF (NOT CYGWIN) - SET (H5_VFD_TESTS "${H5_VFD_TESTS} big") - ENDIF (NOT CYGWIN) + if (NOT CYGWIN) + set (H5_VFD_TESTS "${H5_VFD_TESTS} big") + endif (NOT CYGWIN) - IF (DIRECT_VFD) - SET (VFD_LIST ${VFD_LIST} direct) - ENDIF (DIRECT_VFD) + if (DIRECT_VFD) + set (VFD_LIST ${VFD_LIST} direct) + endif (DIRECT_VFD) MACRO (ADD_VFD_TEST vfdname resultcode) - FOREACH (test ${H5_VFD_TESTS}) - ADD_TEST ( + foreach (test ${H5_VFD_TESTS}) + add_test ( NAME VFD-${vfdname}-${test} COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$<TARGET_FILE:${test}>" @@ -433,9 +433,9 @@ IF (HDF5_TEST_VFD) -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -P "${HDF5_RESOURCES_DIR}/vfdTest.cmake" ) - ENDFOREACH (test ${H5_VFD_TESTS}) - IF (HDF5_TEST_FHEAP_VFD) - ADD_TEST ( + endforeach (test ${H5_VFD_TESTS}) + if (HDF5_TEST_FHEAP_VFD) + add_test ( NAME VFD-${vfdname}-fheap COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$<TARGET_FILE:fheap>" @@ -446,15 +446,15 @@ IF (HDF5_TEST_VFD) -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -P "${HDF5_RESOURCES_DIR}/vfdTest.cmake" ) - ENDIF (HDF5_TEST_FHEAP_VFD) + endif (HDF5_TEST_FHEAP_VFD) ENDMACRO (ADD_VFD_TEST) # Run test with different Virtual File Driver - FOREACH (vfd ${VFD_LIST}) + foreach (vfd ${VFD_LIST}) ADD_VFD_TEST (${vfd} 0) - ENDFOREACH (vfd ${VFD_LIST}) + endforeach (vfd ${VFD_LIST}) -ENDIF (HDF5_TEST_VFD) +endif (HDF5_TEST_VFD) ############################################################################## ############################################################################## @@ -462,23 +462,22 @@ ENDIF (HDF5_TEST_VFD) ############################################################################## ############################################################################## -IF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS) +if (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS) MACRO (ADD_H5_GENERATOR genfile) - ADD_EXECUTABLE (${genfile} ${HDF5_TEST_SOURCE_DIR}/${genfile}.c) + add_executable (${genfile} ${HDF5_TEST_SOURCE_DIR}/${genfile}.c) TARGET_NAMING (${genfile} ${LIB_TYPE}) TARGET_C_PROPERTIES (${genfile} " " " ") - TARGET_LINK_LIBRARIES (${genfile} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) - SET_TARGET_PROPERTIES (${genfile} PROPERTIES FOLDER generator/test) + target_link_libraries (${genfile} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) + set_target_properties (${genfile} PROPERTIES FOLDER generator/test) ENDMACRO (ADD_H5_GENERATOR genfile) # generator executables - SET (H5_GENERATORS + set (H5_GENERATORS gen_bad_ohdr gen_bogus gen_cross gen_deflate gen_filters - gen_idx gen_new_array gen_new_fill gen_new_group @@ -488,12 +487,15 @@ IF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS) gen_nullspace gen_udlinks space_overflow + gen_filespace + gen_specmetaread gen_sizes_lheap gen_file_image + gen_plist ) - FOREACH (gen ${H5_GENERATORS}) + foreach (gen ${H5_GENERATORS}) ADD_H5_GENERATOR (${gen}) - ENDFOREACH (gen ${H5_GENERATORS}) + endforeach (gen ${H5_GENERATORS}) -ENDIF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS) +endif (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS) |