Bug 1056862 - make |mach python-test| work even if run from outside the srcdir; r=gps
authorNathan Froyd <froydnj@mozilla.com>
Thu, 21 Aug 2014 11:03:26 -0400
changeset 223988 afaa2a2dd1cf08af8fbcaa306fc98f61ba609724
parent 223987 de5cefa8e52e34a979b5fef169b55f5fa8dd027b
child 223989 c80f5c1fd92dfa7bd2f5f94610ddee70b64b02b9
push id3979
push userraliiev@mozilla.com
push dateMon, 13 Oct 2014 16:35:44 +0000
treeherdermozilla-beta@30f2cc610691 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs1056862
milestone34.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 1056862 - make |mach python-test| work even if run from outside the srcdir; r=gps DONTBUILD because NPOTB
python/mach_commands.py
--- a/python/mach_commands.py
+++ b/python/mach_commands.py
@@ -58,26 +58,27 @@ class MachCommands(MachCommandBase):
 
         # Python's unittest, and in particular discover, has problems with
         # clashing namespaces when importing multiple test modules. What follows
         # is a simple way to keep environments separate, at the price of
         # launching Python multiple times. This also runs tests via mozunit,
         # which produces output in the format Mozilla infrastructure expects.
         return_code = 0
         files = []
-        for test in tests:
+        for test in [mozpack.path.join(self.topsrcdir, t) for t in tests]:
             if test.endswith('.py') and os.path.isfile(test):
                 files.append(test)
             elif os.path.isfile(test + '.py'):
                 files.append(test + '.py')
             elif os.path.isdir(test):
                 files += glob.glob(mozpack.path.join(test, 'test*.py'))
                 files += glob.glob(mozpack.path.join(test, 'unit*.py'))
             else:
-                self.log(logging.WARN, 'python-test', {'test': test},
+                self.log(logging.WARN, 'python-test',
+                         {'test': mozpack.path.relpath(test, self.topsrcdir)},
                          'TEST-UNEXPECTED-FAIL | Invalid test: {test}')
                 if stop:
                     return 1
 
         for f in files:
             file_displayed_test = [] # Used as a boolean.
             def _line_handler(line):
                 if not file_displayed_test and line.startswith('TEST-'):