Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

COMP: Update Slicer test macros to support ExternalData

git-svn-id: http://svn.slicer.org/Slicer4/trunk@21794 3bd1e089-480b-0410-8dfb-8563597acbee
  • Loading branch information...
commit 0aaf5433b326ef4ed71d2b4272e801ffe8e00c42 1 parent 42c84df
Jean-Christophe Fillion-Robin jcfr authored
4 Base/QTCore/qSlicerCoreApplication.cxx
@@ -854,6 +854,10 @@ void qSlicerCoreApplication::handleCommandLineArguments()
854 854 QString pythonCode = options->pythonCode();
855 855 if(!pythonCode.isEmpty())
856 856 {
  857 + // HACK - Waiting the generator expression $<SEMICOLON> is available with the required CMake
  858 + // version, let's proceed to the replacement of "<SEMICOLON>" here.
  859 + // See http://cmake.org/Bug/view.php?id=14003
  860 + pythonCode.replace("<SEMICOLON>", ";");
857 861 qApp->processEvents();
858 862 this->corePythonManager()->executeString(pythonCode);
859 863 }
3  CMake/SlicerConfig.cmake.in
@@ -190,6 +190,9 @@ set(Slicer_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@")
190 190 # --------------------------------------------------------------------------
191 191 # External data
192 192 # --------------------------------------------------------------------------
  193 +if(NOT DEFINED Slicer_ExternalData_DATA_MANAGEMENT_TARGET)
  194 + set(Slicer_ExternalData_DATA_MANAGEMENT_TARGET "@Slicer_ExternalData_DATA_MANAGEMENT_TARGET@")
  195 +endif()
193 196 set(Slicer_ExternalData_OBJECT_STORES "@Slicer_ExternalData_OBJECT_STORES@")
194 197 set(Slicer_ExternalData_URL_TEMPLATES "@Slicer_ExternalData_URL_TEMPLATES@")
195 198
11 CMake/SlicerMacroPythonTesting.cmake
@@ -25,7 +25,7 @@ macro(SLICER_ADD_PYTHON_TEST)
25 25 set(multiValueArgs SLICER_ARGS SCRIPT_ARGS)
26 26 cmake_parse_arguments(MY "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
27 27 get_filename_component(test_name ${MY_SCRIPT} NAME_WE)
28   - add_test(
  28 + ExternalData_add_test(${Slicer_ExternalData_DATA_MANAGEMENT_TARGET}
29 29 NAME py_${MY_TESTNAME_PREFIX}${test_name}
30 30 COMMAND ${Slicer_LAUNCHER_EXECUTABLE}
31 31 --no-splash
@@ -46,13 +46,18 @@ macro(SLICER_ADD_PYTHON_UNITTEST)
46 46 if("${_script_source_dir}" STREQUAL "")
47 47 set(_script_source_dir ${CMAKE_CURRENT_SOURCE_DIR})
48 48 endif()
49   - add_test(
  49 + # HACK - Waiting the generator expression $<SEMICOLON> is available with the required CMake
  50 + # version and since using an unknown genetor expression trigger an error. Let's use
  51 + # "<SEMICOLON>" instead. See associated code in
  52 + # qSlicerCoreApplication::handleCommandLineArguments function.
  53 + # See http://cmake.org/Bug/view.php?id=14003
  54 + ExternalData_add_test(${Slicer_ExternalData_DATA_MANAGEMENT_TARGET}
50 55 NAME py_${MY_TESTNAME_PREFIX}${test_name}
51 56 COMMAND ${Slicer_LAUNCHER_EXECUTABLE}
52 57 --no-splash
53 58 --testing
54 59 --ignore-slicerrc ${Slicer_ADDITIONAL_LAUNCHER_SETTINGS}
55   - --python-code "import slicer.testing; slicer.testing.runUnitTest(['${CMAKE_CURRENT_BINARY_DIR}', '${_script_source_dir}'], '${test_name}')"
  60 + --python-code "import slicer.testing<SEMICOLON> slicer.testing.runUnitTest(['${CMAKE_CURRENT_BINARY_DIR}', '${_script_source_dir}'], '${test_name}')"
56 61 ${MY_SLICER_ARGS}
57 62 )
58 63 set_property(TEST py_${MY_TESTNAME_PREFIX}${test_name} PROPERTY RUN_SERIAL TRUE)
2  CMake/SlicerMacroSimpleTest.cmake
@@ -41,7 +41,7 @@ macro(SIMPLE_TEST testname)
41 41 message(FATAL_ERROR "error: Target '${KIT}CxxTests' is not defined !")
42 42 endif()
43 43
44   - add_test(NAME ${testname}
  44 + ExternalData_add_test(${Slicer_ExternalData_DATA_MANAGEMENT_TARGET} NAME ${testname}
45 45 COMMAND ${Slicer_LAUNCH_COMMAND} $<TARGET_FILE:${KIT}CxxTests> ${testname} ${ARGN})
46 46 set_property(TEST ${testname} PROPERTY LABELS ${KIT})
47 47 endmacro()
6 CMakeLists.txt
@@ -542,6 +542,7 @@ message(STATUS "Configuring Slicer for ${Slicer_OS}-${Slicer_ARCHITECTURE}")
542 542 #-----------------------------------------------------------------------------
543 543 # ExternalData configuration for test data
544 544 #-----------------------------------------------------------------------------
  545 +set(Slicer_ExternalData_DATA_MANAGEMENT_TARGET ${PROJECT_NAME}Data)
545 546 list(APPEND ExternalData_URL_TEMPLATES "http://slicer.kitware.com/midas3/api/rest?method=midas.bitstream.download&checksum=%(hash)")
546 547 set(ExternalData_OBJECT_STORES ${Slicer_BINARY_DIR}/ExternalData/Objects)
547 548 include(ExternalData)
@@ -1042,6 +1043,11 @@ if(NOT Slicer_INSTALL_NO_DEVELOPMENT)
1042 1043 endif()
1043 1044
1044 1045 #-----------------------------------------------------------------------------
  1046 +# Create target to download data from the <Slicer_ExternalData_DATA_MANAGEMENT_TARGET> group.
  1047 +# This must come after all tests have been added that reference the group, so we put it last.
  1048 +ExternalData_Add_Target(${Slicer_ExternalData_DATA_MANAGEMENT_TARGET})
  1049 +
  1050 +#-----------------------------------------------------------------------------
1045 1051 # The commands in this directory are intended to be executed as
1046 1052 # the end of the whole configuration process, as a "last step".
1047 1053 # This directory is typically the last add_subdirectory in the main CMakeLists.txt.

0 comments on commit 0aaf543

Please sign in to comment.
Something went wrong with that request. Please try again.