summaryrefslogtreecommitdiffstats
path: root/media/tools
diff options
context:
space:
mode:
authorimasaki@google.com <imasaki@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-03 17:28:36 +0000
committerimasaki@google.com <imasaki@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-03 17:28:36 +0000
commit73c0dfe51002c86bf11953fd5f1eb9825911da66 (patch)
tree8e07cf00a752aba15d116fc46d82ac72e8951cd6 /media/tools
parentc09294d9a3ab9e25cda1f6dfa1b17b6092aa3bfe (diff)
downloadchromium_src-73c0dfe51002c86bf11953fd5f1eb9825911da66.zip
chromium_src-73c0dfe51002c86bf11953fd5f1eb9825911da66.tar.gz
chromium_src-73c0dfe51002c86bf11953fd5f1eb9825911da66.tar.bz2
Modification based on user's feedback in the layout test analyzer.
Most of the modifications are cosmetic change. Review URL: http://codereview.chromium.org/8103013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@103732 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/tools')
-rw-r--r--media/tools/layout_tests/layouttest_analyzer.py99
-rw-r--r--media/tools/layout_tests/layouttest_analyzer_helpers.py20
-rw-r--r--media/tools/layout_tests/layouttest_analyzer_helpers_unittest.py15
-rw-r--r--media/tools/layout_tests/layouttest_analyzer_runner.py46
-rw-r--r--media/tools/layout_tests/trend_graph.py5
-rw-r--r--media/tools/layout_tests/trend_graph_unittest.py9
6 files changed, 143 insertions, 51 deletions
diff --git a/media/tools/layout_tests/layouttest_analyzer.py b/media/tools/layout_tests/layouttest_analyzer.py
index 97fa4ee..a407fb0 100644
--- a/media/tools/layout_tests/layouttest_analyzer.py
+++ b/media/tools/layout_tests/layouttest_analyzer.py
@@ -12,7 +12,7 @@ import os
import sys
import time
-from layouttests import LayoutTests
+import layouttests
import layouttest_analyzer_helpers
from test_expectations import TestExpectations
from trend_graph import TrendGraph
@@ -130,9 +130,10 @@ def GetCurrentAndPreviousResults(debug, test_group_file_location,
sys.exit()
filter_names = []
if test_group_file_location and os.path.exists(test_group_file_location):
- filter_names = LayoutTests.GetLayoutTestNamesFromCSV(
+ filter_names = layouttests.LayoutTests.GetLayoutTestNamesFromCSV(
test_group_file_location)
- parent_location_list = LayoutTests.GetParentDirectoryList(filter_names)
+ parent_location_list = (
+ layouttests.LayoutTests.GetParentDirectoryList(filter_names))
recursion = False
else:
# When test group CSV file is not specified, test group name
@@ -150,11 +151,11 @@ def GetCurrentAndPreviousResults(debug, test_group_file_location,
parent_location_list = [test_group_name]
filter_names = None
recursion = True
- layouttests = LayoutTests(parent_location_list=parent_location_list,
- recursion=recursion,
- filter_names=filter_names)
+ layouttests_object = layouttests.LayoutTests(
+ parent_location_list=parent_location_list, recursion=recursion,
+ filter_names=filter_names)
analyzer_result_map = layouttest_analyzer_helpers.AnalyzerResultMap(
- layouttests.JoinWithTestExpectation(TestExpectations()))
+ layouttests_object.JoinWithTestExpectation(TestExpectations()))
result = layouttest_analyzer_helpers.FindLatestResult(
result_directory_location)
if result:
@@ -236,7 +237,11 @@ def SendEmail(prev_time, prev_analyzer_result_map, analyzer_result_map,
layouttest_analyzer_helpers.SendStatusEmail().
simple_rev_str: a simple version of revision string that is sent in
the email.
+ rev: the latest revision number for the given test group.
+ rev_date: the latest revision date for the given test group.
"""
+ rev = ''
+ rev_date = ''
if prev_analyzer_result_map:
diff_map = analyzer_result_map.CompareToOtherResultMap(
prev_analyzer_result_map)
@@ -254,7 +259,7 @@ def SendEmail(prev_time, prev_analyzer_result_map, analyzer_result_map,
cur_time_in_float = time.mktime(cur_time_in_float.timetuple())
else:
cur_time_in_float = time.time()
- (rev_str, simple_rev_str) = (
+ (rev_str, simple_rev_str, rev, rev_date) = (
layouttest_analyzer_helpers.GetRevisionString(prev_time_in_float,
cur_time_in_float,
diff_map))
@@ -273,7 +278,7 @@ def SendEmail(prev_time, prev_analyzer_result_map, analyzer_result_map,
result_change = True
diff_map = None
simple_rev_str = 'undefined'
- return (result_change, diff_map, simple_rev_str)
+ return (result_change, diff_map, simple_rev_str, rev, rev_date)
def UpdateTrendGraph(start_time, analyzer_result_map, diff_map, simple_rev_str,
@@ -296,8 +301,8 @@ def UpdateTrendGraph(start_time, analyzer_result_map, diff_map, simple_rev_str,
Returns:
a dictionary that maps result data category ('whole', 'skip', 'nonskip',
- 'passingrate') to information tuple (the number of the tests,
- annotation, simple_rev_string) of the given result
+ 'passingrate') to information tuple (a dictionary that maps test name
+ to its description, annotation, simple_rev_string) of the given result
data category. These tuples are used for trend graph update.
"""
# Trend graph update (if specified in the command-line argument) when
@@ -318,7 +323,11 @@ def UpdateTrendGraph(start_time, analyzer_result_map, diff_map, simple_rev_str,
passingrate_anno = ''
for test_group in ['whole', 'skip', 'nonskip']:
anno = 'undefined'
- tests = analyzer_result_map.result_map[test_group].keys()
+ # Extract test description.
+ test_map = {}
+ for (test_name, value) in (
+ analyzer_result_map.result_map[test_group].iteritems()):
+ test_map[test_name] = value['desc']
test_str = ''
links = ''
if diff_map and diff_map[test_group]:
@@ -337,9 +346,9 @@ def UpdateTrendGraph(start_time, analyzer_result_map, diff_map, simple_rev_str,
else:
links = 'undefined'
if test_group is 'whole':
- data_map[test_group] = (str(len(tests)), anno, links)
+ data_map[test_group] = (test_map, anno, links)
else:
- data_map[test_group] = (str(len(tests)), anno, simple_rev_str)
+ data_map[test_group] = (test_map, anno, simple_rev_str)
if not passingrate_anno:
passingrate_anno = 'undefined'
data_map['passingrate'] = (
@@ -349,27 +358,60 @@ def UpdateTrendGraph(start_time, analyzer_result_map, diff_map, simple_rev_str,
return data_map
-def UpdateDashboard(dashboard_file_location, test_group_name, data_map):
+def UpdateDashboard(dashboard_file_location, test_group_name, data_map,
+ layouttest_root_path, rev, rev_date):
"""Update dashboard HTML file.
Args:
dashboard_file_location: the file location for the dashboard file.
test_group_name: please refer to |options|.
- data_map: a dictionary that maps result data category
- ('whole', 'skip', 'nonskip', 'passingrate') to information tuple (the
- number of the tests, annotation, simple_rev_string) of the given result
- data category.
+ data_map: a dictionary that maps result data category ('whole', 'skip',
+ 'nonskip', 'passingrate') to information tuple (a dictionary that maps
+ test name to its description, annotation, simple_rev_string) of the
+ given result data category. These tuples are used for trend graph
+ update.
+ layouttest_root_path: A location string where Webkit layout tests are
+ stored.
+ rev: the latest revision number for the given test group.
+ rev_date: the latest revision date for the given test group.
"""
- new_str = ('<td><a href="%s">%s</a><td>%s</td><td>%s</td><td>%s</td>'
- '<td>%s%%</td><tr>\n') % (
+ # Generate a HTML file that contains all test names for each test group.
+ escaped_tg_name = test_group_name.replace('/', '_')
+ for tg in ['whole', 'skip', 'nonskip']:
+ file_name = os.path.join(
+ os.path.dirname(dashboard_file_location),
+ escaped_tg_name + '_' + tg + '.html')
+ file_object = open(file_name, 'wb')
+ file_object.write('<table border="1">')
+ sorted_testnames = data_map[tg][0].keys()
+ sorted_testnames.sort()
+ for testname in sorted_testnames:
+ file_object.write(('<tr><td><a href="%s">%s</a></td>'
+ '<td><a href="%s">dashboard</a></td>'
+ '<td>%s</td></tr>') % (
+ layouttest_root_path + testname, testname,
+ ('http://test-results.appspot.com/dashboards/'
+ 'flakiness_dashboard.html#tests=%s') % testname,
+ data_map[tg][0][testname]))
+ file_object.write('</table>')
+ file_object.close()
+ new_str = ('<td><a href="%s">%s</a></td><td><a href="%s">%s</a></td>'
+ '<td><a href="%s">%s</a></td><td><a href="%s">%s</a></td>'
+ '<td><a href="%s">%s</a></td><td>%d%%</td><td>%s%%</td>'
+ '<td><a href="http://trac.webkit.org/changeset/%s">%s</a></td>'
+ '<td>%s</td>\n') % (
# Dashboard file and graph must be in the same directory
# to make the following link work.
- test_group_name.replace('/', '_') + '.html',
- test_group_name, data_map['whole'][0],
- data_map['skip'][0], data_map['nonskip'][0],
- data_map['passingrate'][0])
+ layouttest_root_path + '/' + test_group_name,
+ test_group_name, escaped_tg_name + '.html',
+ 'graph', escaped_tg_name + '_whole.html',
+ len(data_map['whole'][0]), escaped_tg_name + '_skip.html',
+ len(data_map['skip'][0]), escaped_tg_name + '_nonskip.html',
+ len(data_map['nonskip'][0]),
+ 100 - int(data_map['passingrate'][0]),
+ data_map['passingrate'][0], rev, rev, rev_date)
layouttest_analyzer_helpers.ReplaceLineInFile(
- dashboard_file_location, test_group_name, new_str)
+ dashboard_file_location, '<td>' + test_group_name + '</td>', new_str)
def main():
@@ -385,7 +427,7 @@ def main():
(anno_map, appended_text_to_email) = ReadEmailInformation(
options.bug_annotation_file_location,
options.email_appended_text_file_location)
- (result_change, diff_map, simple_rev_str) = (
+ (result_change, diff_map, simple_rev_str, rev, rev_date) = (
SendEmail(prev_time, prev_analyzer_result_map, analyzer_result_map,
anno_map, appended_text_to_email,
options.email_only_change_mode, options.debug,
@@ -402,7 +444,8 @@ def main():
# Report the result to dashboard.
if options.dashboard_file_location:
UpdateDashboard(options.dashboard_file_location, options.test_group_name,
- data_map)
+ data_map, layouttests.DEFAULT_LAYOUTTEST_LOCATION, rev,
+ rev_date)
if '__main__' == __name__:
diff --git a/media/tools/layout_tests/layouttest_analyzer_helpers.py b/media/tools/layout_tests/layouttest_analyzer_helpers.py
index c1d628c..534a13c 100644
--- a/media/tools/layout_tests/layouttest_analyzer_helpers.py
+++ b/media/tools/layout_tests/layouttest_analyzer_helpers.py
@@ -311,13 +311,16 @@ def GetRevisionString(prev_time, current_time, diff_map):
Please refer to |diff_map| in |SendStatusEmail()|.
Returns:
- a tuple of two strings: one string is a full string that contains links,
- author, date, and line for each change in the test expectation file,
- and the other string contains only links to the change. The latter is
- used for the trend graph annotations.
+ a tuple of strings:
+ 1) full string containing links, author, date, and line for each
+ change in the test expectation file.
+ 2) shorter string containing only links to the change. Used for
+ trend graph annotations.
+ 3) last revision number for the given test group.
+ 4) last revision date for the given test group.
"""
if not diff_map:
- return ('', '')
+ return ('', '', '', '')
testname_map = {}
for test_group in ['skip', 'nonskip']:
for i in range(2):
@@ -328,7 +331,12 @@ def GetRevisionString(prev_time, current_time, diff_map):
testname_map.keys())
rev_str = ''
simple_rev_str = ''
+ rev = ''
+ rev_date = ''
if rev_infos:
+ # Get latest revision number and date.
+ rev = rev_infos[-1][1]
+ rev_date = rev_infos[-1][3]
for rev_info in rev_infos:
(old_rev, new_rev, author, date, _, target_lines) = rev_info
link = urllib.unquote('http://trac.webkit.org/changeset?new=%d%40trunk'
@@ -343,7 +351,7 @@ def GetRevisionString(prev_time, current_time, diff_map):
for line in target_lines:
rev_str += '<li>%s</li>\n' % line
rev_str += '</ul></ul>'
- return (rev_str, simple_rev_str)
+ return (rev_str, simple_rev_str, rev, rev_date)
def SendEmail(sender_email_address, receivers_email_addresses, subject,
diff --git a/media/tools/layout_tests/layouttest_analyzer_helpers_unittest.py b/media/tools/layout_tests/layouttest_analyzer_helpers_unittest.py
index b362228..2c399a1 100644
--- a/media/tools/layout_tests/layouttest_analyzer_helpers_unittest.py
+++ b/media/tools/layout_tests/layouttest_analyzer_helpers_unittest.py
@@ -112,6 +112,7 @@ class TestLayoutTestAnalyzerHelpers(unittest.TestCase):
def RunTestGetRevisionString(self, current_time_str, prev_time_str,
expected_rev_str, expected_simple_rev_str,
+ expected_rev_number, expected_rev_date,
testname, diff_map_none=False):
current_time = datetime.strptime(current_time_str, '%Y-%m-%d-%H')
current_time = time.mktime(current_time.timetuple())
@@ -125,12 +126,13 @@ class TestLayoutTestAnalyzerHelpers(unittest.TestCase):
'skip': [[(testname, 'te_info1')], []],
'nonskip': [[], []],
}
- (rev_str, simple_rev_str) = (
- layouttest_analyzer_helpers.GetRevisionString(prev_time,
- current_time, diff_map))
-
+ (rev_str, simple_rev_str, rev_number, rev_date) = (
+ layouttest_analyzer_helpers.GetRevisionString(prev_time, current_time,
+ diff_map))
self.assertEquals(rev_str, expected_rev_str)
self.assertEquals(simple_rev_str, expected_simple_rev_str)
+ self.assertEquals(rev_number, expected_rev_number)
+ self.assertEquals(rev_date, expected_rev_date)
def testGetRevisionString(self):
expected_rev_str = ('<ul><a href="http://trac.webkit.org/changeset?'
@@ -150,15 +152,16 @@ class TestLayoutTestAnalyzerHelpers(unittest.TestCase):
'test_expectations.txt">94366->94377</a>,')
self.RunTestGetRevisionString('2011-09-02-00', '2011-09-01-00',
expected_rev_str, expected_simple_rev_str,
+ 94377, '2011-09-01 18:00:23',
'fast/dom/dom-constructors.html')
def testGetRevisionStringNoneDiffMap(self):
self.RunTestGetRevisionString('2011-09-02-00', '2011-09-01-00', '', '',
- '', diff_map_none=True)
+ '', '', '', diff_map_none=True)
def testGetRevisionStringNoMatchingTest(self):
self.RunTestGetRevisionString('2011-09-01-00', '2011-09-02-00', '', '',
- 'foo1.html')
+ '', '', 'foo1.html')
def testReplaceLineInFile(self):
file_path = os.path.join('test_data', 'inplace.txt')
diff --git a/media/tools/layout_tests/layouttest_analyzer_runner.py b/media/tools/layout_tests/layouttest_analyzer_runner.py
index dacac1a..6f81fb7 100644
--- a/media/tools/layout_tests/layouttest_analyzer_runner.py
+++ b/media/tools/layout_tests/layouttest_analyzer_runner.py
@@ -81,16 +81,52 @@ def GenerateDashboardHTMLFile(file_name, test_group_list):
test_group_list: a list of test group names such as 'media' or 'composite'.
"""
file_object = open(file_name, 'wb')
+ legend_txt = """
+<style type="text/css">
+th {
+ width: 30px; overflow: hidden;
+}
+tr.d0 td {
+ background-color: #CC9999; color: black;
+ text-align: right;
+ width: 30px; overflow: hidden;
+}
+tr.d1 td {
+ background-color: #9999CC; color: black;
+ text-align: right;
+ width: 30px; overflow: hidden;
+}
+</style>
+<h2>Chromium Layout Test Analyzer Result</h2>
+Legend:
+<ul>
+<li>#Tests: the number of tests for the given test group
+<li>#Skipped Tests: the number of tests that are skipped in the
+<a href='http://svn.webkit.org/repository/webkit/trunk/LayoutTests/platform/\
+chromium/test_expectations.txt'>test expectaion file</a> (e.g., BUGWK60877
+SKIP : loader/navigation-while-deferring-loads.html = FAIL)
+<li>#Non-Skipped Failing Tests: the number of tests that appeared in the
+test expectation file and were not skipped.
+<li>Failing rate: #NonSkippedFailing / (#Tests - #Skipped)
+<li>Passing rate: 100 - (Failing rate)
+</ul>
+ """
+ file_object.write(legend_txt)
file_object.write('<table border="1">')
- file_object.write('<tr><th>test group</th>')
+ file_object.write('<tr><th>Base Directory</th>')
+ file_object.write('<th>Trend Graph</th>')
file_object.write('<th>#Tests</th>')
file_object.write('<th>#Skipped Tests</th>')
file_object.write('<th>#Non-Skipped Failing Tests</th>')
- file_object.write('<th>Passing Rate</td></tr>')
- for test_group in test_group_list:
- file_object.write('<tr>\n')
+ file_object.write('<th>Failing Rate</th>')
+ file_object.write('<th>Passing Rate</th>')
+ file_object.write('<th>Last Revision Number</th>')
+ file_object.write('<th>Last Revision Date</th></tr>\n')
+ test_group_list.sort()
+ for i, test_group in enumerate(test_group_list):
+ file_object.write('<tr class="d' + str(i % 2) + '">\n')
file_object.write('<td>' + test_group + '</td>\n')
- file_object.write('</tr>')
+ file_object.write('</tr>\n')
file_object.write('</table>')
file_object.close()
diff --git a/media/tools/layout_tests/trend_graph.py b/media/tools/layout_tests/trend_graph.py
index 86f857b..cd080fb 100644
--- a/media/tools/layout_tests/trend_graph.py
+++ b/media/tools/layout_tests/trend_graph.py
@@ -56,7 +56,8 @@ class TrendGraph(object):
str_list[1] = str(int(str_list[1])-1) # month
datetime_string = ','.join(str_list)
for key in ['whole', 'skip', 'nonskip']:
- joined_str += ','.join(data_map[key]) + ','
+ joined_str += str(len(data_map[key][0])) + ','
+ joined_str += ','.join(data_map[key][1:]) + ','
new_line_for_numbers = ' [new Date(%s),%s],\n' % (datetime_string,
joined_str)
new_line_for_numbers += ' %s\n' % (
@@ -66,7 +67,7 @@ class TrendGraph(object):
new_line_for_numbers)
joined_str = '%s,%s,%s' % (
- data_map['passingrate'][0], data_map['nonskip'][1],
+ str(data_map['passingrate'][0]), data_map['nonskip'][1],
data_map['nonskip'][2])
new_line_for_passingrate = ' [new Date(%s),%s],\n' % (
datetime_string, joined_str)
diff --git a/media/tools/layout_tests/trend_graph_unittest.py b/media/tools/layout_tests/trend_graph_unittest.py
index 3d35a61..33eaf14 100644
--- a/media/tools/layout_tests/trend_graph_unittest.py
+++ b/media/tools/layout_tests/trend_graph_unittest.py
@@ -18,9 +18,10 @@ class TestTrendGraph(unittest.TestCase):
shutil.copyfile(test_graph_file_backup_path, test_graph_file_path)
trend_graph = TrendGraph(test_graph_file_path)
data_map = {}
- data_map['whole'] = (str(1), 'undefined', 'undefined')
- data_map['skip'] = (str(2), 'undefined', 'undefined')
- data_map['nonskip'] = (str(3), 'undefined', 'undefined')
+ data_map['whole'] = (['test1'], 'undefined', 'undefined')
+ data_map['skip'] = (['test1', 'test2'], 'undefined', 'undefined')
+ data_map['nonskip'] = (['test1', 'test2', 'test3'], 'undefined',
+ 'undefined')
data_map['passingrate'] = (str(4), 'undefined', 'undefined')
trend_graph.Update('2008,1,1,13,45,00', data_map)
@@ -30,6 +31,6 @@ class TestTrendGraph(unittest.TestCase):
f.close()
lineCount = 0
for line in lines2:
- if '2008,1,1,13,45,00' in line:
+ if '2008,0,1,13,45,00' in line:
lineCount += 1
self.assertEqual(lineCount, 2)