summaryrefslogtreecommitdiffstats
path: root/tests/auto/cmake/CMakeLists.txt
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2022-02-14 16:38:47 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-03-16 19:04:00 +0000
commit83be04a21321c3b089d50dd4edf6606e787c6338 (patch)
tree74a190b244ae901953c2a53b559d73c4d38c56d3 /tests/auto/cmake/CMakeLists.txt
parentd195265e9aa8974da41dc2820854d4bc3f2e334f (diff)
CMake: Add deployment auto test
Add a cmake test that builds a simple widgets application, installs it, in a shared Qt build deploys the runtime dependencies and then runs it to confirm that the app works. With a static Qt, the installation of the runtime dependencies is skipped, but the app should still run. The test is expected to pass only when targeting Windows and macOS (both when using shared and static Qt). Task-number: QTBUG-98545 Change-Id: I41b616e1e1fc463d57c64be9273ed4dc755e9187 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit 21bffeec9031bc1b5e1cb518508650fe4ad04225) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'tests/auto/cmake/CMakeLists.txt')
-rw-r--r--tests/auto/cmake/CMakeLists.txt19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/auto/cmake/CMakeLists.txt b/tests/auto/cmake/CMakeLists.txt
index 8073a47c16..54ce69f0be 100644
--- a/tests/auto/cmake/CMakeLists.txt
+++ b/tests/auto/cmake/CMakeLists.txt
@@ -284,3 +284,22 @@ _qt_internal_test_expect_pass(test_static_resources
_qt_internal_test_expect_pass(test_generating_cpp_exports)
_qt_internal_test_expect_pass(test_qt_extract_metatypes)
+
+set(deploy_args
+ test_widgets_app_deployment
+ BINARY "${CMAKE_CTEST_COMMAND}"
+ BINARY_ARGS "-V"
+ # Need to explicitly specify a writable install prefix.
+ BUILD_OPTIONS
+ -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/test_widgets_app_deployment_installed
+)
+
+# For now, the test should only pass on Windows and macOS shared and static builds and fail on
+# other platforms, because there is no support for runtime dependency deployment
+# on those platforms.
+# With static builds the runtime dependencies are just skipped, but the test should still pass.
+if((WIN32 OR (APPLE AND NOT IOS)))
+ _qt_internal_test_expect_pass(${deploy_args})
+else()
+ _qt_internal_test_expect_fail(${deploy_args})
+endif()