Bug 1278702 - Fail early in compiled-code tests with --artifact Try syntax; r=armenzg
authorMaja Frydrychowicz <mjzffr@gmail.com>
Tue, 20 Sep 2016 13:43:06 -0400
changeset 314746 e9aa1c694bb184367ef344831a09bba3e84be681
parent 314745 e4086709000d694e33c20e27af1ff42e3f2311e2
child 314747 12d60c0e0b0ed7a0005d500564da8ba7b7ca840f
push id30733
push usercbook@mozilla.com
push dateThu, 22 Sep 2016 09:50:59 +0000
treeherdermozilla-central@4aa20c3e211f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersarmenzg
bugs1278702
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 1278702 - Fail early in compiled-code tests with --artifact Try syntax; r=armenzg MozReview-Commit-ID: 84IZn2Qpvk4
testing/mozharness/scripts/desktop_unittest.py
--- a/testing/mozharness/scripts/desktop_unittest.py
+++ b/testing/mozharness/scripts/desktop_unittest.py
@@ -21,16 +21,17 @@ import imp
 # load modules from parent dir
 sys.path.insert(1, os.path.dirname(sys.path[0]))
 
 from mozharness.base.errors import BaseErrorList
 from mozharness.base.log import INFO, ERROR
 from mozharness.base.script import PreScriptAction
 from mozharness.base.vcs.vcsbase import MercurialScript
 from mozharness.mozilla.blob_upload import BlobUploadMixin, blobupload_config_options
+from mozharness.mozilla.buildbot import TBPL_EXCEPTION
 from mozharness.mozilla.mozbase import MozbaseMixin
 from mozharness.mozilla.testing.codecoverage import (
     CodeCoverageMixin,
     code_coverage_config_options
 )
 from mozharness.mozilla.testing.testbase import TestingMixin, testing_config_options
 
 SUITE_CATEGORIES = ['gtest', 'cppunittest', 'jittest', 'mochitest', 'reftest', 'xpcshell', 'mozbase', 'mozmill']
@@ -476,16 +477,41 @@ class DesktopUnittest(TestingMixin, Merc
     # read_buildbot_config is in BuildbotMixin.
     # postflight_read_buildbot_config is in TestingMixin.
     # preflight_download_and_extract is in TestingMixin.
     # create_virtualenv is in VirtualenvMixin.
     # preflight_install is in TestingMixin.
     # install is in TestingMixin.
     # upload_blobber_files is in BlobUploadMixin
 
+    @PreScriptAction('download-and-extract')
+    def _pre_download_and_extract(self, action):
+        """Abort if --artifact try syntax is used with compiled-code tests"""
+        if not self.try_message_has_flag('artifact'):
+            return
+        self.info('Artifact build requested in try syntax.')
+        rejected = []
+        compiled_code_suites = [
+            "cppunit",
+            "gtest",
+            "jittest",
+        ]
+        for category in SUITE_CATEGORIES:
+            suites = self._query_specified_suites(category) or []
+            for suite in suites:
+                if any([suite.startswith(c) for c in compiled_code_suites]):
+                    rejected.append(suite)
+                    break
+        if rejected:
+            self.buildbot_status(TBPL_EXCEPTION)
+            self.fatal("There are specified suites that are incompatible with "
+                      "--artifact try syntax flag: {}".format(', '.join(rejected)),
+                       exit_code=self.return_code)
+
+
     def download_and_extract(self):
         """
         download and extract test zip / download installer
         optimizes which subfolders to extract from tests zip
         """
         c = self.config
 
         extract_dirs = None