Bug 1342937 - Error out of |mach try| when using test paths and no build config is detected, r?chmanchester
MozReview-Commit-ID: 2RE3vc1Kxvc
--- 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)