Do not batch standalone tests; add an option to batch them
Tests generated with qt-cmake-standalone-test will now not be batched by default. Defining the QT_BATCH_STANDALONE_TESTS environment variable will make the build system batch them. Fixes: QTBUG-111226 Change-Id: I9f01c662e22f8ffdd33e1c4d82619db0689fecc7 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
parent
d87ba73d48
commit
5947c07717
@ -427,7 +427,14 @@ function(qt_internal_add_test name)
|
||||
)
|
||||
_qt_internal_validate_all_args_are_parsed(arg)
|
||||
|
||||
if(QT_BUILD_TESTS_BATCHED AND NOT arg_NO_BATCH AND NOT arg_QMLTEST)
|
||||
set(batch_current_test FALSE)
|
||||
if(QT_BUILD_TESTS_BATCHED AND NOT arg_NO_BATCH AND NOT arg_QMLTEST AND NOT arg_MANUAL
|
||||
AND ("${QT_STANDALONE_TEST_PATH}" STREQUAL ""
|
||||
OR DEFINED ENV{QT_BATCH_STANDALONE_TESTS}))
|
||||
set(batch_current_test TRUE)
|
||||
endif()
|
||||
|
||||
if(batch_current_test)
|
||||
if (QT_SUPERBUILD OR DEFINED ENV{TESTED_MODULE_COIN})
|
||||
set(is_qtbase_test FALSE)
|
||||
if(QT_SUPERBUILD)
|
||||
@ -464,9 +471,8 @@ function(qt_internal_add_test name)
|
||||
"removed in a future Qt version. Use the LIBRARIES option instead.")
|
||||
endif()
|
||||
|
||||
if(NOT arg_NO_BATCH AND QT_BUILD_TESTS_BATCHED AND NOT arg_QMLTEST AND NOT arg_MANUAL)
|
||||
if(batch_current_test)
|
||||
qt_internal_add_test_to_batch(name ${name} ${ARGN})
|
||||
set(setting_up_batched_test TRUE)
|
||||
elseif(arg_SOURCES)
|
||||
if(QT_BUILD_TESTS_BATCHED AND arg_QMLTEST)
|
||||
message(WARNING "QML tests won't be batched - unsupported (yet)")
|
||||
@ -542,7 +548,6 @@ function(qt_internal_add_test name)
|
||||
qt_internal_extend_target("${name}" CONDITION ANDROID
|
||||
LIBRARIES ${QT_CMAKE_EXPORT_NAMESPACE}::Gui
|
||||
)
|
||||
set(setting_up_batched_test FALSE)
|
||||
set_target_properties(${name} PROPERTIES _qt_is_test_executable TRUE)
|
||||
set_target_properties(${name} PROPERTIES _qt_is_manual_test ${arg_MANUAL})
|
||||
endif()
|
||||
@ -578,7 +583,7 @@ function(qt_internal_add_test name)
|
||||
elseif(WASM)
|
||||
# The test script expects an html file. In case of batched tests, the
|
||||
# version specialized for running batches has to be supplied.
|
||||
if(setting_up_batched_test)
|
||||
if(batch_current_test)
|
||||
get_target_property(batch_output_dir ${name} RUNTIME_OUTPUT_DIRECTORY)
|
||||
set(test_executable "${batch_output_dir}/${name}.html")
|
||||
else()
|
||||
@ -618,9 +623,11 @@ function(qt_internal_add_test name)
|
||||
endif()
|
||||
|
||||
if(NOT arg_MANUAL)
|
||||
if(setting_up_batched_test)
|
||||
if(batch_current_test)
|
||||
qt_internal_get_batched_test_arguments(batched_test_args ${testname})
|
||||
list(PREPEND extra_test_args ${batched_test_args})
|
||||
elseif(WASM AND CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
list(PREPEND extra_test_args "qvisualoutput")
|
||||
endif()
|
||||
|
||||
qt_internal_collect_command_environment(test_env_path test_env_plugin_path)
|
||||
@ -697,7 +704,7 @@ function(qt_internal_add_test name)
|
||||
)
|
||||
endforeach()
|
||||
|
||||
if(setting_up_batched_test)
|
||||
if(batch_current_test)
|
||||
set(blacklist_path "BLACKLIST")
|
||||
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${blacklist_path}")
|
||||
get_target_property(blacklist_files ${name} _qt_blacklist_files)
|
||||
@ -811,7 +818,8 @@ for this function. Will be ignored")
|
||||
endif()
|
||||
|
||||
set(executable_name ${arg_NAME})
|
||||
if(QT_BUILD_TESTS_BATCHED)
|
||||
qt_internal_is_in_test_batch(is_in_batch ${executable_name})
|
||||
if(is_in_batch)
|
||||
_qt_internal_test_batch_target_name(executable_name)
|
||||
endif()
|
||||
add_test(NAME "${arg_NAME}" COMMAND "${CMAKE_COMMAND}" "-P" "${arg_OUTPUT_FILE}"
|
||||
|
Loading…
x
Reference in New Issue
Block a user