Commit 728c361f authored by David Fairbrother's avatar David Fairbrother
Browse files

Makes SysTests and Workbench runnable from MSVC IDE

Updates the CMake configuration to set our debugging targets. This means
a user can debug Workbench or System tests, which have a python entry
point, directly from the MSVC IDE.
parent f428121b
......@@ -113,6 +113,7 @@ if(MSVC)
"The location of the pythonw executable. This suppresses the new terminal window on startup"
FORCE
)
set(THIRD_PARTY_BIN
"${THIRD_PARTY_DIR}/bin;${THIRD_PARTY_DIR}/lib/qt4/bin;${THIRD_PARTY_DIR}/lib/qt5/bin;${MSVC_PYTHON_EXECUTABLE_DIR}"
)
......
......@@ -128,18 +128,23 @@ else ()
set (PARAVIEW_PYTHON_PATHS "" )
endif ()
set(MSVC_BIN_DIR ${PROJECT_BINARY_DIR}/bin/$<CONFIG>)
configure_file ( ${PACKAGING_DIR}/mantidpython.bat.in
${PROJECT_BINARY_DIR}/mantidpython.bat.in @ONLY )
# place it in the appropriate directory
file(GENERATE
OUTPUT
${PROJECT_BINARY_DIR}/bin/$<$<CONFIG:Release>:Release>$<$<CONFIG:Debug>:Debug>/mantidpython.bat
${MSVC_BIN_DIR}/mantidpython.bat
INPUT
${PROJECT_BINARY_DIR}/mantidpython.bat.in
)
# install version
set ( MANTIDPYTHON_PREAMBLE "set PYTHONHOME=%_BIN_DIR%\nset PATH=%_BIN_DIR%;%_BIN_DIR%\\..\\plugins;%_BIN_DIR%\\..\\PVPlugins;%PATH%" )
# Semi-colon gen exp prevents future generators converting to CMake lists
set ( MSVC_IDE_ENV "PYTHONPATH=${MSVC_BIN_DIR}$<SEMICOLON>PYTHONHOME=${MSVC_PYTHON_EXECUTABLE_DIR}" )
if (MAKE_VATES)
set ( PV_LIBS "%_BIN_DIR%\\..\\lib\\paraview-${PARAVIEW_VERSION_MAJOR}.${PARAVIEW_VERSION_MINOR}")
set ( PARAVIEW_PYTHON_PATHS ";${PV_LIBS}\\site-packages;${PV_LIBS}\\site-packages\\vtk" )
......@@ -150,6 +155,17 @@ endif ()
configure_file ( ${PACKAGING_DIR}/mantidpython.bat.in
${PROJECT_BINARY_DIR}/mantidpython.bat.install @ONLY )
##########################################################################
# Custom targets to fix-up and run Python entry point code
##########################################################################
add_custom_target(SystemTests)
add_dependencies(SystemTests Framework StandardTestData SystemTestData)
set_target_properties(SystemTests PROPERTIES
VS_DEBUGGER_COMMAND "${PYTHON_EXECUTABLE}"
VS_DEBUGGER_COMMAND_ARGUMENTS "${CMAKE_SOURCE_DIR}/Testing/SystemTests/scripts/runSystemTests.py --executable \"${MSVC_BIN_DIR}/mantidpython.bat\" --exec-args \" --classic\""
VS_DEBUGGER_ENVIRONMENT "${MSVC_IDE_ENV}"
)
###########################################################################
# (Fake) installation variables to keep windows sweet
###########################################################################
......
......@@ -201,6 +201,22 @@ fixed when running CMake, e.g.
cd build
systemtest
Selecting Tests to Run From IDE
-------------------------------
System tests can be ran from the MSVC IDE using the ``SystemTests`` target,
which behaves in a similar way to unit test targets. One key advantage is
that it allows you to start Mantid in a debug environment rather than attach
to one midway through.
To select an individual test, or range of tests, go to the ``SystemTests``
properties, go to ```Command Arguments``` and append flags as appropriate.
For example, adding ``-R ISIS`` will run any tests which match the regular
expression ``ISIS``.
Selecting Tests To Run
----------------------
......@@ -217,6 +233,7 @@ e.g.
would run all of the tests whose name contains SNS.
Running the tests on multiple cores
-----------------------------------
......
......@@ -12,6 +12,12 @@ add_python_package(workbench
INSTALL_BIN_DIR "${WORKBENCH_BIN_DIR}"
)
set_target_properties(workbench PROPERTIES
VS_DEBUGGER_COMMAND $<$<BOOL:${WIN32}>:${PYTHON_EXECUTABLE}>
VS_DEBUGGER_COMMAND_ARGUMENTS $<$<BOOL:${WIN32}>:${MSVC_BIN_DIR}/workbench-script.pyw>
VS_DEBUGGER_ENVIRONMENT $<$<BOOL:${WIN32}>:${MSVC_IDE_ENV}>
)
set(_images_qrc_file ${CMAKE_CURRENT_LIST_DIR}/resources.qrc)
if (WIN32)
......
Markdown is supported
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