Concatenate blacklist files for test batch
This works by collecting the paths of all blacklist files and deferring a call which ultimately reads all of the files and glues them together to form a master blacklist file for the batch. There might be conflicting function names inside the batch. For now we ignore the problem, while keeping in mind that it exists. Fixes: QTBUG-110016 Change-Id: I9c8412097418c6e93297ab89af718d7466e2e451 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
parent
02effb2c37
commit
6a9e89121d
@ -241,10 +241,10 @@ endif()
|
||||
|
||||
option(QT_BUILD_TESTS_BATCHED "Link all tests into a single binary." ${_qt_batch_tests})
|
||||
|
||||
if(QT_BUILD_TESTS AND QT_BUILD_TESTS_BATCHED AND CMAKE_VERSION VERSION_LESS "3.18")
|
||||
if(QT_BUILD_TESTS AND QT_BUILD_TESTS_BATCHED AND CMAKE_VERSION VERSION_LESS "3.19")
|
||||
message(FATAL_ERROR
|
||||
"Test batching requires at least CMake 3.18, due to requiring per-source "
|
||||
"TARGET_DIRECTORY assignments.")
|
||||
"Test batching requires at least CMake 3.19, due to requiring per-source "
|
||||
"TARGET_DIRECTORY assignments and DEFER calls.")
|
||||
endif()
|
||||
|
||||
# QT_BUILD_TOOLS_WHEN_CROSSCOMPILING -> QT_FORCE_BUILD_TOOLS
|
||||
|
@ -672,10 +672,29 @@ function(qt_internal_add_test name)
|
||||
foreach(testdata IN LISTS arg_TESTDATA)
|
||||
list(APPEND builtin_files ${testdata})
|
||||
endforeach()
|
||||
foreach(file IN LISTS builtin_files)
|
||||
set_source_files_properties(${file}
|
||||
PROPERTIES QT_SKIP_QUICKCOMPILER TRUE
|
||||
)
|
||||
endforeach()
|
||||
|
||||
set(blacklist_path "BLACKLIST")
|
||||
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${blacklist_path}")
|
||||
list(APPEND builtin_files ${blacklist_path})
|
||||
if(setting_up_batched_test)
|
||||
set(blacklist_path "BLACKLIST")
|
||||
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${blacklist_path}")
|
||||
get_target_property(blacklist_files ${name} _qt_blacklist_files)
|
||||
if(NOT blacklist_files)
|
||||
set_target_properties(${name} PROPERTIES _qt_blacklist_files "")
|
||||
set(blacklist_files "")
|
||||
cmake_language(EVAL CODE "cmake_language(DEFER DIRECTORY \"${CMAKE_SOURCE_DIR}\" CALL \"_qt_internal_finalize_batch\" \"${name}\") ")
|
||||
endif()
|
||||
list(PREPEND blacklist_files "${CMAKE_CURRENT_SOURCE_DIR}/${blacklist_path}")
|
||||
set_target_properties(${name} PROPERTIES _qt_blacklist_files "${blacklist_files}")
|
||||
endif()
|
||||
else()
|
||||
set(blacklist_path "BLACKLIST")
|
||||
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${blacklist_path}")
|
||||
list(APPEND builtin_files ${blacklist_path})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
list(REMOVE_DUPLICATES builtin_files)
|
||||
|
@ -670,6 +670,26 @@ function(_qt_internal_finalize_executable target)
|
||||
set_target_properties(${target} PROPERTIES _qt_executable_is_finalized TRUE)
|
||||
endfunction()
|
||||
|
||||
function(_cat IN_FILE OUT_FILE)
|
||||
file(READ ${IN_FILE} CONTENTS)
|
||||
file(APPEND ${OUT_FILE} "${CONTENTS}\n")
|
||||
endfunction()
|
||||
|
||||
function(_qt_internal_finalize_batch name)
|
||||
find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS Core)
|
||||
|
||||
set(generated_blacklist_file "${CMAKE_CURRENT_BINARY_DIR}/BLACKLIST")
|
||||
get_target_property(blacklist_files "${name}" _qt_blacklist_files)
|
||||
file(WRITE "${generated_blacklist_file}" "")
|
||||
foreach(blacklist_file ${blacklist_files})
|
||||
_cat("${blacklist_file}" "${generated_blacklist_file}")
|
||||
endforeach()
|
||||
qt_internal_add_resource(${name} "batch_blacklist"
|
||||
PREFIX "/"
|
||||
FILES "${CMAKE_CURRENT_BINARY_DIR}/BLACKLIST"
|
||||
BASE ${CMAKE_CURRENT_BINARY_DIR})
|
||||
endfunction()
|
||||
|
||||
# If a task needs to run before any targets are finalized in the current directory
|
||||
# scope, call this function and pass the ID of that task as the argument.
|
||||
function(_qt_internal_delay_finalization_until_after defer_id)
|
||||
|
Loading…
x
Reference in New Issue
Block a user