From 5ebce47ac417c51e0a2a027eb873a91f1c703e16 Mon Sep 17 00:00:00 2001 From: Assam Boudjelthia Date: Tue, 12 Dec 2023 14:51:01 +0200 Subject: [PATCH] CMake:Android:Coin: prioritize timeout from COIN_COMMAND_OUTPUT_TIMEOUT ... from CMake so that Coin doesn't end up killing the whole VM if aRows test gets stuck and instead allow androidtestrunner to cleanup and fetch the logs so we know what happened, and even potentially ending up re-run the test and succeeding if it was flaky. Also, since CMake sets the timeout during configuration time, coin needs to set COIN_COMMAND_OUTPUT_TIMEOUT under the build target where tests are configured, so this moves the setting of that env var from the test target to the build target. Pick-to: 6.6 6.5 Change-Id: I9883ea1e98c93f79a088067518d09ca8acd5fdfd Reviewed-by: Alexandru Croitor (cherry picked from commit 3ee2ecd6bfdf3320e66628afa5d017783df2ee91) Reviewed-by: Qt Cherry-pick Bot --- cmake/QtTestHelpers.cmake | 9 +++++++-- .../cmake_run_ctest_enforce_exit_code.yaml | 15 --------------- coin/instructions/prepare_building_env.yaml | 15 +++++++++++++++ 3 files changed, 22 insertions(+), 17 deletions(-) diff --git a/cmake/QtTestHelpers.cmake b/cmake/QtTestHelpers.cmake index 9edf5274bd9..c9cb9e8ab74 100644 --- a/cmake/QtTestHelpers.cmake +++ b/cmake/QtTestHelpers.cmake @@ -863,8 +863,13 @@ endfunction() function(qt_internal_get_android_test_timeout input_timeout percentage output_timeout_var) set(actual_timeout "${input_timeout}") if(NOT actual_timeout) - # Related: https://gitlab.kitware.com/cmake/cmake/-/issues/20450 - if(DART_TESTING_TIMEOUT) + # we have coin ci timeout set use that to avoid having the emulator killed + # so we can at least get some logs from the android test runner. + set(coin_timeout $ENV{COIN_COMMAND_OUTPUT_TIMEOUT}) + if(coin_timeout) + set(actual_timeout "${coin_timeout}") + elseif(DART_TESTING_TIMEOUT) + # Related: https://gitlab.kitware.com/cmake/cmake/-/issues/20450 set(actual_timeout "${DART_TESTING_TIMEOUT}") elseif(CTEST_TEST_TIMEOUT) set(actual_timeout "${CTEST_TEST_TIMEOUT}") diff --git a/coin/instructions/cmake_run_ctest_enforce_exit_code.yaml b/coin/instructions/cmake_run_ctest_enforce_exit_code.yaml index 68bbed6173a..8551cbbda2a 100644 --- a/coin/instructions/cmake_run_ctest_enforce_exit_code.yaml +++ b/coin/instructions/cmake_run_ctest_enforce_exit_code.yaml @@ -85,21 +85,6 @@ instructions: - !include "{{qt/qtbase}}/coin_module_test_android_start_emulator.yaml" - - type: EnvironmentVariable - variableName: COIN_COMMAND_OUTPUT_TIMEOUT - variableValue: "900" - disable_if: - condition: property - property: features - contains_value: UseAddressSanitizer - - type: EnvironmentVariable - variableName: COIN_COMMAND_OUTPUT_TIMEOUT - variableValue: "10800" - enable_if: - condition: property - property: features - contains_value: UseAddressSanitizer - - type: ExecuteCommand command: "{{.Env.TESTS_ENV_PREFIX}} ctest {{.Env.CTEST_ARGS}}" executeCommandArgumentSplitingBehavior: SplitAfterVariableSubstitution diff --git a/coin/instructions/prepare_building_env.yaml b/coin/instructions/prepare_building_env.yaml index efeaa3d7211..b689eb34c75 100644 --- a/coin/instructions/prepare_building_env.yaml +++ b/coin/instructions/prepare_building_env.yaml @@ -608,3 +608,18 @@ instructions: condition: property property: host.os equals_value: Windows + + - type: EnvironmentVariable + variableName: COIN_COMMAND_OUTPUT_TIMEOUT + variableValue: "900" + disable_if: + condition: property + property: features + contains_value: UseAddressSanitizer + - type: EnvironmentVariable + variableName: COIN_COMMAND_OUTPUT_TIMEOUT + variableValue: "10800" + enable_if: + condition: property + property: features + contains_value: UseAddressSanitizer