diff options
author | Matthew Woehlke <matthew.woehlke@kitware.com> | 2022-11-23 22:02:22 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2022-12-16 15:11:37 (GMT) |
commit | 746c776caf1207049922edb3ea63586b94fca4c6 (patch) | |
tree | a846db4f6435b8d4f1c592af0a26209ba13b5a1f /Tests | |
parent | e8b8d82cbf60e517ad4b9026ba24de1c59165af4 (diff) | |
download | CMake-746c776caf1207049922edb3ea63586b94fca4c6.zip CMake-746c776caf1207049922edb3ea63586b94fca4c6.tar.gz CMake-746c776caf1207049922edb3ea63586b94fca4c6.tar.bz2 |
ConfigureLog: Add infrastructure for structured configure event logging
Add infrastructure for a "configure log". Use YAML for a balance of
machine- and human-readability to records details of configure-time
events in a structured format.
Teach the RunCMake test framework to support matching the configure log.
Issue: #23200
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/RunCMake/RunCMake.cmake | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake index 670beb9..54d7eb5 100644 --- a/Tests/RunCMake/RunCMake.cmake +++ b/Tests/RunCMake/RunCMake.cmake @@ -33,7 +33,7 @@ function(run_cmake test) set(platform_name msys) endif() - foreach(o IN ITEMS stdout stderr) + foreach(o IN ITEMS stdout stderr config) if(RunCMake-${o}-file AND EXISTS ${top_src}/${RunCMake-${o}-file}) file(READ ${top_src}/${RunCMake-${o}-file} expect_${o}) string(REGEX REPLACE "\n+$" "" expect_${o} "${expect_${o}}") @@ -144,6 +144,12 @@ function(run_cmake test) if(NOT "${actual_result}" MATCHES "${expect_result}") string(APPEND msg "Result is [${actual_result}], not [${expect_result}].\n") endif() + set(config_file "${RunCMake_TEST_COMMAND_WORKING_DIRECTORY}/CMakeFiles/CMakeConfigureLog.yaml") + if(EXISTS "${config_file}") + file(READ "${config_file}" actual_config) + else() + set(actual_config "") + 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. @@ -180,7 +186,7 @@ function(run_cmake test) "|[^\n]*Bullseye Testing Technology" ")[^\n]*\n)+" ) - foreach(o IN ITEMS stdout stderr) + foreach(o IN ITEMS stdout stderr config) string(REGEX REPLACE "\r\n" "\n" actual_${o} "${actual_${o}}") string(REGEX REPLACE "${ignore_line_regex}" "\\1" actual_${o} "${actual_${o}}") string(REGEX REPLACE "\n+$" "" actual_${o} "${actual_${o}}") @@ -211,13 +217,15 @@ function(run_cmake test) string(APPEND msg "Command was:\n command> ${command}\n") endif() if(msg) - foreach(o IN ITEMS stdout stderr) + foreach(o IN ITEMS stdout stderr config) if(DEFINED expect_${o}) string(REGEX REPLACE "\n" "\n expect-${o}> " expect_${o} " expect-${o}> ${expect_${o}}") string(APPEND msg "Expected ${o} to match:\n${expect_${o}}\n") endif() - string(REGEX REPLACE "\n" "\n actual-${o}> " actual_${o} " actual-${o}> ${actual_${o}}") - string(APPEND msg "Actual ${o}:\n${actual_${o}}\n") + if(NOT o STREQUAL "config" OR DEFINED expect_${o}) + string(REGEX REPLACE "\n" "\n actual-${o}> " actual_${o} " actual-${o}> ${actual_${o}}") + string(APPEND msg "Actual ${o}:\n${actual_${o}}\n") + endif() endforeach() message(SEND_ERROR "${test}${RunCMake_TEST_VARIANT_DESCRIPTION} - FAILED:\n${msg}") else() |