From 56f13765cdc7bb3f380ccbbc02b9af95af2e0592 Mon Sep 17 00:00:00 2001 From: Yunlian Jiang Date: Wed, 6 Jan 2016 12:56:24 -0800 Subject: toolchain-utils: check vanilla image before calling crosperf. In some cases, the vanilla image builds finishes later than the image from trybot, this could cause the nightly test job fail. This CL makes sure the vanilla image is ready before calling crosperf. BUG=None TEST=None Change-Id: Id2f28717c5a8c6c6db0d6c2e240c687199ea6a7c Reviewed-on: https://chrome-internal-review.googlesource.com/243618 Commit-Ready: Yunlian Jiang Tested-by: Yunlian Jiang Reviewed-by: Yunlian Jiang --- buildbot_test_toolchains.py | 3 +++ utils/buildbot_utils.py | 23 +++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/buildbot_test_toolchains.py b/buildbot_test_toolchains.py index b984fca7..ea6099b6 100755 --- a/buildbot_test_toolchains.py +++ b/buildbot_test_toolchains.py @@ -288,6 +288,9 @@ class ToolchainComparator(object): vanilla_image = self._ParseVanillaImage(trybot_image) nonafdo_image = self._ParseNonAFDOImage(trybot_image) + # The trybot image is ready here, in some cases, the vanilla image + # is not ready, so we need to make sure vanilla image is available. + buildbot_utils.WaitForImage(self._chromeos_root, vanilla_image) print('trybot_image: %s' % trybot_image) print('vanilla_image: %s' % vanilla_image) print('nonafdo_image: %s' % nonafdo_image) diff --git a/utils/buildbot_utils.py b/utils/buildbot_utils.py index 2d7960a5..0116fc61 100644 --- a/utils/buildbot_utils.py +++ b/utils/buildbot_utils.py @@ -2,6 +2,8 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +"""Module for building with cbuildbot.""" + from __future__ import print_function import os @@ -294,3 +296,24 @@ def GetTrybotImage(chromeos_root, logger.GetLogger().LogOutput("trybot_image is '%s'" % trybot_image) logger.GetLogger().LogOutput('build_status is %d' % build_status) return trybot_image + +def WaitForImage(chromeos_root, build): + """Wait for a image to be ready.""" + + ready = False + elapsed_time = 0 + ce = command_executer.GetCommandExecuter() + command = ('gsutil ls gs://chromeos-image-archive/%s' + '/chromiumos_test_image.tar.xz' % (build)) + while not ready and elapsed_time < TIME_OUT: + ret = ce.ChrootRunCommand(chromeos_root, + command, + print_to_console=False) + if not ret: + return ret + logger.GetLogger().LogOutput("Image %s not ready, waiting for 10 minutes" + % build) + time.sleep(SLEEP_TIME) + elapsed_time += SLEEP_TIME + + return ret -- cgit v1.2.3