From ca7ed478597fd026a16a9f77a297ac879021c5af Mon Sep 17 00:00:00 2001 From: Andrew Halberstadt Date: Wed, 11 Sep 2013 14:53:47 -0400 Subject: [PATCH] Bug 914327 - Mach command for b2g mochitests should handle test_path better, r=jgriffin, DONTBUILD, a=NPOTB --- testing/mochitest/mach_commands.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/testing/mochitest/mach_commands.py b/testing/mochitest/mach_commands.py index 8484044583a7..659442c9e929 100644 --- a/testing/mochitest/mach_commands.py +++ b/testing/mochitest/mach_commands.py @@ -65,6 +65,11 @@ class MochitestRunner(MozbuildObject): # TODO Find adb automatically if it isn't on the path raise Exception(ADB_NOT_FOUND % ('mochitest-remote', b2g_home)) + # Need to call relpath before os.chdir() below. + test_path = '' + if test_file: + test_path = self._wrap_path_argument(test_file).relpath() + # TODO without os.chdir, chained imports fail below os.chdir(self.mochitest_dir) @@ -86,8 +91,12 @@ class MochitestRunner(MozbuildObject): options.httpdPath = self.mochitest_dir options.xrePath = xre_path - if test_file: - options.testPath = test_file + if test_path: + test_root_file = mozpack.path.join(self.mochitest_dir, 'tests', test_path) + if not os.path.exists(test_root_file): + print('Specified test path does not exist: %s' % test_root_file) + return 1 + options.testPath = test_path else: options.testManifest = 'b2g.json'