diff options
Diffstat (limited to 'Tests')
28 files changed, 195 insertions, 4 deletions
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 c09fff8..724c5e4 100644 --- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake @@ -240,6 +240,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 012c1a0..ee7114b 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,7 @@ 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) @@ -25,6 +28,7 @@ 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) @@ -33,6 +37,36 @@ 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/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() |