| OLD | NEW |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """Helper functions for the layout test analyzer.""" | 5 """Helper functions for the layout test analyzer.""" |
| 6 | 6 |
| 7 from datetime import datetime | 7 from datetime import datetime |
| 8 from email.mime.multipart import MIMEMultipart | 8 from email.mime.multipart import MIMEMultipart |
| 9 from email.mime.text import MIMEText | 9 from email.mime.text import MIMEText |
| 10 import fileinput | 10 import fileinput |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 classify them as 'whole', 'skip' or 'nonskip' based on that information. | 46 classify them as 'whole', 'skip' or 'nonskip' based on that information. |
| 47 | 47 |
| 48 Args: | 48 Args: |
| 49 test_info_map: the result map of |layouttests.JoinWithTestExpectation|. | 49 test_info_map: the result map of |layouttests.JoinWithTestExpectation|. |
| 50 The key of the map is test name such as 'media/media-foo.html'. | 50 The key of the map is test name such as 'media/media-foo.html'. |
| 51 The value of the map is a map that contains the following keys: | 51 The value of the map is a map that contains the following keys: |
| 52 'desc'(description), 'te_info' (test expectation information), | 52 'desc'(description), 'te_info' (test expectation information), |
| 53 which is a list of test expectation information map. The key of the | 53 which is a list of test expectation information map. The key of the |
| 54 test expectation information map is test expectation keywords such | 54 test expectation information map is test expectation keywords such |
| 55 as "SKIP" and other keywords (for full list of keywords, please | 55 as "SKIP" and other keywords (for full list of keywords, please |
| 56 refer to |test_expectaions.ALL_TE_KEYWORDS|). | 56 refer to |test_expectations.ALL_TE_KEYWORDS|). |
| 57 """ | 57 """ |
| 58 self.result_map = {} | 58 self.result_map = {} |
| 59 self.result_map['whole'] = {} | 59 self.result_map['whole'] = {} |
| 60 self.result_map['skip'] = {} | 60 self.result_map['skip'] = {} |
| 61 self.result_map['nonskip'] = {} | 61 self.result_map['nonskip'] = {} |
| 62 if test_info_map: | 62 if test_info_map: |
| 63 for (k, value) in test_info_map.iteritems(): | 63 for (k, value) in test_info_map.iteritems(): |
| 64 self.result_map['whole'][k] = value | 64 self.result_map['whole'][k] = value |
| 65 if 'te_info' in value: | 65 if 'te_info' in value: |
| 66 # Don't count SLOW PASS or WONTFIX tests as failures. | 66 # Don't count SLOW PASS, WONTFIX, or ANDROID tests as failures. |
| 67 if any([True for x in value['te_info'] if set(x.keys()) == | 67 if any([True for x in value['te_info'] if set(x.keys()) == |
| 68 set(['SLOW', 'PASS', 'Bugs', 'Comments']) or 'WONTFIX' in x]): | 68 set(['SLOW', 'PASS', 'Bugs', 'Comments', 'Platforms']) or |
| 69 continue | 69 'WONTFIX' in x or x['Platforms'] == ['ANDROID']]): |
| 70 # Ignore failures on the ANDROID platform. | |
| 71 if value['te_info']['Platforms'] == ['ANDROID']: | |
| 72 continue | 70 continue |
| 73 if any([True for x in value['te_info'] if 'SKIP' in x]): | 71 if any([True for x in value['te_info'] if 'SKIP' in x]): |
| 74 self.result_map['skip'][k] = value | 72 self.result_map['skip'][k] = value |
| 75 else: | 73 else: |
| 76 self.result_map['nonskip'][k] = value | 74 self.result_map['nonskip'][k] = value |
| 77 | 75 |
| 78 @staticmethod | 76 @staticmethod |
| 79 def GetDiffString(diff_map_element, type_str): | 77 def GetDiffString(diff_map_element, type_str): |
| 80 """Get difference string out of diff map element. | 78 """Get difference string out of diff map element. |
| 81 | 79 |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 return_str += '<ul>%s %s' % (Bug(bug_txt), bug_anno_map[bug_txt]) | 234 return_str += '<ul>%s %s' % (Bug(bug_txt), bug_anno_map[bug_txt]) |
| 237 for test_info in test_info_list: | 235 for test_info in test_info_list: |
| 238 (test_name, te_info) = test_info | 236 (test_name, te_info) = test_info |
| 239 gpu_link = '' | 237 gpu_link = '' |
| 240 if 'GPU' in te_info: | 238 if 'GPU' in te_info: |
| 241 gpu_link = 'group=%40ToT%20GPU%20Mesa%20-%20chromium.org&' | 239 gpu_link = 'group=%40ToT%20GPU%20Mesa%20-%20chromium.org&' |
| 242 dashboard_link = ('http://test-results.appspot.com/dashboards/' | 240 dashboard_link = ('http://test-results.appspot.com/dashboards/' |
| 243 'flakiness_dashboard.html#%stests=%s') % ( | 241 'flakiness_dashboard.html#%stests=%s') % ( |
| 244 gpu_link, test_name) | 242 gpu_link, test_name) |
| 245 return_str += '<li><a href="%s">%s</a> (%s) </li>' % ( | 243 return_str += '<li><a href="%s">%s</a> (%s) </li>' % ( |
| 246 dashboard_link, test_name, ' '.join(te_info.keys())) | 244 dashboard_link, test_name, ' '.join( |
| 245 [key for key in te_info.keys() if key != 'Platforms'])) |
| 247 return_str += '</ul>\n' | 246 return_str += '</ul>\n' |
| 248 return return_str | 247 return return_str |
| 249 | 248 |
| 250 def CompareToOtherResultMap(self, other_result_map): | 249 def CompareToOtherResultMap(self, other_result_map): |
| 251 """Compare this result map with the other to see if there are any diff. | 250 """Compare this result map with the other to see if there are any diff. |
| 252 | 251 |
| 253 The comparison is done for layouttests which belong to 'whole', 'skip', | 252 The comparison is done for layouttests which belong to 'whole', 'skip', |
| 254 or 'nonskip'. | 253 or 'nonskip'. |
| 255 | 254 |
| 256 Args: | 255 Args: |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 if rev_str: | 362 if rev_str: |
| 364 email_content += '<br><b>Revision Information:</b>' | 363 email_content += '<br><b>Revision Information:</b>' |
| 365 email_content += rev_str | 364 email_content += rev_str |
| 366 localtime = time.asctime(time.localtime(time.time())) | 365 localtime = time.asctime(time.localtime(time.time())) |
| 367 change_str = '' | 366 change_str = '' |
| 368 if email_only_change_mode: | 367 if email_only_change_mode: |
| 369 change_str = 'Status Change ' | 368 change_str = 'Status Change ' |
| 370 subject = 'Layout Test Analyzer Result %s(%s): %s' % (change_str, | 369 subject = 'Layout Test Analyzer Result %s(%s): %s' % (change_str, |
| 371 test_group_name, | 370 test_group_name, |
| 372 localtime) | 371 localtime) |
| 373 # TODO(imasaki): remove my name from here. | 372 SendEmail('no-reply@chromium.org', [receiver_email_address], |
| 374 SendEmail('imasaki@chromium.org', [receiver_email_address], | |
| 375 subject, email_content + appended_text_to_email) | 373 subject, email_content + appended_text_to_email) |
| 376 | 374 |
| 377 | 375 |
| 378 def GetRevisionString(prev_time, current_time, diff_map): | 376 def GetRevisionString(prev_time, current_time, diff_map): |
| 379 """Get a string for revision information during the specified time period. | 377 """Get a string for revision information during the specified time period. |
| 380 | 378 |
| 381 Args: | 379 Args: |
| 382 prev_time: the previous time as a floating point number expressed | 380 prev_time: the previous time as a floating point number expressed |
| 383 in seconds since the epoch, in UTC. | 381 in seconds since the epoch, in UTC. |
| 384 current_time: the current time as a floating point number expressed | 382 current_time: the current time as a floating point number expressed |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 597 list2 = map2[name]['te_info'] | 595 list2 = map2[name]['te_info'] |
| 598 te_diff = [item for item in list1 if not item in list2] | 596 te_diff = [item for item in list1 if not item in list2] |
| 599 if te_diff: | 597 if te_diff: |
| 600 name_list.append((name, te_diff)) | 598 name_list.append((name, te_diff)) |
| 601 else: | 599 else: |
| 602 name_list.append((name, value1)) | 600 name_list.append((name, value1)) |
| 603 return name_list | 601 return name_list |
| 604 | 602 |
| 605 return (GetDiffBetweenMapsHelper(map1, map2, lookIntoTestExpectationInfo), | 603 return (GetDiffBetweenMapsHelper(map1, map2, lookIntoTestExpectationInfo), |
| 606 GetDiffBetweenMapsHelper(map2, map1, lookIntoTestExpectationInfo)) | 604 GetDiffBetweenMapsHelper(map2, map1, lookIntoTestExpectationInfo)) |
| OLD | NEW |