зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1756867 - Label the video folders in the browsertime-results archive more clearly. r=sparky,perftest-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D145468
This commit is contained in:
Родитель
c3c7926d5a
Коммит
1d21e9c55c
|
@ -8,6 +8,7 @@ from __future__ import absolute_import
|
|||
|
||||
import json
|
||||
import os
|
||||
import pathlib
|
||||
import shutil
|
||||
from abc import ABCMeta, abstractmethod
|
||||
from io import open
|
||||
|
@ -664,6 +665,23 @@ class BrowsertimeResultsHandler(PerftestResultsHandler):
|
|||
"accept_zero_vismet": accept_zero_vismet,
|
||||
}
|
||||
|
||||
def _label_video_folder(self, result_data, base_dir, kind="warm"):
|
||||
for idx, data in enumerate(result_data["files"]["video"]):
|
||||
parts = list(pathlib.Path(data).parts)
|
||||
lable_idx = parts.index("data")
|
||||
if "query-" in parts[lable_idx - 1]:
|
||||
lable_idx -= 1
|
||||
|
||||
src_dir = pathlib.Path(base_dir).joinpath(*parts[: lable_idx + 1])
|
||||
parts.insert(lable_idx, kind)
|
||||
dst_dir = pathlib.Path(base_dir).joinpath(*parts[: lable_idx + 1])
|
||||
|
||||
if src_dir.exists():
|
||||
pathlib.Path(dst_dir).mkdir(parents=True, exist_ok=True)
|
||||
shutil.move(str(src_dir), str(dst_dir))
|
||||
|
||||
result_data["files"]["video"][idx] = str(pathlib.Path(*parts[:]))
|
||||
|
||||
def summarize_and_output(self, test_config, tests, test_names):
|
||||
"""
|
||||
Retrieve, process, and output the browsertime test results. Currently supports page-load
|
||||
|
@ -729,6 +747,9 @@ class BrowsertimeResultsHandler(PerftestResultsHandler):
|
|||
cold_path = os.path.join(dirpath, "cold-browsertime.json")
|
||||
warm_path = os.path.join(dirpath, "warm-browsertime.json")
|
||||
|
||||
self._label_video_folder(cold_data, dirpath, "cold")
|
||||
self._label_video_folder(warm_data, dirpath, "warm")
|
||||
|
||||
with open(cold_path, "w") as f:
|
||||
json.dump([cold_data], f)
|
||||
with open(warm_path, "w") as f:
|
||||
|
|
Загрузка…
Ссылка в новой задаче