From 4c626b7e43c27de0dce4b8af15290cce861f9dc8 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 30 Oct 2017 10:48:05 -0400 Subject: Tests: Refactor contract test activation Use separate `CMake_TEST_CONTRACT_` variables for each test. Make the set of possible tests match what is in the source tree. --- Tests/CMakeLists.txt | 47 ++++++++++++++++---------------- Tests/Contracts/Trilinos/Configure.cmake | 7 +++++ Tests/Contracts/Trilinos/RunTest.cmake | 7 ----- Tests/Contracts/VTK/Configure.cmake | 3 ++ Tests/Contracts/VTK/RunTest.cmake | 3 -- 5 files changed, 33 insertions(+), 34 deletions(-) create mode 100644 Tests/Contracts/Trilinos/Configure.cmake delete mode 100644 Tests/Contracts/Trilinos/RunTest.cmake create mode 100644 Tests/Contracts/VTK/Configure.cmake delete mode 100644 Tests/Contracts/VTK/RunTest.cmake diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index bd44b17..5a149c8 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -3388,31 +3388,30 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release set_property(TEST CMakeWizardTest PROPERTY PASS_REGULAR_EXPRESSION "The \"cmake -i\" wizard mode is no longer supported.") - # If the cache variable CMAKE_CONTRACT_PROJECTS is set - # then the dashboard will run a contract with CMake test of that - # name. For example CMAKE_CONTRACT_PROJECTS = vtk542 would run - # the vtk542 contract test. - # For each Contract test, the project should provide a directory - # with at least one CMakeLists.txt file that uses ExternalProject - # to download and configure the project. The directory should also - # contain a RunTest.cmake file that has a single set of the format: - # set(project_RUN_TEST testToRun) - # The testToRun should be a test executable that can be run to - # smoke test the build. - foreach(project ${CMAKE_CONTRACT_PROJECTS}) - include(Contracts/${project}/RunTest.cmake) - ADD_TEST_MACRO(Contracts.${project} - ${${project}_RUN_TEST}) - # Contract test timeout in seconds. - # Default to 6 hours. - if(DEFINED ${project}_TEST_TIMEOUT) - set(timeout ${${project}_TEST_TIMEOUT}) - elseif(CMAKE_CONTRACT_TEST_TIMEOUT_DEFAULT) - set(timeout ${CMAKE_CONTRACT_TEST_TIMEOUT_DEFAULT}) - else() - set(timeout 21600) + # Define a set of "contract" tests, each activated by a cache entry + # named "CMake_TEST_CONTRACT_". For each Contract test, + # the project should provide a directory with a CMakeLists.txt file + # that uses ExternalProject to download and configure the project. + # The directory should also contain a Configure.cmake file that + # sets "CMake_TEST_CONTRACT__" variables to configure + # the code below. + foreach(project + Trilinos + VTK + ) + if(CMake_TEST_CONTRACT_${project}) + include(Contracts/${project}/Configure.cmake) + ADD_TEST_MACRO(Contracts.${project} ${CMake_TEST_CONTRACT_${project}_RUN_TEST}) + # The external projects may take a long time to build. + if(DEFINED CMake_TEST_CONTRACT_${project}_TIMEOUT) + set(timeout ${CMake_TEST_CONTRACT_${project}_TIMEOUT}) + elseif(CMake_TEST_CONTRACT_DEFAULT_TIMEOUT) + set(timeout ${CMake_TEST_CONTRACT_DEFAULT_TIMEOUT}) + else() + set(timeout 21600) + endif() + set_property(TEST Contracts.${project} PROPERTY TIMEOUT "${timeout}") endif() - set_tests_properties(Contracts.${project} PROPERTIES TIMEOUT ${timeout}) endforeach() if(TEST_CompileCommandOutput) diff --git a/Tests/Contracts/Trilinos/Configure.cmake b/Tests/Contracts/Trilinos/Configure.cmake new file mode 100644 index 0000000..d62eb79 --- /dev/null +++ b/Tests/Contracts/Trilinos/Configure.cmake @@ -0,0 +1,7 @@ +# ValidateBuild.cmake is configured into this location when the test is built: +set(dir "${CMAKE_CURRENT_BINARY_DIR}/Contracts/${project}") + +set(exe "${CMAKE_COMMAND}") +set(args -P "${dir}/ValidateBuild.cmake") + +set(CMake_TEST_CONTRACT_Trilinos_RUN_TEST ${exe} ${args}) diff --git a/Tests/Contracts/Trilinos/RunTest.cmake b/Tests/Contracts/Trilinos/RunTest.cmake deleted file mode 100644 index d661a4c..0000000 --- a/Tests/Contracts/Trilinos/RunTest.cmake +++ /dev/null @@ -1,7 +0,0 @@ -# ValidateBuild.cmake is configured into this location when the test is built: -set(dir "${CMAKE_CURRENT_BINARY_DIR}/Contracts/${project}") - -set(exe "${CMAKE_COMMAND}") -set(args -P "${dir}/ValidateBuild.cmake") - -set(Trilinos_RUN_TEST ${exe} ${args}) diff --git a/Tests/Contracts/VTK/Configure.cmake b/Tests/Contracts/VTK/Configure.cmake new file mode 100644 index 0000000..037d75a --- /dev/null +++ b/Tests/Contracts/VTK/Configure.cmake @@ -0,0 +1,3 @@ +set(exe "$ENV{HOME}/.cmake/Contracts/VTK/VTK-build/bin/vtkCommonCoreCxxTests") +set(args otherArrays) +set(CMake_TEST_CONTRACT_VTK_RUN_TEST ${exe} ${args}) diff --git a/Tests/Contracts/VTK/RunTest.cmake b/Tests/Contracts/VTK/RunTest.cmake deleted file mode 100644 index 65285cf..0000000 --- a/Tests/Contracts/VTK/RunTest.cmake +++ /dev/null @@ -1,3 +0,0 @@ -set(exe "$ENV{HOME}/.cmake/Contracts/VTK/VTK-build/bin/vtkCommonCoreCxxTests") -set(args otherArrays) -set(VTK_RUN_TEST ${exe} ${args}) -- cgit v0.12