From 73ae888506c89b8c0619905f4c19b79116afb514 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 16 Dec 2014 22:11:40 +0100 Subject: 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. --- Tests/RunCMake/CMP0019/CMakeLists.txt | 2 +- Tests/RunCMake/CheckModules/CMakeLists.txt | 1 + Tests/RunCMake/CommandLine/RunCMakeTest.cmake | 2 ++ Tests/RunCMake/FPHSA/RunCMakeTest.cmake | 2 ++ Tests/RunCMake/Languages/CMakeLists.txt | 1 + Tests/RunCMake/Languages/LINK_LANGUAGE-genex-stderr.txt | 2 +- .../RunCMake/Languages/link-libraries-TARGET_FILE-genex-stderr.txt | 2 +- Tests/RunCMake/README.rst | 2 +- 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 12cd3c7..8f85fbf 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 72abfc8..9872df2 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 84e3614..0c43c20 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 bb7743c..e9b2a7a 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 12cd3c7..8996fef 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 3a7f480..03c002e 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 d8bc238..be3b12c 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 536cff2..e801a86 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: ``-stdout.txt`` Regex matching expected stdout content ``-stderr.txt`` - Regex matching expected stderr content + Regex matching expected stderr content, if not "^$" ``-check.cmake`` Custom result check. diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake index 7b1a5b2..7b3eda7 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() -- cgit v0.12