Bug 1286900 - Ensure WPT tests have a version control checkout; r=ted

We add a mozharness action to the TestingMixin base class that ensures
we're running from a VCS checkout and we add this action to the WPT
script.

This ensures that we always have a source checkout available, even
in buildbot. (Before, we only had a source checkout in TaskCluster.)

MozReview-Commit-ID: 26NxwDZywXr

--HG--
extra : rebase_source : d9c0fade450ab14c0b52be674c3c92bf670d2d3b
This commit is contained in:
Gregory Szorc 2016-09-21 10:57:08 -07:00
parent d51263ff47
commit 8c38bb4182
2 changed files with 55 additions and 2 deletions

View File

@ -9,7 +9,6 @@ import copy
import os
import platform
import pprint
import re
import urllib2
import json
import socket
@ -21,6 +20,9 @@ from mozharness.base.python import (
VirtualenvMixin,
virtualenv_config_options,
)
from mozharness.base.vcs.vcsbase import (
VCSMixin,
)
from mozharness.mozilla.buildbot import BuildbotMixin, TBPL_WARNING
from mozharness.mozilla.proxxy import Proxxy
from mozharness.mozilla.structuredlog import StructuredOutputParser
@ -102,7 +104,8 @@ testing_config_options = [
# TestingMixin {{{1
class TestingMixin(VirtualenvMixin, BuildbotMixin, ResourceMonitoringMixin,
TaskClusterArtifactFinderMixin, TooltoolMixin, TryToolsMixin):
TaskClusterArtifactFinderMixin, TooltoolMixin, TryToolsMixin,
VCSMixin):
"""
The steps to identify + download the proper bits for [browser] unit
tests and Talos.
@ -120,6 +123,55 @@ class TestingMixin(VirtualenvMixin, BuildbotMixin, ResourceMonitoringMixin,
default_tools_repo = 'https://hg.mozilla.org/build/tools'
proxxy = None
def query_abs_dirs(self):
dirs = super(TestingMixin, self).query_abs_dirs()
if self.topsrcdir:
dirs['checkout'] = self.topsrcdir
else:
dirs['checkout'] = os.path.join(dirs['base_work_dir'], 'checkout')
if 'HG_SHARE_BASE_DIR' in os.environ:
dirs['hg_shared'] = os.environ['HG_SHARE_BASE_DIR']
else:
dirs['hg_shared'] = os.path.join(dirs['base_work_dir'], 'hg-shared')
return dirs
def ensure_firefox_checkout(self):
"""Action that ensures we have a source checkout available.
If a source checkout is not available, we create one.
"""
if self.topsrcdir:
self.info('already running from a source checkout; nothing to do')
return
self.info('not running from source checkout')
bb_config = getattr(self, 'buildbot_config', None)
if not bb_config:
self.fatal('buildbot config not loaded; unable to proceed '
'(a buildbot config must be loaded to obtain VCS info)')
bb_props = bb_config['properties']
dirs = self.query_abs_dirs()
args = {
'repo': 'https://hg.mozilla.org/%s' % bb_props['repo_path'],
'dest': dirs['checkout'],
'vcs_share_base': dirs['hg_shared'],
'revision': bb_props['revision'],
'clone_with_purge': True,
# Always use the unified repo as the upstream because it is
# stored more efficiently.
'clone_upstream_url': 'https://hg.mozilla.org/mozilla-unified',
}
self.vcs_checkout(vcs='hg', **args)
self.topsrcdir = dirs['checkout']
def _query_proxxy(self):
"""manages the proxxy"""
if not self.proxxy:

View File

@ -56,6 +56,7 @@ class WebPlatformTest(TestingMixin, MercurialScript, BlobUploadMixin):
all_actions=[
'clobber',
'read-buildbot-config',
'ensure-firefox-checkout',
'download-and-extract',
'create-virtualenv',
'pull',