Commit 65014162 authored by nednguyen's avatar nednguyen Committed by Commit bot

Enable more benchmark_smoke_unittest coverage

Previously, benchmark_smoke_unittest has a heuristic to pick
a benchmark for smoke testing if the benchmark uses a test
in measurement directory.
This patch removes that check, and instead provide a black
list of benchmarks module that we exclude the
benchmark_smoke_unittest to avoid high CQ time.

This helped increases benchmark smoke coverage from 14 benchmarks -> 33 benchmarks (one in each benchmark module).

On my local linux machine, this increases the cycle time of
benchmark_smoke_unittest from 20s -> 1m7s.

BUG=490130
CQ_EXTRA_TRYBOTS=tryserver.chromium.perf:linux_perf_bisect;tryserver.chromium.perf:mac_perf_bisect;tryserver.chromium.perf:android_nexus5_perf_bisect

Review URL: https://codereview.chromium.org/1144193002

Cr-Commit-Position: refs/heads/master@{#330909}
parent e53349cf
...@@ -10,14 +10,21 @@ of every benchmark would run impractically long. ...@@ -10,14 +10,21 @@ of every benchmark would run impractically long.
""" """
import os import os
import sys
import time
import unittest import unittest
from telemetry import benchmark as benchmark_module from telemetry import benchmark as benchmark_module
from telemetry.core import discover from telemetry.core import discover
from telemetry.page import page_test
from telemetry.unittest_util import options_for_unittests from telemetry.unittest_util import options_for_unittests
from telemetry.unittest_util import progress_reporter from telemetry.unittest_util import progress_reporter
from benchmarks import dom_perf
from benchmarks import rasterize_and_record_micro
from benchmarks import spaceport
from benchmarks import speedometer
from benchmarks import jetstream
def SmokeTestGenerator(benchmark): def SmokeTestGenerator(benchmark):
# NOTE TO SHERIFFS: DO NOT DISABLE THIS TEST. # NOTE TO SHERIFFS: DO NOT DISABLE THIS TEST.
...@@ -56,34 +63,42 @@ def SmokeTestGenerator(benchmark): ...@@ -56,34 +63,42 @@ def SmokeTestGenerator(benchmark):
benchmark.ProcessCommandLineArgs(None, options) benchmark.ProcessCommandLineArgs(None, options)
benchmark_module.ProcessCommandLineArgs(None, options) benchmark_module.ProcessCommandLineArgs(None, options)
current = time.time()
try:
self.assertEqual(0, SinglePageBenchmark().Run(options), self.assertEqual(0, SinglePageBenchmark().Run(options),
msg='Failed: %s' % benchmark) msg='Failed: %s' % benchmark)
finally:
print 'Benchmark %s run takes %i seconds' % (
benchmark.Name(), time.time() - current)
return BenchmarkSmokeTest return BenchmarkSmokeTest
# The list of benchmark modules to be excluded from our smoke tests.
_BLACK_LIST_TEST_MODULES = {
dom_perf, # Always fails on cq bot.
rasterize_and_record_micro, # Always fails on cq bot.
spaceport, # Takes 451 seconds.
speedometer, # Takes 101 seconds.
jetstream, # Take 206 seconds.
}
def load_tests(loader, standard_tests, pattern): def load_tests(loader, standard_tests, pattern):
del loader, standard_tests, pattern # unused del loader, standard_tests, pattern # unused
suite = progress_reporter.TestSuite() suite = progress_reporter.TestSuite()
benchmarks_dir = os.path.dirname(__file__) benchmarks_dir = os.path.dirname(__file__)
top_level_dir = os.path.dirname(benchmarks_dir) top_level_dir = os.path.dirname(benchmarks_dir)
measurements_dir = os.path.join(top_level_dir, 'measurements')
all_measurements = discover.DiscoverClasses(
measurements_dir, top_level_dir, page_test.PageTest).values()
# Using the default of |index_by_class_name=False| means that if a module # Using the default of |index_by_class_name=False| means that if a module
# has multiple benchmarks, only the last one is returned. # has multiple benchmarks, only the last one is returned.
all_benchmarks = discover.DiscoverClasses( all_benchmarks = discover.DiscoverClasses(
benchmarks_dir, top_level_dir, benchmark_module.Benchmark, benchmarks_dir, top_level_dir, benchmark_module.Benchmark,
index_by_class_name=False).values() index_by_class_name=False).values()
for benchmark in all_benchmarks: for benchmark in all_benchmarks:
if hasattr(benchmark, 'test') and benchmark.test not in all_measurements: if sys.modules[benchmark.__module__] in _BLACK_LIST_TEST_MODULES:
# If the benchmark does not have a measurement, then it is not composable.
# Ideally we'd like to test these as well, but the non-composable
# benchmarks are usually long-running benchmarks.
continue continue
# TODO(tonyg): Smoke doesn't work with session_restore yet. # TODO(tonyg): Smoke doesn't work with session_restore yet.
if (benchmark.Name().startswith('session_restore') or if (benchmark.Name().startswith('session_restore') or
benchmark.Name().startswith('skpicture_printer')): benchmark.Name().startswith('skpicture_printer')):
......
...@@ -43,7 +43,7 @@ class UserStorySet(object): ...@@ -43,7 +43,7 @@ class UserStorySet(object):
self._cloud_storage_bucket = cloud_storage_bucket self._cloud_storage_bucket = cloud_storage_bucket
if base_dir: if base_dir:
if not os.path.isdir(base_dir): if not os.path.isdir(base_dir):
raise ValueError('Must provide valid directory path for base_dir.') raise ValueError('Invalid directory path of base_dir: %s' % base_dir)
self._base_dir = base_dir self._base_dir = base_dir
else: else:
self._base_dir = os.path.dirname(inspect.getfile(self.__class__)) self._base_dir = os.path.dirname(inspect.getfile(self.__class__))
......
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