Commit ba828861 authored by Caleb Rouleau's avatar Caleb Rouleau Committed by Commit Bot

Reland "[Benchmarks] Smoke tests lay groundwork for move to story_filter."

This is a reland of 37d44dbb

Original change's description:
> [Benchmarks] Smoke tests lay groundwork for move to story_filter.
>
> This change
> https://chromium-review.googlesource.com/c/catapult/+/1839176
> makes it so that expectations config is passed to story_filter.py
> using the project config (sometimes referred to as the
> "environment"). This change lays the groundwork for that future
> change. Until that change is committed, this is a no-op change.
>
> This change first requires this catapult-side change
> https://chromium-review.googlesource.com/c/catapult/+/1854882
> to make sure that we don't pass an invalid argument to
> GetRunOptions().
>
>
> Bug: 985103
> Change-Id: Idd53aaf7f84e792b0d7a7d0db6b45ce0562fb5f4
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1854794
> Commit-Queue: Caleb Rouleau <crouleau@chromium.org>
> Reviewed-by: Juan Antonio Navarro Pérez <perezju@chromium.org>
> Reviewed-by: Rakib Hasan <rmhasan@google.com>
> Auto-Submit: Caleb Rouleau <crouleau@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#706080}

TBR=crouleau@chromium.org

Bug: 985103
Change-Id: I4add85016cbe95c31632e54b51d3b9c4deb2cbef
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1864672Reviewed-by: default avatarJuan Antonio Navarro Pérez <perezju@chromium.org>
Commit-Queue: Juan Antonio Navarro Pérez <perezju@chromium.org>
Cr-Commit-Position: refs/heads/master@{#706360}
parent dfcfa2be
......@@ -13,6 +13,8 @@ import os
import sys
import unittest
from chrome_telemetry_build import chromium_config
from core import path_util
from telemetry import benchmark as benchmark_module
......@@ -82,12 +84,17 @@ def SmokeTestGenerator(benchmark, num_pages=1):
# Set the benchmark's default arguments.
options = options_for_unittests.GetRunOptions(
output_dir=temp_dir,
benchmark_cls=SinglePageBenchmark)
benchmark_cls=SinglePageBenchmark,
environment=chromium_config.GetDefaultChromiumConfig())
options.pageset_repeat = 1 # For smoke testing only run the page once.
single_page_benchmark = SinglePageBenchmark()
with open(path_util.GetExpectationsPath()) as fp:
single_page_benchmark.AugmentExpectationsWithFile(fp.read())
# TODO(crbug.com/985103): Remove this code once
# AugmentExpectationsWithFile is deleted and replaced with functionality
# in story_filter.py.
if hasattr(single_page_benchmark, 'AugmentExpectationsWithFile'):
with open(path_util.GetExpectationsPath()) as fp:
single_page_benchmark.AugmentExpectationsWithFile(fp.read())
return_code = single_page_benchmark.Run(options)
......
......@@ -9,9 +9,10 @@ cycle time manageable. Other system health benchmarks should be using the same
stories as memory ones, only with fewer actions (no memory dumping).
"""
import collections
import unittest
from collections import defaultdict
from chrome_telemetry_build import chromium_config
from core import path_util
from core import perf_benchmark
......@@ -250,8 +251,12 @@ def _GenerateSmokeTestCase(benchmark_class, story_to_smoke_test):
self.skipTest('Test is explicitly disabled')
single_page_benchmark = SinglePageBenchmark()
with open(path_util.GetExpectationsPath()) as fp:
single_page_benchmark.AugmentExpectationsWithFile(fp.read())
# TODO(crbug.com/985103): Remove this code once
# AugmentExpectationsWithFile is deleted and replaced with functionality
# in story_filter.py.
if hasattr(single_page_benchmark, 'AugmentExpectationsWithFile'):
with open(path_util.GetExpectationsPath()) as fp:
single_page_benchmark.AugmentExpectationsWithFile(fp.read())
return_code = single_page_benchmark.Run(options)
......@@ -275,7 +280,8 @@ def _GenerateSmokeTestCase(benchmark_class, story_to_smoke_test):
def GenerateBenchmarkOptions(output_dir, benchmark_cls):
options = options_for_unittests.GetRunOptions(
output_dir=output_dir, benchmark_cls=benchmark_cls)
output_dir=output_dir, benchmark_cls=benchmark_cls,
environment=chromium_config.GetDefaultChromiumConfig())
options.pageset_repeat = 1 # For smoke testing only run each page once.
# Enable browser logging in the smoke test only. Hopefully, this will detect
......@@ -350,7 +356,7 @@ def find_multi_version_stories(stories, disabled):
A dict mapping from a prefix string to a list of stories each of which
has the name with that prefix and has multiple versions enabled.
"""
prefixes = defaultdict(list)
prefixes = collections.defaultdict(list)
for name in stories:
if name in disabled:
continue
......
......@@ -29,3 +29,11 @@ class ChromiumConfig(project_config.ProjectConfig):
top_level_dir=top_level_dir, benchmark_dirs=benchmark_dirs,
client_configs=client_configs, default_chrome_root=default_chrome_root,
expectations_files=expectations_files)
def GetDefaultChromiumConfig():
return ChromiumConfig(
benchmark_dirs=[path_util.GetOfficialBenchmarksDir(),
path_util.GetContribDir()],
top_level_dir=path_util.GetPerfDir(),
expectations_files=[path_util.GetExpectationsPath()])
......@@ -7,16 +7,10 @@ import sys
from chrome_telemetry_build import chromium_config
from core import benchmark_runner
from core import path_util
def main():
config = chromium_config.ChromiumConfig(
benchmark_dirs=[path_util.GetOfficialBenchmarksDir(),
path_util.GetContribDir()],
top_level_dir=path_util.GetPerfDir(),
expectations_files=[path_util.GetExpectationsPath()])
return benchmark_runner.main(config)
return benchmark_runner.main(chromium_config.GetDefaultChromiumConfig())
if __name__ == '__main__':
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment