diff options
author | Stephen Kelly <steveire@gmail.com> | 2014-12-16 22:11:40 +0100 |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2014-12-31 16:34:34 +0100 |
commit | 73ae888506c89b8c0619905f4c19b79116afb514 (patch) | |
tree | c7af7e40b479536d725266181876cefb735947a9 | |
parent | c2445d3dfd837cd2e372061f5545054317be110a (diff) | |
download | cmake-73ae888506c89b8c0619905f4c19b79116afb514.tar.gz |
RunCMake: Expect empty output by default.
Expect tests to specify stderr content if it is present.
Fix the CMP0019 test, which has only been testing the WARN status
until now. Specify in the CommandLine and FPHSA tests that content
is at least one character.
Set policies in the Language and CheckModules tests, which have empty
test output, modulo unrelated policies on some platforms.
-rw-r--r-- | Tests/RunCMake/CMP0019/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Tests/RunCMake/CheckModules/CMakeLists.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/CommandLine/RunCMakeTest.cmake | 2 | ||||
-rw-r--r-- | Tests/RunCMake/FPHSA/RunCMakeTest.cmake | 2 | ||||
-rw-r--r-- | Tests/RunCMake/Languages/CMakeLists.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/Languages/LINK_LANGUAGE-genex-stderr.txt | 2 | ||||
-rw-r--r-- | Tests/RunCMake/Languages/link-libraries-TARGET_FILE-genex-stderr.txt | 2 | ||||
-rw-r--r-- | Tests/RunCMake/README.rst | 2 | ||||
-rw-r--r-- | Tests/RunCMake/RunCMake.cmake | 7 |
9 files changed, 17 insertions, 4 deletions
diff --git a/Tests/RunCMake/CMP0019/CMakeLists.txt b/Tests/RunCMake/CMP0019/CMakeLists.txt index 12cd3c7757..8f85fbf540 100644 --- a/Tests/RunCMake/CMP0019/CMakeLists.txt +++ b/Tests/RunCMake/CMP0019/CMakeLists.txt @@ -1,3 +1,3 @@ cmake_minimum_required(VERSION 2.8.4) project(${RunCMake_TEST} NONE) -include(${RunCMake_TEST}.cmake) +include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE) diff --git a/Tests/RunCMake/CheckModules/CMakeLists.txt b/Tests/RunCMake/CheckModules/CMakeLists.txt index 72abfc8099..9872df2a18 100644 --- a/Tests/RunCMake/CheckModules/CMakeLists.txt +++ b/Tests/RunCMake/CheckModules/CMakeLists.txt @@ -1,3 +1,4 @@ cmake_minimum_required(VERSION 2.8.11) +cmake_policy(SET CMP0054 NEW) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index 84e36145fb..0c43c20b8c 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -37,7 +37,9 @@ run_cmake_command(E_env-bad-arg1 ${CMAKE_COMMAND} -E env -bad-arg1) run_cmake_command(E_env-set ${CMAKE_COMMAND} -E env TEST_ENV=1 ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/E_env-set.cmake) run_cmake_command(E_env-unset ${CMAKE_COMMAND} -E env TEST_ENV=1 ${CMAKE_COMMAND} -E env --unset=TEST_ENV ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/E_env-unset.cmake) +set(RunCMake_DEFAULT_stderr ".") run_cmake_command(E_sleep-no-args ${CMAKE_COMMAND} -E sleep) +unset(RunCMake_DEFAULT_stderr) run_cmake_command(E_sleep-bad-arg1 ${CMAKE_COMMAND} -E sleep x) run_cmake_command(E_sleep-bad-arg2 ${CMAKE_COMMAND} -E sleep 1 -1) run_cmake_command(E_sleep-one-tenth ${CMAKE_COMMAND} -E sleep 0.1) diff --git a/Tests/RunCMake/FPHSA/RunCMakeTest.cmake b/Tests/RunCMake/FPHSA/RunCMakeTest.cmake index bb7743c0fa..e9b2a7a70e 100644 --- a/Tests/RunCMake/FPHSA/RunCMakeTest.cmake +++ b/Tests/RunCMake/FPHSA/RunCMakeTest.cmake @@ -14,6 +14,7 @@ run_cmake(exact_1.2.3) run_cmake(exact_1.2.3.4) # now test every component with an invalid version +set(RunCMake_DEFAULT_stderr ".") run_cmake(exact_0) run_cmake(exact_2) run_cmake(exact_1.1) @@ -22,6 +23,7 @@ run_cmake(exact_1.2.2) run_cmake(exact_1.2.4) run_cmake(exact_1.2.3.3) run_cmake(exact_1.2.3.5) +unset(RunCMake_DEFAULT_stderr) # check if searching for a version 0 works list(APPEND RunCMake_TEST_OPTIONS "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" "-DPseudo_VERSION=0") diff --git a/Tests/RunCMake/Languages/CMakeLists.txt b/Tests/RunCMake/Languages/CMakeLists.txt index 12cd3c7757..8996fef6bd 100644 --- a/Tests/RunCMake/Languages/CMakeLists.txt +++ b/Tests/RunCMake/Languages/CMakeLists.txt @@ -1,3 +1,4 @@ cmake_minimum_required(VERSION 2.8.4) +cmake_policy(SET CMP0042 NEW) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/Languages/LINK_LANGUAGE-genex-stderr.txt b/Tests/RunCMake/Languages/LINK_LANGUAGE-genex-stderr.txt index 3a7f4806cb..03c002e7d8 100644 --- a/Tests/RunCMake/Languages/LINK_LANGUAGE-genex-stderr.txt +++ b/Tests/RunCMake/Languages/LINK_LANGUAGE-genex-stderr.txt @@ -6,4 +6,4 @@ CMake Error at LINK_LANGUAGE-genex.cmake:[0-9]+ \(target_link_libraries\): LINKER_LANGUAGE target property can not be used while evaluating link libraries for a static library Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/Languages/link-libraries-TARGET_FILE-genex-stderr.txt b/Tests/RunCMake/Languages/link-libraries-TARGET_FILE-genex-stderr.txt index d8bc2387b4..be3b12c3ae 100644 --- a/Tests/RunCMake/Languages/link-libraries-TARGET_FILE-genex-stderr.txt +++ b/Tests/RunCMake/Languages/link-libraries-TARGET_FILE-genex-stderr.txt @@ -6,4 +6,4 @@ CMake Error at link-libraries-TARGET_FILE-genex.cmake:[0-9]+ \(target_link_libra Expressions which require the linker language may not be used while evaluating link libraries Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/README.rst b/Tests/RunCMake/README.rst index 536cff2e26..e801a86c29 100644 --- a/Tests/RunCMake/README.rst +++ b/Tests/RunCMake/README.rst @@ -41,7 +41,7 @@ but do not actually build anything. To add a test: ``<SubTest>-stdout.txt`` Regex matching expected stdout content ``<SubTest>-stderr.txt`` - Regex matching expected stderr content + Regex matching expected stderr content, if not "^$" ``<SubTest>-check.cmake`` Custom result check. diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake index 7b1a5b2a85..7b3eda77c0 100644 --- a/Tests/RunCMake/RunCMake.cmake +++ b/Tests/RunCMake/RunCMake.cmake @@ -25,6 +25,13 @@ function(run_cmake test) unset(expect_std${o}) endif() endforeach() + if (NOT expect_stderr) + if (NOT RunCMake_DEFAULT_stderr) + set(RunCMake_DEFAULT_stderr "^$") + endif() + set(expect_stderr ${RunCMake_DEFAULT_stderr}) + endif() + if (NOT RunCMake_TEST_SOURCE_DIR) set(RunCMake_TEST_SOURCE_DIR "${top_src}") endif() |