Bug 1240767 - Handle incorrect test paths in 'mach robocop'; r=jmaher
authorGeoff Brown <gbrown@mozilla.com>
Thu, 21 Jan 2016 16:59:44 -0700
changeset 303346 698919a8af162ca0ee5739d8717b7a08556a5599
parent 303345 fa8e29521b0931e14be53e62e19210177fd5b28b
child 303347 afb7190f14d97225c8a6465dfe763411e58a4d65
push id8978
push userraliiev@mozilla.com
push dateMon, 25 Jan 2016 14:05:32 +0000
treeherdermozilla-aurora@b9a803752a2c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmaher
bugs1240767
milestone46.0a1
Bug 1240767 - Handle incorrect test paths in 'mach robocop'; r=jmaher
testing/mochitest/mach_commands.py
--- a/testing/mochitest/mach_commands.py
+++ b/testing/mochitest/mach_commands.py
@@ -57,16 +57,25 @@ TESTS_NOT_FOUND = '''
 The mochitest command could not find any mochitests under the following
 test path(s):
 
 {}
 
 Please check spelling and make sure there are mochitests living there.
 '''.lstrip()
 
+ROBOCOP_TESTS_NOT_FOUND = '''
+The robocop command could not find any tests under the following
+test path(s):
+
+{}
+
+Please check spelling and make sure the named tests exist.
+'''.lstrip()
+
 NOW_RUNNING = '''
 ######
 ### Now running mochitest-{}.
 ######
 '''
 
 
 # Maps test flavors to data needed to run them
@@ -589,16 +598,21 @@ class RobocopCommands(MachCommandBase):
         test_paths = kwargs['test_paths']
         kwargs['test_paths'] = []
 
         from mozbuild.testing import TestResolver
         resolver = self._spawn(TestResolver)
         tests = list(resolver.resolve_tests(paths=test_paths, cwd=self._mach_context.cwd,
                                             flavor='instrumentation', subsuite='robocop'))
 
+        if len(tests) < 1:
+            print(ROBOCOP_TESTS_NOT_FOUND.format('\n'.join(
+                sorted(list(test_paths)))))
+            return 1
+
         mochitest = self._spawn(MochitestRunner)
         return mochitest.run_robocop_test(self._mach_context, tests, 'robocop', **kwargs)
 
 
 # NOTE python/mach/mach/commands/commandinfo.py references this function
 #      by name. If this function is renamed or removed, that file should
 #      be updated accordingly as well.
 def REMOVED(cls):