Commit 37d44dbb authored by Caleb Rouleau's avatar Caleb Rouleau Committed by Commit Bot

[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: default avatarJuan Antonio Navarro Pérez <perezju@chromium.org>
Reviewed-by: default avatarRakib Hasan <rmhasan@google.com>
Auto-Submit: Caleb Rouleau <crouleau@chromium.org>
Cr-Commit-Position: refs/heads/master@{#706080}
parent 6eb34170
...@@ -13,6 +13,8 @@ import os ...@@ -13,6 +13,8 @@ import os
import sys import sys
import unittest import unittest
from chrome_telemetry_build import chromium_config
from core import path_util from core import path_util
from telemetry import benchmark as benchmark_module from telemetry import benchmark as benchmark_module
...@@ -82,12 +84,17 @@ def SmokeTestGenerator(benchmark, num_pages=1): ...@@ -82,12 +84,17 @@ def SmokeTestGenerator(benchmark, num_pages=1):
# Set the benchmark's default arguments. # Set the benchmark's default arguments.
options = options_for_unittests.GetRunOptions( options = options_for_unittests.GetRunOptions(
output_dir=temp_dir, 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. options.pageset_repeat = 1 # For smoke testing only run the page once.
single_page_benchmark = SinglePageBenchmark() single_page_benchmark = SinglePageBenchmark()
with open(path_util.GetExpectationsPath()) as fp: # TODO(crbug.com/985103): Remove this code once
single_page_benchmark.AugmentExpectationsWithFile(fp.read()) # 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) return_code = single_page_benchmark.Run(options)
......
...@@ -9,9 +9,10 @@ cycle time manageable. Other system health benchmarks should be using the same ...@@ -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). stories as memory ones, only with fewer actions (no memory dumping).
""" """
import collections
import unittest import unittest
from collections import defaultdict from chrome_telemetry_build import chromium_config
from core import path_util from core import path_util
from core import perf_benchmark from core import perf_benchmark
...@@ -250,8 +251,12 @@ def _GenerateSmokeTestCase(benchmark_class, story_to_smoke_test): ...@@ -250,8 +251,12 @@ def _GenerateSmokeTestCase(benchmark_class, story_to_smoke_test):
self.skipTest('Test is explicitly disabled') self.skipTest('Test is explicitly disabled')
single_page_benchmark = SinglePageBenchmark() single_page_benchmark = SinglePageBenchmark()
with open(path_util.GetExpectationsPath()) as fp: # TODO(crbug.com/985103): Remove this code once
single_page_benchmark.AugmentExpectationsWithFile(fp.read()) # 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) return_code = single_page_benchmark.Run(options)
...@@ -275,7 +280,8 @@ def _GenerateSmokeTestCase(benchmark_class, story_to_smoke_test): ...@@ -275,7 +280,8 @@ def _GenerateSmokeTestCase(benchmark_class, story_to_smoke_test):
def GenerateBenchmarkOptions(output_dir, benchmark_cls): def GenerateBenchmarkOptions(output_dir, benchmark_cls):
options = options_for_unittests.GetRunOptions( 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. options.pageset_repeat = 1 # For smoke testing only run each page once.
# Enable browser logging in the smoke test only. Hopefully, this will detect # Enable browser logging in the smoke test only. Hopefully, this will detect
...@@ -350,7 +356,7 @@ def find_multi_version_stories(stories, disabled): ...@@ -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 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. has the name with that prefix and has multiple versions enabled.
""" """
prefixes = defaultdict(list) prefixes = collections.defaultdict(list)
for name in stories: for name in stories:
if name in disabled: if name in disabled:
continue continue
......
...@@ -29,3 +29,11 @@ class ChromiumConfig(project_config.ProjectConfig): ...@@ -29,3 +29,11 @@ class ChromiumConfig(project_config.ProjectConfig):
top_level_dir=top_level_dir, benchmark_dirs=benchmark_dirs, top_level_dir=top_level_dir, benchmark_dirs=benchmark_dirs,
client_configs=client_configs, default_chrome_root=default_chrome_root, client_configs=client_configs, default_chrome_root=default_chrome_root,
expectations_files=expectations_files) 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 ...@@ -7,16 +7,10 @@ import sys
from chrome_telemetry_build import chromium_config from chrome_telemetry_build import chromium_config
from core import benchmark_runner from core import benchmark_runner
from core import path_util
def main(): def main():
config = chromium_config.ChromiumConfig( return benchmark_runner.main(chromium_config.GetDefaultChromiumConfig())
benchmark_dirs=[path_util.GetOfficialBenchmarksDir(),
path_util.GetContribDir()],
top_level_dir=path_util.GetPerfDir(),
expectations_files=[path_util.GetExpectationsPath()])
return benchmark_runner.main(config)
if __name__ == '__main__': 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