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 120648 112c885bd01f504678222b0810df95387e0ab990
parent 120647 b0cb01ce8f12c30105522bce27f95feba23e7e22
child 120649 137d80a07e64b82e2fbc95c9a0a7cc8690376bf4
child 120709 4cc00705166e693c02fffca115ede5d981ac936f
push idunknown
push userunknown
push dateunknown
reviewersted
bugs818475
milestone20.0a1
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',