diff options
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/RunCMake/CMP0116/CMP0116-Mixed-stderr.txt | 17 | ||||
-rw-r--r-- | Tests/RunCMake/CMP0116/CMP0116-Mixed.cmake | 18 | ||||
-rw-r--r-- | Tests/RunCMake/CMP0116/RunCMakeTest.cmake | 3 | ||||
-rw-r--r-- | Tests/RunCMake/CMakePresets/CMakePresets.json.in | 4 | ||||
-rw-r--r-- | Tests/RunCMake/CMakePresets/Comment-result.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/CMakePresets/Comment-stderr.txt | 2 | ||||
-rw-r--r-- | Tests/RunCMake/CMakePresets/Comment.json.in | 11 | ||||
-rw-r--r-- | Tests/RunCMake/CMakePresets/RunCMakeTest.cmake | 1 | ||||
-rw-r--r-- | Tests/RunCMake/CMakePresets/validate_schema.py | 3 | ||||
-rw-r--r-- | Tests/RunCMake/CMakePresetsTest/Good.json.in | 9 | ||||
-rw-r--r-- | Tests/RunCMake/Ninja/Qt5AutoMocDeps.cmake | 1 | ||||
-rw-r--r-- | Tests/RunCMake/Ninja/QtSubDir3/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Tests/RunCMake/Ninja/RunCMakeTest.cmake | 2 | ||||
-rw-r--r-- | Tests/RunCMake/RunCMake.cmake | 6 | ||||
-rw-r--r-- | Tests/RunCMake/try_compile/RunCMakeTest.cmake | 4 |
15 files changed, 69 insertions, 15 deletions
diff --git a/Tests/RunCMake/CMP0116/CMP0116-Mixed-stderr.txt b/Tests/RunCMake/CMP0116/CMP0116-Mixed-stderr.txt new file mode 100644 index 0000000..10e83a9 --- /dev/null +++ b/Tests/RunCMake/CMP0116/CMP0116-Mixed-stderr.txt @@ -0,0 +1,17 @@ +^CMake Warning \(dev\) at CMP0116-Mixed\.cmake:1 \(add_custom_command\): + Policy CMP0116 is not set: Ninja generators transform DEPFILEs from + add_custom_command\(\)\. Run "cmake --help-policy CMP0116" for policy + details\. Use the cmake_policy command to set the policy and suppress this + warning\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\.( + +CMake Warning \(dev\) at CMP0116-Mixed\.cmake:1 \(add_custom_command\): + Policy CMP0116 is not set: Ninja generators transform DEPFILEs from + add_custom_command\(\)\. Run "cmake --help-policy CMP0116" for policy + details\. Use the cmake_policy command to set the policy and suppress this + warning\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\.)*$ diff --git a/Tests/RunCMake/CMP0116/CMP0116-Mixed.cmake b/Tests/RunCMake/CMP0116/CMP0116-Mixed.cmake new file mode 100644 index 0000000..6cbbc09 --- /dev/null +++ b/Tests/RunCMake/CMP0116/CMP0116-Mixed.cmake @@ -0,0 +1,18 @@ +add_custom_command( + OUTPUT warn.txt + COMMAND ${CMAKE_COMMAND} -E touch warn.txt + DEPFILE warn.d + ) +cmake_policy(SET CMP0116 OLD) +add_custom_command( + OUTPUT old.txt + COMMAND ${CMAKE_COMMAND} -E touch old.txt + DEPFILE old.d + ) +cmake_policy(SET CMP0116 NEW) +add_custom_command( + OUTPUT new.txt + COMMAND ${CMAKE_COMMAND} -E touch new.txt + DEPFILE new.d + ) +add_custom_target(cc ALL DEPENDS warn.txt old.txt new.txt) diff --git a/Tests/RunCMake/CMP0116/RunCMakeTest.cmake b/Tests/RunCMake/CMP0116/RunCMakeTest.cmake index 8a83cc1..ce3e86a 100644 --- a/Tests/RunCMake/CMP0116/RunCMakeTest.cmake +++ b/Tests/RunCMake/CMP0116/RunCMakeTest.cmake @@ -47,3 +47,6 @@ run_cmp0116(NEW OFF) run_cmp0116(WARN ON) run_cmp0116(OLD ON) run_cmp0116(NEW ON) + +set(RunCMake_TEST_OPTIONS -DCMAKE_POLICY_WARNING_CMP0116:BOOL=TRUE) +run_cmake(CMP0116-Mixed) diff --git a/Tests/RunCMake/CMakePresets/CMakePresets.json.in b/Tests/RunCMake/CMakePresets/CMakePresets.json.in index 54e4140..e65c1a9 100644 --- a/Tests/RunCMake/CMakePresets/CMakePresets.json.in +++ b/Tests/RunCMake/CMakePresets/CMakePresets.json.in @@ -1,8 +1,4 @@ -/* - * Block comment - */ { - // Inline comment "version": 1, "cmakeMinimumRequired": { "major": 3, diff --git a/Tests/RunCMake/CMakePresets/Comment-result.txt b/Tests/RunCMake/CMakePresets/Comment-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/Comment-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/Comment-stderr.txt b/Tests/RunCMake/CMakePresets/Comment-stderr.txt new file mode 100644 index 0000000..2f404bc --- /dev/null +++ b/Tests/RunCMake/CMakePresets/Comment-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresets/Comment: JSON parse error$ diff --git a/Tests/RunCMake/CMakePresets/Comment.json.in b/Tests/RunCMake/CMakePresets/Comment.json.in new file mode 100644 index 0000000..0f7120c --- /dev/null +++ b/Tests/RunCMake/CMakePresets/Comment.json.in @@ -0,0 +1,11 @@ +// Comment +{ + "version": 1, + "configurePresets": [ + { + "name": "Comment", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build" + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake b/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake index 25a7f2f..1864ecd 100644 --- a/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake +++ b/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake @@ -63,6 +63,7 @@ endfunction() # Test CMakePresets.json errors set(CMakePresets_SCHEMA_EXPECTED_RESULT 1) run_cmake_presets(NoCMakePresets) +run_cmake_presets(Comment) run_cmake_presets(JSONParseError) run_cmake_presets(InvalidRoot) run_cmake_presets(NoVersion) diff --git a/Tests/RunCMake/CMakePresets/validate_schema.py b/Tests/RunCMake/CMakePresets/validate_schema.py index c9f84ee..b2a67fc 100644 --- a/Tests/RunCMake/CMakePresets/validate_schema.py +++ b/Tests/RunCMake/CMakePresets/validate_schema.py @@ -1,4 +1,3 @@ -import jsmin import json import jsonschema import os.path @@ -6,7 +5,7 @@ import sys with open(sys.argv[1], "rb") as f: - contents = json.loads(jsmin.jsmin(f.read().decode("utf-8-sig"))) + contents = json.loads(f.read().decode("utf-8-sig")) schema_file = os.path.join( os.path.dirname(__file__), diff --git a/Tests/RunCMake/CMakePresetsTest/Good.json.in b/Tests/RunCMake/CMakePresetsTest/Good.json.in index 791d41f..57be5a5 100644 --- a/Tests/RunCMake/CMakePresetsTest/Good.json.in +++ b/Tests/RunCMake/CMakePresetsTest/Good.json.in @@ -49,8 +49,6 @@ "outputLogFile": "", "labelSummary": true, "subprojectSummary": true - // "maxPassedTestOutputSize": 0 - // "maxTestNameWidth": 0 }, "filter": { "include": { @@ -58,11 +56,6 @@ "label": "", "useUnion": false, "index": "" - // "index": { - // "start": 0, - // "end": 0, - // "stride": 0 - // } }, "exclude": { "name": "", @@ -79,7 +72,6 @@ "enableFailover": false, "jobs": 0, "resourceSpecFile": "", - // "testLoad": 0, "showOnly": "human", "repeat": { "mode": "until-pass", @@ -87,7 +79,6 @@ }, "interactiveDebugging": false, "scheduleRandom": false, - // "timeout": 0, "noTestsAction": "default" } }, diff --git a/Tests/RunCMake/Ninja/Qt5AutoMocDeps.cmake b/Tests/RunCMake/Ninja/Qt5AutoMocDeps.cmake index d314ff3..7456608 100644 --- a/Tests/RunCMake/Ninja/Qt5AutoMocDeps.cmake +++ b/Tests/RunCMake/Ninja/Qt5AutoMocDeps.cmake @@ -10,3 +10,4 @@ target_link_libraries(app_with_qt PRIVATE simple_lib Qt5::Core) add_subdirectory(QtSubDir1) add_subdirectory(QtSubDir2) +add_subdirectory(QtSubDir3) diff --git a/Tests/RunCMake/Ninja/QtSubDir3/CMakeLists.txt b/Tests/RunCMake/Ninja/QtSubDir3/CMakeLists.txt new file mode 100644 index 0000000..d38cfe0 --- /dev/null +++ b/Tests/RunCMake/Ninja/QtSubDir3/CMakeLists.txt @@ -0,0 +1,2 @@ +add_executable(sub_exe_3 ../app.cpp) +target_link_libraries(sub_exe_3 PRIVATE Qt5::Core) diff --git a/Tests/RunCMake/Ninja/RunCMakeTest.cmake b/Tests/RunCMake/Ninja/RunCMakeTest.cmake index b91ab00..1b252cd 100644 --- a/Tests/RunCMake/Ninja/RunCMakeTest.cmake +++ b/Tests/RunCMake/Ninja/RunCMakeTest.cmake @@ -34,6 +34,7 @@ function(run_NoWorkToDo) run_cmake(NoWorkToDo) set(RunCMake_TEST_NO_CLEAN 1) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/NoWorkToDo-build) + set(RunCMake_TEST_OUTPUT_MERGE 1) run_cmake_command(NoWorkToDo-build ${CMAKE_COMMAND} --build .) run_cmake_command(NoWorkToDo-nowork ${CMAKE_COMMAND} --build . -- -d explain) endfunction() @@ -43,6 +44,7 @@ function(run_VerboseBuild) run_cmake(VerboseBuild) set(RunCMake_TEST_NO_CLEAN 1) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/VerboseBuild-build) + set(RunCMake_TEST_OUTPUT_MERGE 1) run_cmake_command(VerboseBuild-build ${CMAKE_COMMAND} --build . -v --clean-first) run_cmake_command(VerboseBuild-nowork ${CMAKE_COMMAND} --build . --verbose) endfunction() diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake index e8fbd6a..a26f632 100644 --- a/Tests/RunCMake/RunCMake.cmake +++ b/Tests/RunCMake/RunCMake.cmake @@ -139,6 +139,12 @@ function(run_cmake test) if(NOT "${actual_result}" MATCHES "${expect_result}") string(APPEND msg "Result is [${actual_result}], not [${expect_result}].\n") endif() + + # Special case: remove ninja no-op line from stderr, but not stdout. + # Test cases that look for it should use RunCMake_TEST_OUTPUT_MERGE. + string(REGEX REPLACE "(^|\r?\n)ninja: no work to do\\.\r?\n" "\\1" actual_stderr "${actual_stderr}") + + # Remove incidental content from both stdout and stderr. string(CONCAT ignore_line_regex "(^|\n)((==[0-9]+==" "|BullseyeCoverage" diff --git a/Tests/RunCMake/try_compile/RunCMakeTest.cmake b/Tests/RunCMake/try_compile/RunCMakeTest.cmake index 5b849bf..fffb038 100644 --- a/Tests/RunCMake/try_compile/RunCMakeTest.cmake +++ b/Tests/RunCMake/try_compile/RunCMakeTest.cmake @@ -93,7 +93,9 @@ if(RunCMake_GENERATOR MATCHES "Make|Ninja") message(STATUS "RerunCMake: first configuration...") run_cmake(RerunCMake) if(NOT CMake_TEST_FILESYSTEM_1S) + set(RunCMake_TEST_OUTPUT_MERGE 1) run_cmake_command(RerunCMake-nowork${ninja} ${CMAKE_COMMAND} --build .) + unset(RunCMake_TEST_OUTPUT_MERGE) endif() execute_process(COMMAND ${CMAKE_COMMAND} -E sleep 1) # handle 1s resolution @@ -101,7 +103,9 @@ if(RunCMake_GENERATOR MATCHES "Make|Ninja") file(WRITE "${in_tc}" "does-not-compile\n") run_cmake_command(RerunCMake-rerun${ninja} ${CMAKE_COMMAND} --build .) if(NOT CMake_TEST_FILESYSTEM_1S) + set(RunCMake_TEST_OUTPUT_MERGE 1) run_cmake_command(RerunCMake-nowork${ninja} ${CMAKE_COMMAND} --build .) + unset(RunCMake_TEST_OUTPUT_MERGE) endif() unset(RunCMake_TEST_BINARY_DIR) |