diff options
author | Pavan Holla <pholla@chromium.org> | 2022-05-25 22:55:01 +0000 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-05-26 22:09:50 +0000 |
commit | 4eb6e6fe9d4da125fb1774a2ded7f068828a8a2f (patch) | |
tree | 7dbcd1731fc592215769fa3526b4139d15ff93f9 | |
parent | 60e833e8a2af60314acc737d1d3589e6492c10a9 (diff) | |
download | autotest-4eb6e6fe9d4da125fb1774a2ded7f068828a8a2f.tar.gz |
cellular: Wait for 1 minute uptime before beginning test
Wait for system daemons to stabilize before beginning the test.
Modemfwd, Chrome, Shill and Hermes might be active before the test
begins, and interrupting them abruptly during test setup might
lead to flaky tests. The modem might also appear/disappear
multiple times during this period. Ideally, we would wait for a
green signal from these daemons before performing test setup.
BUG=b:233647569
TEST=test_that $cr cellular_Identifiers
Change-Id: I23da68c950f939fa28a72423a4bf5ad27db85d31
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/autotest/+/3668782
Reviewed-by: Daniel Winkler <danielwinkler@google.com>
Commit-Queue: Pavan Holla <pholla@google.com>
Tested-by: Pavan Holla <pholla@google.com>
Reviewed-by: Eric Caruso <ejcaruso@chromium.org>
-rw-r--r-- | client/cros/cellular/test_environment.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/client/cros/cellular/test_environment.py b/client/cros/cellular/test_environment.py index c6de8ba596..d1158805d3 100644 --- a/client/cros/cellular/test_environment.py +++ b/client/cros/cellular/test_environment.py @@ -104,6 +104,20 @@ class CellularTestEnvironment(object): def __enter__(self): try: + # Wait for system daemons to stabilize before beginning the test. + # Modemfwd, Chrome, Shill and Hermes might be active before the test + # begins, and interrupting them abruptly during test setup might + # lead to flaky tests. The modem might also appear/disappear + # multiple times during this period. Ideally, we would wait for a + # green signal from these daemons before performing test setup. + with open('/proc/uptime') as uptime_file: + uptime = float(uptime_file.readline().split()[0]) + if uptime < 60: + logging.info( + "Waiting %.1f seconds to reach uptime of 1 minute before " + "starting test", 60 - uptime) + time.sleep(60 - uptime) + if upstart.has_service('modemfwd') and upstart.is_running('modemfwd'): # Due to b/179796133, stopping modemfwd right after it was # started by a previous test, can wedge the modem. In many |