Bug 1691739 - [perfdocs] Display each test description for raptor r=sparky,perftest-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D105643
This commit is contained in:
Myeongjun Go 2021-03-11 15:59:15 +00:00
Родитель caa4eff9e7
Коммит 95e1fff568
6 изменённых файлов: 2296 добавлений и 111 удалений

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

@ -48,6 +48,7 @@ extensions = [
"recommonmark",
"sphinx_copybutton",
"sphinx_markdown_tables",
"sphinx_panels",
"glean",
]

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -34,7 +34,7 @@ class FrameworkGatherer(object):
self._yaml_path = yaml_path
self._suite_list = {}
self._test_list = {}
self._urls = {}
self._descriptions = {}
self._manifest_path = ""
self._manifest = None
self.script_infos = {}
@ -130,19 +130,20 @@ class RaptorGatherer(FrameworkGatherer):
:param str manifest_path: path to the ini file
:return list: the list of the tests
"""
desc_exclusion = ["here", "manifest", "manifest_relpath", "path", "relpath"]
test_manifest = TestManifest([manifest_path], strict=False)
test_list = test_manifest.active_tests(exists=False, disabled=False)
subtests = {}
for subtest in test_list:
subtests[subtest["name"]] = subtest["manifest"]
self._urls.setdefault(suite_name, []).append(
{
"test_name": subtest["name"],
"url": subtest["test_url"],
}
)
self._urls[suite_name].sort(key=lambda item: item["test_name"])
description = {}
for key, value in subtest.items():
if key not in desc_exclusion:
description[key] = value
self._descriptions.setdefault(suite_name, []).append(description)
self._descriptions[suite_name].sort(key=lambda item: item["name"])
return subtests
@ -174,19 +175,45 @@ class RaptorGatherer(FrameworkGatherer):
return self._test_list
def build_test_description(self, title, test_description="", suite_name=""):
matcher = set()
for suite, val in self._urls.items():
matcher = []
browsers = [
"firefox",
"chrome",
"chromium",
"refbrow",
"fennec68",
"geckoview",
"fenix",
]
test_name = [f"{title}-{browser}" for browser in browsers]
test_name.append(title)
for suite, val in self._descriptions.items():
for test in val:
if title in test["test_name"] and suite_name == suite:
matcher.add(test["url"])
break
if test["name"] in test_name and suite_name == suite:
matcher.append(test)
try:
url = matcher.pop()
except KeyError as e:
logger.critical("{}: no url found for test {}".format(e, title))
if len(matcher) == 0:
logger.critical("No url found for test {}".format(title))
raise Exception("No url found for test")
return ["* `{} ({}) <{}>`__".format(title, test_description, url)]
result = f".. dropdown:: {title} ({test_description})\n\n"
for idx, description in enumerate(matcher):
if description["name"] != title:
result += f" {idx+1}. **{description['name']}**\n\n"
for key in sorted(description.keys()):
if key == "name":
continue
sub_title = key.replace("_", " ")
if key == "test_url":
result += f" * **{sub_title}**: `<{description[key]}>`__\n"
else:
result += f" * **{sub_title}**: {description[key]}\n"
result += "\n"
return [result]
def build_suite_section(self, title, content):
return self._build_section_with_header(

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

@ -511,10 +511,10 @@ def test_perfdocs_framework_gatherers_urls(logger, structured_logger, perfdocs_s
# suties the urls are generated correctly for the test under
# every suite
for suite, suitetests in fg.get_test_list().items():
url = fg._urls.get(suite)
url = fg._descriptions.get(suite)
assert url is not None
assert url[0]["test_name"] == "Example"
assert url[0]["url"] == "Example_url"
assert url[0]["name"] == "Example"
assert url[0]["test_url"] == "Example_url"
perfdocs_tree = gn._perfdocs_tree[0]
yaml_content = read_yaml(

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

@ -45,6 +45,7 @@ Sphinx==3.5.1
sphinx-copybutton==0.3.1
sphinx-js==3.0.1
sphinx-markdown-tables==0.0.15
sphinx-panels==0.5.2
sphinx-rtd-theme==0.5.1
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2

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

@ -65,6 +65,7 @@ docutils==0.16 \
# recommonmark
# sphinx
# sphinx-js
# sphinx-panels
fluent.pygments==1.0 \
--hash=sha256:625c87a8a2362ef304146b161d359dcf652bed2a1ae4869b5607b8e06d117d97 \
--hash=sha256:b44758f74f87e1aa9d78d8f53363962639c5bf99d88cf3e407d046b5249ec27f
@ -90,7 +91,14 @@ imagesize==1.2.0 \
importlib-metadata==2.0.0 \
--hash=sha256:77a540690e24b0305878c37ffd421785a6f7e53c8b5720d211b211de8d0e95da \
--hash=sha256:cefa1a2f919b866c5beb7c9f7b0ebb4061f30a8a9bf16d609b000e2dfaceb9c3
# via -r requirements.in
# via
# -r requirements.in
# jsonschema
# markdown
importlib-resources==3.0.0 \
--hash=sha256:19f745a6eca188b490b1428c8d1d4a0d2368759f32370ea8fb89cad2ab1106c3 \
--hash=sha256:d028f66b66c0d5732dae86ba4276999855e162a749c92620a38c1d779ed138a7
# via sphinx-panels
jinja2==2.11.2 \
--hash=sha256:89aab215427ef59c34ad58735269eb58b1a5808103067f7bb9d5836c651b3bb0 \
--hash=sha256:f0a4641d3cf955324a89c04f3d94663aa4d638abe8f733ecd3582848e1c37035
@ -304,6 +312,10 @@ sphinx-markdown-tables==0.0.15 \
--hash=sha256:24a37662d86ee8bceb7d4f7003df0b25bc52401369d1ddc40d13ae7b58697031 \
--hash=sha256:c5f423a018aed9447aad1fbbada32c21c7565183aaf2da3c7fdb7bf4dffa3a0b
# via -r requirements.in
sphinx-panels==0.5.2 \
--hash=sha256:2b2e18448b0494e7a232d6c7dfb9aa3982e7aeb92aeea7d1b146e34e9261d2f1 \
--hash=sha256:b7b3faa05f37b7318fd14cd85c4effa1ab905dfc8bed236a63978565ea461ae4
# via -r requirements.in
sphinx-rtd-theme==0.5.1 \
--hash=sha256:eda689eda0c7301a80cf122dad28b1861e5605cbf455558f3775e1e8200e83a5 \
--hash=sha256:fa6bebd5ab9a73da8e102509a86f3fcc36dec04a0b52ea80e5a033b2aba00113
@ -316,6 +328,7 @@ sphinx==3.5.1 \
# recommonmark
# sphinx-copybutton
# sphinx-js
# sphinx-panels
# sphinx-rtd-theme
sphinxcontrib-applehelp==1.0.2 \
--hash=sha256:806111e5e962be97c29ec4c1e7fe277bfd19e9652fb1a4392105b43e01af885a \
@ -384,6 +397,7 @@ zipp==3.2.0 \
# via
# -r requirements.in
# importlib-metadata
# importlib-resources
# WARNING: The following packages were not pinned, but pip requires them to be
# pinned when the requirements file includes hashes. Consider using the --allow-unsafe flag.