Turn off forced updates. Modify perf to always update.
To increase lab efficiency we only want to trigger an update if we're
not already running the version we want to test.
However, some tests (boot perf) need to always start with a fresh
install.
BUG=none
TEST=Ran run_remote_tests --update_url w/ Old->New, New->New.
Change-Id: Ie5e1eee89f3c603938e24d6743d93f7cbdcbc544
Reviewed-on: http://gerrit.chromium.org/gerrit/943
Reviewed-by: Eric Li <ericli@google.com>
Tested-by: Eric Li <ericli@google.com>
Tested-by: Eric Li (do not use)
Reviewed-by: Eric Li (do not use)
diff --git a/client/common_lib/cros/autoupdater.py b/client/common_lib/cros/autoupdater.py
index f94c41b..9e4b32d 100644
--- a/client/common_lib/cros/autoupdater.py
+++ b/client/common_lib/cros/autoupdater.py
@@ -167,6 +167,10 @@
logging.info('System is already up to date. Skipping update.')
return False
+ logging.info(
+ 'Updating from version %s to %s.', booted_version,
+ self.update_version)
+
# Check that Dev Server is accepting connections (from autoserv's host).
# If we can't talk to it, the machine host probably can't either.
auserver_host = urlparse.urlparse(self.update_url)[1]
diff --git a/server/hosts/chromiumos_host.py b/server/hosts/chromiumos_host.py
index bb7168a..5c0a692 100644
--- a/server/hosts/chromiumos_host.py
+++ b/server/hosts/chromiumos_host.py
@@ -15,15 +15,14 @@
# Time to wait for new kernel to be marked successful.
_KERNEL_UPDATE_TIMEOUT = 60
+# Ephemeral file to indicate that an update has just occurred.
+_JUST_UPDATED_FLAG = '/tmp/just_updated'
+
class ChromiumOSHost(base_classes.Host):
"""ChromiumOSHost is a special subclass of SSHHost that supports
additional install methods.
"""
- # Force updating of the host, even if it's already up to date.
- force_update = True
-
-
def __initialize(self, hostname, *args, **dargs):
"""
Construct a ChromiumOSHost object
@@ -34,7 +33,7 @@
super(ChromiumOSHost, self)._initialize(hostname, *args, **dargs)
- def machine_install(self, update_url=None):
+ def machine_install(self, update_url=None, force_update=False):
if parser.options.image:
update_url = parser.options.image
elif not update_url:
@@ -43,7 +42,7 @@
# Attempt to update the system.
updater = autoupdater.ChromiumOSUpdater(update_url, host=self)
- if updater.run_update(self.force_update):
+ if updater.run_update(force_update):
# Figure out active and inactive kernel.
active_kernel, inactive_kernel = updater.get_kernel_state()
@@ -92,6 +91,18 @@
'AUTOSERV', 'client_autodir_paths', type=list):
self.run('rm -rf ' + path)
+ # Mark host as recently updated. Hosts are rebooted at the end of every
+ # test cycle which will remove the file.
+ self.run('touch %s' % _JUST_UPDATED_FLAG)
+
+
+ def has_just_updated(self):
+ """Indicates whether the host was updated within this boot."""
+ # Check for the existence of the just updated flag file.
+ return self.run(
+ '[ -f %s ] && echo T || echo F'
+ % _JUST_UPDATED_FLAG).stdout.strip() == 'T'
+
def cleanup(self):
"""Special cleanup method to make sure hosts always get power back."""
diff --git a/server/site_tests/suites/control.perfalerts b/server/site_tests/suites/control.perfalerts
index b1eb882..9116763 100644
--- a/server/site_tests/suites/control.perfalerts
+++ b/server/site_tests/suites/control.perfalerts
@@ -21,6 +21,10 @@
def run_assigned_tests(machine):
client = hosts.create_host(machine)
+ # Always make sure the host has a fresh install; avoid double fresh install.
+ if not client.has_just_updated():
+ client.machine_install(force_update=True)
+
job.run_test(
"platform_BootPerfServer", host=client, iterations=100)