From 14c7c3061b02bd64092c48b8bb0e20985aefef51 Mon Sep 17 00:00:00 2001 From: Jani Korteniemi Date: Fri, 30 Aug 2024 10:50:27 +0200 Subject: [PATCH] Fix Android emulator timeout and restart on COIN Changed device's start timeout to 3 minutes, and restarting retries to 3. Changed emulator boot check loop to check against real time value instead int value. Some of the tests caused previous for-loop to take more than 1 second. Task-number: COIN-1154 Change-Id: I58066ad8f440b2fdee3c5b64d094b2713007bf19 Reviewed-by: Assam Boudjelthia Reviewed-by: Jukka Jokiniva --- .../common/linux/android_emulator_launcher.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/coin/provisioning/common/linux/android_emulator_launcher.sh b/coin/provisioning/common/linux/android_emulator_launcher.sh index fad20148..351a04f9 100755 --- a/coin/provisioning/common/linux/android_emulator_launcher.sh +++ b/coin/provisioning/common/linux/android_emulator_launcher.sh @@ -7,8 +7,8 @@ set -e -EMULATOR_MAX_RETRIES=5 -ADB_MAX_TIMEOUT=300 +EMULATOR_MAX_RETRIES=3 +ADB_MAX_TIMEOUT=180 EMULATOR_EXEC="$ANDROID_SDK_ROOT/emulator/emulator" ADB_EXEC="$ANDROID_SDK_ROOT/platform-tools/adb" LOGCAT_PATH="$COIN_CTEST_RESULTSDIR/emulator_logcat_%iter.txt" @@ -85,7 +85,11 @@ do echo "Waiting a few minutes for the emulator to fully boot..." emulator_status=down - for _ in $(seq ${ADB_MAX_TIMEOUT}) + + time_start=${SECONDS} + duration=0 + + while [ $duration -lt ${ADB_MAX_TIMEOUT} ] do sleep 1 @@ -94,6 +98,7 @@ do emulator_status=up break fi + duration=$(( SECONDS - time_start )) done # If emulator status is still offline after timeout period,