Skip tests outside of qtbase on batching+superbuild

The batcher does not currently work properly with non-qtbase
submodules. Disable them temporarily so that at least the
tests in qtbase are batched. Do this from qtbase so that changes
to each and every submodule are not necessary.

Also, maintain a list of tests that were thus skipped. On any
qt cmake internal function call that refers to such a target,
identify the target as skipped and make the call a no-op.

Fixes: QTBUG-109785
Change-Id: Ib0aa5d39eee8315ffd4ac62f6d1f44fe9bbf7a2f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Mikolaj Boc 2023-01-03 14:42:33 +01:00
parent 69e478480a
commit 11891ae9c9
3 changed files with 52 additions and 0 deletions

View File

@ -5,6 +5,10 @@ function(qt_internal_add_resource target resourceName)
if(NOT TARGET "${target}") if(NOT TARGET "${target}")
message(FATAL_ERROR "${target} is not a target.") message(FATAL_ERROR "${target} is not a target.")
endif() endif()
qt_internal_is_skipped_test(skipped ${target})
if(skipped)
return()
endif()
qt_internal_is_in_test_batch(in_batch ${target}) qt_internal_is_in_test_batch(in_batch ${target})
if(in_batch) if(in_batch)
_qt_internal_test_batch_target_name(target) _qt_internal_test_batch_target_name(target)

View File

@ -20,6 +20,10 @@ function(qt_internal_extend_target target)
if(NOT TARGET "${target}") if(NOT TARGET "${target}")
message(FATAL_ERROR "${target} is not a target.") message(FATAL_ERROR "${target} is not a target.")
endif() endif()
qt_internal_is_skipped_test(skipped ${target})
if(skipped)
return()
endif()
qt_internal_is_in_test_batch(in_batch ${target}) qt_internal_is_in_test_batch(in_batch ${target})
if(in_batch) if(in_batch)
_qt_internal_test_batch_target_name(target) _qt_internal_test_batch_target_name(target)
@ -1075,6 +1079,10 @@ function(qt_internal_undefine_global_definition target)
if(NOT TARGET "${target}") if(NOT TARGET "${target}")
message(FATAL_ERROR "${target} is not a target.") message(FATAL_ERROR "${target} is not a target.")
endif() endif()
qt_internal_is_skipped_test(skipped ${target})
if(skipped)
return()
endif()
qt_internal_is_in_test_batch(in_batch ${target}) qt_internal_is_in_test_batch(in_batch ${target})
if(in_batch) if(in_batch)
_qt_internal_test_batch_target_name(target) _qt_internal_test_batch_target_name(target)

View File

@ -398,6 +398,34 @@ function(qt_internal_is_in_test_batch out name)
endif() endif()
endfunction() endfunction()
function(qt_internal_is_skipped_test out name)
get_target_property(is_skipped_test ${name} _qt_is_skipped_test)
set(${out} ${is_skipped_test} PARENT_SCOPE)
endfunction()
function(qt_internal_set_skipped_test name)
set_target_properties(${name} PROPERTIES _qt_is_skipped_test TRUE)
endfunction()
function(qt_internal_is_qtbase_test out)
get_filename_component(dir "${CMAKE_CURRENT_BINARY_DIR}" ABSOLUTE)
set(${out} FALSE PARENT_SCOPE)
while(TRUE)
get_filename_component(filename "${dir}" NAME)
if("${filename}" STREQUAL "qtbase")
set(${out} TRUE PARENT_SCOPE)
break()
endif()
set(prev_dir "${dir}")
get_filename_component(dir "${dir}" DIRECTORY)
if("${dir}" STREQUAL "${prev_dir}")
break()
endif()
endwhile()
endfunction()
function(qt_internal_get_batched_test_arguments out testname) function(qt_internal_get_batched_test_arguments out testname)
if(WASM) if(WASM)
# Add a query string to the runner document, so that the script therein # Add a query string to the runner document, so that the script therein
@ -434,6 +462,18 @@ function(qt_internal_add_test name)
) )
_qt_internal_validate_all_args_are_parsed(arg) _qt_internal_validate_all_args_are_parsed(arg)
if(QT_BUILD_TESTS_BATCHED AND QT_SUPERBUILD AND NOT arg_NO_BATCH AND NOT arg_QMLTEST)
qt_internal_is_qtbase_test(is_qtbase_test)
if(NOT is_qtbase_test)
file(GENERATE OUTPUT "dummy${name}.cpp" CONTENT "int main() { return 0; }")
# Add a dummy target to tackle some potential problems
qt_internal_add_executable(${name} SOURCES "dummy${name}.cpp")
# Batched tests outside of qtbase are unsupported and skipped
qt_internal_set_skipped_test(${name})
return()
endif()
endif()
if (NOT arg_OUTPUT_DIRECTORY) if (NOT arg_OUTPUT_DIRECTORY)
set(arg_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") set(arg_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
endif() endif()