Commit Graph

12 Commits

Author SHA1 Message Date
Dimitrios Apostolou
98f1034f96 Properly wait for the Android emulator to fully boot
It had been noticed that sometimes the Android emulator in our CI took
several minutes to fully boot. It turns out that this behavior can be
reproduced locally by removing the image files under $HOME/.android
especially the "userdata-qemu.img.qcow2" file.

Then the emulator goes through several reboots until fully booted with a
full set of packages installed. We discovered that the property that
signifies it is finished is dev.bootcomplete=1. So we now check for this
flag and remove the other heuristics we had.

We also disable the debug output to avoid hundreds lines of
logs. Instead we selectively print the values that the emulator returns,
every second until full boot is detected.

We increase the Coin timeout for the shell script, from 5min to 10min,
since it has been measured that it takes about 2.5min on a good day, and
the script itself retries several times to restart the emulator in case
of failure.

Finally we adjust the coding style a bit to be more consistent.

Pick-to: 6.3 6.2
Fixes: QTQAINFRA-4681
Change-Id: I77062dceb91477e957696c89bfacb4ebabc34c1f
Reviewed-by: Toni Saario <toni.saario@qt.io>
Reviewed-by: Daniel Smith <Daniel.Smith@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-01-07 19:34:50 +01:00
Dimitrios Apostolou
c8e0a742fb Wait for boot to be fully complete with all packages installed
It happens that the android emulator supposedly "finishes" booting and
getprop shows bootanim=stopped and boot_completed=1. But sometimes not
all packages have been installed (`pm list packages` shows only 16
packages installed).

After around half a minute the boot animation starts spinning
(bootanim=running) again despite boot_completed=1 all the time. After
some minutes the boot animation stops again and the list of packages
contains 80 packages, among which is also the "development" package.
Only then is the device ready for `adb install` of custom packages.

This should be the last time we see the message:

Error: Could not access the Package Manager.  Is the system running?

Just for completeness, we also properly disown the emulator process and
its file descriptors, since the parent shell dies but the process stays.

Pick-to: 6.3 6.2
Fixes: QTQAINFRA-4681
Change-Id: I2b9d4bdc3dac0f10d09d4f09c83b4028ebc31f48
Reviewed-by: Daniel Smith <Daniel.Smith@qt.io>
2022-01-06 17:14:58 +01:00
Dimitrios Apostolou
8bf1beb9bd Do not hide android emulator output
It might print useful messages, even though they might come mixed with
other test messages.

However we can't leave stdout/stderr as is, because Coin agent hangs at
the end of the shell script, waiting for them to close. So we just
redirect them to a file.

Pick-to: 6.3 6.2
Change-Id: I797af78786b7df31131b3c3261e1c1fc00e5d460
Reviewed-by: Daniel Smith <Daniel.Smith@qt.io>
2022-01-06 14:34:15 +01:00
Dimitrios Apostolou
0aaf514042 Wait for android emulator to be up and running properly
Pick-to: 6.3 6.2
Fixes: QTQAINFRA-4681
Change-Id: Icfa75b6982964970172726379e5a2a2bb640f8bf
Reviewed-by: Daniel Smith <Daniel.Smith@qt.io>
2022-01-06 14:34:09 +01:00
Assam Boudjelthia
a81f24ada5 Rename deprecated ANDROID_SDK_HOME to ANDROID_SDK_ROOT
Pick-to: 6.2
Task-number: QTBUG-97002
Change-Id: I777491f542e5388e04ed4c1b7ff5d9db75f9e778
Reviewed-by: Heikki Halmet <heikki.halmet@qt.io>
2021-10-22 17:21:10 +02:00
Heikki Halmet
507499d4b6 Change Android emulator command path
Pick-to: 6.2
Pick-to: 6.1
Change-Id: I6e7df6cdf7f0a0a7efea8fb7672be0b3df096d12
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-06-14 16:01:52 +03:00
Heikki Halmet
e75bd6e09a Add option to use different ANDROID_EMULATOR
This change add option to determine used Android emulator version using
environment variable. If variable is not set @x86emulator will be used
as default value.

Change-Id: Ifc52d07d058bf078bf915ca78683822a966b58fb
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-06-02 21:02:41 +03:00
Assam Boudjelthia
cbd226fffa CI: explicitly use -gpu swiftshader_indirect with Android emulator
Force the emulator to use software acceleration to avoid a crash.

Change-Id: I1e73b8bc6485b0854cf83f5d9faa5d5f872a90df
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-05-31 00:03:05 +03:00
Assam Boudjelthia
136324ad62 Coin: fix android emulator script to use bash instead of sh
Task-number: QTBUG-91180
Pick-to: 6.0 6.1
Change-Id: I410c6769aac3b3b760ff35aa71d52c8a5d6c1143
Reviewed-by: Toni Saario <toni.saario@qt.io>
2021-02-19 10:31:44 +02:00
Assam Boudjelthia
bcbdbd50fe Coin: remove workarounds to allow running Android tests
We had two workarounds:
* script that adds Gui to tests
* create a symbolic link for the qt install dir to fake_prefix which
androiddelployqt was expecting them to be under

Both issues are fixed, thus removing the workarounds.

Pick-to: 6.1 6.0
Change-Id: Ic022bece15afe92c693d573893d260b13b4227ed
Reviewed-by: Heikki Halmet <heikki.halmet@qt.io>
2021-02-18 13:42:19 +02:00
Assam Boudjelthia
86a655387c Android: restart emulator if it gets stuck during testing
Task-number: QTQAINFRA-4052
Pick-to: 6.0
Change-Id: Ie1a0d1c6b6c5cd0425b7ccf195ac57408142f3c3
Reviewed-by: Simo Fält <simo.falt@qt.io>
2020-12-11 11:09:22 +02:00
Simo Fält
13c460d0ff Add coin instructions to run Android test in emulator
Task-number: QTQAINFRA-3867
Pick-to: 6.0
Change-Id: Ie6dd9c2dfeeccd526c2133d7ac03efce5b7ed091
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2020-11-20 13:28:31 +00:00