From 76029cba99f5937208e766ba24409c5bc08ecb1e Mon Sep 17 00:00:00 2001 From: Andrew Halberstadt Date: Fri, 23 Jun 2017 08:25:21 -0400 Subject: [PATCH] Bug 1375173 - Fix bug preventing running xpcshell from ./mach test, r=jgraham MozReview-Commit-ID: FxPAAP3r9k0 --HG-- extra : rebase_source : 12e607f9b5c7e95ed3c60223c8fc1ea2228f5083 --- testing/xpcshell/runxpcshelltests.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/testing/xpcshell/runxpcshelltests.py b/testing/xpcshell/runxpcshelltests.py index b8ac2856fa08..11e84dfd6e46 100755 --- a/testing/xpcshell/runxpcshelltests.py +++ b/testing/xpcshell/runxpcshelltests.py @@ -44,6 +44,12 @@ from xpcshellcommandline import parser_desktop SCRIPT_DIR = os.path.abspath(os.path.realpath(os.path.dirname(__file__))) +try: + from mozbuild.base import MozbuildObject + build = MozbuildObject.from_environment(cwd=SCRIPT_DIR) +except ImportError: + build = None + HARNESS_TIMEOUT = 5 * 60 # benchmarking on tbpl revealed that this works best for now @@ -834,7 +840,8 @@ class XPCShellTests(object): else: test_object['id'] = path - test_object['manifest'] = os.path.relpath(test_object['manifest'], root) + if root: + test_object['manifest'] = os.path.relpath(test_object['manifest'], root) if os.sep != '/': for key in ('id', 'manifest'): @@ -859,7 +866,11 @@ class XPCShellTests(object): self.singleFile = None mp = self.getTestManifest(self.manifest) - normalize = partial(self.normalizeTest, mp.rootdir) + + root = mp.rootdir + if build and not root: + root = build.topsrcdir + normalize = partial(self.normalizeTest, root) filters = [] if test_tags: