Bug 987398 - Part 2: Handle install-to-subdir in TestResolver; r=ahal
authorGregory Szorc <gps@mozilla.com>
Tue, 25 Mar 2014 18:17:31 -0700
changeset 175448 dc348b447da7558cfc0a52c5d094b22f3070314d
parent 175447 b151f7bd1c10c3ed68a9b9cd30ecea598198bcad
child 175449 3701bf9004ae453097e133fb07a0f51a05046432
push id26491
push userryanvm@gmail.com
push dateThu, 27 Mar 2014 00:50:16 +0000
treeherdermozilla-central@da3198b95e6b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersahal
bugs987398
milestone31.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 987398 - Part 2: Handle install-to-subdir in TestResolver; r=ahal
python/mozbuild/mozbuild/testing.py
--- a/python/mozbuild/mozbuild/testing.py
+++ b/python/mozbuild/mozbuild/testing.py
@@ -8,24 +8,35 @@ import json
 import os
 
 import mozpack.path as mozpath
 
 from .base import MozbuildObject
 from .util import DefaultOnReadDict
 
 
-def rewrite_test_base(test, new_base):
+def rewrite_test_base(test, new_base, honor_install_to_subdir=False):
     """Rewrite paths in a test to be under a new base path.
 
     This is useful for running tests from a separate location from where they
     were defined.
+
+    honor_install_to_subdir and the underlying install-to-subdir field are a
+    giant hack intended to work around the restriction where the mochitest
+    runner can't handle single test files with multiple configurations. This
+    argument should be removed once the mochitest runner talks manifests
+    (bug 984670).
     """
     test['here'] = mozpath.join(new_base, test['dir_relpath'])
-    test['path'] = mozpath.join(new_base, test['file_relpath'])
+
+    if honor_install_to_subdir and test.get('install-to-subdir'):
+        test['path'] = mozpath.join(new_base, test['dir_relpath'],
+            test['install-to-subdir'], test['relpath'])
+    else:
+        test['path'] = mozpath.join(new_base, test['file_relpath'])
 
     return test
 
 
 class TestMetadata(object):
     """Holds information about tests.
 
     This class provides an API to query tests active in the build
@@ -169,11 +180,12 @@ class TestResolver(MozbuildObject):
 
         else:
             result = self._tests.resolve_tests(**kwargs)
 
         for test in result:
             rewrite_base = self._test_rewrites.get(test['flavor'], None)
 
             if rewrite_base:
-                yield rewrite_test_base(test, rewrite_base)
+                yield rewrite_test_base(test, rewrite_base,
+                    honor_install_to_subdir=True)
             else:
                 yield test