Factory VM and servo tests.
BUG=chrome-os-partner:6534
TEST=Ran the test manually
Change-Id: Ia844e37d892540cc0cf73dae73a21e74b85e6766
Reviewed-on: https://gerrit.chromium.org/gerrit/11843
Reviewed-by: Scott Zawalski <scottz@chromium.org>
Tested-by: Jon Salz <jsalz@chromium.org>
Commit-Ready: Jon Salz <jsalz@chromium.org>
diff --git a/client/bin/site_utils.py b/client/bin/site_utils.py
index deb96ec..e3963cd 100644
--- a/client/bin/site_utils.py
+++ b/client/bin/site_utils.py
@@ -59,19 +59,24 @@
condition, exception=None, timeout=10, sleep_interval=0.1, desc=None):
"""Poll until a condition becomes true.
- condition: function taking no args and returning bool
- exception: exception to throw if condition doesn't become true
- timeout: maximum number of seconds to wait
- sleep_interval: time to sleep between polls
- desc: description of default TimeoutError used if 'exception' is None
+ Arguments:
+ condition: function taking no args and returning bool
+ exception: exception to throw if condition doesn't become true
+ timeout: maximum number of seconds to wait
+ sleep_interval: time to sleep between polls
+ desc: description of default TimeoutError used if 'exception' is None
+
+ Returns:
+ The true value that caused the poll loop to terminate.
Raises:
'exception' arg if supplied; site_utils.TimeoutError otherwise
"""
start_time = time.time()
while True:
- if condition():
- return
+ value = condition()
+ if value:
+ return value
if time.time() + sleep_interval - start_time > timeout:
if exception:
logging.error(exception)