| Index: tools/perf/benchmarks/system_health_smoke_test.py
|
| diff --git a/tools/perf/benchmarks/system_health_smoke_test.py b/tools/perf/benchmarks/system_health_smoke_test.py
|
| index bc22e9a2d0685a307db9bc75684e5abcfc376405..f82d3d25979e03bad5a05f795d523dd1ff64c77a 100644
|
| --- a/tools/perf/benchmarks/system_health_smoke_test.py
|
| +++ b/tools/perf/benchmarks/system_health_smoke_test.py
|
| @@ -10,6 +10,7 @@ stories as memory ones, only with fewer actions (no memory dumping).
|
| """
|
|
|
| import unittest
|
| +import os
|
|
|
| from core import perf_benchmark
|
|
|
| @@ -73,10 +74,10 @@ def _GenerateSmokeTestCase(benchmark_class, story_to_smoke_test):
|
| @benchmark_module.Disabled('chromeos') # crbug.com/351114
|
| def RunTest(self):
|
|
|
| - class SinglePageBenchmark(benchmark_class): # pylint: disable=no-init
|
| + class SingleStoryBenchmark(benchmark_class): # pylint: disable=no-init
|
| def CreateStorySet(self, options):
|
| # pylint: disable=super-on-old-class
|
| - story_set = super(SinglePageBenchmark, self).CreateStorySet(options)
|
| + story_set = super(SingleStoryBenchmark, self).CreateStorySet(options)
|
| assert story_to_smoke_test in story_set.stories
|
| story_set.stories = [story_to_smoke_test]
|
| return story_set
|
| @@ -85,14 +86,32 @@ def _GenerateSmokeTestCase(benchmark_class, story_to_smoke_test):
|
| possible_browser = browser_finder.FindBrowser(options)
|
| if possible_browser is None:
|
| self.skipTest('Cannot find the browser to run the test.')
|
| - if (SinglePageBenchmark.ShouldDisable(possible_browser) or
|
| + if (SingleStoryBenchmark.ShouldDisable(possible_browser) or
|
| not decorators.IsEnabled(benchmark_class, possible_browser)[0]):
|
| - self.skipTest('Benchmark %s is disabled' % SinglePageBenchmark.Name())
|
| + self.skipTest('Benchmark %s is disabled' % SingleStoryBenchmark.Name())
|
|
|
| if self.id() in _DISABLED_TESTS:
|
| self.skipTest('Test is explictly disabled')
|
|
|
| - self.assertEqual(0, SinglePageBenchmark().Run(options),
|
| + # If this is run on swarming, dump all the data to ${ISOLATED_OUTDIR} to
|
| + # archive them.
|
| + if os.environ.get('ISOLATED_OUTDIR'):
|
| + if possible_browser.platform.GetOSName() == 'android':
|
| + options.profiler = 'android-screen-recorder'
|
| + system_health_dir = os.path.join(
|
| + os.path.abspath(os.environ.get('ISOLATED_OUTDIR')),
|
| + 'system_health_smoke')
|
| + # Create system_health_dir if not already exists (this could be racey
|
| + # hence we just ignore OSError).
|
| + try:
|
| + os.mkdir(system_health_dir)
|
| + except OSError:
|
| + pass
|
| + options.output_dir = os.path.join(system_health_dir,
|
| + story_to_smoke_test.file_safe_name)
|
| + os.mkdir(options.output_dir)
|
| + options.output_formats = ['json', 'html2']
|
| + self.assertEqual(0, SingleStoryBenchmark().Run(options),
|
| msg='Failed: %s' % benchmark_class)
|
|
|
| # We attach the test method to SystemHealthBenchmarkSmokeTest dynamically
|
|
|