opm_add_test: make default working directory configurable
The "default default" is the source directory of the project in order to avoid having to copy the data files which are necessary for executing the tests. (copying them is an almost impossible thing to do in general, since the file system layout of the project is not standardized.) this can be changed using the new opm_set_test_default_working_directory() macro. having said this, some tests may have to write some output to disk during execution and the source directory should not be assumed to be writable (e.g., it could be burned on a DVD), i.e., using the build directory by default would be the more sensible choice IMO.
This commit is contained in:
@@ -216,9 +216,15 @@ macro(opm_add_test TestName)
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
# the default working directory is the build directory
|
||||
# the default working directory is the content of
|
||||
# OPM_TEST_DEFAULT_WORKING_DIRECTORY or the source directory if this
|
||||
# is unspecified
|
||||
if (NOT CURTEST_WORKING_DIRECTORY)
|
||||
set(CURTEST_WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
|
||||
if (OPM_TEST_DEFAULT_WORKING_DIRECTORY)
|
||||
set(CURTEST_WORKING_DIRECTORY ${OPM_TEST_DEFAULT_WORKING_DIRECTORY})
|
||||
else()
|
||||
set(CURTEST_WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# don't build the tests by _default_ if BUILD_TESTING is false,
|
||||
@@ -329,3 +335,9 @@ macro(opm_set_test_driver DriverBinary DriverDefaultArgs)
|
||||
set(OPM_TEST_DRIVER "${DriverBinary}")
|
||||
set(OPM_TEST_DRIVER_ARGS "${DriverDefaultArgs}")
|
||||
endmacro()
|
||||
|
||||
# macro to set the default test driver script and the its default
|
||||
# arguments
|
||||
macro(opm_set_test_default_working_directory Dir)
|
||||
set(OPM_TEST_DEFAULT_WORKING_DIRECTORY "${Dir}")
|
||||
endmacro()
|
||||
|
||||
Reference in New Issue
Block a user