Bug 1390084 - Fix enabling gecko profiling on try; r?jmaher draft
authorRob Wood <rwood@mozilla.com>
Tue, 29 Aug 2017 11:44:58 -0400
changeset 656115 3e6848020e61
parent 654592 1b4c59eef820
child 729010 83d1a14c9045
push id77067
push userrwood@mozilla.com
push dateWed, 30 Aug 2017 18:52:27 +0000
reviewersjmaher
bugs1390084
milestone57.0a1
Bug 1390084 - Fix enabling gecko profiling on try; r?jmaher MozReview-Commit-ID: 8Cm9zH7lxGF
testing/mozharness/mozharness/mozilla/testing/talos.py
testing/mozharness/mozharness/mozilla/testing/try_tools.py
--- a/testing/mozharness/mozharness/mozilla/testing/talos.py
+++ b/testing/mozharness/mozharness/mozilla/testing/talos.py
@@ -206,29 +206,34 @@ class Talos(TestingMixin, MercurialScrip
             # now let's see if we added GeckoProfile specs in the commit message
             try:
                 junk, junk, opts = self.buildbot_config['sourcestamp']['changes'][-1]['comments'].partition('mozharness:')
             except IndexError:
                 # when we don't have comments on changes (bug 1255187)
                 opts = None
 
             if opts:
-              # In the case of a multi-line commit message, only examine
-              # the first line for mozharness options
-              opts = opts.split('\n')[0]
-              opts = re.sub(r'\w+:.*', '', opts).strip().split(' ')
-              if "--geckoProfile" in opts:
-                  # overwrite whatever was set here.
-                  self.gecko_profile = True
-              try:
-                  idx = opts.index('--geckoProfileInterval')
-                  if len(opts) > idx + 1:
-                      self.gecko_profile_interval = opts[idx + 1]
-              except ValueError:
-                  pass
+                # In the case of a multi-line commit message, only examine
+                # the first line for mozharness options
+                opts = opts.split('\n')[0]
+                opts = re.sub(r'\w+:.*', '', opts).strip().split(' ')
+                if "--geckoProfile" in opts:
+                    # overwrite whatever was set here.
+                    self.gecko_profile = True
+                try:
+                    idx = opts.index('--geckoProfileInterval')
+                    if len(opts) > idx + 1:
+                        self.gecko_profile_interval = opts[idx + 1]
+                except ValueError:
+                    pass
+            else:
+                # no opts, check for '--geckoProfile' in try message text directly
+                if self.try_message_has_flag('geckoProfile'):
+                    self.gecko_profile = True
+
         # finally, if gecko_profile is set, we add that to the talos options
         if self.gecko_profile:
             gecko_results.append('--geckoProfile')
             if self.gecko_profile_interval:
                 gecko_results.extend(
                     ['--geckoProfileInterval', str(self.gecko_profile_interval)]
                 )
         return gecko_results
--- a/testing/mozharness/mozharness/mozilla/testing/try_tools.py
+++ b/testing/mozharness/mozharness/mozilla/testing/try_tools.py
@@ -158,18 +158,24 @@ class TryToolsMixin(TransferMixin):
         msg_list = self._extract_try_args(message)
         args, _ = parser.parse_known_args(msg_list)
         return getattr(args, flag, False)
 
     def _is_try(self):
         repo_path = None
         if self.buildbot_config and 'properties' in self.buildbot_config:
             repo_path = self.buildbot_config['properties'].get('branch')
-        return (self.config.get('branch', repo_path) == 'try' or
-                'TRY_COMMIT_MSG' in os.environ)
+        get_branch = self.config.get('branch', repo_path)
+        if get_branch is not None:
+            on_try = ('try' in get_branch or 'Try' in get_branch)
+        elif os.environ is not None:
+            on_try = ('TRY_COMMIT_MSG' in os.environ)
+        else:
+            on_try = False
+        return on_try
 
     @PostScriptAction('download-and-extract')
     def set_extra_try_arguments(self, action, success=None):
         """Finds a commit message and parses it for extra arguments to pass to the test
         harness command line and test paths used to filter manifests.
 
         Extracting arguments from a commit message taken directly from the try_parser.
         """