Bug 818475 - Return proper exit code if xpcshell test fails; r=ted
authorGregory Szorc <gps@mozilla.com>
Wed, 05 Dec 2012 15:42:11 -0800
changeset 124179 112c885bd01f504678222b0810df95387e0ab990
parent 124178 b0cb01ce8f12c30105522bce27f95feba23e7e22
child 124180 137d80a07e64b82e2fbc95c9a0a7cc8690376bf4
child 124240 4cc00705166e693c02fffca115ede5d981ac936f
push id2151
push userlsblakk@mozilla.com
push dateTue, 19 Feb 2013 18:06:57 +0000
treeherdermozilla-beta@4952e88741ec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted
bugs818475
milestone20.0a1
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 818475 - Return proper exit code if xpcshell test fails; r=ted DONTBUILD (NPOTB)
testing/xpcshell/mach_commands.py
--- a/testing/xpcshell/mach_commands.py
+++ b/testing/xpcshell/mach_commands.py
@@ -36,17 +36,17 @@ class InvalidTestPathError(Exception):
 
 
 class XPCShellRunner(MozbuildObject):
     """Run xpcshell tests."""
     def run_suite(self, **kwargs):
         manifest = os.path.join(self.topobjdir, '_tests', 'xpcshell',
             'xpcshell.ini')
 
-        self._run_xpcshell_harness(manifest=manifest, **kwargs)
+        return self._run_xpcshell_harness(manifest=manifest, **kwargs)
 
     def run_test(self, test_file, debug=False, interactive=False,
         keep_going=False, shuffle=False):
         """Runs an individual xpcshell test."""
 
         if test_file == 'all':
             self.run_suite(debug=debug, interactive=interactive,
                 keep_going=keep_going, shuffle=shuffle)
@@ -78,17 +78,17 @@ class XPCShellRunner(MozbuildObject):
             'keep_going': keep_going,
             'shuffle': shuffle,
             'test_dirs': [test_dir],
         }
 
         if os.path.isfile(test_file):
             args['test_path'] = os.path.basename(test_file)
 
-        self._run_xpcshell_harness(**args)
+        return self._run_xpcshell_harness(**args)
 
     def _run_xpcshell_harness(self, test_dirs=None, manifest=None,
         test_path=None, debug=False, shuffle=False, interactive=False,
         keep_going=False):
 
         # Obtain a reference to the xpcshell test runner.
         import runxpcshelltests
 
@@ -135,21 +135,22 @@ class XPCShellRunner(MozbuildObject):
             if isinstance(v, unicode_type):
                 v = v.encode('utf-8')
 
             if isinstance(k, unicode_type):
                 k = k.encode('utf-8')
 
             filtered_args[k] = v
 
-        # TODO do something with result.
-        xpcshell.runTests(**filtered_args)
+        result = xpcshell.runTests(**filtered_args)
 
         self.log_manager.disable_unstructured()
 
+        return int(not result)
+
 
 @CommandProvider
 class MachCommands(MachCommandBase):
     @Command('xpcshell-test', help='Run an xpcshell test.')
     @CommandArgument('test_file', default='all', nargs='?', metavar='TEST',
         help='Test to run. Can be specified as a single JS file, a directory, '
              'or omitted. If omitted, the entire test suite is executed.')
     @CommandArgument('--debug', '-d', action='store_true',