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 175365 dc348b447da7558cfc0a52c5d094b22f3070314d
parent 175364 b151f7bd1c10c3ed68a9b9cd30ecea598198bcad
child 175366 3701bf9004ae453097e133fb07a0f51a05046432
push id5941
push usergszorc@mozilla.com
push dateWed, 26 Mar 2014 18:46:54 +0000
treeherderfx-team@3701bf9004ae [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
Bug 987398 - Part 2: Handle install-to-subdir in TestResolver; r=ahal
--- 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):
             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)
                 yield test