aboutsummaryrefslogtreecommitdiff
path: root/crosperf
diff options
context:
space:
mode:
authorcmtice <cmtice@google.com>2015-05-22 11:36:35 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-05-22 22:48:16 +0000
commit7658aecb942b63472453be82a24bc2036121383d (patch)
tree094f8b5a8575f4ecd9505266bf623057733b0cb0 /crosperf
parentd96e457132abf36c05936121e59acbab819ecd8e (diff)
downloadtoolchain-utils-7658aecb942b63472453be82a24bc2036121383d.tar.gz
Add email message body to results directory.
Save the email message body in the results directory. Also update the email message to say where the results directory is. BUG=None TEST=Tested in my chroot. Change-Id: I1da651549db87edc6b781525d443d21f97041d21 Reviewed-on: https://chrome-internal-review.googlesource.com/217265 Reviewed-by: Luis Lozano <llozano@chromium.org> Commit-Queue: Caroline Tice <cmtice@google.com> Tested-by: Caroline Tice <cmtice@google.com>
Diffstat (limited to 'crosperf')
-rw-r--r--crosperf/experiment_runner.py10
-rwxr-xr-x[-rw-r--r--]crosperf/experiment_runner_unittest.py13
2 files changed, 17 insertions, 6 deletions
diff --git a/crosperf/experiment_runner.py b/crosperf/experiment_runner.py
index 3a2d600c..d27144ed 100644
--- a/crosperf/experiment_runner.py
+++ b/crosperf/experiment_runner.py
@@ -85,6 +85,8 @@ class ExperimentRunner(object):
subject = "%s: %s" % (experiment.name, " vs. ".join(label_names))
text_report = TextResultsReport(experiment, True).GetReport()
+ text_report += ("\nResults are stored in %s.\n" %
+ experiment.results_directory)
text_report = "<pre style='font-size: 13px'>%s</pre>" % text_report
html_report = HTMLResultsReport(experiment).GetReport()
attachment = EmailSender.Attachment("report.html", html_report)
@@ -111,6 +113,14 @@ class ExperimentRunner(object):
report = HTMLResultsReport(experiment).GetReport()
FileUtils().WriteFile(results_table_path, report)
+ self.l.LogOutput("Storing email message body in %s." % results_directory)
+ msg_file_path = os.path.join(results_directory, "msg_body.html")
+ text_report = TextResultsReport(experiment, True).GetReport()
+ text_report += ("\nResults are stored in %s.\n" %
+ experiment.results_directory)
+ msg_body = "<pre style='font-size: 13px'>%s</pre>" % text_report
+ FileUtils().WriteFile(msg_file_path, msg_body)
+
self.l.LogOutput("Storing results of each benchmark run.")
for benchmark_run in experiment.benchmark_runs:
if benchmark_run.result:
diff --git a/crosperf/experiment_runner_unittest.py b/crosperf/experiment_runner_unittest.py
index 8ac0c591..0e949eb0 100644..100755
--- a/crosperf/experiment_runner_unittest.py
+++ b/crosperf/experiment_runner_unittest.py
@@ -269,7 +269,7 @@ class ExperimentRunnerTest(unittest.TestCase):
(['john.smith@google.com', 'jane.doe@google.com'],
': image1 vs. image2',
"<pre style='font-size: 13px'>This is a fake text "
- "report.</pre>"))
+ "report.\nResults are stored in _results.\n</pre>"))
self.assertTrue(type(mock_emailer.call_args[1]) is dict)
self.assertEqual(len(mock_emailer.call_args[1]), 2)
self.assertTrue('attachments' in mock_emailer.call_args[1].keys())
@@ -299,7 +299,7 @@ class ExperimentRunnerTest(unittest.TestCase):
(['john.smith@google.com', 'jane.doe@google.com'],
': image1 vs. image2',
"<pre style='font-size: 13px'>This is a fake text "
- "report.</pre>"))
+ "report.\nResults are stored in _results.\n</pre>"))
self.assertTrue(type(mock_emailer.call_args[1]) is dict)
self.assertEqual(len(mock_emailer.call_args[1]), 2)
self.assertTrue('attachments' in mock_emailer.call_args[1].keys())
@@ -327,7 +327,7 @@ class ExperimentRunnerTest(unittest.TestCase):
(['john.smith@google.com'],
': image1 vs. image2',
"<pre style='font-size: 13px'>This is a fake text "
- "report.</pre>"))
+ "report.\nResults are stored in _results.\n</pre>"))
self.assertTrue(type(mock_emailer.call_args[1]) is dict)
self.assertEqual(len(mock_emailer.call_args[1]), 2)
self.assertTrue('attachments' in mock_emailer.call_args[1].keys())
@@ -392,8 +392,8 @@ class ExperimentRunnerTest(unittest.TestCase):
mock_cleanup.called_with(bench_run.benchmark.rm_chroot_tmp)
self.assertEqual(mock_copy.call_count, 6)
mock_copy.called_with(bench_path)
- self.assertEqual(mock_writefile.call_count, 2)
- self.assertEqual (len(mock_writefile.call_args_list), 2)
+ self.assertEqual(mock_writefile.call_count, 3)
+ self.assertEqual (len(mock_writefile.call_args_list), 3)
first_args = mock_writefile.call_args_list[0]
second_args = mock_writefile.call_args_list[1]
self.assertEqual(first_args[0][0],
@@ -404,10 +404,11 @@ class ExperimentRunnerTest(unittest.TestCase):
mock_mkdir.called_with('/usr/local/crosperf-results')
self.assertEqual(mock_rmdir.call_count, 1)
mock_rmdir.called_with('/usr/local/crosperf-results')
- self.assertEqual(self.mock_logger.LogOutputCount, 3)
+ self.assertEqual(self.mock_logger.LogOutputCount, 4)
self.assertEqual(self.mock_logger.output_msgs,
[ 'Storing experiment file in /usr/local/crosperf-results.',
'Storing results report in /usr/local/crosperf-results.',
+ 'Storing email message body in /usr/local/crosperf-results.',
'Storing results of each benchmark run.' ])