Bug 1642709 - Make a relative path from topsrcdir work in jstestbrowser. r=jmaher

jsreftest tests are staged into objdir, and specifying a path inside it isn't
user friendly.

Made it automatically try resolving the relative path from staged area, if
the relative path doesn't find any test.

Differential Revision: https://phabricator.services.mozilla.com/D106010
This commit is contained in:
Tooru Fujisawa 2021-02-22 20:32:26 +00:00
Родитель 500580e010
Коммит fe9e88dcf7
2 изменённых файлов: 18 добавлений и 1 удалений

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

@ -308,7 +308,10 @@ class ReftestArgumentsParser(argparse.ArgumentParser):
"tests",
metavar="TEST_PATH",
nargs="*",
help="Path to test file, manifest file, or directory containing tests",
help="Path to test file, manifest file, or directory containing "
"tests. For jstestbrowser, the relative path can be either from "
"topsrcdir or the staged area "
"($OBJDIR/dist/test-stage/jsreftest/tests)",
)
self.add_argument(

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

@ -216,7 +216,9 @@ class ReftestResolver(object):
"""
rv = []
default_manifest = self.defaultManifest(suite)
relative_path = None
if not os.path.isabs(test_file):
relative_path = test_file
test_file = self.absManifestPath(test_file)
if os.path.isdir(test_file):
@ -227,6 +229,18 @@ class ReftestResolver(object):
# of include directives we get the same manifest multiple times.
# However reftest.js will only read each manifest once
if (
len(rv) == 0
and relative_path
and suite == "jstestbrowser"
and build_obj
):
# The relative path can be from staging area.
staged_js_dir = os.path.join(
build_obj.topobjdir, "dist", "test-stage", "jsreftest"
)
staged_file = os.path.join(staged_js_dir, "tests", relative_path)
return self.findManifest(suite, staged_file, subdirs)
elif test_file.endswith(".list"):
if os.path.exists(test_file):
rv = [(test_file, None)]