Bug 1342909 - Error out of |mach try| when using test paths and no build config is detected, r?chmanchester draft
authorAndrew Halberstadt <ahalberstadt@mozilla.com>
Mon, 27 Feb 2017 09:42:25 -0500
changeset 490036 b9f88f3e5894cb09cdc29d14d2bf6a9eb3e871f8
parent 489990 ecf39ae188da37206b39a31e585fdcb028bd8b7b
child 547149 b08a1019f400d5e4ebda4c384274217de0d9805c
push id46978
push userahalberstadt@mozilla.com
push dateMon, 27 Feb 2017 15:59:20 +0000
reviewerschmanchester
bugs1342909
milestone54.0a1
Bug 1342909 - Error out of |mach try| when using test paths and no build config is detected, r?chmanchester MozReview-Commit-ID: 2RE3vc1Kxvc
testing/mach_commands.py
--- a/testing/mach_commands.py
+++ b/testing/mach_commands.py
@@ -37,16 +37,25 @@ a bug at
 https://bugzilla.mozilla.org/enter_bug.cgi?product=Testing&component=General.
 '''.strip()
 
 UNKNOWN_FLAVOR = '''
 I know you are trying to run a %s test. Unfortunately, I can't run those
 tests yet. Sorry!
 '''.strip()
 
+CONFIG_ENVIRONMENT_NOT_FOUND = '''
+No config environment detected. This means we are unable to properly
+detect test files in the specified paths or tags. Please run:
+
+    $ mach configure
+
+and try again.
+'''.lstrip()
+
 MOCHITEST_CHUNK_BY_DIR = 4
 MOCHITEST_TOTAL_CHUNKS = 5
 
 TEST_SUITES = {
     'cppunittest': {
         'aliases': ('Cpp', 'cpp'),
         'mach_command': 'cppunittest',
         'kwargs': {'test_file': None},
@@ -647,16 +656,20 @@ class PushToTry(MachCommandBase):
             sys.exit(1)
 
         if not any(kwargs[item] for item in ("paths", "tests", "tags")):
             kwargs["paths"], kwargs["tags"] = at.find_paths_and_tags(kwargs["verbose"])
 
         builds, platforms, tests, talos, paths, tags, extra = self.validate_args(**kwargs)
 
         if paths or tags:
+            if not os.path.exists(os.path.join(self.topobjdir, 'config.status')):
+                print(CONFIG_ENVIRONMENT_NOT_FOUND)
+                sys.exit(1)
+
             paths = [os.path.relpath(os.path.normpath(os.path.abspath(item)), self.topsrcdir)
                      for item in paths]
             paths_by_flavor = at.paths_by_flavor(paths=paths, tags=tags)
 
             if not paths_by_flavor and not tests:
                 print("No tests were found when attempting to resolve paths:\n\n\t%s" %
                       paths)
                 sys.exit(1)