summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2022-08-12 16:21:04 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2022-08-15 10:44:54 +0200
commit6c9f4f5ebcd35dc1a68c442d9fbf3ec48f30baca (patch)
tree2a4e47f152d18406372c0645597a8e8f590a3a54 /cmake
parentc76bf583504091f91f119135befdef0e02a5ddf5 (diff)
CMake: Enable public executable finalizers for iOS tests
This ensures that tests can be executed on the simulator or device, by doing the necessary steps like setting a bundle identifier, Info.plist file, launch screen, etc. This is done by calling _qt_internal_finalize_executable in the implementation of all internal test adding functions. The finalizers are limited only to iOS for now, as an incremental step, and to ensure we don't accidentally break tests on other platforms. At least WebAssembly uses its own finalizers which would likely cause duplicate calls if the _qt_internal_finalize_executable was unconditional. Pick-to: 6.4 Fixes: QTBUG-104754 Change-Id: I729d56385dd206b22c975fc2ce4e2c683e6e4e2c Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/QtTestHelpers.cmake15
1 files changed, 15 insertions, 0 deletions
diff --git a/cmake/QtTestHelpers.cmake b/cmake/QtTestHelpers.cmake
index 862e79c6fa..1bf87c3870 100644
--- a/cmake/QtTestHelpers.cmake
+++ b/cmake/QtTestHelpers.cmake
@@ -68,6 +68,8 @@ function(qt_internal_add_benchmark target)
if (TARGET benchmark)
add_dependencies("benchmark" "${target}_benchmark")
endif()
+
+ qt_internal_add_test_finalizers("${target}")
endfunction()
# Simple wrapper around qt_internal_add_executable for manual tests which insure that
@@ -113,6 +115,7 @@ function(qt_internal_add_manual_test target)
# Disable the QT_NO_NARROWING_CONVERSIONS_IN_CONNECT define for manual tests
qt_internal_undefine_global_definition(${target} QT_NO_NARROWING_CONVERSIONS_IN_CONNECT)
+ qt_internal_add_test_finalizers("${target}")
endfunction()
# This function will configure the fixture for the network tests that require docker network services
@@ -493,6 +496,7 @@ function(qt_internal_add_test name)
endif()
endif()
+ qt_internal_add_test_finalizers("${name}")
endfunction()
# This function adds test with specified NAME and wraps given test COMMAND with standalone cmake
@@ -756,3 +760,14 @@ function(qt_internal_collect_command_environment out_path out_plugin_path)
string(REPLACE ";" "\;" plugin_paths_joined "${plugin_paths_joined}")
set(${out_plugin_path} "${plugin_paths_joined}" PARENT_SCOPE)
endfunction()
+
+function(qt_internal_add_test_finalizers target)
+ # It might not be safe to run all the finalizers of _qt_internal_finalize_executable
+ # within the context of a Qt build (not a user project) when targeting a host build.
+ # At least one issue is missing qmlimportscanner at configure time.
+ # For now, we limit it to iOS, where it was tested to work, an we know that host tools
+ # should already be built and available.
+ if(IOS)
+ qt_add_list_file_finalizer(_qt_internal_finalize_executable "${target}")
+ endif()
+endfunction()