CMake: Allow echoing RunCMake test command output via an opt-in
This will be used in a new manual test in qt5.git, to show progress of long-running commands. Store the diff in a new patches subdir, to make it easier to re-apply when we update the file from upstream. As a drive-by, store patches from the previous modifications that were done before this change. Pick-to: 6.8 Change-Id: Ib73908e20fac7fe0bd620400d483625238fa37d1 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Cristian Le <cristian.le@qt.io> (cherry picked from commit d8caf6d89f662d4b3f0c0633fcce46e0f46ec5a7) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
10d3076a93
commit
ea47e479a2
12
src/testinternal/3rdparty/cmake/RunCMake.cmake
vendored
12
src/testinternal/3rdparty/cmake/RunCMake.cmake
vendored
@ -144,6 +144,16 @@ function(run_cmake test)
|
||||
if(NOT RunCMake_TEST_COMMAND_WORKING_DIRECTORY)
|
||||
set(RunCMake_TEST_COMMAND_WORKING_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
|
||||
endif()
|
||||
if(RunCMake_TEST_ECHO_OUTPUT_VARIABLE AND CMAKE_VERSION VERSION_GREATER_EQUAL "3.18")
|
||||
set(maybe_echo_output "ECHO_OUTPUT_VARIABLE")
|
||||
else()
|
||||
set(maybe_echo_output "")
|
||||
endif()
|
||||
if(RunCMake_TEST_ECHO_ERROR_VARIABLE AND CMAKE_VERSION VERSION_GREATER_EQUAL "3.18")
|
||||
set(maybe_echo_error "ECHO_ERROR_VARIABLE")
|
||||
else()
|
||||
set(maybe_echo_error "")
|
||||
endif()
|
||||
execute_process(
|
||||
COMMAND ${RunCMake_TEST_COMMAND}
|
||||
${RunCMake_TEST_OPTIONS}
|
||||
@ -154,6 +164,8 @@ function(run_cmake test)
|
||||
ENCODING UTF8
|
||||
${maybe_timeout}
|
||||
${maybe_input_file}
|
||||
${maybe_echo_output}
|
||||
${maybe_echo_error}
|
||||
)
|
||||
if(DEFINED ENV{PWD})
|
||||
set(old_pwd "$ENV{PWD}")
|
||||
|
46
src/testinternal/3rdparty/cmake/patches/0001-Make-RunCMake-compatible-with-downstream.patch
vendored
Normal file
46
src/testinternal/3rdparty/cmake/patches/0001-Make-RunCMake-compatible-with-downstream.patch
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
Subject: [PATCH] Make RunCMake compatible with downstream projects
|
||||
---
|
||||
Index: src/testinternal/3rdparty/cmake/QtRunCMakeTestHelpers.cmake
|
||||
IDEA additional info:
|
||||
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
||||
<+>UTF-8
|
||||
===================================================================
|
||||
diff --git a/src/testinternal/3rdparty/cmake/QtRunCMakeTestHelpers.cmake b/src/testinternal/3rdparty/cmake/QtRunCMakeTestHelpers.cmake
|
||||
--- a/src/testinternal/3rdparty/cmake/QtRunCMakeTestHelpers.cmake (revision 5201a6f8063d7be8fee3d9cd01e7c5e195869467)
|
||||
+++ b/src/testinternal/3rdparty/cmake/QtRunCMakeTestHelpers.cmake (revision 27aa47b3c906dbe263f23ff4abbdb535b504404f)
|
||||
@@ -3,6 +3,8 @@
|
||||
#
|
||||
# Original file location was Tests/RunCMake/CMakeLists.txt
|
||||
|
||||
+set(RunCMakeDir ${CMAKE_CURRENT_LIST_DIR})
|
||||
+
|
||||
macro(add_RunCMake_test test)
|
||||
set(TEST_ARGS ${ARGN})
|
||||
if ("${ARGV1}" STREQUAL "TEST_DIR")
|
||||
@@ -18,8 +20,8 @@
|
||||
if(CMAKE_C_COMPILER_ID STREQUAL "LCC")
|
||||
list(APPEND TEST_ARGS -DRunCMake_TEST_LCC=1)
|
||||
endif()
|
||||
- add_test(NAME RunCMake.${test} COMMAND ${CMAKE_CMAKE_COMMAND}
|
||||
- -DCMAKE_MODULE_PATH=${CMAKE_CURRENT_SOURCE_DIR}
|
||||
+ add_test(NAME RunCMake.${test} COMMAND ${CMAKE_COMMAND}
|
||||
+ -DCMAKE_MODULE_PATH=${RunCMakeDir}
|
||||
-DRunCMake_GENERATOR_IS_MULTI_CONFIG=${_isMultiConfig}
|
||||
-DRunCMake_GENERATOR=${CMAKE_GENERATOR}
|
||||
-DRunCMake_GENERATOR_INSTANCE=${CMAKE_GENERATOR_INSTANCE}
|
||||
Index: src/testinternal/3rdparty/cmake/RunCMake.cmake
|
||||
IDEA additional info:
|
||||
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
||||
<+>UTF-8
|
||||
===================================================================
|
||||
diff --git a/src/testinternal/3rdparty/cmake/RunCMake.cmake b/src/testinternal/3rdparty/cmake/RunCMake.cmake
|
||||
--- a/src/testinternal/3rdparty/cmake/RunCMake.cmake (revision 5201a6f8063d7be8fee3d9cd01e7c5e195869467)
|
||||
+++ b/src/testinternal/3rdparty/cmake/RunCMake.cmake (revision 27aa47b3c906dbe263f23ff4abbdb535b504404f)
|
||||
@@ -1,5 +1,7 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
+#
|
||||
+# Original file location was Tests/RunCMake/RunCMake.cmake
|
||||
|
||||
foreach(
|
||||
arg
|
90
src/testinternal/3rdparty/cmake/patches/0002-Make-RunCMake-compatible-with-CMake-3.18.patch
vendored
Normal file
90
src/testinternal/3rdparty/cmake/patches/0002-Make-RunCMake-compatible-with-CMake-3.18.patch
vendored
Normal file
@ -0,0 +1,90 @@
|
||||
From 3617409325fb3757d9126e72d4b852fa571f42f7 Mon Sep 17 00:00:00 2001
|
||||
From: Cristian Le <cristian.le@qt.io>
|
||||
Date: Fri, 7 Mar 2025 18:20:08 +0100
|
||||
Subject: [PATCH] Make RunCMake compatible with CMake<3.18
|
||||
|
||||
Avoid using `cmake_language`.
|
||||
|
||||
Reverting commit:
|
||||
https://gitlab.kitware.com/cmake/cmake/-/commit/67f97f54789413f47a0f03a36c3bb32518a2e922
|
||||
|
||||
Pick-to: 6.9 6.8
|
||||
Change-Id: I8311508c904cbc66aa663a0b62f861b7b056b526
|
||||
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
|
||||
---
|
||||
.../3rdparty/cmake/RunCMake.cmake | 19 ++++---------------
|
||||
1 file changed, 4 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/src/testinternal/3rdparty/cmake/RunCMake.cmake b/src/testinternal/3rdparty/cmake/RunCMake.cmake
|
||||
index 65a320dacad..4b53e839951 100644
|
||||
--- a/src/testinternal/3rdparty/cmake/RunCMake.cmake
|
||||
+++ b/src/testinternal/3rdparty/cmake/RunCMake.cmake
|
||||
@@ -2,6 +2,8 @@
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
#
|
||||
# Original file location was Tests/RunCMake/RunCMake.cmake
|
||||
+#
|
||||
+# reverted https://gitlab.kitware.com/cmake/cmake/-/commit/67f97f54789413f47a0f03a36c3bb32518a2e922
|
||||
|
||||
foreach(
|
||||
arg
|
||||
@@ -139,16 +141,12 @@ function(run_cmake test)
|
||||
else()
|
||||
set(RunCMake_TEST_OPTIONS "")
|
||||
endif()
|
||||
- if(NOT DEFINED RunCMake_TEST_RAW_ARGS)
|
||||
- set(RunCMake_TEST_RAW_ARGS "")
|
||||
- endif()
|
||||
if(NOT RunCMake_TEST_COMMAND_WORKING_DIRECTORY)
|
||||
set(RunCMake_TEST_COMMAND_WORKING_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
|
||||
endif()
|
||||
- string(CONCAT _code [[execute_process(
|
||||
+ execute_process(
|
||||
COMMAND ${RunCMake_TEST_COMMAND}
|
||||
${RunCMake_TEST_OPTIONS}
|
||||
- ]] "${RunCMake_TEST_RAW_ARGS}\n" [[
|
||||
WORKING_DIRECTORY "${RunCMake_TEST_COMMAND_WORKING_DIRECTORY}"
|
||||
OUTPUT_VARIABLE actual_stdout
|
||||
ERROR_VARIABLE ${actual_stderr_var}
|
||||
@@ -156,7 +154,7 @@ function(run_cmake test)
|
||||
ENCODING UTF8
|
||||
${maybe_timeout}
|
||||
${maybe_input_file}
|
||||
- )]])
|
||||
+ )
|
||||
if(DEFINED ENV{PWD})
|
||||
set(old_pwd "$ENV{PWD}")
|
||||
else()
|
||||
@@ -164,7 +162,6 @@ function(run_cmake test)
|
||||
endif()
|
||||
# Emulate a shell using this directory.
|
||||
set(ENV{PWD} "${RunCMake_TEST_COMMAND_WORKING_DIRECTORY}")
|
||||
- cmake_language(EVAL CODE "${_code}")
|
||||
if(DEFINED old_pwd)
|
||||
set(ENV{PWD} "${old_pwd}")
|
||||
else()
|
||||
@@ -266,9 +263,6 @@ function(run_cmake test)
|
||||
string(REPLACE ";" "\" \"" options "\"${RunCMake_TEST_OPTIONS}\"")
|
||||
string(APPEND command " ${options}")
|
||||
endif()
|
||||
- if(RunCMake_TEST_RAW_ARGS)
|
||||
- string(APPEND command " ${RunCMake_TEST_RAW_ARGS}")
|
||||
- endif()
|
||||
string(APPEND msg "Command was:\n command> ${command}\n")
|
||||
endif()
|
||||
if(msg)
|
||||
@@ -306,11 +300,6 @@ function(run_cmake_with_options test)
|
||||
run_cmake(${test})
|
||||
endfunction()
|
||||
|
||||
-function(run_cmake_with_raw_args test args)
|
||||
- set(RunCMake_TEST_RAW_ARGS "${args}")
|
||||
- run_cmake(${test})
|
||||
-endfunction()
|
||||
-
|
||||
function(ensure_files_match expected_file actual_file)
|
||||
if(NOT EXISTS "${expected_file}")
|
||||
message(FATAL_ERROR "Expected file does not exist:\n ${expected_file}")
|
||||
--
|
||||
2.47.0
|
||||
|
@ -0,0 +1,47 @@
|
||||
From 171377424a728b0cd5a635f07ade8930ee10b9d7 Mon Sep 17 00:00:00 2001
|
||||
From: Alexandru Croitor <alexandru.croitor@qt.io>
|
||||
Date: Wed, 26 Mar 2025 19:47:37 +0100
|
||||
Subject: [PATCH] CMake: Allow echoing RunCMake test command output via an
|
||||
opt-in
|
||||
|
||||
This will be used in a new manual test in qt5.git, to show progress of
|
||||
long-running commands.
|
||||
|
||||
Change-Id: Ib73908e20fac7fe0bd620400d483625238fa37d1
|
||||
---
|
||||
src/testinternal/3rdparty/cmake/RunCMake.cmake | 12 ++++++++++++
|
||||
1 file changed, 12 insertions(+)
|
||||
|
||||
diff --git a/src/testinternal/3rdparty/cmake/RunCMake.cmake b/src/testinternal/3rdparty/cmake/RunCMake.cmake
|
||||
index 4b53e839951..5d32e1c0eb8 100644
|
||||
--- a/src/testinternal/3rdparty/cmake/RunCMake.cmake
|
||||
+++ b/src/testinternal/3rdparty/cmake/RunCMake.cmake
|
||||
@@ -144,6 +144,16 @@ function(run_cmake test)
|
||||
if(NOT RunCMake_TEST_COMMAND_WORKING_DIRECTORY)
|
||||
set(RunCMake_TEST_COMMAND_WORKING_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
|
||||
endif()
|
||||
+ if(RunCMake_TEST_ECHO_OUTPUT_VARIABLE AND CMAKE_VERSION VERSION_GREATER_EQUAL "3.18")
|
||||
+ set(maybe_echo_output "ECHO_OUTPUT_VARIABLE")
|
||||
+ else()
|
||||
+ set(maybe_echo_output "")
|
||||
+ endif()
|
||||
+ if(RunCMake_TEST_ECHO_ERROR_VARIABLE AND CMAKE_VERSION VERSION_GREATER_EQUAL "3.18")
|
||||
+ set(maybe_echo_error "ECHO_ERROR_VARIABLE")
|
||||
+ else()
|
||||
+ set(maybe_echo_error "")
|
||||
+ endif()
|
||||
execute_process(
|
||||
COMMAND ${RunCMake_TEST_COMMAND}
|
||||
${RunCMake_TEST_OPTIONS}
|
||||
@@ -154,6 +164,8 @@ function(run_cmake test)
|
||||
ENCODING UTF8
|
||||
${maybe_timeout}
|
||||
${maybe_input_file}
|
||||
+ ${maybe_echo_output}
|
||||
+ ${maybe_echo_error}
|
||||
)
|
||||
if(DEFINED ENV{PWD})
|
||||
set(old_pwd "$ENV{PWD}")
|
||||
--
|
||||
2.47.0
|
||||
|
Loading…
x
Reference in New Issue
Block a user