From 3d2265b333b97e9e564833948021306cbc3b1940 Mon Sep 17 00:00:00 2001 From: Assam Boudjelthia Date: Wed, 29 Nov 2023 13:45:04 +0200 Subject: AndroidTestRunner: uninstall the test when interrupted If the test runner was interrupted, stop waiting for the test to start or to finish, go fetch the available test results and logcat and uninstall the test app. Also, set CMake TIMEOUT_SIGNAL_NAME to SIGINT and TIMEOUT_SIGNAL_GRACE_PERIOD to 10 seconds to allow enough time to fetch the logs and uninstall the test app. Task-number: QTBUG-106479 Pick-to: 6.5 Change-Id: I4820cfe58f05d15179b4af819caa92e475881634 Reviewed-by: Alexandru Croitor (cherry picked from commit 4a3936c33cb2ab9fee2e93cbe99d31daf1cd0cc8) Reviewed-by: Qt Cherry-pick Bot (cherry picked from commit aecf64eb7b896285d66b22fd725cb11e83f5e807) --- cmake/QtTestHelpers.cmake | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'cmake') diff --git a/cmake/QtTestHelpers.cmake b/cmake/QtTestHelpers.cmake index 9bde392077..f5470db9fd 100644 --- a/cmake/QtTestHelpers.cmake +++ b/cmake/QtTestHelpers.cmake @@ -579,12 +579,12 @@ function(qt_internal_add_test name) endif() endif() - # Pass 95% of the timeout to allow the test runner time to do any cleanup - # before being killed. - set(percentage "95") - qt_internal_get_android_test_timeout("${arg_TIMEOUT}" "${percentage}" android_timeout) - if (ANDROID) + # Pass 95% of the timeout to allow the test runner time to do any cleanup + # before being killed. + set(percentage "95") + qt_internal_get_android_test_timeout("${arg_TIMEOUT}" "${percentage}" android_timeout) + if(arg_BUNDLE_ANDROID_OPENSSL_LIBS) if(NOT OPENSSL_ROOT_DIR) message(WARNING "The argument BUNDLE_ANDROID_OPENSSL_LIBS is set " @@ -695,6 +695,14 @@ function(qt_internal_add_test name) set_tests_properties(${testname} PROPERTIES TIMEOUT ${arg_TIMEOUT}) endif() + if(ANDROID) + # Set timeout signal and some time for androidtestrunner to do cleanup + set_tests_properties(${testname} PROPERTIES + TIMEOUT_SIGNAL_NAME "SIGINT" + TIMEOUT_SIGNAL_GRACE_PERIOD 10.0 + ) + endif() + # Add a ${target}/check makefile target, to more easily test one test. set(test_config_options "") -- cgit v1.2.3