Bug 914327 - Mach command for b2g mochitests should handle test_path better, r=jgriffin, DONTBUILD, a=NPOTB
authorAndrew Halberstadt <ahalberstadt@mozilla.com>
Wed, 11 Sep 2013 14:53:47 -0400
changeset 159556 db0a833aee39db7c72f266a193d1583a388a08b3
parent 159555 fa066cc5c1f99157656baa3610941348631cf91c
child 159557 2d38a1453c3d7e3ee6cb4dc54b5220fa5049356b
push id2961
push userlsblakk@mozilla.com
push dateMon, 28 Oct 2013 21:59:28 +0000
treeherdermozilla-beta@73ef4f13486f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgriffin, DONTBUILD, NPOTB
bugs914327
milestone26.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 914327 - Mach command for b2g mochitests should handle test_path better, r=jgriffin, DONTBUILD, a=NPOTB
testing/mochitest/mach_commands.py
--- a/testing/mochitest/mach_commands.py
+++ b/testing/mochitest/mach_commands.py
@@ -60,16 +60,21 @@ class MochitestRunner(MozbuildObject):
         test files.
         """
         try:
             which.which('adb')
         except which.WhichError:
             # 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)
 
         import imp
         path = os.path.join(self.mochitest_dir, 'runtestsb2g.py')
         with open(path, 'r') as fh:
             imp.load_module('mochitest', fh, path,
                 ('.py', 'r', imp.PY_SOURCE))
@@ -81,18 +86,22 @@ class MochitestRunner(MozbuildObject):
         options = parser.parse_args([])[0]
 
         options.b2gPath = b2g_home
         options.consoleLevel = 'INFO'
         options.logcat_dir = self.mochitest_dir
         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'
 
         for k, v in kwargs.iteritems():
             setattr(options, k, v)
 
         mochitest.run_remote_mochitests(parser, options)