From 6a45b54812eba7fd0e7d4dfc8f8faac004f3044c Mon Sep 17 00:00:00 2001 From: Chris Manchester Date: Tue, 29 Sep 2015 12:59:55 -0700 Subject: [PATCH] Bug 1209312 - Accept test_objects in testing/xpcshell/mach_commands.py to support |./mach test|. r=jgraham --HG-- extra : commitid : 7hOvYy0xdzm --- testing/xpcshell/mach_commands.py | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/testing/xpcshell/mach_commands.py b/testing/xpcshell/mach_commands.py index 765d1d2251c1..1a0e6c99ae8f 100644 --- a/testing/xpcshell/mach_commands.py +++ b/testing/xpcshell/mach_commands.py @@ -59,8 +59,6 @@ class XPCShellRunner(MozbuildObject): def run_test(self, **kwargs): """Runs an individual xpcshell test.""" - from mozbuild.testing import TestResolver - from manifestparser import TestManifest # TODO Bug 794506 remove once mach integrates with virtualenv. build_path = os.path.join(self.topobjdir, 'build') @@ -84,12 +82,15 @@ class XPCShellRunner(MozbuildObject): self.log_manager.enable_unstructured() tests_dir = os.path.join(self.topobjdir, '_tests', 'xpcshell') - modules_dir = os.path.join(self.topobjdir, '_tests', 'modules') # We want output from the test to be written immediately if we are only # running a single test. - single_test = (kwargs["testPaths"] is not None or - (manifest and len(manifest.test_paths())==1)) - sequential = kwargs["sequential"] or single_test + single_test = (len(kwargs["testPaths"]) == 1 and + os.path.isfile(kwargs["testPaths"][0]) or + kwargs["manifest"] and + (len(kwargs["manifest"].test_paths()) == 1)) + + if single_test: + kwargs["verbose"] = True if kwargs["xpcshell"] is None: kwargs["xpcshell"] = self.get_binary_path('xpcshell') @@ -334,10 +335,15 @@ class MachCommands(MachCommandBase): description='Run XPCOM Shell tests (API direct unit testing)', conditions=[lambda *args: True], parser=get_parser) - - def run_xpcshell_test(self, **params): + def run_xpcshell_test(self, test_objects=None, **params): from mozbuild.controller.building import BuildDriver + if test_objects is not None: + from manifestparser import TestManifest + m = TestManifest() + m.tests.extend(test_objects) + params['manifest'] = m + # We should probably have a utility function to ensure the tree is # ready to run tests. Until then, we just create the state dir (in # case the tree wasn't built with mach).