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

Remove configuration for doctests within ctest

This is never going to work with the parallel nature of ctest so we'll
stick with the script-based approach.
Refs #9639
parent 2be01abe
No related branches found
No related tags found
No related merge requests found
......@@ -7,84 +7,6 @@
# SPHINX_FOUND
# SPHINX_EXECUTABLE
#
# It also adds the macro "sphinx_add_test" for defining
# suites of documentation tests
#
#=============================================================
# SPHINX_ADD_TEST()
# Adds a set of Sphinx doctests run using the sphinx_builder
# It is assumed that the test files are all given as relative
# paths ${SPHINX_SRC_DIR}
#
# Parameters:
# _testname_prefix :: A prefix for each test that is added to ctest, the name will be
# ${_testname_prefix}_TestName
# _doctest_runner_script :: The path to the runsphinx_doctest script
# ${ARGN} :: List of test files
#=============================================================
macro ( SPHINX_ADD_TEST _testname_prefix _doctest_runner_script )
# The ideal would be to simply use sphinx-build everywhere but on Windows we would need
# to call a debug version of sphinx-build, which we don't have. We therefore a
# wrapper script, to run the test.
# If the script finds an environment variable SPHINX_SRC_FILE then it will only process
# that file.
# Property for the module directory
if ( MSVC OR CMAKE_GENERATOR STREQUAL Xcode) # both have separate configs
set ( _multiconfig TRUE )
set ( _module_dir ${CMAKE_BINARY_DIR}/bin/Release )
set ( _module_dir_debug ${CMAKE_BINARY_DIR}/bin/Debug )
set ( _working_dir ${_module_dir} )
set ( _working_dir_debug ${_module_dir_debug} )
if ( MSVC )
set ( _debug_exe ${PYTHON_EXECUTABLE_DEBUG} )
set ( _release_exe ${PYTHON_EXECUTABLE} )
else()
set ( _debug_exe ${PYTHON_EXECUTABLE} )
set ( _release_exe ${PYTHON_EXECUTABLE} )
endif()
else()
set ( _module_dir ${CMAKE_BINARY_DIR}/bin )
set ( _working_dir ${_module_dir} )
set ( _debug_exe ${PYTHON_EXECUTABLE} )
set ( _release_exe ${PYTHON_EXECUTABLE} )
endif()
foreach ( part ${ARGN} )
set ( _fullpath ${SPHINX_SRC_DIR}/${part} )
get_filename_component( _filename ${part} NAME )
get_filename_component( _docname ${part} NAME_WE )
set ( _testname "${_testname_prefix}_${_docname}" )
if ( _multiconfig )
# Debug builds need to call the debug executable
add_test ( NAME ${_testname}_Debug CONFIGURATIONS Debug
COMMAND ${_debug_exe} ${_doctest_runner_script} )
set_property ( TEST ${_testname}_Debug PROPERTY
ENVIRONMENT "SPHINX_SRC_FILE=${_fullpath};RUNTIME_CONFIG=Debug" )
set_property ( TEST ${_testname}_Debug PROPERTY
WORKING_DIRECTORY ${_working_dir} )
# Release
add_test ( NAME ${_testname} CONFIGURATIONS Release
COMMAND ${_release_exe} ${_doctest_runner_script} )
set_property ( TEST ${_testname} PROPERTY
ENVIRONMENT "SPHINX_SRC_FILE=${_fullpath};RUNTIME_CONFIG=Release" )
set_property ( TEST ${_testname} PROPERTY
WORKING_DIRECTORY ${_working_dir} )
else ()
add_test ( NAME ${_testname}
COMMAND ${_release_exe} ${_doctest_runner_script} )
set_property ( TEST ${_testname} PROPERTY
ENVIRONMENT "SPHINX_SRC_FILE=${_fullpath}" )
set_property ( TEST ${_testname} PROPERTY
WORKING_DIRECTORY ${_working_dir} )
endif()
endforeach ()
endmacro ()
#=============================================================
# main()
#=============================================================
......
......@@ -85,10 +85,6 @@ if ( SPHINX_FOUND )
# Tests ( It would be nice to have this is a test sub directory but the
# configure of the runsphinx file doesn't like being in two directories.
# Ninja complains about multiple targets creating runsphinx.py.in)
#
# Set up two things:
# - adds a global docs-test target to run all tests
# - adds individual tests through ctest for each rst file.
###############################################################################
###############################################################################
......@@ -109,27 +105,6 @@ if ( SPHINX_FOUND )
EXCLUDE_FROM_DEFAULT_BUILD 1
EXCLUDE_FROM_ALL 1)
###############################################################################
# Add individual test targets for each file, if requested.
# They will require the Framework target to be built
###############################################################################
set ( SEPARATE_DOC_TESTS TRUE CACHE BOOL
"If true, a separate test for each documentation file is added to ctest.")
if( SEPARATE_DOC_TESTS )
# The cmake documentation does not recommend using FILE (GLOB ) for populating
# the list of files for a target: see GLOB section here -
# http://www.cmake.org/cmake/help/v2.8.8/cmake.html#command:file
# However, adding hundreds of files in a list here seems equally bad from a maintenance
# point of view as it will only get worse so we sacrifice not having to re-run cmake
# occasionally when a non-code file is added for readability.
file ( GLOB ALGDOC_TESTS RELATIVE ${SPHINX_SRC_DIR} ${SPHINX_SRC_DIR}/algorithms/*.rst )
sphinx_add_test ( AlgorithmsDocTest ${CMAKE_CURRENT_BINARY_DIR}/runsphinx_doctest.py
${ALGDOC_TESTS} )
endif()
###############################################################################
# Installation settings
###############################################################################
......
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