1 # Copyright Raimar Sandner 2012–2014. Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.txt)
5 #! \brief %CMake file for the C++QED testing suite.
7 #! The file has the following structure:
11 # Please avoid any special characters in test names (+,^,.,etc.)
12 # The ctest command might interpret them as regular expressions
16 #! <!--#########################################################-->
17 #! ### Configuration of the test suite
18 #! <!--#########################################################-->
20 #! Find the Python interpreter and add the targets `check_fast` and `ckeck` (c.f. \ref testsuite_running).
21 #! Also defines helper macros.
23 include(${core_BINARY_DIR}/CPPQEDConfig.cmake)
24 include(${CPPQED_USE})
28 if(NOT ( PYTHONINTERP_FOUND AND NUMPY_FOUND AND SCIPY_FOUND ) )
29 message(WARNING "Disabling testsuite, not all Python components are available")
33 if(NOT COMPILE_SCRIPTS)
34 message(WARNING "Disabling testsuite, scripts are not compiled.")
38 configure_file(testdriver.conf.in testdriver.conf)
39 configure_file(${CMAKE_SOURCE_DIR}/helperscripts/check_push.sh.in ${CMAKE_BINARY_DIR}/check_push.sh @ONLY)
42 #! <!--#########################################################-->
43 #! ### Convenience custom targets
44 #! <!--#########################################################-->
48 add_custom_target(check_fast DEPENDS check_compilefail check_run check_continue check_boost testdriver.conf.in)
49 add_custom_target(check DEPENDS check_fast check_compile check_cpypyqed)
50 add_custom_target(check_full DEPENDS check_physics check)
51 add_custom_target(check_push COMMAND ${CMAKE_BINARY_DIR}/check_push.sh)
54 #! \name Project options
57 #! Number of parallel test jobs for the test suite, default 1.
58 set(TEST_PARALLEL 1 CACHE STRING "Number of parallel test jobs for the test suite.")
59 set_property(CACHE TEST_PARALLEL PROPERTY STRINGS 1 2 3 4 5 6 7 8 9 10)
60 set(CTEST_J "-j${TEST_PARALLEL}")
61 #! Switch verbose test output.
62 option(TEST_VERBOSE "Verbose output in test suite." Off)
68 #! \brief Initialize a sub-directory of the test suite.
70 #! \param dir The sub-directory name.
71 #! \return `TESTSCRIPT` - set to the command by which to call the Python test driver.
73 #! This macro adds the target `check_${dir}` and makes it depend on any target passed as argument after `dir`.
74 #! This target runs all tests in the current sub-directory.
75 #! It also sets the variable `TESTSCRIPT`, which holds the full path to the python test driver and already
76 #! adds some command line parameters: the configuration files and the build configuration.
78 set(TESTSDEPEND cpypyqed ${ARGN})
80 add_custom_target(check_${dir}
81 COMMAND ${CMAKE_CTEST_COMMAND} ${CTEST_V} ${CTEST_J}
82 DEPENDS ${TESTSDEPEND}
85 set(TESTSCRIPT ${testing_SOURCE_DIR}/testdriver.py ${testing_BINARY_DIR}/testdriver.conf ${CMAKE_CURRENT_LIST_DIR}/testdriver.conf --configuration=$<CONFIGURATION>)
88 #! \brief Declare a new test.
90 #! \param name Name of the test. Avoid any special characters (+,\,$ etc), which might be mis-interpreted in a regular expression.
91 #! \return `TESTNAME` - holds the name of the test.
93 #! Besides setting `TESTNAME`, this macro adds a new target `name` which runs the specific test alone.
94 macro(declaretest name)
97 add_custom_target(${name} COMMAND ${CMAKE_CTEST_COMMAND} ${CTEST_V} -R "^${name}$" DEPENDS ${TESTSDEPEND})
102 #! <!--#########################################################-->
103 #! ### Adding all sub-directories to the test suite
104 #! <!--#########################################################-->
107 add_subdirectory(run)
108 add_subdirectory(continue)
109 add_subdirectory(compile)
110 add_subdirectory(compilefail)
111 add_subdirectory(boost)
112 add_subdirectory(cpypyqed)
113 add_subdirectory(physics)