[autotest] Add get_release_version method to servo_host
get_build_id method in autoupdater was removed. Add the new method for
servo_host to use.
BUG=chromium:472135
TEST=local servo test, confirm verify servo works
Change-Id: Ic255dce3b7bfa361204bd6dd7bb03b8f86ec6c5e
Reviewed-on: https://chromium-review.googlesource.com/263245
Trybot-Ready: Dan Shi <dshi@chromium.org>
Tested-by: Dan Shi <dshi@chromium.org>
Reviewed-by: Fang Deng <fdeng@chromium.org>
Commit-Queue: Dan Shi <dshi@chromium.org>
diff --git a/client/common_lib/cros/autoupdater.py b/client/common_lib/cros/autoupdater.py
index b39be92..5dd930b 100644
--- a/client/common_lib/cros/autoupdater.py
+++ b/client/common_lib/cros/autoupdater.py
@@ -590,7 +590,7 @@
# The crash names contain timestamps that may be useful:
# kernel.20131207.005945.0.kcrash
for crash in kernel_crashes:
- logging.debug(' %s', os.path.basename(crash))
+ logging.debug(' %s', os.path.basename(crash))
# Print out some information to make it easier to debug
# the rollback.
diff --git a/server/hosts/cros_host.py b/server/hosts/cros_host.py
index 6802c72..5e1f27a 100644
--- a/server/hosts/cros_host.py
+++ b/server/hosts/cros_host.py
@@ -596,7 +596,7 @@
'Failed to update %s to build %s; found build '
'%s instead' % (self.hostname,
updater.update_version,
- updater.get_build_id()))
+ self.get_release_version()))
def _stage_image_for_update(self, image_name=None):
diff --git a/server/hosts/servo_host.py b/server/hosts/servo_host.py
index cbe6099..65d2af8 100644
--- a/server/hosts/servo_host.py
+++ b/server/hosts/servo_host.py
@@ -18,11 +18,13 @@
from autotest_lib.client.bin import utils
from autotest_lib.client.common_lib import error
from autotest_lib.client.common_lib import global_config
+from autotest_lib.client.common_lib import lsbrelease_utils
from autotest_lib.client.common_lib.cros import autoupdater
from autotest_lib.client.common_lib.cros import dev_server
from autotest_lib.client.common_lib.cros import retry
from autotest_lib.client.common_lib.cros.graphite import autotest_stats
from autotest_lib.client.common_lib.cros.network import ping_runner
+from autotest_lib.client.cros import constants as client_constants
from autotest_lib.server import site_utils as server_site_utils
from autotest_lib.server.cros.servo import servo
from autotest_lib.server.cros.dynamic_suite import frontend_wrappers
@@ -374,6 +376,18 @@
(self.hostname, e))
+ def get_release_version(self):
+ """Get the value of attribute CHROMEOS_RELEASE_VERSION from lsb-release.
+
+ @returns The version string in lsb-release, under attribute
+ CHROMEOS_RELEASE_VERSION.
+ """
+ lsb_release_content = self.run(
+ 'cat "%s"' % client_constants.LSB_RELEASE).stdout.strip()
+ return lsbrelease_utils.get_chromeos_release_version(
+ lsb_release_content=lsb_release_content)
+
+
@_timer.decorate
def _update_image(self):
"""Update the image on the servo host, if needed.
@@ -421,7 +435,7 @@
url = ds.get_update_url(latest_build)
updater = autoupdater.ChromiumOSUpdater(update_url=url, host=self)
- current_build_number = updater.get_build_id()
+ current_build_number = self.get_release_version()
status = updater.check_update_status()
if status == autoupdater.UPDATER_NEED_REBOOT:
@@ -443,7 +457,7 @@
# raised, so test requires servo should fail.
self.reboot(**kwargs)
if self.wait_up(timeout=120):
- current_build_number = updater.get_build_id()
+ current_build_number = self.get_release_version()
logging.info('servo host %s back from reboot, with build %s',
self.hostname, current_build_number)
else: