Bug 780698 - Part b: Fix mochitest runners; r=gps
authorMs2ger <ms2ger@gmail.com>
Tue, 02 Oct 2012 10:24:11 +0200
changeset 108821 1b36381b4b6bb1122d9deee7c5fd504eadd28508
parent 108820 195e7907f7ba5c96c983558370895f202a865a71
child 108822 111089855ef805f814a3eded6ec9961353d16313
push id23593
push userMs2ger@gmail.com
push dateTue, 02 Oct 2012 08:25:46 +0000
treeherdermozilla-central@e5f2c48f10c2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 780698 - Part b: Fix mochitest runners; r=gps
--- a/python/mach/mach/testing.py
+++ b/python/mach/mach/testing.py
@@ -43,31 +43,31 @@ class Testing(MozbuildObject, ArgumentPr
         group.add_argument('suite', default='all', choices=suites, nargs='?',
             help="Test suite to run.")
         group.set_defaults(cls=Testing, method='run_suite', suite='all')
         mochitest_plain = parser.add_parser('mochitest-plain',
             help='Run a plain mochitest.')
-        mochitest_plain.add_argument('test_file', default='all', nargs='?',
+        mochitest_plain.add_argument('test_file', default=None, nargs='?',
             metavar='TEST', help=generic_help)
         mochitest_plain.set_defaults(cls=Testing, method='run_mochitest',
         mochitest_chrome = parser.add_parser('mochitest-chrome',
             help='Run a chrome mochitest.')
-        mochitest_chrome.add_argument('test_file', default='all', nargs='?',
+        mochitest_chrome.add_argument('test_file', default=None, nargs='?',
             metavar='TEST', help=generic_help)
         mochitest_chrome.set_defaults(cls=Testing, method='run_mochitest',
         mochitest_browser = parser.add_parser('mochitest-browser',
             help='Run a mochitest with browser chrome.')
-        mochitest_browser.add_argument('test_file', default='all', nargs='?',
+        mochitest_browser.add_argument('test_file', default=None, nargs='?',
             metavar='TEST', help=generic_help)
         mochitest_browser.set_defaults(cls=Testing, method='run_mochitest',
         xpcshell = parser.add_parser('xpcshell-test',
             help="Run an individual xpcshell test.")
         xpcshell.add_argument('test_file', default='all', nargs='?',
--- a/python/mozbuild/mozbuild/testing/mochitest.py
+++ b/python/mozbuild/mozbuild/testing/mochitest.py
@@ -40,33 +40,35 @@ class MochitestRunner(MozbuildObject):
         test_file is a path to a test file. It can be a relative path from the
         top source directory, an absolute filename, or a directory containing
         test files.
         suite is the type of mochitest to run. It can be one of ('plain',
         'chrome', 'browser').
-        if test_file is None:
-            raise Exception('test_file must be defined.')
-        parsed = self._parse_test_path(test_file)
         # TODO hook up harness via native Python
         target = None
         if suite == 'plain':
             target = 'mochitest-plain'
         elif suite == 'chrome':
             target = 'mochitest-chrome'
         elif suite == 'browser':
             target = 'mochitest-browser-chrome'
             raise Exception('None or unrecognized mochitest suite type.')
-        env = {'TEST_PATH': parsed['normalized']}
+        if test_file:
+            path = self._parse_test_path(test_file)['normalized']
+            if not os.path.exists(path):
+                raise Exception('No manifest file was found at %s.' % path)
+            env = {'TEST_PATH': path}
+        else:
+            env = {}
         self._run_make(directory='.', target=target, append_env=env)
     def _parse_test_path(self, test_path):
         is_dir = os.path.isdir(test_path)
         if is_dir and not test_path.endswith(os.path.sep):
             test_path += os.path.sep