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

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

Issue 10501010: Update layout_tests tool in media/tools and PRESUBMIT.py per test_expectations.txt renames. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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_unittest.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 # 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
11 import os 11 import os
12 import pickle 12 import pickle
13 import re 13 import re
14 import smtplib 14 import smtplib
15 import socket 15 import socket
16 import sys 16 import sys
17 import time 17 import time
18 import urllib 18 import urllib
19 19
20 from bug import Bug 20 from bug import Bug
21 from test_expectations_history import TestExpectationsHistory 21 from test_expectations_history import TestExpectationsHistory
22 22
23 DEFAULT_TEST_EXPECTATION_PATH = ('trunk/LayoutTests/platform/chromium/'
24 'TestExpectations')
25 LEGACY_DEFAULT_TEST_EXPECTATION_PATH = ('trunk/LayoutTests/platform/chromium/'
26 'test_expectations.txt')
23 27
24 class AnalyzerResultMap: 28 class AnalyzerResultMap:
25 """A class to deal with joined result produed by the analyzer. 29 """A class to deal with joined result produed by the analyzer.
26 30
27 The join is done between layouttests and the test_expectations object 31 The join is done between layouttests and the test_expectations object
28 (based on the test expectation file). The instance variable |result_map| 32 (based on the test expectation file). The instance variable |result_map|
29 contains the following keys: 'whole','skip','nonskip'. The value of 'whole' 33 contains the following keys: 'whole','skip','nonskip'. The value of 'whole'
30 contains information about all layouttests. The value of 'skip' contains 34 contains information about all layouttests. The value of 'skip' contains
31 information about skipped layouttests where it has 'SKIP' in its entry in 35 information about skipped layouttests where it has 'SKIP' in its entry in
32 the test expectation file. The value of 'nonskip' contains all information 36 the test expectation file. The value of 'nonskip' contains all information
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 rev_str = '' 402 rev_str = ''
399 simple_rev_str = '' 403 simple_rev_str = ''
400 rev = '' 404 rev = ''
401 rev_date = '' 405 rev_date = ''
402 if rev_infos: 406 if rev_infos:
403 # Get latest revision number and date. 407 # Get latest revision number and date.
404 rev = rev_infos[-1][1] 408 rev = rev_infos[-1][1]
405 rev_date = rev_infos[-1][3] 409 rev_date = rev_infos[-1][3]
406 for rev_info in rev_infos: 410 for rev_info in rev_infos:
407 (old_rev, new_rev, author, date, _, target_lines) = rev_info 411 (old_rev, new_rev, author, date, _, target_lines) = rev_info
408 link = urllib.unquote('http://trac.webkit.org/changeset?new=%d%40trunk' 412
409 '%2FLayoutTests%2Fplatform%2Fchromium%2F' 413 # test_expectations.txt was renamed to TestExpectations at r119317.
410 'test_expectations.txt&old=%d%40trunk%2F' 414 new_path = DEFAULT_TEST_EXPECTATION_PATH
411 'LayoutTests%2Fplatform%2Fchromium%2F' 415 if new_rev < 119317:
412 'test_expectations.txt') % (new_rev, old_rev) 416 new_path = LEGACY_DEFAULT_TEST_EXPECTATION_PATH
417 old_path = DEFAULT_TEST_EXPECTATION_PATH
418 if old_rev < 119317:
419 old_path = LEGACY_DEFAULT_TEST_EXPECTATION_PATH
420
421 link = 'http://trac.webkit.org/changeset?new=%d@%s&old=%d@%s' % (new_rev,
422 new_path, old_rev, old_path)
413 rev_str += '<ul><a href="%s">%s->%s</a>\n' % (link, old_rev, new_rev) 423 rev_str += '<ul><a href="%s">%s->%s</a>\n' % (link, old_rev, new_rev)
414 simple_rev_str = '<a href="%s">%s->%s</a>,' % (link, old_rev, new_rev) 424 simple_rev_str = '<a href="%s">%s->%s</a>,' % (link, old_rev, new_rev)
415 rev_str += '<li>%s</li>\n' % author 425 rev_str += '<li>%s</li>\n' % author
416 rev_str += '<li>%s</li>\n<ul>' % date 426 rev_str += '<li>%s</li>\n<ul>' % date
417 for line in target_lines: 427 for line in target_lines:
418 # Find *.html pattern (test name) and replace it with the link to 428 # Find *.html pattern (test name) and replace it with the link to
419 # flakiness dashboard. 429 # flakiness dashboard.
420 test_name_pattern = r'(\S+.html)' 430 test_name_pattern = r'(\S+.html)'
421 match = re.search(test_name_pattern, line) 431 match = re.search(test_name_pattern, line)
422 if match: 432 if match:
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 list2 = map2[name]['te_info'] 590 list2 = map2[name]['te_info']
581 te_diff = [item for item in list1 if not item in list2] 591 te_diff = [item for item in list1 if not item in list2]
582 if te_diff: 592 if te_diff:
583 name_list.append((name, te_diff)) 593 name_list.append((name, te_diff))
584 else: 594 else:
585 name_list.append((name, value1)) 595 name_list.append((name, value1))
586 return name_list 596 return name_list
587 597
588 return (GetDiffBetweenMapsHelper(map1, map2, lookIntoTestExpectationInfo), 598 return (GetDiffBetweenMapsHelper(map1, map2, lookIntoTestExpectationInfo),
589 GetDiffBetweenMapsHelper(map2, map1, lookIntoTestExpectationInfo)) 599 GetDiffBetweenMapsHelper(map2, map1, lookIntoTestExpectationInfo))
OLDNEW
« no previous file with comments | « no previous file | media/tools/layout_tests/layouttest_analyzer_helpers_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698