Bug 1286900 - Ensure WPT tests have a version control checkout; r=ted
☠☠ backed out by aed585286446 ☠ ☠
authorGregory Szorc <gps@mozilla.com>
Wed, 21 Sep 2016 10:57:08 -0700
changeset 315352 01c3527edde5d90114b72e52e5890b43e6ba15cb
parent 315351 6b5f059a85ad581fe9078941c80a8e22869f8149
child 315353 5b0f69c86028c974b83717b5f67e6d240d13f1ce
push id30748
push usercbook@mozilla.com
push dateWed, 28 Sep 2016 13:53:19 +0000
treeherdermozilla-central@8c84b7618840 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted
bugs1286900
milestone52.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
testing/mozharness/mozharness/mozilla/testing/testbase.py
testing/mozharness/scripts/web_platform_tests.py
--- a/testing/mozharness/mozharness/mozilla/testing/testbase.py
+++ b/testing/mozharness/mozharness/mozilla/testing/testbase.py
@@ -4,28 +4,30 @@
 # License, v. 2.0. If a copy of the MPL was not distributed with this file,
 # You can obtain one at http://mozilla.org/MPL/2.0/.
 # ***** END LICENSE BLOCK *****
 
 import copy
 import os
 import platform
 import pprint
-import re
 import urllib2
 import json
 import socket
 
 from mozharness.base.errors import BaseErrorList
 from mozharness.base.log import FATAL, WARNING
 from mozharness.base.python import (
     ResourceMonitoringMixin,
     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
 from mozharness.mozilla.taskcluster_helper import TaskClusterArtifactFinderMixin
 from mozharness.mozilla.testing.unittest import DesktopUnittestOutputParser
 from mozharness.mozilla.testing.try_tools import TryToolsMixin, try_config_options
 from mozharness.mozilla.tooltool import TooltoolMixin
 
@@ -97,17 +99,18 @@ testing_config_options = [
      "choices": ['ondemand', 'true'],
      "help": "Download and extract crash reporter symbols.",
       }],
 ] + copy.deepcopy(virtualenv_config_options) + copy.deepcopy(try_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.
     """
 
     installer_url = None
     installer_path = None
     binary_path = None
@@ -115,16 +118,65 @@ class TestingMixin(VirtualenvMixin, Buil
     test_packages_url = None
     symbols_url = None
     symbols_path = None
     jsshell_url = None
     minidump_stackwalk_path = None
     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:
             self.proxxy = Proxxy(self.config, self.log_obj)
         return self.proxxy
 
     def download_proxied_file(self, url, file_name=None, parent_dir=None,
                               create_parent_dir=True, error_level=FATAL,
--- a/testing/mozharness/scripts/web_platform_tests.py
+++ b/testing/mozharness/scripts/web_platform_tests.py
@@ -51,16 +51,17 @@ class WebPlatformTest(TestingMixin, Merc
         copy.deepcopy(blobupload_config_options)
 
     def __init__(self, require_config_file=True):
         super(WebPlatformTest, self).__init__(
             config_options=self.config_options,
             all_actions=[
                 'clobber',
                 'read-buildbot-config',
+                'ensure-firefox-checkout',
                 'download-and-extract',
                 'create-virtualenv',
                 'pull',
                 'install',
                 'run-tests',
             ],
             require_config_file=require_config_file,
             config={'require_test_zip': True})