diff options
Diffstat (limited to 'Tests')
15 files changed, 87 insertions, 1 deletions
diff --git a/Tests/RunCMake/build_command/CMP0061-NEW-stderr.txt b/Tests/RunCMake/build_command/CMP0061-NEW-stderr.txt new file mode 100644 index 0000000..1dde843 --- /dev/null +++ b/Tests/RunCMake/build_command/CMP0061-NEW-stderr.txt @@ -0,0 +1,10 @@ +^[^ +]+ --build \. --config "Release" +[^ +]+ --build \. --config "Release" --target "MyTarget" +[^ +]+ --build \. --config "Debug" +[^ +]+ --build \. --config "Debug" --target "MyTarget" +[^ +]+ --build \. --config "Release"$ diff --git a/Tests/RunCMake/build_command/CMP0061-NEW.cmake b/Tests/RunCMake/build_command/CMP0061-NEW.cmake new file mode 100644 index 0000000..2e439cb --- /dev/null +++ b/Tests/RunCMake/build_command/CMP0061-NEW.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0061 NEW) +include(CMP0061Common.cmake) diff --git a/Tests/RunCMake/build_command/CMP0061-OLD-make-stderr.txt b/Tests/RunCMake/build_command/CMP0061-OLD-make-stderr.txt new file mode 100644 index 0000000..28e0e72 --- /dev/null +++ b/Tests/RunCMake/build_command/CMP0061-OLD-make-stderr.txt @@ -0,0 +1,10 @@ +^[^ +]+ --build \. --config "Release" -- -i +[^ +]+ --build \. --config "Release" --target "MyTarget" -- -i +[^ +]+ --build \. --config "Debug" -- -i +[^ +]+ --build \. --config "Debug" --target "MyTarget" -- -i +[^ +]+ --build \. --config "Release" -- -i$ diff --git a/Tests/RunCMake/build_command/CMP0061-OLD-make.cmake b/Tests/RunCMake/build_command/CMP0061-OLD-make.cmake new file mode 100644 index 0000000..1542d8c --- /dev/null +++ b/Tests/RunCMake/build_command/CMP0061-OLD-make.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0061 OLD) +include(CMP0061Common.cmake) diff --git a/Tests/RunCMake/build_command/CMP0061-OLD-other-stderr.txt b/Tests/RunCMake/build_command/CMP0061-OLD-other-stderr.txt new file mode 100644 index 0000000..1dde843 --- /dev/null +++ b/Tests/RunCMake/build_command/CMP0061-OLD-other-stderr.txt @@ -0,0 +1,10 @@ +^[^ +]+ --build \. --config "Release" +[^ +]+ --build \. --config "Release" --target "MyTarget" +[^ +]+ --build \. --config "Debug" +[^ +]+ --build \. --config "Debug" --target "MyTarget" +[^ +]+ --build \. --config "Release"$ diff --git a/Tests/RunCMake/build_command/CMP0061-OLD-other.cmake b/Tests/RunCMake/build_command/CMP0061-OLD-other.cmake new file mode 100644 index 0000000..1542d8c --- /dev/null +++ b/Tests/RunCMake/build_command/CMP0061-OLD-other.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0061 OLD) +include(CMP0061Common.cmake) diff --git a/Tests/RunCMake/build_command/CMP0061Common.cmake b/Tests/RunCMake/build_command/CMP0061Common.cmake new file mode 100644 index 0000000..50cd7d7 --- /dev/null +++ b/Tests/RunCMake/build_command/CMP0061Common.cmake @@ -0,0 +1,10 @@ +build_command(command) +message("${command}") +build_command(command TARGET MyTarget) +message("${command}") +build_command(command CONFIGURATION Debug) +message("${command}") +build_command(command CONFIGURATION Debug TARGET MyTarget) +message("${command}") +build_command(cache_command "${CMAKE_MAKE_PROGRAM}") +message("${cache_command}") diff --git a/Tests/RunCMake/build_command/RunCMakeTest.cmake b/Tests/RunCMake/build_command/RunCMakeTest.cmake index eaa1d77..c3bef4c 100644 --- a/Tests/RunCMake/build_command/RunCMakeTest.cmake +++ b/Tests/RunCMake/build_command/RunCMakeTest.cmake @@ -1,4 +1,5 @@ include(RunCMake) +unset(ENV{CMAKE_CONFIG_TYPE}) run_cmake(ErrorsOFF) run_cmake(ErrorsON) @@ -6,3 +7,10 @@ run_cmake(ErrorsON) set(RunCMake_TEST_OPTIONS -DNoProject=1) run_cmake(BeforeProject) unset(RunCMake_TEST_OPTIONS) + +run_cmake(CMP0061-NEW) +if(RunCMake_GENERATOR MATCHES "Make") + run_cmake(CMP0061-OLD-make) +else() + run_cmake(CMP0061-OLD-other) +endif() diff --git a/Tests/RunCMake/ctest_build/BuildFailure-CMP0061-OLD-result.txt b/Tests/RunCMake/ctest_build/BuildFailure-CMP0061-OLD-result.txt new file mode 100644 index 0000000..9cdf4a5 --- /dev/null +++ b/Tests/RunCMake/ctest_build/BuildFailure-CMP0061-OLD-result.txt @@ -0,0 +1 @@ +(0|-1|255) diff --git a/Tests/RunCMake/ctest_build/BuildFailure-CMP0061-OLD-stderr.txt b/Tests/RunCMake/ctest_build/BuildFailure-CMP0061-OLD-stderr.txt new file mode 100644 index 0000000..af70ac3 --- /dev/null +++ b/Tests/RunCMake/ctest_build/BuildFailure-CMP0061-OLD-stderr.txt @@ -0,0 +1,2 @@ +^(Error\(s\) when building project +)?ctest_build returned zero$ diff --git a/Tests/RunCMake/ctest_build/BuildFailure-result.txt b/Tests/RunCMake/ctest_build/BuildFailure-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/ctest_build/BuildFailure-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/ctest_build/BuildFailure-stderr.txt b/Tests/RunCMake/ctest_build/BuildFailure-stderr.txt new file mode 100644 index 0000000..1e6ad87 --- /dev/null +++ b/Tests/RunCMake/ctest_build/BuildFailure-stderr.txt @@ -0,0 +1,2 @@ +^Error\(s\) when building project +ctest_build returned non-zero$ diff --git a/Tests/RunCMake/ctest_build/CMakeLists.txt.in b/Tests/RunCMake/ctest_build/CMakeLists.txt.in index 9ba08e9..82cb7c4 100644 --- a/Tests/RunCMake/ctest_build/CMakeLists.txt.in +++ b/Tests/RunCMake/ctest_build/CMakeLists.txt.in @@ -2,3 +2,4 @@ cmake_minimum_required(VERSION 3.1) project(CTestBuild@CASE_NAME@ NONE) include(CTest) add_test(NAME RunCMakeVersion COMMAND "${CMAKE_COMMAND}" --version) +@CASE_CMAKELISTS_SUFFIX_CODE@ diff --git a/Tests/RunCMake/ctest_build/RunCMakeTest.cmake b/Tests/RunCMake/ctest_build/RunCMakeTest.cmake index 5826fe4..c6f732c 100644 --- a/Tests/RunCMake/ctest_build/RunCMakeTest.cmake +++ b/Tests/RunCMake/ctest_build/RunCMakeTest.cmake @@ -8,3 +8,26 @@ function(run_ctest_build CASE_NAME) endfunction() run_ctest_build(BuildQuiet QUIET) + +function(run_BuildFailure) + set(CASE_CMAKELISTS_SUFFIX_CODE [[ +add_custom_target(BuildFailure ALL COMMAND command-does-not-exist) +]]) + set(CASE_TEST_PREFIX_CODE [[ +cmake_policy(SET CMP0061 NEW) +]]) + set(CASE_TEST_SUFFIX_CODE [[ +if (ctest_build_return_value) + message("ctest_build returned non-zero") +else() + message("ctest_build returned zero") +endif() +]]) + run_ctest(BuildFailure) + + if (RunCMake_GENERATOR MATCHES "Makefiles") + set(CASE_TEST_PREFIX_CODE "") + run_ctest(BuildFailure-CMP0061-OLD) + endif() +endfunction() +run_BuildFailure() diff --git a/Tests/RunCMake/ctest_build/test.cmake.in b/Tests/RunCMake/ctest_build/test.cmake.in index 38c8ea1..768f1c6 100644 --- a/Tests/RunCMake/ctest_build/test.cmake.in +++ b/Tests/RunCMake/ctest_build/test.cmake.in @@ -1,4 +1,5 @@ cmake_minimum_required(VERSION 3.1) +@CASE_TEST_PREFIX_CODE@ set(CTEST_SITE "test-site") set(CTEST_BUILD_NAME "test-build-name") @@ -12,4 +13,5 @@ set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") set(ctest_build_args "@CASE_CTEST_BUILD_ARGS@") ctest_start(Experimental) ctest_configure() -ctest_build(${ctest_build_args}) +ctest_build(${ctest_build_args} RETURN_VALUE ctest_build_return_value) +@CASE_TEST_SUFFIX_CODE@ |