Merge pull request #155 from rolk/153_datafiles
Make `make test` work on release builds
This commit is contained in:
commit
42e1fc6d10
@ -242,7 +242,7 @@ opm_compile_satellites (opm-core tests "" "^test_([^/]*)$")
|
|||||||
add_custom_target (check
|
add_custom_target (check
|
||||||
COMMAND ${CMAKE_CTEST_COMMAND}
|
COMMAND ${CMAKE_CTEST_COMMAND}
|
||||||
DEPENDS tests
|
DEPENDS tests
|
||||||
COMMENT Checking if library is functional
|
COMMENT "Checking if library is functional"
|
||||||
VERBATIM
|
VERBATIM
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -32,6 +32,7 @@ macro (opm_dist_clean opm)
|
|||||||
${tutorial_DEBUG}
|
${tutorial_DEBUG}
|
||||||
install_manifest.txt
|
install_manifest.txt
|
||||||
${${opm}_STYLESHEET_COPIED}
|
${${opm}_STYLESHEET_COPIED}
|
||||||
|
${tests_INPUT_FILES}
|
||||||
)
|
)
|
||||||
# only remove these files if they were actually copied
|
# only remove these files if they were actually copied
|
||||||
if (NOT PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR)
|
if (NOT PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR)
|
||||||
|
@ -39,13 +39,20 @@
|
|||||||
# opm_compile_satellites (opm-core test "" "^test_([^/]*)$")
|
# opm_compile_satellites (opm-core test "" "^test_([^/]*)$")
|
||||||
#
|
#
|
||||||
macro (opm_compile_satellites opm satellite excl_all test_regexp)
|
macro (opm_compile_satellites opm satellite excl_all test_regexp)
|
||||||
|
# if we are going to build the tests always, then make sure that
|
||||||
|
# the datafiles are present too
|
||||||
|
if (NOT (${excl_all} MATCHES "EXCLUDE_ALL"))
|
||||||
|
set (_incl_all "ALL")
|
||||||
|
else (NOT (${excl_all} MATCHES "EXCLUDE_ALL"))
|
||||||
|
set (_incl_all "")
|
||||||
|
endif (NOT (${excl_all} MATCHES "EXCLUDE_ALL"))
|
||||||
|
|
||||||
# if a set of datafiles has been setup, pull those in
|
# if a set of datafiles has been setup, pull those in
|
||||||
|
add_custom_target (${satellite} ${_incl_all})
|
||||||
if (${satellite}_DATAFILES)
|
if (${satellite}_DATAFILES)
|
||||||
add_custom_target (${satellite} DEPENDS ${${satellite}_DATAFILES})
|
add_dependencies (${satellite} ${${satellite}_DATAFILES})
|
||||||
else (${satellite}_DATAFILES)
|
|
||||||
add_custom_target (${satellite})
|
|
||||||
endif (${satellite}_DATAFILES)
|
endif (${satellite}_DATAFILES)
|
||||||
|
|
||||||
# compile each of these separately
|
# compile each of these separately
|
||||||
foreach (_sat_FILE IN LISTS ${satellite}_SOURCES)
|
foreach (_sat_FILE IN LISTS ${satellite}_SOURCES)
|
||||||
get_filename_component (_sat_NAME "${_sat_FILE}" NAME_WE)
|
get_filename_component (_sat_NAME "${_sat_FILE}" NAME_WE)
|
||||||
@ -71,11 +78,18 @@ macro (opm_compile_satellites opm satellite excl_all test_regexp)
|
|||||||
if (NOT ${test_regexp} STREQUAL "")
|
if (NOT ${test_regexp} STREQUAL "")
|
||||||
string (REGEX REPLACE "${test_regexp}" "\\1" _sat_FANCY "${_sat_NAME}")
|
string (REGEX REPLACE "${test_regexp}" "\\1" _sat_FANCY "${_sat_NAME}")
|
||||||
get_target_property (_sat_LOC ${_sat_NAME} LOCATION)
|
get_target_property (_sat_LOC ${_sat_NAME} LOCATION)
|
||||||
add_test (${_sat_FANCY} ${_sat_LOC})
|
if (CMAKE_VERSION VERSION_LESS "2.8.4")
|
||||||
# run the test in the directory where the data files are
|
add_test (
|
||||||
set_tests_properties (${_sat_FANCY} PROPERTIES
|
NAME ${_sat_FANCY}
|
||||||
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/${${satellite}_DIR}
|
COMMAND ${CMAKE_COMMAND} -E chdir "${PROJECT_BINARY_DIR}/${${satellite}_DIR}" ${_sat_LOC}
|
||||||
)
|
)
|
||||||
|
else (CMAKE_VERSION VERSION_LESS "2.8.4")
|
||||||
|
add_test (${_sat_FANCY} ${_sat_LOC})
|
||||||
|
# run the test in the directory where the data files are
|
||||||
|
set_tests_properties (${_sat_FANCY} PROPERTIES
|
||||||
|
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/${${satellite}_DIR}
|
||||||
|
)
|
||||||
|
endif (CMAKE_VERSION VERSION_LESS "2.8.4")
|
||||||
endif(NOT ${test_regexp} STREQUAL "")
|
endif(NOT ${test_regexp} STREQUAL "")
|
||||||
endforeach (_sat_FILE)
|
endforeach (_sat_FILE)
|
||||||
endmacro (opm_compile_satellites opm prefix)
|
endmacro (opm_compile_satellites opm prefix)
|
||||||
@ -85,7 +99,7 @@ endmacro (opm_compile_satellites opm prefix)
|
|||||||
#
|
#
|
||||||
# provides these output variables:
|
# provides these output variables:
|
||||||
#
|
#
|
||||||
# ${satellite_INPUT_FILES} List of all files that are copied
|
# ${satellite}_INPUT_FILES List of all files that are copied
|
||||||
# ${satellite}_DATAFILES Name of target which copies these files
|
# ${satellite}_DATAFILES Name of target which copies these files
|
||||||
#
|
#
|
||||||
# Example:
|
# Example:
|
||||||
@ -100,7 +114,7 @@ macro (opm_data satellite target files)
|
|||||||
# provide datafiles as inputs for the tests, by copying them
|
# provide datafiles as inputs for the tests, by copying them
|
||||||
# to a tests/ directory in the output tree (if different)
|
# to a tests/ directory in the output tree (if different)
|
||||||
set (${satellite}_INPUT_FILES)
|
set (${satellite}_INPUT_FILES)
|
||||||
file (GLOB ${satellite}_DATA "tests/*.xml")
|
file (GLOB ${satellite}_DATA ${files})
|
||||||
if (NOT PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR)
|
if (NOT PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR)
|
||||||
foreach (input_datafile IN LISTS ${satellite}_DATA)
|
foreach (input_datafile IN LISTS ${satellite}_DATA)
|
||||||
file (RELATIVE_PATH rel_datafile "${PROJECT_SOURCE_DIR}" ${input_datafile})
|
file (RELATIVE_PATH rel_datafile "${PROJECT_SOURCE_DIR}" ${input_datafile})
|
||||||
|
Loading…
Reference in New Issue
Block a user