Skip to content
Snippets Groups Projects
Commit c1bc081d authored by Gigg, Martyn Anthony's avatar Gigg, Martyn Anthony
Browse files

Add cmake option to only create data targets

This is useful for the standalone system tests that won't necessarily
have all of the Mantid build dependencies installed.
Refs #10870
parent f1ba93a9
No related branches found
No related tags found
No related merge requests found
......@@ -305,36 +305,7 @@ endif()
# External Data for testing
###########################################################################
if ( CXXTEST_FOUND OR PYUNITTEST_FOUND )
include ( MantidExternalData )
# None of our tests reference files directly as arguments so we have to manually
# call ExternalData_Expand_Arguments to register the files with the ExternalData
# mechanism
function(_create_data_target _targetname _content_link_patterns)
get_filename_component ( EXTERNALDATATEST_SOURCE_DIR ${PROJECT_SOURCE_DIR} ABSOLUTE )
foreach(_pattern ${_content_link_patterns})
file( GLOB_RECURSE _content_links
RELATIVE "${EXTERNALDATATEST_SOURCE_DIR}" ${_pattern} )
foreach(link ${_content_links})
string( REGEX REPLACE "\\.md5$" "" link ${link} )
ExternalData_Expand_Arguments( ${_targetname}
link_location
DATA{${link}}
)
endforeach()
endforeach()
# Create target to download data from the StandardTestData group. This must come after
# all tests have been added that reference the group, so we put it last.
ExternalData_Add_Target(${_targetname})
set_target_properties(${_targetname} PROPERTIES EXCLUDE_FROM_ALL TRUE)
endfunction()
# We'll create two targets:
# - StandardTestData: data required by the unit tests and documentation tests
# - SystemTestData: data required for the system tests
_create_data_target(StandardTestData "Testing/Data/DocTest/*.md5;Testing/Data/UnitTest/*.md5")
_create_data_target(SystemTestData "Testing/Data/SystemTest/*.md5;Testing/SystemTests/tests/analysis/reference/*.md5")
include( SetupDataTargets )
endif()
###########################################################################
......
###########################################################################
# Define targets to download the data
###########################################################################
include ( MantidExternalData )
# None of our tests reference files directly as arguments so we have to manually
# call ExternalData_Expand_Arguments to register the files with the ExternalData
# mechanism
function(_create_data_target _targetname _content_link_patterns)
get_filename_component ( EXTERNALDATATEST_SOURCE_DIR ${PROJECT_SOURCE_DIR} ABSOLUTE )
foreach(_pattern ${_content_link_patterns})
file( GLOB_RECURSE _content_links
RELATIVE "${EXTERNALDATATEST_SOURCE_DIR}" ${_pattern} )
foreach(link ${_content_links})
string( REGEX REPLACE "\\.md5$" "" link ${link} )
ExternalData_Expand_Arguments( ${_targetname}
link_location
DATA{${link}}
)
endforeach()
endforeach()
# Create target to download data from the StandardTestData group. This must come after
# all tests have been added that reference the group, so we put it last.
ExternalData_Add_Target(${_targetname})
set_target_properties(${_targetname} PROPERTIES EXCLUDE_FROM_ALL TRUE)
endfunction()
# We'll create two targets:
# - StandardTestData: data required by the unit tests and documentation tests
# - SystemTestData: data required for the system tests
_create_data_target(StandardTestData "Testing/Data/DocTest/*.md5;Testing/Data/UnitTest/*.md5")
_create_data_target(SystemTestData "Testing/Data/SystemTest/*.md5;Testing/SystemTests/tests/analysis/reference/*.md5")
......@@ -41,11 +41,11 @@ fi
cd $WORKSPACE/build
###############################################################################
# CMake configuration if it has not already been configured
# CMake configuration if it has not already been configured.
# We use the special flag that only creates the targets for the data
###############################################################################
if [[ ! -e $WORKSPACE/build/CMakeCache.txt ]]; then
$SCL_ON_RHEL6 "cmake -DMANTID_DATA_STORE=${MANTID_DATA_STORE} -DTESTING_DATA_ONLY=ON ../Code/Mantid"
$SCL_ON_RHEL6 "cmake -DMANTID_DATA_STORE=${MANTID_DATA_STORE} -DDATA_TARGETS_ONLY=ON ../Code/Mantid"
fi
###############################################################################
......
......@@ -12,6 +12,17 @@ set ( CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/Build/CMake")
# Define the project name.
project ( Mantid )
###########################################################################
# Quick exit if we only want data targets
###########################################################################
if( DATA_TARGETS_ONLY )
include( SetupDataTargets )
# System test config files
add_subdirectory( Testing/SystemTests/scripts )
return()
endif()
set ( CPACK_PACKAGE_SUFFIX "" CACHE STRING "suffix used to determine the deployment type")
set_property(CACHE CPACK_PACKAGE_SUFFIX PROPERTY STRINGS nightly unstable "") #empty string and release are treated as the same thing
......@@ -147,7 +158,7 @@ add_subdirectory ( scripts )
add_subdirectory ( docs )
# System tests
# System test data target
add_subdirectory ( Testing/SystemTests/scripts )
###########################################################################
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment