Bug 1278890 - Add a method for normalizing test paths to the test package mach environment, r=armenzg

The test path structure is slightly different in the test package compared to a srcdir. So we may need
to normalize the specified paths such that they are relative to a srcdir. Because every test harness
needs to do this, this method is being added to the bootstrap for re-use.

MozReview-Commit-ID: fBAbfuG5XQ

--HG--
extra : rebase_source : b4cedaecfeab777971c9840e932c0aa2bff88240
This commit is contained in:
Andrew Halberstadt 2016-07-13 10:49:42 -04:00
Родитель a286d3bf33
Коммит 57cb071e1b
1 изменённых файлов: 11 добавлений и 0 удалений

Просмотреть файл

@ -107,6 +107,16 @@ def find_firefox(context):
continue
def normalize_test_path(test_root, path):
if os.path.isabs(path) or os.path.exists(path):
return os.path.normpath(os.path.abspath(path))
for parent in ancestors(test_root):
test_path = os.path.join(parent, path)
if os.path.exists(test_path):
return os.path.normpath(os.path.abspath(test_path))
def bootstrap(test_package_root):
test_package_root = os.path.abspath(test_package_root)
@ -132,6 +142,7 @@ def bootstrap(test_package_root):
context.ancestors = ancestors
context.find_firefox = types.MethodType(find_firefox, context)
context.normalize_test_path = normalize_test_path
# Search for a mozharness localconfig.json
context.mozharness_config = None