summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/ctest_test/RunCMakeTest.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/RunCMake/ctest_test/RunCMakeTest.cmake')
-rw-r--r--Tests/RunCMake/ctest_test/RunCMakeTest.cmake56
1 files changed, 56 insertions, 0 deletions
diff --git a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake
index 768b0be..3c9a80d 100644
--- a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake
+++ b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake
@@ -1,8 +1,10 @@
include(RunCTest)
+
set(RunCMake_TEST_TIMEOUT 60)
set(CASE_CTEST_TEST_ARGS "")
set(CASE_CTEST_TEST_LOAD "")
+set(CASE_CTEST_TEST_RAW_ARGS "")
function(run_ctest_test CASE_NAME)
set(CASE_CTEST_TEST_ARGS "${ARGN}")
@@ -11,6 +13,60 @@ endfunction()
run_ctest_test(TestQuiet QUIET)
+set(ENV{__CTEST_FAKE_PROCESSOR_COUNT_FOR_TESTING} 4)
+set(CASE_CMAKELISTS_SUFFIX_CODE [[
+foreach(i RANGE 1 6)
+ add_test(NAME test${i} COMMAND ${CMAKE_COMMAND} -E true)
+endforeach()
+set_property(TEST test1 PROPERTY COST -2)
+set_property(TEST test2 PROPERTY COST -1)
+set_property(TEST test3 PROPERTY COST 0)
+set_property(TEST test4 PROPERTY COST 1)
+set_property(TEST test5 PROPERTY COST 2)
+set_property(TEST test6 PROPERTY COST 3)
+set_property(TEST test6 PROPERTY DEPENDS test1)
+]])
+run_ctest_test(SerialOrder INCLUDE test)
+unset(CASE_CMAKELISTS_SUFFIX_CODE)
+unset(ENV{__CTEST_FAKE_PROCESSOR_COUNT_FOR_TESTING)
+
+set(CASE_CMAKELISTS_SUFFIX_CODE [[
+add_test(NAME skip COMMAND ${CMAKE_COMMAND} -E true)
+set_property(TEST skip PROPERTY SKIP_RETURN_CODE 0)
+]])
+run_ctest_test(SkipReturnCode)
+unset(CASE_CMAKELISTS_SUFFIX_CODE)
+
+# Spoof a number of processors to make these tests predictable.
+set(ENV{__CTEST_FAKE_PROCESSOR_COUNT_FOR_TESTING} 1)
+set(CASE_CMAKELISTS_SUFFIX_CODE [[
+foreach(i RANGE 1 6)
+ add_test(NAME test${i} COMMAND ${CMAKE_COMMAND} -E true)
+endforeach()
+]])
+run_ctest_test(ParallelBad INCLUDE test PARALLEL_LEVEL bad)
+set(CASE_CTEST_TEST_RAW_ARGS "PARALLEL_LEVEL \"\"")
+run_ctest_test(ParallelEmpty INCLUDE test) # With 1 processor, defaults to 2.
+unset(CASE_CTEST_TEST_RAW_ARGS)
+run_ctest_test(ParallelOmit INCLUDE test PARALLEL_LEVEL) # With 1 processor, defaults to 2.
+run_ctest_test(Parallel0 INCLUDE test PARALLEL_LEVEL 0)
+run_ctest_test(Parallel4 INCLUDE test PARALLEL_LEVEL 4)
+set(ENV{CTEST_PARALLEL_LEVEL} bad)
+run_ctest_test(ParallelEnvBad INCLUDE test)
+if(CMAKE_HOST_WIN32)
+ set(ENV{CTEST_PARALLEL_LEVEL} " ")
+else()
+ set(ENV{CTEST_PARALLEL_LEVEL} "")
+endif()
+run_ctest_test(ParallelEnvEmpty INCLUDE test) # With 1 processor, defaults to 2.
+set(ENV{CTEST_PARALLEL_LEVEL} 0)
+run_ctest_test(ParallelEnv0 INCLUDE test)
+set(ENV{CTEST_PARALLEL_LEVEL} 3)
+run_ctest_test(ParallelEnv3 INCLUDE test)
+unset(ENV{CTEST_PARALLEL_LEVEL})
+unset(CASE_CMAKELISTS_SUFFIX_CODE)
+unset(ENV{__CTEST_FAKE_PROCESSOR_COUNT_FOR_TESTING)
+
# Tests for the 'Test Load' feature of ctest
#
# Spoof a load average value to make these tests more reliable.