aboutsummaryrefslogtreecommitdiff
path: root/buildbot_test_toolchains.py
diff options
context:
space:
mode:
authorLuis Lozano <llozano@chromium.org>2016-02-19 17:37:01 -0800
committerchrome-bot <chrome-bot@chromium.org>2016-02-21 05:17:49 +0000
commitc75fd0585d55b9a4b9d7999a41ce81c43dca0957 (patch)
tree337b0e91f21f22e48bc6facc078381f4b87f0fd4 /buildbot_test_toolchains.py
parent99c79302832b804422ceb23cd6ab4f8113ebbed7 (diff)
downloadtoolchain-utils-c75fd0585d55b9a4b9d7999a41ce81c43dca0957.tar.gz
Improve search for non-AFDO images for performace comparison.
To compare O2 vs AFDO, we try to use images from the chrome-pfq. We now search the PFQ image created by the previous version of chromeos since that is the one that validated the chrome for the current version. If we dont find a previous, we try 2 versions before. BUG=None TEST=White testing.ran simplified version of buildbot_test_toolchains. Change-Id: I800255508117c7aa7f91468243e4713432e5561a Reviewed-on: https://chrome-internal-review.googlesource.com/249245 Commit-Ready: Luis Lozano <llozano@chromium.org> Tested-by: Luis Lozano <llozano@chromium.org> Reviewed-by: Luis Lozano <llozano@chromium.org>
Diffstat (limited to 'buildbot_test_toolchains.py')
-rwxr-xr-xbuildbot_test_toolchains.py67
1 files changed, 43 insertions, 24 deletions
diff --git a/buildbot_test_toolchains.py b/buildbot_test_toolchains.py
index e02f6b3f..58e76b45 100755
--- a/buildbot_test_toolchains.py
+++ b/buildbot_test_toolchains.py
@@ -15,6 +15,7 @@ from __future__ import print_function
import datetime
import optparse
import os
+import re
import sys
import time
@@ -40,6 +41,19 @@ WEEKLY_REPORTS_ROOT = os.path.join(CROSTC_ROOT, 'weekly_test_data')
PENDING_ARCHIVES_DIR = os.path.join(CROSTC_ROOT, 'pending_archives')
NIGHTLY_TESTS_DIR = os.path.join(CROSTC_ROOT, 'nightly_test_reports')
+IMAGE_FS = (r'{board}-{image_type}/{chrome_version}-{tip}\.' +
+ r'{branch}\.{branch_branch}')
+TRYBOT_IMAGE_FS = 'trybot-' + IMAGE_FS + '-{build_id}'
+PFQ_IMAGE_FS = IMAGE_FS + '-rc1'
+IMAGE_RE_GROUPS = {'board': r'(?P<board>\S+)',
+ 'image_type': r'(?P<image_type>\S+)',
+ 'chrome_version': r'(?P<chrome_version>R\d+)',
+ 'tip': r'(?P<tip>\d+)',
+ 'branch': r'(?P<branch>\d+)',
+ 'branch_branch': r'(?P<branch_branch>\d+)',
+ 'build_id': r'(?P<build_id>b\d+)'}
+TRYBOT_IMAGE_RE = TRYBOT_IMAGE_FS.format(**IMAGE_RE_GROUPS)
+
class ToolchainComparator(object):
"""Class for doing the nightly tests work."""
@@ -71,8 +85,8 @@ class ToolchainComparator(object):
self._reports_dir = os.path.join(NIGHTLY_TESTS_DIR,
'%s.%s' % (timestamp, board),)
- def _ParseVanillaImage(self, trybot_image):
- """Parse a trybot artifact name to get corresponding vanilla image.
+ def _GetVanillaImageName(self, trybot_image):
+ """Given a trybot artifact name, get corresponding vanilla image name.
Args:
trybot_image: artifact name such as
@@ -81,15 +95,20 @@ class ToolchainComparator(object):
Returns:
Corresponding official image name, e.g. 'daisy-release/R40-6394.0.0'.
"""
- start_pos = trybot_image.find(self._build)
- assert start_pos != -1
- end_pos = trybot_image.rfind('-b')
- assert end_pos != -1
- vanilla_image = trybot_image[start_pos:end_pos]
- return vanilla_image
+ mo = re.search(TRYBOT_IMAGE_RE, trybot_image)
+ assert mo
+ return IMAGE_FS.replace('\\', '').format(**mo.groupdict())
+
+ def _GetNonAFDOImageName(self, trybot_image):
+ """Given a trybot artifact name, get corresponding non-AFDO image name.
- def _ParseNonAFDOImage(self, trybot_image):
- """Parse a trybot artifact name to get corresponding non-AFDO image.
+ We get the non-AFDO image from the PFQ builders. This image
+ is not generated for all the boards and, the closest PFQ image
+ was the one build for the previous ChromeOS version (the chrome
+ used in the current version is the one validated in the previous
+ version).
+ The previous ChromeOS does not always exist either. So, we try
+ a couple of versions before.
Args:
trybot_image: artifact name such as
@@ -97,17 +116,18 @@ class ToolchainComparator(object):
Returns:
Corresponding chrome PFQ image name, e.g.
- 'daisy-chrome-pfq/R40-6394.0.0-rc1'.
+ 'daisy-chrome-pfq/R40-6393.0.0-rc1'.
"""
- start_pos = trybot_image.find(self._build)
- assert start_pos != -1
- end_pos = trybot_image.rfind('-b')
- assert end_pos != -1
- nonafdo_image = trybot_image[start_pos:end_pos]
- pfq_suffix = '-chrome-pfq'
- nonafdo_image = nonafdo_image.replace('-release', pfq_suffix) + '-rc1'
- assert nonafdo_image.find(pfq_suffix) != -1
- return nonafdo_image
+ mo = re.search(TRYBOT_IMAGE_RE, trybot_image)
+ assert mo
+ image_dict = mo.groupdict()
+ image_dict['image_type'] = 'chrome-pfq'
+ for _ in xrange(2):
+ image_dict['tip'] = str(int(image_dict['tip']) - 1)
+ nonafdo_image = PFQ_IMAGE_FS.replace('\\', '').format(**image_dict)
+ if buildbot_utils.DoesImageExist(self._chromeos_root, nonafdo_image):
+ return nonafdo_image
+ return ''
def _FinishSetup(self):
"""Make sure testing_rsa file is properly set up."""
@@ -282,10 +302,8 @@ class ToolchainComparator(object):
self._l.LogError('Unable to find trybot_image for %s!' % description)
return 1
- vanilla_image = self._ParseVanillaImage(trybot_image)
- nonafdo_image = self._ParseNonAFDOImage(trybot_image)
- if not buildbot_utils.DoesImageExist(self._chromeos_root, nonafdo_image):
- nonafdo_image = ''
+ vanilla_image = self._GetVanillaImageName(trybot_image)
+ nonafdo_image = self._GetNonAFDOImageName(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.
@@ -293,6 +311,7 @@ class ToolchainComparator(object):
print('trybot_image: %s' % trybot_image)
print('vanilla_image: %s' % vanilla_image)
print('nonafdo_image: %s' % nonafdo_image)
+
if os.getlogin() == ROLE_ACCOUNT:
self._FinishSetup()