| OLD | NEW |
| 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 function to run the layout test analyzer. | 6 """Main function to run the layout test analyzer. |
| 7 | 7 |
| 8 The purpose of this script is to run the layout test analyzer for various | 8 The purpose of this script is to run the layout test analyzer for various |
| 9 teams based on the run configuration file in CSV format. The CSV file is based | 9 teams based on the run configuration file in CSV format. The CSV file is based |
| 10 on https://sites.google.com/a/chromium.org/dev/developers/testing/ | 10 on https://sites.google.com/a/chromium.org/dev/developers/testing/ |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 'as test group name with replacement of "/"' | 61 'as test group name with replacement of "/"' |
| 62 'with "_" (default to %default)'), | 62 'with "_" (default to %default)'), |
| 63 default=DEFAULT_ANNO_DIR) | 63 default=DEFAULT_ANNO_DIR) |
| 64 option_parser.add_option('-b', '--email-appended-text-file-location', | 64 option_parser.add_option('-b', '--email-appended-text-file-location', |
| 65 dest='email_appended_text_file_location', | 65 dest='email_appended_text_file_location', |
| 66 help=('File location of the email appended text. ' | 66 help=('File location of the email appended text. ' |
| 67 'The text is appended in the status email. ' | 67 'The text is appended in the status email. ' |
| 68 '(default to %default and no text is ' | 68 '(default to %default and no text is ' |
| 69 'appended in that case.)'), | 69 'appended in that case.)'), |
| 70 default=None) | 70 default=None) |
| 71 option_parser.add_option('-e', '--email-only-change-mode', |
| 72 dest='email_only_change_mode', |
| 73 help=('With this mode, email is sent out ' |
| 74 'only when there is a change in the ' |
| 75 'analyzer result compared to the previous ' |
| 76 'result (off by default)'), |
| 77 action='store_true', default=False) |
| 71 return option_parser.parse_args()[0] | 78 return option_parser.parse_args()[0] |
| 72 | 79 |
| 73 | 80 |
| 74 def GenerateDashboardHTMLFile(file_name, test_group_list): | 81 def GenerateDashboardHTMLFile(file_name, test_group_list): |
| 75 """Generate dashboard HTML file. | 82 """Generate dashboard HTML file. |
| 76 | 83 |
| 77 Currently, it is simple table that shows all the analyzer results. | 84 Currently, it is simple table that shows all the analyzer results. |
| 78 | 85 |
| 79 Args: | 86 Args: |
| 80 file_name: the file name of the dashboard. | 87 file_name: the file name of the dashboard. |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 graph_file = os.path.join(options.graph_directory_location, | 176 graph_file = os.path.join(options.graph_directory_location, |
| 170 test_group_name_for_data + '.html') | 177 test_group_name_for_data + '.html') |
| 171 if not os.path.exists(graph_file): | 178 if not os.path.exists(graph_file): |
| 172 # Copy the template file. | 179 # Copy the template file. |
| 173 shutil.copy(os.path.join('graph', 'graph.html'), | 180 shutil.copy(os.path.join('graph', 'graph.html'), |
| 174 graph_file) | 181 graph_file) |
| 175 os.chmod(graph_file, 0744) | 182 os.chmod(graph_file, 0744) |
| 176 anno_file = os.path.join(options.annotation_directory_location, | 183 anno_file = os.path.join(options.annotation_directory_location, |
| 177 test_group_name_for_data + '.csv') | 184 test_group_name_for_data + '.csv') |
| 178 cmd = ('python layouttest_analyzer.py -x %s -d %s -t %s' | 185 cmd = ('python layouttest_analyzer.py -x %s -d %s -t %s' |
| 179 ' -q %s -a %s -c ') % ( | 186 ' -q %s -a %s ') % ( |
| 180 test_group, result_dir, graph_file, dashboard_file_location, | 187 test_group, result_dir, graph_file, dashboard_file_location, |
| 181 anno_file) | 188 anno_file) |
| 182 if run_config_map[test_group][0]: | 189 if run_config_map[test_group][0]: |
| 183 cmd += '-n ' + run_config_map[test_group][0] + ' ' | 190 cmd += '-n ' + run_config_map[test_group][0] + ' ' |
| 184 if run_config_map[test_group][1]: | 191 if run_config_map[test_group][1]: |
| 185 cmd += '-r ' + run_config_map[test_group][1] + ' ' | 192 cmd += '-r ' + run_config_map[test_group][1] + ' ' |
| 186 if options.email_appended_text_file_location: | 193 if options.email_appended_text_file_location: |
| 187 cmd += ' -b ' + options.email_appended_text_file_location | 194 cmd += ' -b ' + options.email_appended_text_file_location |
| 195 if options.email_only_change_mode: |
| 196 cmd += ' -c ' |
| 188 print 'Running ' + cmd | 197 print 'Running ' + cmd |
| 189 proc = Popen(cmd, shell=True) | 198 proc = Popen(cmd, shell=True) |
| 190 proc.communicate() | 199 proc.communicate() |
| 191 | 200 |
| 192 | 201 |
| 193 if '__main__' == __name__: | 202 if '__main__' == __name__: |
| 194 main() | 203 main() |
| OLD | NEW |