Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(450)

Side by Side Diff: media/tools/layout_tests/layouttest_analyzer.py

Issue 7850023: Add a command-line option about status email in the layout test analyzer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Modification based on CR comments. Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | media/tools/layout_tests/layouttest_analyzer_helpers.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Main functions for the Layout Test Analyzer module.""" 6 """Main functions for the Layout Test Analyzer module."""
7 7
8 import csv 8 import csv
9 from datetime import datetime 9 from datetime import datetime
10 import optparse 10 import optparse
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 help=('Name of result directory location ' 77 help=('Name of result directory location '
78 '(default to %default)'), 78 '(default to %default)'),
79 default=DEFAULT_RESULT_DIR) 79 default=DEFAULT_RESULT_DIR)
80 option_parser.add_option('-b', '--email-appended-text-file-location', 80 option_parser.add_option('-b', '--email-appended-text-file-location',
81 dest='email_appended_text_file_location', 81 dest='email_appended_text_file_location',
82 help=('File location of the email appended text. ' 82 help=('File location of the email appended text. '
83 'The text is appended in the status email. ' 83 'The text is appended in the status email. '
84 '(default to %default and no text is ' 84 '(default to %default and no text is '
85 'appended in that case.)'), 85 'appended in that case.)'),
86 default=None) 86 default=None)
87 option_parser.add_option('-c', '--email-only-change-mode',
88 dest='email_only_change_mode',
89 help=('With this mode, email is sent out '
90 'only when there is a change in the '
91 'analyzer result compared to the previous '
92 'result (off by default)'),
93 action='store_true', default=False)
87 return option_parser.parse_args()[0] 94 return option_parser.parse_args()[0]
88 95
89 96
90 def main(): 97 def main():
91 """A main function for the analyzer.""" 98 """A main function for the analyzer."""
92 options = parse_option() 99 options = parse_option()
93 start_time = datetime.now() 100 start_time = datetime.now()
94 101
95 # Do the main analysis. 102 # Do the main analysis.
96 if not options.debug: 103 if not options.debug:
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 else: 139 else:
133 appended_text_to_email = ''.join(file_object.readlines()) 140 appended_text_to_email = ''.join(file_object.readlines())
134 file_object.close() 141 file_object.close()
135 142
136 143
137 layouttest_analyzer_helpers.SendStatusEmail(prev_time, analyzer_result_map, 144 layouttest_analyzer_helpers.SendStatusEmail(prev_time, analyzer_result_map,
138 prev_analyzer_result_map, 145 prev_analyzer_result_map,
139 anno_map, 146 anno_map,
140 options.receiver_email_address, 147 options.receiver_email_address,
141 options.test_group_name, 148 options.test_group_name,
142 appended_text_to_email) 149 appended_text_to_email,
150 options.email_only_change_mode)
143 if not options.debug: 151 if not options.debug:
144 # Save the current result. 152 # Save the current result.
145 date = start_time.strftime('%Y-%m-%d-%H') 153 date = start_time.strftime('%Y-%m-%d-%H')
146 file_path = os.path.join(options.result_directory_location, date) 154 file_path = os.path.join(options.result_directory_location, date)
147 analyzer_result_map.Save(file_path) 155 analyzer_result_map.Save(file_path)
148 156
149 # Trend graph update (if specified in the command-line argument). 157 # Trend graph update (if specified in the command-line argument).
150 trend_graph = TrendGraph(options.trend_graph_location) 158 trend_graph = TrendGraph(options.trend_graph_location)
151 datetime_string = start_time.strftime('%Y,%m,%d,%H,%M,%S') 159 datetime_string = start_time.strftime('%Y,%m,%d,%H,%M,%S')
152 # TODO(imasaki): add correct title and text instead of 'undefined'. 160 # TODO(imasaki): add correct title and text instead of 'undefined'.
153 data_map = ( 161 data_map = (
154 {'whole': (str(len(analyzer_result_map.result_map['whole'].keys())), 162 {'whole': (str(len(analyzer_result_map.result_map['whole'].keys())),
155 'undefined', 'undefined'), 163 'undefined', 'undefined'),
156 'skip': (str(len(analyzer_result_map.result_map['skip'].keys())), 164 'skip': (str(len(analyzer_result_map.result_map['skip'].keys())),
157 'undefined', 'undefined'), 165 'undefined', 'undefined'),
158 'nonskip': (str(len(analyzer_result_map.result_map['nonskip'].keys())), 166 'nonskip': (str(len(analyzer_result_map.result_map['nonskip'].keys())),
159 'undefined', 'undefined'), 167 'undefined', 'undefined'),
160 'passingrate': (str(analyzer_result_map.GetPassingRate()), 168 'passingrate': (str(analyzer_result_map.GetPassingRate()),
161 'undefined', 'undefined')}) 169 'undefined', 'undefined')})
162 trend_graph.Update(datetime_string, data_map) 170 trend_graph.Update(datetime_string, data_map)
163 171
164 172
165 if '__main__' == __name__: 173 if '__main__' == __name__:
166 main() 174 main()
OLDNEW
« no previous file with comments | « no previous file | media/tools/layout_tests/layouttest_analyzer_helpers.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698