summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
Diffstat (limited to 'Tests')
-rw-r--r--Tests/CMakeLib/CMakeLists.txt4
-rw-r--r--Tests/CMakeLib/testRST.cxx9
-rw-r--r--Tests/CMakeLists.txt15
-rw-r--r--Tests/CTestTestLabelRegExp/CTestTestfile.cmake.in8
-rw-r--r--Tests/CTestTestLabelRegExp/test.cmake.in37
-rw-r--r--Tests/Complex/CMakeLists.txt8
-rw-r--r--Tests/ComplexOneConfig/CMakeLists.txt8
-rw-r--r--Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt7
-rw-r--r--Tests/Module/WriteCompilerDetectionHeader/main.cpp12
-rw-r--r--Tests/RunCMake/CMakeLists.txt4
-rw-r--r--Tests/RunCMake/CommandLine/P_directory-result.txt1
-rw-r--r--Tests/RunCMake/CommandLine/P_directory-stderr.txt1
-rw-r--r--Tests/RunCMake/CommandLine/RunCMakeTest.cmake2
-rw-r--r--Tests/RunCMake/TargetSources/OriginDebug-stderr.txt6
-rw-r--r--Tests/RunCMake/TargetSources/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/WriteCompilerDetectionHeader/OldVersion-stderr.txt6
16 files changed, 120 insertions, 11 deletions
diff --git a/Tests/CMakeLib/CMakeLists.txt b/Tests/CMakeLib/CMakeLists.txt
index 0e1fe8d..8c99f64 100644
--- a/Tests/CMakeLib/CMakeLists.txt
+++ b/Tests/CMakeLib/CMakeLists.txt
@@ -13,6 +13,8 @@ set(CMakeLib_TESTS
testXMLSafe
)
+set(testRST_ARGS ${CMAKE_CURRENT_SOURCE_DIR})
+
if(WIN32)
list(APPEND CMakeLib_TESTS
testVisualStudioSlnParser
@@ -39,7 +41,7 @@ if(CMAKE_OSX_ARCHITECTURES AND XCODE
endif()
foreach(test ${CMakeLib_TESTS})
- add_test(CMakeLib.${test} CMakeLibTests ${test})
+ add_test(CMakeLib.${test} CMakeLibTests ${test} ${${test}_ARGS})
endforeach()
if(TEST_CompileCommandOutput)
diff --git a/Tests/CMakeLib/testRST.cxx b/Tests/CMakeLib/testRST.cxx
index bad9560..37cb3fa 100644
--- a/Tests/CMakeLib/testRST.cxx
+++ b/Tests/CMakeLib/testRST.cxx
@@ -25,9 +25,14 @@ void reportLine(std::ostream& os, bool ret, std::string line, bool eol)
}
}
-int testRST(int, char*[])
+int testRST(int argc, char* argv[])
{
- std::string dir = cmSystemTools::GetFilenamePath(__FILE__);
+ if(argc != 2)
+ {
+ std::cerr << "Usage: testRST <dir>" << std::endl;
+ return 1;
+ }
+ std::string dir = argv[1];
if(dir.empty())
{
dir = ".";
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 852f78f..273a541 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -1820,9 +1820,9 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
--build-options ${build_options}
"--warn-unused-vars")
set_tests_properties(WarnUnusedUnusedViaUnset PROPERTIES
- PASS_REGULAR_EXPRESSION "CMake Warning .*VariableUnusedViaUnset.CMakeLists.txt:7 \\(set\\):")
+ PASS_REGULAR_EXPRESSION "CMake Warning \\(dev\\) at CMakeLists.txt:7 \\(set\\):")
set_tests_properties(WarnUnusedUnusedViaUnset PROPERTIES
- FAIL_REGULAR_EXPRESSION "CMake Warning .*VariableUnusedViaUnset.CMakeLists.txt:5 \\(set\\):")
+ FAIL_REGULAR_EXPRESSION "CMakeLists.txt:5 \\(set\\):")
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/WarnUnusedUnusedViaUnset")
if("${CMAKE_GENERATOR}" MATCHES "Makefile" AND NOT WIN32)
@@ -2359,6 +2359,17 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
"All Labels:.* Label1.* Label2")
configure_file(
+ "${CMake_SOURCE_DIR}/Tests/CTestTestLabelRegExp/test.cmake.in"
+ "${CMake_BINARY_DIR}/Tests/CTestTestLabelRegExp/test.cmake"
+ @ONLY ESCAPE_QUOTES)
+ add_test(NAME CTestTestLabelRegExp
+ COMMAND ${CMAKE_CMAKE_COMMAND}
+ -DSOURCE_DIR=${CMAKE_SOURCE_DIR}/Tests/CTestTestLabelRegExp
+ -P ${CMAKE_BINARY_DIR}/Tests/CTestTestLabelRegExp/test.cmake
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/Tests/CTestTestLabelRegExp
+ )
+
+ configure_file(
"${CMake_SOURCE_DIR}/Tests/CTestTestResourceLock/test.cmake.in"
"${CMake_BINARY_DIR}/Tests/CTestTestResourceLock/test.cmake"
@ONLY ESCAPE_QUOTES)
diff --git a/Tests/CTestTestLabelRegExp/CTestTestfile.cmake.in b/Tests/CTestTestLabelRegExp/CTestTestfile.cmake.in
new file mode 100644
index 0000000..657f382
--- /dev/null
+++ b/Tests/CTestTestLabelRegExp/CTestTestfile.cmake.in
@@ -0,0 +1,8 @@
+add_test(test1 ${CMAKE_COMMAND} -E echo test1)
+set_tests_properties(test1 PROPERTIES LABELS "foo")
+
+add_test(test2 ${CMAKE_COMMAND} -E echo test2)
+set_tests_properties(test2 PROPERTIES LABELS "bar")
+
+add_test(test3 ${CMAKE_COMMAND} -E echo test3)
+set_tests_properties(test3 PROPERTIES LABELS "foo;bar")
diff --git a/Tests/CTestTestLabelRegExp/test.cmake.in b/Tests/CTestTestLabelRegExp/test.cmake.in
new file mode 100644
index 0000000..5c0c9d7
--- /dev/null
+++ b/Tests/CTestTestLabelRegExp/test.cmake.in
@@ -0,0 +1,37 @@
+configure_file(${SOURCE_DIR}/CTestTestfile.cmake.in CTestTestfile.cmake)
+
+function(get_test_list TEST_LIST)
+ set(QUERY_COMMAND ${CMAKE_CTEST_COMMAND} -N ${ARGN})
+
+ execute_process(COMMAND ${QUERY_COMMAND}
+ RESULT_VARIABLE RESULT
+ OUTPUT_VARIABLE OUTPUT
+ ERROR_VARIABLE ERROR)
+
+ if(NOT ${RESULT} STREQUAL "0")
+ message(FATAL_ERROR "command [${QUERY_COMMAND}] failed: RESULT[${RESULT}] OUTPUT[${OUTPUT}] ERROR[${ERROR}]")
+ endif()
+
+ set(${TEST_LIST} "${OUTPUT}" PARENT_SCOPE)
+endfunction()
+
+function(expect_test_list EXPECTED_OUTPUT)
+ get_test_list(TEST_LIST ${ARGN})
+
+ if(NOT "${TEST_LIST}" MATCHES "${EXPECTED_OUTPUT}")
+ message(FATAL_ERROR "actual output [${TEST_LIST}] does not match expected output [${EXPECTED_OUTPUT}] for given arguments [${ARGN}]")
+ endif()
+endfunction()
+
+expect_test_list("test1.*test3.*Total Tests: 2" --label-regex foo)
+expect_test_list("test2.*test3.*Total Tests: 2" --label-regex bar)
+expect_test_list("test1.*test2.*test3.*Total Tests: 3" --label-regex foo|bar)
+expect_test_list("Total Tests: 0" --label-regex baz)
+
+expect_test_list("test2.*Total Tests: 1" --label-exclude foo)
+expect_test_list("test1.*Total Tests: 1" --label-exclude bar)
+expect_test_list("Total Tests: 0" --label-exclude foo|bar)
+expect_test_list("test1.*test2.*test3.*Total Tests: 3" --label-exclude baz)
+
+expect_test_list("test1.*Total Tests: 1" --label-regex foo --label-exclude bar)
+expect_test_list("test2.*Total Tests: 1" --label-regex bar --label-exclude foo)
diff --git a/Tests/Complex/CMakeLists.txt b/Tests/Complex/CMakeLists.txt
index 5fa46bf..222250c 100644
--- a/Tests/Complex/CMakeLists.txt
+++ b/Tests/Complex/CMakeLists.txt
@@ -83,6 +83,14 @@ set_property(DIRECTORY
PROPERTY COMPILE_DEFINITIONS_RELEASE
CMAKE_IS_FUN_IN_RELEASE_MODE
)
+set_property(DIRECTORY
+ PROPERTY COMPILE_DEFINITIONS_RELWITHDEBINFO
+ CMAKE_IS_FUN_IN_RELEASE_MODE
+ )
+set_property(DIRECTORY
+ PROPERTY COMPILE_DEFINITIONS_MINSIZEREL
+ CMAKE_IS_FUN_IN_RELEASE_MODE
+ )
set(TEST_SEP "a b c")
separate_arguments(TEST_SEP)
diff --git a/Tests/ComplexOneConfig/CMakeLists.txt b/Tests/ComplexOneConfig/CMakeLists.txt
index d3d9132..3f17dcc 100644
--- a/Tests/ComplexOneConfig/CMakeLists.txt
+++ b/Tests/ComplexOneConfig/CMakeLists.txt
@@ -83,6 +83,14 @@ set_property(DIRECTORY
PROPERTY COMPILE_DEFINITIONS_RELEASE
CMAKE_IS_FUN_IN_RELEASE_MODE
)
+set_property(DIRECTORY
+ PROPERTY COMPILE_DEFINITIONS_RELWITHDEBINFO
+ CMAKE_IS_FUN_IN_RELEASE_MODE
+ )
+set_property(DIRECTORY
+ PROPERTY COMPILE_DEFINITIONS_MINSIZEREL
+ CMAKE_IS_FUN_IN_RELEASE_MODE
+ )
set(TEST_SEP "a b c")
separate_arguments(TEST_SEP)
diff --git a/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt b/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt
index ab0ebc3..645cc65 100644
--- a/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt
+++ b/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt
@@ -35,6 +35,10 @@ if (NOT CMAKE_CXX_COMPILE_FEATURES AND NOT CMAKE_C_COMPILE_FEATURES)
return()
endif()
+string(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" COMPILER_VERSION_MAJOR "${CMAKE_CXX_COMPILER_VERSION}")
+string(REGEX REPLACE "^[0-9]+\\.([0-9]+)\\.[0-9]+.*" "\\1" COMPILER_VERSION_MINOR "${CMAKE_CXX_COMPILER_VERSION}")
+string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" COMPILER_VERSION_PATCH "${CMAKE_CXX_COMPILER_VERSION}")
+
macro(set_defines target true_defs false_defs)
set(defines)
foreach(def ${true_defs})
@@ -46,6 +50,9 @@ macro(set_defines target true_defs false_defs)
target_compile_definitions(${target}
PRIVATE
${defines}
+ EXPECTED_COMPILER_VERSION_MAJOR=${COMPILER_VERSION_MAJOR}
+ EXPECTED_COMPILER_VERSION_MINOR=${COMPILER_VERSION_MINOR}
+ EXPECTED_COMPILER_VERSION_PATCH=${COMPILER_VERSION_PATCH}
)
endmacro()
diff --git a/Tests/Module/WriteCompilerDetectionHeader/main.cpp b/Tests/Module/WriteCompilerDetectionHeader/main.cpp
index 8b4ea52..b807ad5 100644
--- a/Tests/Module/WriteCompilerDetectionHeader/main.cpp
+++ b/Tests/Module/WriteCompilerDetectionHeader/main.cpp
@@ -13,6 +13,18 @@
#error cxx_variadic_templates expected availability did not match.
#endif
+#if !CHECK(VERSION_MAJOR)
+#error Compiler major version did not match.
+#endif
+
+#if !CHECK(VERSION_MINOR)
+#error Compiler minor version did not match.
+#endif
+
+#if !CHECK(VERSION_PATCH)
+#error Compiler patch version did not match.
+#endif
+
int main()
{
return 0;
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index d5af542..06272ce 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -16,6 +16,10 @@ if(XCODE_VERSION AND "${XCODE_VERSION}" VERSION_LESS 3)
set(GeneratorToolset_ARGS -DXCODE_BELOW_3=1)
endif()
+if(XCODE_VERSION AND "${XCODE_VERSION}" VERSION_LESS 2)
+ set(TargetSources_ARGS -DXCODE_BELOW_2=1)
+endif()
+
add_RunCMake_test(CMP0019)
add_RunCMake_test(CMP0022)
add_RunCMake_test(CMP0026)
diff --git a/Tests/RunCMake/CommandLine/P_directory-result.txt b/Tests/RunCMake/CommandLine/P_directory-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/P_directory-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLine/P_directory-stderr.txt b/Tests/RunCMake/CommandLine/P_directory-stderr.txt
new file mode 100644
index 0000000..b8319a1
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/P_directory-stderr.txt
@@ -0,0 +1 @@
+^CMake Error: Error processing file: .*/Tests/RunCMake/CommandLine$
diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
index 3aaeac0..f3d9637 100644
--- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
@@ -35,3 +35,5 @@ run_cmake_command(E_sleep-no-args ${CMAKE_COMMAND} -E sleep)
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)
+
+run_cmake_command(P_directory ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR})
diff --git a/Tests/RunCMake/TargetSources/OriginDebug-stderr.txt b/Tests/RunCMake/TargetSources/OriginDebug-stderr.txt
index 0200dcb..11bc96c 100644
--- a/Tests/RunCMake/TargetSources/OriginDebug-stderr.txt
+++ b/Tests/RunCMake/TargetSources/OriginDebug-stderr.txt
@@ -5,7 +5,7 @@ CMake Debug Log at OriginDebug.cmake:13 \(add_library\):
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
-+
+.*
CMake Debug Log at OriginDebug.cmake:16 \(set_property\):
Used sources for target OriginDebug:
@@ -13,7 +13,7 @@ CMake Debug Log at OriginDebug.cmake:16 \(set_property\):
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
-+
+.*
CMake Debug Log at OriginDebug.cmake:20 \(target_sources\):
Used sources for target OriginDebug:
@@ -21,7 +21,7 @@ CMake Debug Log at OriginDebug.cmake:20 \(target_sources\):
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
-+
+.*
CMake Debug Log at OriginDebug.cmake:14 \(target_link_libraries\):
Used sources for target OriginDebug:
diff --git a/Tests/RunCMake/TargetSources/RunCMakeTest.cmake b/Tests/RunCMake/TargetSources/RunCMakeTest.cmake
index 01e505c..1d2eaec 100644
--- a/Tests/RunCMake/TargetSources/RunCMakeTest.cmake
+++ b/Tests/RunCMake/TargetSources/RunCMakeTest.cmake
@@ -1,7 +1,6 @@
include(RunCMake)
-if(RunCMake_GENERATOR MATCHES Xcode
- OR RunCMake_GENERATOR MATCHES "Visual Studio")
+if(RunCMake_GENERATOR MATCHES "Visual Studio|Xcode" AND NOT XCODE_BELOW_2)
run_cmake(ConfigNotAllowed)
run_cmake(OriginDebugIDE)
else()
diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/OldVersion-stderr.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/OldVersion-stderr.txt
index 842eb3f..8d4db34 100644
--- a/Tests/RunCMake/WriteCompilerDetectionHeader/OldVersion-stderr.txt
+++ b/Tests/RunCMake/WriteCompilerDetectionHeader/OldVersion-stderr.txt
@@ -1,5 +1,9 @@
CMake Error at .*Modules/WriteCompilerDetectionHeader.cmake:[0-9]+ \(message\):
- VERSION parameter too low.
+ VERSION compatibility for write_compiler_detection_header is set to 3.0,
+ which is too low. It must be set to at least 3.1.0. Either set the
+ VERSION parameter to the write_compiler_detection_header function, or
+ update your minimum required CMake version with the cmake_minimum_required
+ command.
Call Stack \(most recent call first\):
OldVersion.cmake:4 \(write_compiler_detection_header\)
CMakeLists.txt:3 \(include\)