summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/ctest_fixtures/RunCMakeTest.cmake
diff options
context:
space:
mode:
authorCraig Scott <craig.scott@crascit.com>2016-09-07 04:04:07 (GMT)
committerBrad King <brad.king@kitware.com>2016-09-20 18:37:38 (GMT)
commit73f47c9e46d42513cd7eeb08e27c4d1a424949ad (patch)
treef7f275e022e3c6debf4450015d1ae40e46fb56a3 /Tests/RunCMake/ctest_fixtures/RunCMakeTest.cmake
parent6b8812c27e6df1d10fa4bfc30cb3eadd08d7966b (diff)
downloadCMake-73f47c9e46d42513cd7eeb08e27c4d1a424949ad.zip
CMake-73f47c9e46d42513cd7eeb08e27c4d1a424949ad.tar.gz
CMake-73f47c9e46d42513cd7eeb08e27c4d1a424949ad.tar.bz2
CTest: Add support for test fixtures
Add new test properties: * FIXTURES_SETUP * FIXTURES_CLEANUP * FIXTURES_REQUIRED to specify the roles and dependencies of tests providing/using test fixtures.
Diffstat (limited to 'Tests/RunCMake/ctest_fixtures/RunCMakeTest.cmake')
-rw-r--r--Tests/RunCMake/ctest_fixtures/RunCMakeTest.cmake36
1 files changed, 36 insertions, 0 deletions
diff --git a/Tests/RunCMake/ctest_fixtures/RunCMakeTest.cmake b/Tests/RunCMake/ctest_fixtures/RunCMakeTest.cmake
new file mode 100644
index 0000000..f13289a
--- /dev/null
+++ b/Tests/RunCMake/ctest_fixtures/RunCMakeTest.cmake
@@ -0,0 +1,36 @@
+include(RunCTest)
+
+# Isolate our ctest runs from external environment.
+unset(ENV{CTEST_PARALLEL_LEVEL})
+unset(ENV{CTEST_OUTPUT_ON_FAILURE})
+
+function(run_ctest_test CASE_NAME)
+ set(CASE_CTEST_FIXTURES_ARGS "${ARGN}")
+ run_ctest(${CASE_NAME})
+endfunction()
+
+#------------------------------------------------------------
+# CMake configure will pass
+#------------------------------------------------------------
+run_ctest_test(one INCLUDE one)
+run_ctest_test(two INCLUDE two)
+run_ctest_test(three INCLUDE three)
+run_ctest_test(setupFoo INCLUDE setupFoo)
+run_ctest_test(wontRun INCLUDE wontRun)
+
+#------------------------------------------------------------
+# CMake configure will fail due to cyclic test dependencies
+#------------------------------------------------------------
+set(CASE_CMAKELISTS_CYCLIC_CODE [[
+ set_tests_properties(cyclicSetup PROPERTIES
+ FIXTURES_SETUP "Foo"
+ FIXTURES_REQUIRED "Foo")
+]])
+run_ctest(cyclicSetup)
+
+set(CASE_CMAKELISTS_CYCLIC_CODE [[
+ set_tests_properties(cyclicCleanup PROPERTIES
+ FIXTURES_CLEANUP "Foo"
+ FIXTURES_REQUIRED "Foo")
+]])
+run_ctest(cyclicCleanup)