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

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

Issue 7789008: Added an option to append text at the end of the status email n layout test analyzer tool. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove graph/graph.html 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
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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 option_parser.add_option('-x', '--test-group-name', 72 option_parser.add_option('-x', '--test-group-name',
73 dest='test_group_name', 73 dest='test_group_name',
74 help=('Name of test group ' 74 help=('Name of test group '
75 '(default to %default)'), 75 '(default to %default)'),
76 default=DEFAULT_TEST_GROUP_NAME) 76 default=DEFAULT_TEST_GROUP_NAME)
77 option_parser.add_option('-d', '--result-directory-location', 77 option_parser.add_option('-d', '--result-directory-location',
78 dest='result_directory_location', 78 dest='result_directory_location',
79 help=('Name of result directory location ' 79 help=('Name of result directory location '
80 '(default to %default)'), 80 '(default to %default)'),
81 default=DEFAULT_RESULT_DIR) 81 default=DEFAULT_RESULT_DIR)
82 option_parser.add_option('-b', '--email-insert-text-file-location',
83 dest='email_insert_text_file_location',
84 help=('File location of the email insert text. '
85 'The text is included in the status email. '
86 '(default to %default)'),
dennis_jeffrey 2011/09/06 19:25:55 You might want to clarify that in the default case
imasaki1 2011/09/06 20:26:10 Done.
87 default=None)
82 return option_parser.parse_args()[0] 88 return option_parser.parse_args()[0]
83 89
84 90
85 def main(): 91 def main():
86 """A main function for the analyzer.""" 92 """A main function for the analyzer."""
87 options = parse_option() 93 options = parse_option()
88 start_time = datetime.now() 94 start_time = datetime.now()
89 95
90 # Do the main analysis. 96 # Do the main analysis.
91 if not options.debug: 97 if not options.debug:
(...skipping 12 matching lines...) Expand all
104 110
105 # Read bug annotations and generate an annotation map used for the status 111 # Read bug annotations and generate an annotation map used for the status
106 # email. 112 # email.
107 anno_map = {} 113 anno_map = {}
108 file_object = open(options.bug_annotation_file_location) 114 file_object = open(options.bug_annotation_file_location)
109 data = csv.reader(file_object) 115 data = csv.reader(file_object)
110 for row in data: 116 for row in data:
111 anno_map[row[0]] = row[1] 117 anno_map[row[0]] = row[1]
112 file_object.close() 118 file_object.close()
113 119
120 appended_text_to_email = ''
121 if options.email_insert_text_file_location:
122 file_object = open(options.email_insert_text_file_location)
dennis_jeffrey 2011/09/06 19:25:55 We should check to make sure the file exists befor
imasaki1 2011/09/06 20:26:10 Done. Also changed annotation file reading part.
123 appended_text_to_email = ''.join(file_object.readlines())
124 file_object.close()
125
114 layouttest_analyzer_helpers.SendStatusEmail(prev_time, analyzer_result_map, 126 layouttest_analyzer_helpers.SendStatusEmail(prev_time, analyzer_result_map,
115 prev_analyzer_result_map, 127 prev_analyzer_result_map,
116 anno_map, 128 anno_map,
117 options.receiver_email_address, 129 options.receiver_email_address,
118 options.test_group_name) 130 options.test_group_name,
131 appended_text_to_email)
119 if not options.debug: 132 if not options.debug:
120 # Save the current result. 133 # Save the current result.
121 date = start_time.strftime('%Y-%m-%d-%H') 134 date = start_time.strftime('%Y-%m-%d-%H')
122 file_path = os.path.join(options.result_directory_location, date) 135 file_path = os.path.join(options.result_directory_location, date)
123 analyzer_result_map.Save(file_path) 136 analyzer_result_map.Save(file_path)
124 137
125 # Trend graph update (if specified in the command-line argument). 138 # Trend graph update (if specified in the command-line argument).
126 trend_graph = TrendGraph(options.trend_graph_location) 139 trend_graph = TrendGraph(options.trend_graph_location)
127 datetime_string = start_time.strftime('%Y,%m,%d,%H,%M,%S') 140 datetime_string = start_time.strftime('%Y,%m,%d,%H,%M,%S')
128 # TODO(imasaki): add correct title and text instead of 'undefined'. 141 # TODO(imasaki): add correct title and text instead of 'undefined'.
129 data_map = ( 142 data_map = (
130 {'whole': (str(len(analyzer_result_map.result_map['whole'].keys())), 143 {'whole': (str(len(analyzer_result_map.result_map['whole'].keys())),
131 'undefined', 'undefined'), 144 'undefined', 'undefined'),
132 'skip': (str(len(analyzer_result_map.result_map['skip'].keys())), 145 'skip': (str(len(analyzer_result_map.result_map['skip'].keys())),
133 'undefined', 'undefined'), 146 'undefined', 'undefined'),
134 'nonskip': (str(len(analyzer_result_map.result_map['nonskip'].keys())), 147 'nonskip': (str(len(analyzer_result_map.result_map['nonskip'].keys())),
135 'undefined', 'undefined'), 148 'undefined', 'undefined'),
136 'passingrate': (str(analyzer_result_map.GetPassingRate()), 149 'passingrate': (str(analyzer_result_map.GetPassingRate()),
137 'undefined', 'undefined')}) 150 'undefined', 'undefined')})
138 trend_graph.Update(datetime_string, data_map) 151 trend_graph.Update(datetime_string, data_map)
139 152
140 153
141 if '__main__' == __name__: 154 if '__main__' == __name__:
142 main() 155 main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698