aboutsummaryrefslogtreecommitdiff
path: root/crosperf/experiment_runner_unittest.py
diff options
context:
space:
mode:
authorGeorge Burgess IV <gbiv@google.com>2016-08-25 11:29:09 -0700
committerchrome-bot <chrome-bot@chromium.org>2016-09-08 11:48:40 -0700
commit2368b41ea869a6904ae8320ad69f1b8b9a9a3714 (patch)
treea9bd3cbad3a4a52b937708a668e9210dfddfd6c7 /crosperf/experiment_runner_unittest.py
parenta3e8787abdde02848ff987b67fa9ac0b22e24b7b (diff)
downloadtoolchain-utils-2368b41ea869a6904ae8320ad69f1b8b9a9a3714.tar.gz
crosperf: Make results_report more general.
The goal of this patch is to allow us to use results_report to generate non-ChromeOS-specific results reports. It's meant to be a nop for regular crosperf runs (except that, in HTML report generation, whitespace in the HTML itself will look a bit different.) Moreover, results_report used to shuffle Experiments around, each of which, unsurprisingly, contained *tons* of data about an experiment. So, part of this patch was reducing results_report's reliance on Experiments, in favor of a new type, BenchmarkResult. Some parts of results_report still rely on Experiments, but only to provide *extra* data. The minimum amount of data needed to make a results report is contained in a BenchmarkResult, and there's a convenient API we can use to make a BenchmarkResult out of an Experiment. This patch also does a massive refactor of results_report, because lots of the code was mildly more icky than it is with this patch applied. The refactor-for-prettiness and refactor-for-BenchmarkResults kind of go hand-in-hand, so it's really hard to split them out. The only part that's not so difficult to split out is the refactor to results_report_templates, but the value of splitting that out is questionable (to me). Speaking of which, all HTML magicks that were in results_report is now in results_report_templates, and now use *actual* Templates. It -- and HTMLReportGenerator -- are hopefully more readable as a result. Next, this makes JSONRsultsReport's GetReport() return a string containing JSON data, rather than calling a callback to write that string to a file. Finally, this includes a change to perf_table. Namely, its removal. It was otherwise unused, and I couldn't get it to even work, so I cleaned it up, made a perf report parser (because I couldn't get the cros_utils one to work, either...), and made sure it functions. If we're able to produce perf reports that cros_utils can parse, I'm happy to back my new parser out; I was primarily using it so I could be sure I didn't break HTML report generation. BUG=chromium:641098 TEST=./run_tests.sh passes Change-Id: I437de9eb39e00c9dd5c223ecd27feaaab544a6fd Reviewed-on: https://chrome-internal-review.googlesource.com/282217 Commit-Ready: George Burgess <gbiv@google.com> Tested-by: George Burgess <gbiv@google.com> Reviewed-by: Caroline Tice <cmtice@google.com>
Diffstat (limited to 'crosperf/experiment_runner_unittest.py')
-rwxr-xr-xcrosperf/experiment_runner_unittest.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/crosperf/experiment_runner_unittest.py b/crosperf/experiment_runner_unittest.py
index fde9f03d..6ad0c7fa 100755
--- a/crosperf/experiment_runner_unittest.py
+++ b/crosperf/experiment_runner_unittest.py
@@ -1,6 +1,8 @@
#!/usr/bin/python2
#
-# Copyright 2014 Google Inc. All Rights Reserved
+# Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
"""Tests for the experiment runner module."""
from __future__ import print_function
@@ -17,11 +19,12 @@ import experiment_status
import machine_manager
import config
import test_flag
-from experiment_file import ExperimentFile
+
from experiment_factory import ExperimentFactory
-from results_report import TextResultsReport
-from results_report import HTMLResultsReport
+from experiment_file import ExperimentFile
from results_cache import Result
+from results_report import HTMLResultsReport
+from results_report import TextResultsReport
from cros_utils import command_executer
from cros_utils.email_sender import EmailSender
@@ -380,8 +383,8 @@ class ExperimentRunnerTest(unittest.TestCase):
@mock.patch.object(FileUtils, 'RmDir')
@mock.patch.object(FileUtils, 'MkDirP')
@mock.patch.object(FileUtils, 'WriteFile')
- @mock.patch.object(HTMLResultsReport, 'GetReport')
- @mock.patch.object(TextResultsReport, 'GetReport')
+ @mock.patch.object(HTMLResultsReport, 'FromExperiment')
+ @mock.patch.object(TextResultsReport, 'FromExperiment')
@mock.patch.object(Result, 'CopyResultsTo')
@mock.patch.object(Result, 'CleanUp')
def test_store_results(self, mock_cleanup, mock_copy, _mock_text_report,