Commit 6e4edcc1 authored by Owen Arnold's avatar Owen Arnold
Browse files

Merge pull request #150 from mantidproject/feature/10869_external_data_support

Added external data support to mantid
parents 9c01cee3 f0ac5f5e
......@@ -301,6 +301,35 @@ else()
message ( STATUS "Could not find Squish - GUI testing not available. Try specifying your SQUISH_INSTALL_DIR cmake variable." )
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
get_filename_component ( EXTERNALDATATEST_SOURCE_DIR ${PROJECT_SOURCE_DIR} ABSOLUTE )
file( GLOB_RECURSE doctest_content_links
RELATIVE "${EXTERNALDATATEST_SOURCE_DIR}" "Testing/Data/DocTest/*.md5" )
file( GLOB_RECURSE unittest_content_links
RELATIVE "${EXTERNALDATATEST_SOURCE_DIR}" "Testing/Data/UnitTest/*.md5" )
set ( content_links "${doctest_content_links};${unittest_content_links}" )
foreach(link ${content_links})
string( REGEX REPLACE "\\.md5$" "" link ${link} )
ExternalData_Expand_Arguments( StandardTestData
link_location
DATA{${link}}
)
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(StandardTestData)
set_target_properties(StandardTestData PROPERTIES EXCLUDE_FROM_ALL TRUE)
endif()
###########################################################################
# Set a flag to indicate that this script has been called
###########################################################################
......
################################################################################
# Setup the ExternalData variables for the project
################################################################################
include(ExternalData)
if(NOT MANTID_DATA_STORE)
# Select a default in the home directory
set(MANTID_DATA_STORE_DEFAULT "$ENV{HOME}/MantidExternalData")
endif()
# Provide users with an option to select a local object store,
# starting with the above-selected default.
set(MANTID_DATA_STORE "${MANTID_DATA_STORE_DEFAULT}" CACHE PATH
"Local directory holding ExternalData objects in the layout %(algo)/%(hash).")
mark_as_advanced(MANTID_DATA_STORE)
if(NOT MANTID_DATA_STORE)
message(FATAL_ERROR "MANTID_DATA_STORE not set. It is required for external data")
endif()
# Tell ExternalData module about selected object stores.
list(APPEND ExternalData_OBJECT_STORES
# Store selected by Mantid-specific configuration above.
${MANTID_DATA_STORE}
)
# Default binary root to build directory
set(ExternalData_BINARY_ROOT ${CMAKE_BINARY_DIR}/ExternalData CACHE STRING
"A directory holding the links (copies on windows) to the real content files.")
set(ExternalData_URL_TEMPLATES "" CACHE STRING
"Additional URL templates for the ExternalData CMake script to look for testing data. E.g.
file:///var/bigharddrive/%(algo)/%(hash)")
mark_as_advanced(ExternalData_URL_TEMPLATES)
list(APPEND ExternalData_URL_TEMPLATES
"http://198.74.56.37/ftp/external-data/%(algo)/%(hash)"
)
......@@ -50,6 +50,16 @@ if [[ $(uname) == 'Darwin' ]] && [[ ${JOB_NAME} != *clang* ]]; then
icpc --version
fi
###############################################################################
# Set up the location for the local object store outside of the build and
# source tree, which can be shared by multiple builds.
# It defaults to the parent directory of the workspace but can be overridden
# by setting the MANTID_DATA_STORE environment variable.
###############################################################################
if [ -z "$MANTID_DATA_STORE" ]; then
export MANTID_DATA_STORE=$(dirname $WORKSPACE)
fi
###############################################################################
# Check whether this is a clean build (must have 'clean' in the job name)
###############################################################################
......@@ -104,7 +114,7 @@ fi
###############################################################################
# CMake configuration
###############################################################################
$SCL_ON_RHEL6 "cmake -DCMAKE_BUILD_TYPE=${BUILD_CONFIG} -DENABLE_CPACK=ON -DMAKE_VATES=ON -DParaView_DIR=${PARAVIEW_DIR} -DDOCS_HTML=ON ${PACKAGINGVARS} ../Code/Mantid"
$SCL_ON_RHEL6 "cmake -DCMAKE_BUILD_TYPE=${BUILD_CONFIG} -DENABLE_CPACK=ON -DMAKE_VATES=ON -DParaView_DIR=${PARAVIEW_DIR} -DMANTID_DATA_STORE=${MANTID_DATA_STORE} -DDOCS_HTML=ON ${PACKAGINGVARS} ../Code/Mantid"
###############################################################################
# Coverity build should exit early
......
......@@ -32,6 +32,16 @@ cd %WORKSPACE%
set PATH=%WORKSPACE%\Code\Third_Party\lib\win64;%WORKSPACE%\Code\Third_Party\lib\win64\Python27;%PARAVIEW_DIR%\bin\%BUILD_CONFIG%;%PATH%
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Set up the location for local object store outside of the build and source
:: tree, which can be shared by multiple builds.
:: It defaults to the parent directory of the workspace but can be overridden
:: by setting the MANTID_DATA_STORE environment variable.
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
if NOT DEFINED MANTID_DATA_STORE (
for %%F in ("%WORKSPACE%") do set MANTID_DATA_STORE=%%~dpF
)
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Check whether this is a clean build (must have 'clean' in the job name)
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
......@@ -53,7 +63,7 @@ cd %WORKSPACE%\build
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: CMake configuration
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
"C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" -G "Visual Studio 11 Win64" -DCONSOLE=OFF -DENABLE_CPACK=ON -DMAKE_VATES=ON -DParaView_DIR=%PARAVIEW_DIR% -DUSE_PRECOMPILED_HEADERS=ON %PACKAGE_DOCS% ..\Code\Mantid
"C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" -G "Visual Studio 11 Win64" -DCONSOLE=OFF -DENABLE_CPACK=ON -DMAKE_VATES=ON -DParaView_DIR=%PARAVIEW_DIR% -DMANTID_DATA_STORE=%MANTID_DATA_STORE% -DUSE_PRECOMPILED_HEADERS=ON %PACKAGE_DOCS% ..\Code\Mantid
if ERRORLEVEL 1 exit /B %ERRORLEVEL%
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
......
......@@ -18,6 +18,9 @@ if ( CXXTEST_FOUND )
target_link_libraries( APITest API )
endif()
add_dependencies ( FrameworkTests APITest )
# Test data
add_dependencies ( APITest StandardTestData )
# Add to the 'FrameworkTests' group in VS
set_property ( TARGET APITest PROPERTY FOLDER "UnitTests" )
endif ()
......@@ -111,7 +111,7 @@ public:
std::string msg = fp->setValue("LOQ48127.raw");
TS_ASSERT_EQUALS(msg, "");
// I'm using part of the file's path to check that the property really has found the file, with OptionalLoad the property returns valid whether it finds the file or not
TS_ASSERT(fp->value().find("AutoTestData") != std::string::npos);
TS_ASSERT(fp->value().find("UnitTest") != std::string::npos);
// do this in parts making no assumptions about the identity of the slash that separates directories
TS_ASSERT(fp->value().find("Test") != std::string::npos);
......
......@@ -41,6 +41,9 @@ if ( CXXTEST_FOUND )
target_link_libraries ( AlgorithmsTest Algorithms DataHandling MDEvents ${GMOCK_LIBRARIES} )
add_dependencies ( AlgorithmsTest Crystal CurveFitting MDAlgorithms )
add_dependencies ( FrameworkTests AlgorithmsTest )
# Test data
add_dependencies ( AlgorithmsTest StandardTestData )
# Add to the 'FrameworkTests' group in VS
set_property ( TARGET AlgorithmsTest PROPERTY FOLDER "UnitTests" )
endif ()
......
......@@ -12,6 +12,9 @@ if ( CXXTEST_FOUND )
target_link_libraries ( CrystalTest Crystal DataHandling MDEvents MDAlgorithms ${GMOCK_LIBRARIES} ${GTEST_LIBRARIES})
add_dependencies ( CrystalTest Algorithms CurveFitting )
add_dependencies ( FrameworkTests CrystalTest )
# Test data
add_dependencies ( CrystalTest StandardTestData )
# Add to the 'FrameworkTests' group in VS
set_property ( TARGET CrystalTest PROPERTY FOLDER "UnitTests" )
endif ()
......
......@@ -13,6 +13,9 @@ if ( CXXTEST_FOUND )
target_link_libraries( CurveFittingTest CurveFitting DataHandling DataObjects ${GMOCK_LIBRARIES} ${GTEST_LIBRARIES})
add_dependencies ( CurveFittingTest Algorithms )
add_dependencies ( FrameworkTests CurveFittingTest )
# Test data
add_dependencies ( CurveFittingTest StandardTestData )
# Add to the 'FrameworkTests' group in VS
set_property ( TARGET CurveFittingTest PROPERTY FOLDER "UnitTests" )
endif ()
......
......@@ -15,6 +15,9 @@ if ( CXXTEST_FOUND )
target_link_libraries( DataHandlingTest DataHandling )
add_dependencies ( DataHandlingTest Algorithms MDAlgorithms )
add_dependencies ( FrameworkTests DataHandlingTest )
# Test data
add_dependencies ( DataHandlingTest StandardTestData )
# Add to the 'FrameworkTests' group in VS
set_property ( TARGET DataHandlingTest PROPERTY FOLDER "UnitTests" )
endif ()
......
......@@ -442,7 +442,7 @@ set ( QTPLUGINS "." )
set ( UPDATE_INSTRUMENT_DEFINTITIONS "0" )
set ( ENABLE_USAGE_REPORTS "0" )
set ( PYTHONPLUGIN_DIRS "${MANTID_ROOT}/Framework/PythonInterface/plugins" )
set ( DATADIRS ${MANTID_ROOT}/../../Test/AutoTestData;${MANTID_ROOT}/../../Test/AutoTestData/UsageData;${MANTID_ROOT}/instrument )
set ( DATADIRS ${ExternalData_BINARY_ROOT}/Testing/Data/UnitTest;${ExternalData_BINARY_ROOT}/Testing/Data/DocTest;${MANTID_ROOT}/instrument )
set ( COLORMAPS_FOLDER ${MANTID_ROOT}/Installers/colormaps/ )
set ( MANTIDPUBLISHER "http://upload.mantidproject.org/scriptrepository/payload/publish_debug" )
set ( HTML_ROOT ${DOCS_BUILDDIR}/html )
......
......@@ -10,6 +10,9 @@ if ( CXXTEST_FOUND )
cxxtest_add_test ( KernelTest ${TEST_FILES} )
target_link_libraries( KernelTest Kernel ${GMOCK_LIBRARIES} ${GTEST_LIBRARIES} )
add_dependencies ( FrameworkTests KernelTest )
# Test data
add_dependencies ( KernelTest StandardTestData )
# Add to the 'FrameworkTests' group in VS
set_property ( TARGET KernelTest PROPERTY FOLDER "UnitTests" )
......
......@@ -16,6 +16,9 @@ if ( CXXTEST_FOUND )
target_link_libraries( LiveDataTest LiveData )
add_dependencies ( LiveDataTest DataHandling Algorithms MDAlgorithms )
add_dependencies ( FrameworkTests LiveDataTest )
# Test data
add_dependencies ( LiveDataTest StandardTestData )
# Add to the 'FrameworkTests' group in VS
set_property ( TARGET LiveDataTest PROPERTY FOLDER "UnitTests" )
endif ()
......
......@@ -18,6 +18,9 @@ if ( CXXTEST_FOUND )
endif ()
add_dependencies ( MDAlgorithmsTest DataHandling Algorithms CurveFitting )
add_dependencies ( FrameworkTests MDAlgorithmsTest )
# Test data
add_dependencies ( MDAlgorithmsTest StandardTestData )
# Add to the 'FrameworkTests' group in VS
set_property ( TARGET MDAlgorithmsTest PROPERTY FOLDER "UnitTests" )
endif ()
......
......@@ -21,6 +21,8 @@ if ( CXXTEST_FOUND )
endif ()
add_dependencies ( FrameworkTests MDEventsTest )
# Test data
add_dependencies ( MDEventsTest StandardTestData )
# Add to the 'FrameworkTests' group in VS
set_property ( TARGET MDEventsTest PROPERTY FOLDER "UnitTests" )
......
......@@ -14,6 +14,8 @@ if ( CXXTEST_FOUND )
cxxtest_add_test ( PSISINQTest ${TEST_FILES} )
target_link_libraries ( PSISINQTest SINQ CurveFitting ${MANTIDLIBS} MDEvents )
endif()
# Test data
add_dependencies ( PSISINQTest StandardTestData )
add_dependencies ( FrameworkTests PSISINQTest )
# Add to the 'FrameworkTests' group in VS
......
......@@ -12,6 +12,9 @@ if ( CXXTEST_FOUND )
target_link_libraries ( WorkflowAlgorithmsTest WorkflowAlgorithms Algorithms DataHandling )
add_dependencies ( WorkflowAlgorithmsTest CurveFitting )
add_dependencies ( FrameworkTests WorkflowAlgorithmsTest )
# Test data
add_dependencies ( WorkflowAlgorithmsTest StandardTestData )
# Add to the 'FrameworkTests' group in VS
set_property ( TARGET WorkflowAlgorithmsTest PROPERTY FOLDER "UnitTests" )
endif ()
......
......@@ -13,7 +13,8 @@ if ( CXXTEST_FOUND )
cxxtest_add_test ( CustomInterfacesTest ${TEST_FILES} ${GMOCK_TEST_FILES} )
target_link_libraries( CustomInterfacesTest CustomInterfaces DataObjects ${GMOCK_LIBRARIES} ${GTEST_LIBRARIES} )
add_dependencies( CustomInterfacesTest MDAlgorithms )
# Test data
add_dependencies( CustomInterfacesTest StandardTestData )
add_dependencies( GUITests CustomInterfacesTest )
# Add to the 'UnitTests' group in VS
set_property( TARGET CustomInterfacesTest PROPERTY FOLDER "UnitTests" )
......
......@@ -34,14 +34,14 @@ public:
{
Poco::Path path(*it);
if(path.directory(path.depth() - 1) == "AutoTestData")
if(path.directory(path.depth() - 1) == "UnitTest")
{
m_testDataDir = *it;
break;
}
}
TSM_ASSERT("Unable to find AutoTestData directory", !m_testDataDir.empty());
TSM_ASSERT("Unable to find UnitTest data directory", !m_testDataDir.empty());
m_tmpDir = ConfigService::Instance().getTempDir();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment