summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2024-03-11 14:18:38 (GMT)
committerKitware Robot <kwrobot@kitware.com>2024-03-11 14:18:49 (GMT)
commit04d8bc6bb9727b667b8a0d339c7803befce337f2 (patch)
tree51b6488c733279d704a2c25dc7bbb9fdb2d74226 /Tests
parentda334e2db9e9c931e833ed7f38bf6bdb607312d4 (diff)
parent5de1e21659090ca83e39e223d351e353347eb88e (diff)
downloadCMake-04d8bc6bb9727b667b8a0d339c7803befce337f2.zip
CMake-04d8bc6bb9727b667b8a0d339c7803befce337f2.tar.gz
CMake-04d8bc6bb9727b667b8a0d339c7803befce337f2.tar.bz2
Merge topic 'ctest-j-default' into release-3.29
5de1e21659 ctest: Allow passing -j without value to choose a contextual default bbcbcff7d9 cmCTestMultiProcessHandler: Modernize member initialization 7457b474a1 Tests: Remove unnecessary parallel suppression from CTestCoverageCollectGCOV ae69801d96 Tests: Convert CTestTestSkipReturnCode to RunCMake.ctest_test case 30dda49416 Tests: Convert CTestTestSerialOrder to RunCMake.ctest_test case Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Acked-by: scivision <michael@scivision.dev> Merge-request: !9315
Diffstat (limited to 'Tests')
-rw-r--r--Tests/CMakeLists.txt18
-rw-r--r--Tests/CTestTestSerialOrder/CMakeLists.txt40
-rw-r--r--Tests/CTestTestSerialOrder/test.cmake31
-rw-r--r--Tests/CTestTestSkipReturnCode/CMakeLists.txt8
-rw-r--r--Tests/CTestTestSkipReturnCode/CTestConfig.cmake4
-rw-r--r--Tests/CTestTestSkipReturnCode/test.cmake.in23
-rw-r--r--Tests/RunCMake/CTestCommandLine/Parallel-0-stdout.txt9
-rw-r--r--Tests/RunCMake/CTestCommandLine/Parallel-4-stdout.txt7
-rw-r--r--Tests/RunCMake/CTestCommandLine/Parallel-N-stdout.txt10
-rw-r--r--Tests/RunCMake/CTestCommandLine/Parallel-bad-result.txt1
-rw-r--r--Tests/RunCMake/CTestCommandLine/Parallel-bad-stderr.txt1
-rw-r--r--Tests/RunCMake/CTestCommandLine/Parallel-empty-stdout.txt5
-rw-r--r--Tests/RunCMake/CTestCommandLine/Parallel-env-0-stdout.txt9
-rw-r--r--Tests/RunCMake/CTestCommandLine/Parallel-env-3-stdout.txt6
-rw-r--r--Tests/RunCMake/CTestCommandLine/Parallel-env-bad-stdout.txt4
-rw-r--r--Tests/RunCMake/CTestCommandLine/Parallel-env-empty-stdout.txt5
-rw-r--r--Tests/RunCMake/CTestCommandLine/Parallel-j-bad-result.txt1
-rw-r--r--Tests/RunCMake/CTestCommandLine/Parallel-j-bad-stderr.txt1
-rw-r--r--Tests/RunCMake/CTestCommandLine/Parallel-j-stdout.txt5
-rw-r--r--Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake38
-rw-r--r--Tests/RunCMake/Make/CTestJobServer.make6
-rw-r--r--Tests/RunCMake/Make/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/ctest_test/Parallel0-stdout.txt9
-rw-r--r--Tests/RunCMake/ctest_test/Parallel4-stdout.txt7
-rw-r--r--Tests/RunCMake/ctest_test/ParallelBad-result.txt1
-rw-r--r--Tests/RunCMake/ctest_test/ParallelBad-stderr.txt1
-rw-r--r--Tests/RunCMake/ctest_test/ParallelEmpty-stdout.txt5
-rw-r--r--Tests/RunCMake/ctest_test/ParallelEnv0-stdout.txt9
-rw-r--r--Tests/RunCMake/ctest_test/ParallelEnv3-stdout.txt6
-rw-r--r--Tests/RunCMake/ctest_test/ParallelEnvBad-stdout.txt4
-rw-r--r--Tests/RunCMake/ctest_test/ParallelEnvEmpty-stdout.txt5
-rw-r--r--Tests/RunCMake/ctest_test/ParallelOmit-stdout.txt5
-rw-r--r--Tests/RunCMake/ctest_test/RunCMakeTest.cmake56
-rw-r--r--Tests/RunCMake/ctest_test/SerialOrder-stdout.txt16
-rw-r--r--Tests/RunCMake/ctest_test/SkipReturnCode-stdout.txt8
-rw-r--r--Tests/RunCMake/ctest_test/test.cmake.in2
36 files changed, 241 insertions, 128 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 1ee45d6..ab31e70 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -2806,7 +2806,6 @@ if(BUILD_TESTING)
-S "${CMake_BINARY_DIR}/Tests/CTestCoverageCollectGCOV/test.cmake" -VV
--output-log "${CMake_BINARY_DIR}/Tests/CTestCoverageCollectGCOV/testOut.log"
)
- set_property(TEST CTestCoverageCollectGCOV PROPERTY ENVIRONMENT CTEST_PARALLEL_LEVEL=)
configure_file(
"${CMake_SOURCE_DIR}/Tests/CTestTestEmptyBinaryDirectory/test.cmake.in"
@@ -3073,19 +3072,6 @@ if(BUILD_TESTING)
"Test command:.*Working Directory:.*Environment variables:.*foo=bar.*this=that"
)
- configure_file(
- "${CMake_SOURCE_DIR}/Tests/CTestTestSkipReturnCode/test.cmake.in"
- "${CMake_BINARY_DIR}/Tests/CTestTestSkipReturnCode/test.cmake"
- @ONLY ESCAPE_QUOTES)
- add_test(CTestTestSkipReturnCode ${CMAKE_CTEST_COMMAND}
- -S "${CMake_BINARY_DIR}/Tests/CTestTestSkipReturnCode/test.cmake" -V
- --output-log "${CMake_BINARY_DIR}/Tests/CTestTestSkipReturnCode/testOutput.log"
- -C \${CTEST_CONFIGURATION_TYPE}
- )
- set_tests_properties(CTestTestSkipReturnCode PROPERTIES
- PASS_REGULAR_EXPRESSION "CMakeV1 \\.* +Passed.*CMakeV2 \\.+\\*+Skipped")
- set_property(TEST CTestTestSkipReturnCode PROPERTY ENVIRONMENT CTEST_PARALLEL_LEVEL=)
-
ADD_TEST_MACRO(CTestTestSerialInDepends ${CMAKE_CTEST_COMMAND} -j 4
--output-on-failure -C "\${CTestTest_CONFIG}")
@@ -3095,10 +3081,6 @@ if(BUILD_TESTING)
PASS_REGULAR_EXPRESSION "\\*\\*\\*Not Run"
)
- ADD_TEST_MACRO(CTestTestSerialOrder ${CMAKE_CTEST_COMMAND}
- --output-on-failure -C "\${CTestTest_CONFIG}")
- set_property(TEST CTestTestSerialOrder PROPERTY ENVIRONMENT CTEST_PARALLEL_LEVEL=)
-
if(NOT BORLAND)
set(CTestLimitDashJ_CTEST_OPTIONS --force-new-ctest-process)
add_test_macro(CTestLimitDashJ ${CMAKE_CTEST_COMMAND} -j 4
diff --git a/Tests/CTestTestSerialOrder/CMakeLists.txt b/Tests/CTestTestSerialOrder/CMakeLists.txt
deleted file mode 100644
index d46d80e..0000000
--- a/Tests/CTestTestSerialOrder/CMakeLists.txt
+++ /dev/null
@@ -1,40 +0,0 @@
-cmake_minimum_required(VERSION 3.5)
-
-project(CTestTestSerialOrder)
-
-set(TEST_OUTPUT_FILE "${CMAKE_CURRENT_BINARY_DIR}/test_output.txt")
-
-enable_testing()
-
-function(add_serial_order_test TEST_NAME)
- add_test(NAME ${TEST_NAME}
- COMMAND ${CMAKE_COMMAND}
- "-DTEST_OUTPUT_FILE=${TEST_OUTPUT_FILE}"
- "-DTEST_NAME=${TEST_NAME}"
- -P "${CMAKE_CURRENT_SOURCE_DIR}/test.cmake"
- )
-
- if(ARGC GREATER 1)
- set_tests_properties(${TEST_NAME} PROPERTIES ${ARGN})
- endif()
-endfunction()
-
-add_serial_order_test(initialization COST 1000)
-add_serial_order_test(test1)
-add_serial_order_test(test2)
-add_serial_order_test(test3)
-add_serial_order_test(test4 DEPENDS test5)
-
-add_serial_order_test(test5)
-set_tests_properties(test5 PROPERTIES DEPENDS "test6;test7b;test7a")
-
-add_serial_order_test(test6 COST -2)
-add_serial_order_test(test7a COST -1)
-add_serial_order_test(test7b COST -1)
-add_serial_order_test(test8 COST 10)
-add_serial_order_test(test9 COST 20)
-add_serial_order_test(test10 COST 0)
-add_serial_order_test(test11)
-add_serial_order_test(test12 COST 0)
-
-add_serial_order_test(verification COST -1000)
diff --git a/Tests/CTestTestSerialOrder/test.cmake b/Tests/CTestTestSerialOrder/test.cmake
deleted file mode 100644
index 8479cae..0000000
--- a/Tests/CTestTestSerialOrder/test.cmake
+++ /dev/null
@@ -1,31 +0,0 @@
-list(APPEND EXPECTED_OUTPUT
- initialization
- test9
- test8
- test1
- test2
- test3
- test6
- test7a
- test7b
- test5
- test4
- test10
- test11
- test12
-)
-
-
-if("${TEST_NAME}" STREQUAL "initialization")
- file(WRITE ${TEST_OUTPUT_FILE} "${TEST_NAME}")
-
-elseif("${TEST_NAME}" STREQUAL "verification")
- file(READ ${TEST_OUTPUT_FILE} ACTUAL_OUTPUT)
- if(NOT "${ACTUAL_OUTPUT}" STREQUAL "${EXPECTED_OUTPUT}")
- message(FATAL_ERROR "Actual test order [${ACTUAL_OUTPUT}] differs from expected test order [${EXPECTED_OUTPUT}]")
- endif()
-
-else()
- file(APPEND ${TEST_OUTPUT_FILE} ";${TEST_NAME}")
-
-endif()
diff --git a/Tests/CTestTestSkipReturnCode/CMakeLists.txt b/Tests/CTestTestSkipReturnCode/CMakeLists.txt
deleted file mode 100644
index 1eeeec6..0000000
--- a/Tests/CTestTestSkipReturnCode/CMakeLists.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-cmake_minimum_required(VERSION 3.5)
-project(CTestTestSkipReturnCode)
-include(CTest)
-
-add_test (NAME CMakeV1 COMMAND ${CMAKE_COMMAND} "--version")
-add_test (NAME CMakeV2 COMMAND ${CMAKE_COMMAND} "--version")
-
-set_tests_properties(CMakeV2 PROPERTIES SKIP_RETURN_CODE 0)
diff --git a/Tests/CTestTestSkipReturnCode/CTestConfig.cmake b/Tests/CTestTestSkipReturnCode/CTestConfig.cmake
deleted file mode 100644
index 5bc1e9e..0000000
--- a/Tests/CTestTestSkipReturnCode/CTestConfig.cmake
+++ /dev/null
@@ -1,4 +0,0 @@
-set (CTEST_NIGHTLY_START_TIME "21:00:00 EDT")
-set(CTEST_DROP_METHOD "http")
-set(CTEST_DROP_SITE "open.cdash.org")
-set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard")
diff --git a/Tests/CTestTestSkipReturnCode/test.cmake.in b/Tests/CTestTestSkipReturnCode/test.cmake.in
deleted file mode 100644
index b45e4a6..0000000
--- a/Tests/CTestTestSkipReturnCode/test.cmake.in
+++ /dev/null
@@ -1,23 +0,0 @@
-cmake_minimum_required(VERSION 3.5)
-
-# Settings:
-set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest")
-set(CTEST_SITE "@SITE@")
-set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-SkipReturnCode")
-
-set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestSkipReturnCode")
-set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestSkipReturnCode")
-set(CTEST_CVS_COMMAND "@CVSCOMMAND@")
-set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@")
-set(CTEST_CMAKE_GENERATOR_PLATFORM "@CMAKE_GENERATOR_PLATFORM@")
-set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@")
-set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}")
-set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@")
-set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}")
-
-#CTEST_EMPTY_BINARY_DIRECTORY(${CTEST_BINARY_DIRECTORY})
-
-CTEST_START(Experimental)
-CTEST_CONFIGURE(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res)
-CTEST_BUILD(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res)
-CTEST_TEST(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res)
diff --git a/Tests/RunCMake/CTestCommandLine/Parallel-0-stdout.txt b/Tests/RunCMake/CTestCommandLine/Parallel-0-stdout.txt
new file mode 100644
index 0000000..37f728e
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/Parallel-0-stdout.txt
@@ -0,0 +1,9 @@
+Test project [^
+]*/Tests/RunCMake/CTestCommandLine/Parallel-0
+ Start [0-9]+: test[0-9]+
+ Start [0-9]+: test[0-9]+
+ Start [0-9]+: test[0-9]+
+ Start [0-9]+: test[0-9]+
+ Start [0-9]+: test[0-9]+
+ Start [0-9]+: test[0-9]+
+1/6 Test #[0-9]+: test[0-9]+ ............................ Passed +[0-9.]+ sec
diff --git a/Tests/RunCMake/CTestCommandLine/Parallel-4-stdout.txt b/Tests/RunCMake/CTestCommandLine/Parallel-4-stdout.txt
new file mode 100644
index 0000000..d90cbd8
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/Parallel-4-stdout.txt
@@ -0,0 +1,7 @@
+Test project [^
+]*/Tests/RunCMake/CTestCommandLine/Parallel-4
+ Start [0-9]+: test[0-9]+
+ Start [0-9]+: test[0-9]+
+ Start [0-9]+: test[0-9]+
+ Start [0-9]+: test[0-9]+
+1/6 Test #[0-9]+: test[0-9]+ ............................ Passed +[0-9.]+ sec
diff --git a/Tests/RunCMake/CTestCommandLine/Parallel-N-stdout.txt b/Tests/RunCMake/CTestCommandLine/Parallel-N-stdout.txt
new file mode 100644
index 0000000..2c16db7
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/Parallel-N-stdout.txt
@@ -0,0 +1,10 @@
+Test project [^
+]*/Tests/RunCMake/CTestCommandLine/Parallel-N
+ Test #1: test1
+ Test #2: test2
+ Test #3: test3
+ Test #4: test4
+ Test #5: test5
+ Test #6: test6
+
+Total Tests: 6
diff --git a/Tests/RunCMake/CTestCommandLine/Parallel-bad-result.txt b/Tests/RunCMake/CTestCommandLine/Parallel-bad-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/Parallel-bad-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CTestCommandLine/Parallel-bad-stderr.txt b/Tests/RunCMake/CTestCommandLine/Parallel-bad-stderr.txt
new file mode 100644
index 0000000..121248b
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/Parallel-bad-stderr.txt
@@ -0,0 +1 @@
+^CMake Error: '--parallel' given invalid value 'bad'$
diff --git a/Tests/RunCMake/CTestCommandLine/Parallel-empty-stdout.txt b/Tests/RunCMake/CTestCommandLine/Parallel-empty-stdout.txt
new file mode 100644
index 0000000..f380c17
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/Parallel-empty-stdout.txt
@@ -0,0 +1,5 @@
+Test project [^
+]*/Tests/RunCMake/CTestCommandLine/Parallel-empty
+ Start [0-9]+: test[0-9]+
+ Start [0-9]+: test[0-9]+
+1/6 Test #[0-9]+: test[0-9]+ ............................ Passed +[0-9.]+ sec
diff --git a/Tests/RunCMake/CTestCommandLine/Parallel-env-0-stdout.txt b/Tests/RunCMake/CTestCommandLine/Parallel-env-0-stdout.txt
new file mode 100644
index 0000000..1eb05ac
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/Parallel-env-0-stdout.txt
@@ -0,0 +1,9 @@
+Test project [^
+]*/Tests/RunCMake/CTestCommandLine/Parallel-env-0
+ Start [0-9]+: test[0-9]+
+ Start [0-9]+: test[0-9]+
+ Start [0-9]+: test[0-9]+
+ Start [0-9]+: test[0-9]+
+ Start [0-9]+: test[0-9]+
+ Start [0-9]+: test[0-9]+
+1/6 Test #[0-9]+: test[0-9]+ ............................ Passed +[0-9.]+ sec
diff --git a/Tests/RunCMake/CTestCommandLine/Parallel-env-3-stdout.txt b/Tests/RunCMake/CTestCommandLine/Parallel-env-3-stdout.txt
new file mode 100644
index 0000000..d6fc03b
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/Parallel-env-3-stdout.txt
@@ -0,0 +1,6 @@
+Test project [^
+]*/Tests/RunCMake/CTestCommandLine/Parallel-env-3
+ Start [0-9]+: test[0-9]+
+ Start [0-9]+: test[0-9]+
+ Start [0-9]+: test[0-9]+
+1/6 Test #[0-9]+: test[0-9]+ ............................ Passed +[0-9.]+ sec
diff --git a/Tests/RunCMake/CTestCommandLine/Parallel-env-bad-stdout.txt b/Tests/RunCMake/CTestCommandLine/Parallel-env-bad-stdout.txt
new file mode 100644
index 0000000..def3313
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/Parallel-env-bad-stdout.txt
@@ -0,0 +1,4 @@
+Test project [^
+]*/Tests/RunCMake/CTestCommandLine/Parallel-env-bad
+ Start [0-9]+: test[0-9]+
+1/6 Test #[0-9]+: test[0-9]+ ............................ Passed +[0-9.]+ sec
diff --git a/Tests/RunCMake/CTestCommandLine/Parallel-env-empty-stdout.txt b/Tests/RunCMake/CTestCommandLine/Parallel-env-empty-stdout.txt
new file mode 100644
index 0000000..85b880d
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/Parallel-env-empty-stdout.txt
@@ -0,0 +1,5 @@
+Test project [^
+]*/Tests/RunCMake/CTestCommandLine/Parallel-env-empty
+ Start [0-9]+: test[0-9]+
+ Start [0-9]+: test[0-9]+
+1/6 Test #[0-9]+: test[0-9]+ ............................ Passed +[0-9.]+ sec
diff --git a/Tests/RunCMake/CTestCommandLine/Parallel-j-bad-result.txt b/Tests/RunCMake/CTestCommandLine/Parallel-j-bad-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/Parallel-j-bad-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CTestCommandLine/Parallel-j-bad-stderr.txt b/Tests/RunCMake/CTestCommandLine/Parallel-j-bad-stderr.txt
new file mode 100644
index 0000000..228f7cf
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/Parallel-j-bad-stderr.txt
@@ -0,0 +1 @@
+^CMake Error: '-j' given invalid value 'bad'$
diff --git a/Tests/RunCMake/CTestCommandLine/Parallel-j-stdout.txt b/Tests/RunCMake/CTestCommandLine/Parallel-j-stdout.txt
new file mode 100644
index 0000000..39dd34a
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/Parallel-j-stdout.txt
@@ -0,0 +1,5 @@
+Test project [^
+]*/Tests/RunCMake/CTestCommandLine/Parallel-j
+ Start [0-9]+: test[0-9]+
+ Start [0-9]+: test[0-9]+
+1/6 Test #[0-9]+: test[0-9]+ ............................ Passed +[0-9.]+ sec
diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
index a5e8037..a9f392b 100644
--- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
@@ -244,6 +244,44 @@ add_test(Echo \"${CMAKE_COMMAND}\" -E echo \"EchoTest\")
endfunction()
run_SerialFailed()
+function(run_Parallel case)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Parallel-${case})
+ set(RunCMake_TEST_NO_CLEAN 1)
+ file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
+ file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
+ file(WRITE "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake" "
+foreach(i RANGE 1 6)
+ add_test(test\${i} \"${CMAKE_COMMAND}\" -E true)
+endforeach()
+")
+ run_cmake_command(Parallel-${case} ${CMAKE_CTEST_COMMAND} ${ARGN})
+endfunction()
+# Spoof a number of processors to make these tests predictable.
+set(ENV{__CTEST_FAKE_PROCESSOR_COUNT_FOR_TESTING} 1)
+run_Parallel(bad --parallel bad)
+run_Parallel(j-bad -j bad)
+set(RunCMake_TEST_RAW_ARGS [[--parallel ""]])
+run_Parallel(empty) # With 1 processor, defaults to 2.
+unset(RunCMake_TEST_RAW_ARGS)
+run_Parallel(j -j) # With 1 processor, defaults to 2.
+run_Parallel(0 -j0)
+run_Parallel(4 --parallel 4)
+run_Parallel(N --parallel -N)
+set(ENV{CTEST_PARALLEL_LEVEL} bad)
+run_Parallel(env-bad)
+if(CMAKE_HOST_WIN32)
+ set(ENV{CTEST_PARALLEL_LEVEL} " ")
+else()
+ set(ENV{CTEST_PARALLEL_LEVEL} "")
+endif()
+run_Parallel(env-empty) # With 1 processor, defaults to 2.
+set(ENV{CTEST_PARALLEL_LEVEL} 0)
+run_Parallel(env-0)
+set(ENV{CTEST_PARALLEL_LEVEL} 3)
+run_Parallel(env-3)
+unset(ENV{CTEST_PARALLEL_LEVEL})
+unset(ENV{__CTEST_FAKE_PROCESSOR_COUNT_FOR_TESTING)
+
function(run_TestLoad name load)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/TestLoad)
set(RunCMake_TEST_NO_CLEAN 1)
diff --git a/Tests/RunCMake/Make/CTestJobServer.make b/Tests/RunCMake/Make/CTestJobServer.make
index 7fc5e28..24fe774 100644
--- a/Tests/RunCMake/Make/CTestJobServer.make
+++ b/Tests/RunCMake/Make/CTestJobServer.make
@@ -1,11 +1,11 @@
NoPipe:
- env MAKEFLAGS= $(CMAKE_CTEST_COMMAND) -j6
+ env MAKEFLAGS= $(CMAKE_CTEST_COMMAND) -j0
.PHONY: NoPipe
NoTests:
- +$(CMAKE_CTEST_COMMAND) -j6 -R NoTests
+ +$(CMAKE_CTEST_COMMAND) -j -R NoTests
.PHONY: NoTests
Tests:
- +$(CMAKE_CTEST_COMMAND) -j6
+ +$(CMAKE_CTEST_COMMAND) -j
.PHONY: Tests
diff --git a/Tests/RunCMake/Make/RunCMakeTest.cmake b/Tests/RunCMake/Make/RunCMakeTest.cmake
index cfaf759..9673329 100644
--- a/Tests/RunCMake/Make/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Make/RunCMakeTest.cmake
@@ -90,10 +90,13 @@ function(run_CTestJobServer)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CTestJobServer-build)
run_cmake(CTestJobServer)
set(RunCMake_TEST_NO_CLEAN 1)
+ # Spoof a number of processors to make sure jobserver integration is unbounded.
+ set(ENV{__CTEST_FAKE_PROCESSOR_COUNT_FOR_TESTING} 1)
run_make_rule(CTestJobServer NoPipe 2)
run_make_rule(CTestJobServer NoTests 2)
run_make_rule(CTestJobServer Tests 2)
run_make_rule(CTestJobServer Tests 3)
+ unset(ENV{__CTEST_FAKE_PROCESSOR_COUNT_FOR_TESTING)
endfunction()
# Jobservers are currently only supported by GNU makes, except MSYS2 make
diff --git a/Tests/RunCMake/ctest_test/Parallel0-stdout.txt b/Tests/RunCMake/ctest_test/Parallel0-stdout.txt
new file mode 100644
index 0000000..98230cb
--- /dev/null
+++ b/Tests/RunCMake/ctest_test/Parallel0-stdout.txt
@@ -0,0 +1,9 @@
+Test project [^
+]*/Tests/RunCMake/ctest_test/Parallel0-build
+ Start [0-9]+: test[0-9]+
+ Start [0-9]+: test[0-9]+
+ Start [0-9]+: test[0-9]+
+ Start [0-9]+: test[0-9]+
+ Start [0-9]+: test[0-9]+
+ Start [0-9]+: test[0-9]+
+1/6 Test #[0-9]+: test[0-9]+ ............................ Passed +[0-9.]+ sec
diff --git a/Tests/RunCMake/ctest_test/Parallel4-stdout.txt b/Tests/RunCMake/ctest_test/Parallel4-stdout.txt
new file mode 100644
index 0000000..36b0b85
--- /dev/null
+++ b/Tests/RunCMake/ctest_test/Parallel4-stdout.txt
@@ -0,0 +1,7 @@
+Test project [^
+]*/Tests/RunCMake/ctest_test/Parallel4-build
+ Start [0-9]+: test[0-9]+
+ Start [0-9]+: test[0-9]+
+ Start [0-9]+: test[0-9]+
+ Start [0-9]+: test[0-9]+
+1/6 Test #[0-9]+: test[0-9]+ ............................ Passed +[0-9.]+ sec
diff --git a/Tests/RunCMake/ctest_test/ParallelBad-result.txt b/Tests/RunCMake/ctest_test/ParallelBad-result.txt
new file mode 100644
index 0000000..b57e2de
--- /dev/null
+++ b/Tests/RunCMake/ctest_test/ParallelBad-result.txt
@@ -0,0 +1 @@
+(-1|255)
diff --git a/Tests/RunCMake/ctest_test/ParallelBad-stderr.txt b/Tests/RunCMake/ctest_test/ParallelBad-stderr.txt
new file mode 100644
index 0000000..2e21a1b
--- /dev/null
+++ b/Tests/RunCMake/ctest_test/ParallelBad-stderr.txt
@@ -0,0 +1 @@
+^ParallelLevel invalid value: bad$
diff --git a/Tests/RunCMake/ctest_test/ParallelEmpty-stdout.txt b/Tests/RunCMake/ctest_test/ParallelEmpty-stdout.txt
new file mode 100644
index 0000000..fec0789
--- /dev/null
+++ b/Tests/RunCMake/ctest_test/ParallelEmpty-stdout.txt
@@ -0,0 +1,5 @@
+Test project [^
+]*/Tests/RunCMake/ctest_test/ParallelEmpty-build
+ Start [0-9]+: test[0-9]+
+ Start [0-9]+: test[0-9]+
+1/6 Test #[0-9]+: test[0-9]+ ............................ Passed +[0-9.]+ sec
diff --git a/Tests/RunCMake/ctest_test/ParallelEnv0-stdout.txt b/Tests/RunCMake/ctest_test/ParallelEnv0-stdout.txt
new file mode 100644
index 0000000..2e4bc6f
--- /dev/null
+++ b/Tests/RunCMake/ctest_test/ParallelEnv0-stdout.txt
@@ -0,0 +1,9 @@
+Test project [^
+]*/Tests/RunCMake/ctest_test/ParallelEnv0-build
+ Start [0-9]+: test[0-9]+
+ Start [0-9]+: test[0-9]+
+ Start [0-9]+: test[0-9]+
+ Start [0-9]+: test[0-9]+
+ Start [0-9]+: test[0-9]+
+ Start [0-9]+: test[0-9]+
+1/6 Test #[0-9]+: test[0-9]+ ............................ Passed +[0-9.]+ sec
diff --git a/Tests/RunCMake/ctest_test/ParallelEnv3-stdout.txt b/Tests/RunCMake/ctest_test/ParallelEnv3-stdout.txt
new file mode 100644
index 0000000..0193b6c
--- /dev/null
+++ b/Tests/RunCMake/ctest_test/ParallelEnv3-stdout.txt
@@ -0,0 +1,6 @@
+Test project [^
+]*/Tests/RunCMake/ctest_test/ParallelEnv3-build
+ Start [0-9]+: test[0-9]+
+ Start [0-9]+: test[0-9]+
+ Start [0-9]+: test[0-9]+
+1/6 Test #[0-9]+: test[0-9]+ ............................ Passed +[0-9.]+ sec
diff --git a/Tests/RunCMake/ctest_test/ParallelEnvBad-stdout.txt b/Tests/RunCMake/ctest_test/ParallelEnvBad-stdout.txt
new file mode 100644
index 0000000..cd7970b
--- /dev/null
+++ b/Tests/RunCMake/ctest_test/ParallelEnvBad-stdout.txt
@@ -0,0 +1,4 @@
+Test project [^
+]*/Tests/RunCMake/ctest_test/ParallelEnvBad-build
+ Start [0-9]+: test[0-9]+
+1/6 Test #[0-9]+: test[0-9]+ ............................ Passed +[0-9.]+ sec
diff --git a/Tests/RunCMake/ctest_test/ParallelEnvEmpty-stdout.txt b/Tests/RunCMake/ctest_test/ParallelEnvEmpty-stdout.txt
new file mode 100644
index 0000000..e0f92d1
--- /dev/null
+++ b/Tests/RunCMake/ctest_test/ParallelEnvEmpty-stdout.txt
@@ -0,0 +1,5 @@
+Test project [^
+]*/Tests/RunCMake/ctest_test/ParallelEnvEmpty-build
+ Start [0-9]+: test[0-9]+
+ Start [0-9]+: test[0-9]+
+1/6 Test #[0-9]+: test[0-9]+ ............................ Passed +[0-9.]+ sec
diff --git a/Tests/RunCMake/ctest_test/ParallelOmit-stdout.txt b/Tests/RunCMake/ctest_test/ParallelOmit-stdout.txt
new file mode 100644
index 0000000..c388937
--- /dev/null
+++ b/Tests/RunCMake/ctest_test/ParallelOmit-stdout.txt
@@ -0,0 +1,5 @@
+Test project [^
+]*/Tests/RunCMake/ctest_test/ParallelOmit-build
+ Start [0-9]+: test[0-9]+
+ Start [0-9]+: test[0-9]+
+1/6 Test #[0-9]+: test[0-9]+ ............................ Passed +[0-9.]+ sec
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.
diff --git a/Tests/RunCMake/ctest_test/SerialOrder-stdout.txt b/Tests/RunCMake/ctest_test/SerialOrder-stdout.txt
new file mode 100644
index 0000000..5f5a0bc
--- /dev/null
+++ b/Tests/RunCMake/ctest_test/SerialOrder-stdout.txt
@@ -0,0 +1,16 @@
+Test project [^
+]*/Tests/RunCMake/ctest_test/SerialOrder-build
+ Start 2: test1
+1/6 Test #2: test1 ............................ Passed +[0-9.]+ sec
+ Start 7: test6
+2/6 Test #7: test6 ............................ Passed +[0-9.]+ sec
+ Start 6: test5
+3/6 Test #6: test5 ............................ Passed +[0-9.]+ sec
+ Start 5: test4
+4/6 Test #5: test4 ............................ Passed +[0-9.]+ sec
+ Start 4: test3
+5/6 Test #4: test3 ............................ Passed +[0-9.]+ sec
+ Start 3: test2
+6/6 Test #3: test2 ............................ Passed +[0-9.]+ sec
++
+100% tests passed, 0 tests failed out of 6
diff --git a/Tests/RunCMake/ctest_test/SkipReturnCode-stdout.txt b/Tests/RunCMake/ctest_test/SkipReturnCode-stdout.txt
new file mode 100644
index 0000000..98e603a
--- /dev/null
+++ b/Tests/RunCMake/ctest_test/SkipReturnCode-stdout.txt
@@ -0,0 +1,8 @@
+Test project [^
+]*/Tests/RunCMake/ctest_test/SkipReturnCode-build
+ Start 1: RunCMakeVersion
+1/2 Test #1: RunCMakeVersion .................. Passed +[0-9.]+ sec
+ Start 2: skip
+2/2 Test #2: skip .............................\*\*\*Skipped +[0-9.]+ sec
++
+100% tests passed, 0 tests failed out of 2
diff --git a/Tests/RunCMake/ctest_test/test.cmake.in b/Tests/RunCMake/ctest_test/test.cmake.in
index 16dde1c..d28b1e2 100644
--- a/Tests/RunCMake/ctest_test/test.cmake.in
+++ b/Tests/RunCMake/ctest_test/test.cmake.in
@@ -19,5 +19,5 @@ if("@CASE_NAME@" STREQUAL "TestChangingLabels")
ctest_test(${ctest_test_args} INCLUDE_LABEL "^a$")
ctest_test(${ctest_test_args} INCLUDE_LABEL "^b$")
else()
- ctest_test(${ctest_test_args})
+ ctest_test(${ctest_test_args} @CASE_CTEST_TEST_RAW_ARGS@)
endif()