Bug 1305242 - Disable linux64-jsdcov and linux64-ccov from running on try with '-u all'. r?dustin draft
authorGreg Mierzwinski <gmierz2@outlook.com>
Sat, 24 Sep 2016 14:31:25 -0400
changeset 425012 4125e49eaee483b08624f3f341f0b9904807b446
parent 424914 7452437b3ab571b1d60aed4e973d82a1471f72b2
child 533821 be9de6750762ff6d7870ebda6368ca3421650a06
push id32316
push userbmo:gmierz2@outlook.com
push dateFri, 14 Oct 2016 01:46:28 +0000
reviewersdustin
bugs1305242
milestone52.0a1
Bug 1305242 - Disable linux64-jsdcov and linux64-ccov from running on try with '-u all'. r?dustin This patch prevents tests which have the 'run_on_projects' attribute assigned to an empty set from running when the try message contains '-p all' and '-u all' together. It also makes the 'match_test' function a little more readable and updates the 'attributes.rst' document to reflect the changes that were made. MozReview-Commit-ID: IMk0cmSza8U
taskcluster/docs/attributes.rst
taskcluster/taskgraph/try_option_syntax.py
--- a/taskcluster/docs/attributes.rst
+++ b/taskcluster/docs/attributes.rst
@@ -29,17 +29,17 @@ either project names or the aliases
  * `integration` -- integration branches
  * `release` -- release branches including mozilla-central
  * `all` -- everywhere (the default)
 
 For try, this attribute applies only if ``-p all`` is specified.  All jobs can
 be specified by name regardless of ``run_on_projects``.
 
 If ``run_on_projects`` is set to an empty list, then the task will not run
-anywhere, unless specified explicitly in try syntax.
+anywhere, unless its build platform is specified explicitly in try syntax.
 
 task_duplicates
 ===============
 
 This is used to indicate that we want multiple copies of the task created.
 This feature is used to track down intermittent job failures.
 
 If this value is set to N, the task-creation machinery will create a total of N
--- a/taskcluster/taskgraph/try_option_syntax.py
+++ b/taskcluster/taskgraph/try_option_syntax.py
@@ -491,49 +491,55 @@ class TryOptionSyntax(object):
 
             result += char
 
         return result
 
     def task_matches(self, attributes):
         attr = attributes.get
 
+        def check_run_on_projects():
+            return set(['try', 'all']) & set(attr('run_on_projects', []))
+
         def match_test(try_spec, attr_name):
             if attr('build_type') not in self.build_types:
                 return False
             if self.platforms is not None:
                 if attr('build_platform') not in self.platforms:
                     return False
-            if try_spec is not None:
-                # TODO: optimize this search a bit
-                for test in try_spec:
-                    if attr(attr_name) == test['test']:
-                        break
-                else:
+            else:
+                if not check_run_on_projects():
                     return False
-                if 'platforms' in test and attr('test_platform') not in test['platforms']:
-                    return False
-                if 'only_chunks' in test and attr('test_chunk') not in test['only_chunks']:
-                    return False
+            if try_spec is None:
                 return True
+            # TODO: optimize this search a bit
+            for test in try_spec:
+                if attr(attr_name) == test['test']:
+                    break
+            else:
+                return False
+            if 'platforms' in test and attr('test_platform') not in test['platforms']:
+                return False
+            if 'only_chunks' in test and attr('test_chunk') not in test['only_chunks']:
+                return False
             return True
 
         if attr('kind') in ('desktop-test', 'android-test'):
             return match_test(self.unittests, 'unittest_try_name')
         elif attr('kind') in JOB_KINDS:
             if self.jobs is None:
                 return True
             if attr('build_platform') in self.jobs:
                 return True
         elif attr('kind') in BUILD_KINDS:
             if attr('build_type') not in self.build_types:
                 return False
             elif self.platforms is None:
                 # for "-p all", look for try in the 'run_on_projects' attribute
-                return set(['try', 'all']) & set(attr('run_on_projects', []))
+                return check_run_on_projects()
             else:
                 if attr('build_platform') not in self.platforms:
                     return False
             return True
         else:
             return False
 
     def __str__(self):