Commit 1237dbe2 authored by rnephew's avatar rnephew Committed by Commit Bot

[Telemetry] Move system_health_csv_generator to use expectations file.

Bug: 781409
Change-Id: I70d28e9f43a4747f19666fbfa9f3bb18ac1d22d7
Reviewed-on: https://chromium-review.googlesource.com/830256Reviewed-by: default avatarNed Nguyen <nednguyen@google.com>
Reviewed-by: default avatarCharlie Andrews <charliea@chromium.org>
Commit-Queue: rnephew <rnephew@chromium.org>
Cr-Commit-Position: refs/heads/master@{#524454}
parent a86dd477
...@@ -6,10 +6,14 @@ import csv ...@@ -6,10 +6,14 @@ import csv
import sys import sys
from core import path_util from core import path_util
sys.path.insert(1, path_util.GetPerfDir()) # To resolve perf imports sys.path.insert(1, path_util.GetPerfDir()) # To resolve perf imports
sys.path.insert(1, path_util.GetTelemetryDir()) # To resolve telemetry imports path_util.AddPyUtilsToPath()
path_util.AddTelemetryToPath()
import page_sets import page_sets
from page_sets.system_health import expectations from page_sets.system_health import expectations
from py_utils import expectations_parser
from telemetry.story import expectations as expectations_module
def IterAllSystemHealthStories(): def IterAllSystemHealthStories():
for s in page_sets.SystemHealthStorySet(platform='desktop'): for s in page_sets.SystemHealthStorySet(platform='desktop'):
...@@ -50,11 +54,24 @@ def PopulateExpectations(all_expectations): ...@@ -50,11 +54,24 @@ def PopulateExpectations(all_expectations):
def GenerateSystemHealthCSV(file_path): def GenerateSystemHealthCSV(file_path):
system_health_stories = list(IterAllSystemHealthStories()) system_health_stories = list(IterAllSystemHealthStories())
e = expectations_module.StoryExpectations()
with open(path_util.GetExpectationsPath()) as fp:
parser = expectations_parser.TestExpectationParser(fp.read())
benchmarks = ['system_health.common_desktop', 'system_health.common_mobile',
'system_health.memory_desktop', 'system_health.memory_mobile']
for benchmark in benchmarks:
e.GetBenchmarkExpectationsFromParser(parser.expectations, benchmark)
all_expectations = [ all_expectations = [
e.AsDict()['stories'],
# TODO(rnephew): Delete these when system health uses file.
expectations.SystemHealthDesktopCommonExpectations().AsDict()['stories'], expectations.SystemHealthDesktopCommonExpectations().AsDict()['stories'],
expectations.SystemHealthDesktopMemoryExpectations().AsDict()['stories'], expectations.SystemHealthDesktopMemoryExpectations().AsDict()['stories'],
expectations.SystemHealthMobileCommonExpectations().AsDict()['stories'], expectations.SystemHealthMobileCommonExpectations().AsDict()['stories'],
expectations.SystemHealthMobileMemoryExpectations().AsDict()['stories'],] expectations.SystemHealthMobileMemoryExpectations().AsDict()['stories'],]
disabed_platforms = PopulateExpectations(all_expectations) disabed_platforms = PopulateExpectations(all_expectations)
system_health_stories.sort(key=lambda s: s.name) system_health_stories.sort(key=lambda s: s.name)
with open(file_path, 'w') as f: with open(file_path, 'w') as f:
......
This diff is collapsed.
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