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.
This commit is contained in:
Stephen Kelly 2014-12-16 22:11:40 +01:00
parent c2445d3dfd
commit 73ae888506
9 changed files with 17 additions and 4 deletions

View File

@ -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)

View File

@ -1,3 +1,4 @@
cmake_minimum_required(VERSION 2.8.11)
cmake_policy(SET CMP0054 NEW)
project(${RunCMake_TEST} NONE)
include(${RunCMake_TEST}.cmake)

View File

@ -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)

View File

@ -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")

View File

@ -1,3 +1,4 @@
cmake_minimum_required(VERSION 2.8.4)
cmake_policy(SET CMP0042 NEW)
project(${RunCMake_TEST} NONE)
include(${RunCMake_TEST}.cmake)

View File

@ -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\)

View File

@ -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\)

View File

@ -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.

View File

@ -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()