summaryrefslogtreecommitdiffstats
path: root/media/tools/layout_tests
diff options
context:
space:
mode:
authorimasaki@google.com <imasaki@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-09 17:25:24 +0000
committerimasaki@google.com <imasaki@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-09 17:25:24 +0000
commitb514a3adf94b3e91359fcad1060fb7fc4080e194 (patch)
tree1365a09e28456a03fa30f34c9a19b0edba4f966f /media/tools/layout_tests
parent029ed32035887051c85e1649a7ae2fd0daf84b52 (diff)
downloadchromium_src-b514a3adf94b3e91359fcad1060fb7fc4080e194.zip
chromium_src-b514a3adf94b3e91359fcad1060fb7fc4080e194.tar.gz
chromium_src-b514a3adf94b3e91359fcad1060fb7fc4080e194.tar.bz2
Update trend graph only in result change in the layout test analyzer.
The code in SendStatusEmail is refactored as well. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@100422 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/tools/layout_tests')
-rw-r--r--media/tools/layout_tests/layouttest_analyzer.py48
-rw-r--r--media/tools/layout_tests/layouttest_analyzer_helpers.py34
2 files changed, 44 insertions, 38 deletions
diff --git a/media/tools/layout_tests/layouttest_analyzer.py b/media/tools/layout_tests/layouttest_analyzer.py
index 717d452..6f48e54 100644
--- a/media/tools/layout_tests/layouttest_analyzer.py
+++ b/media/tools/layout_tests/layouttest_analyzer.py
@@ -140,34 +140,40 @@ def main():
appended_text_to_email = ''.join(file_object.readlines())
file_object.close()
-
- layouttest_analyzer_helpers.SendStatusEmail(prev_time, analyzer_result_map,
- prev_analyzer_result_map,
- anno_map,
- options.receiver_email_address,
- options.test_group_name,
- appended_text_to_email,
- options.email_only_change_mode)
+ diff_map = analyzer_result_map.CompareToOtherResultMap(
+ prev_analyzer_result_map)
+ result_change = (any(diff_map['whole']) or any(diff_map['skip']) or
+ any(diff_map['nonskip']))
+ # Do not email when |email_only_change_mode| is true and there is no change
+ # in the result compared to the last result.
+ if not options.email_only_change_mode or result_change:
+ layouttest_analyzer_helpers.SendStatusEmail(
+ prev_time, analyzer_result_map, diff_map, anno_map,
+ options.receiver_email_address, options.test_group_name,
+ appended_text_to_email)
if not options.debug:
# Save the current result.
date = start_time.strftime('%Y-%m-%d-%H')
file_path = os.path.join(options.result_directory_location, date)
analyzer_result_map.Save(file_path)
- # Trend graph update (if specified in the command-line argument).
- trend_graph = TrendGraph(options.trend_graph_location)
- datetime_string = start_time.strftime('%Y,%m,%d,%H,%M,%S')
- # TODO(imasaki): add correct title and text instead of 'undefined'.
- data_map = (
- {'whole': (str(len(analyzer_result_map.result_map['whole'].keys())),
- 'undefined', 'undefined'),
- 'skip': (str(len(analyzer_result_map.result_map['skip'].keys())),
- 'undefined', 'undefined'),
- 'nonskip': (str(len(analyzer_result_map.result_map['nonskip'].keys())),
+ if result_change:
+ # Trend graph update (if specified in the command-line argument) when
+ # there is change from the last result.
+ trend_graph = TrendGraph(options.trend_graph_location)
+ datetime_string = start_time.strftime('%Y,%m,%d,%H,%M,%S')
+ # TODO(imasaki): add correct title and text instead of 'undefined'.
+ data_map = (
+ {'whole': (str(len(analyzer_result_map.result_map['whole'].keys())),
'undefined', 'undefined'),
- 'passingrate': (str(analyzer_result_map.GetPassingRate()),
- 'undefined', 'undefined')})
- trend_graph.Update(datetime_string, data_map)
+ 'skip': (str(len(analyzer_result_map.result_map['skip'].keys())),
+ 'undefined', 'undefined'),
+ 'nonskip': (
+ str(len(analyzer_result_map.result_map['nonskip'].keys())),
+ 'undefined', 'undefined'),
+ 'passingrate': (str(analyzer_result_map.GetPassingRate()),
+ 'undefined', 'undefined')})
+ trend_graph.Update(datetime_string, data_map)
if '__main__' == __name__:
diff --git a/media/tools/layout_tests/layouttest_analyzer_helpers.py b/media/tools/layout_tests/layouttest_analyzer_helpers.py
index 15a3f96..b27026f 100644
--- a/media/tools/layout_tests/layouttest_analyzer_helpers.py
+++ b/media/tools/layout_tests/layouttest_analyzer_helpers.py
@@ -262,37 +262,37 @@ class AnalyzerResultMap:
return bug_map
-def SendStatusEmail(prev_time, analyzer_result_map, prev_analyzer_result_map,
+def SendStatusEmail(prev_time, analyzer_result_map, diff_map,
bug_anno_map, receiver_email_address, test_group_name,
- appended_text_to_email, email_only_change_mode):
+ appended_text_to_email):
"""Send status email.
Args:
prev_time: the date string such as '2011-10-09-11'. This format has been
used in this analyzer.
analyzer_result_map: current analyzer result.
- prev_analyzer_result_map: previous analyzer result, which is read from
- a file.
+ diff_map: a map that has 'whole', 'skip' and 'nonskip' as keys.
+ The values of the map are the result of |GetDiffBetweenMaps()|.
+ The element has two lists of test cases. One (with index 0) is for
+ test names that are in the current result but NOT in the previous
+ result. The other (with index 1) is for test names that are in the
+ previous results but NOT in the current result.
+ For example (test expectation information is omitted for
+ simplicity),
+ comp_result_map['whole'][0] = ['foo1.html']
+ comp_result_map['whole'][1] = ['foo2.html']
+ This means that current result has 'foo1.html' but NOT in the
+ previous result. This also means the previous result has 'foo2.html'
+ but it is NOT the current result.
bug_anno_map: bug annotation map where bug name and annotations are
stored.
receiver_email_address: receiver's email address.
test_group_name: string representing the test group name (e.g., 'media').
appended_text_to_email: a text which is appended at the end of the status
email.
- email_only_change_mode: when this is true, the analyzer sends out the
- status email only when there is change in the analyzer result compared
- to the last result. When this is false, it sends the email out every
- time it runs.
"""
- diff_map = analyzer_result_map.CompareToOtherResultMap(
- prev_analyzer_result_map)
- # Do not email when |email_only_change_mode| is true and there is no change
- # in the result compared to the last result.
- if (email_only_change_mode and not any(diff_map['whole']) and
- not any(diff_map['skip']) and not any(diff_map['nonskip'])):
- return
- output_str = analyzer_result_map.ConvertToString(prev_time,
- diff_map, bug_anno_map)
+ output_str = analyzer_result_map.ConvertToString(prev_time, diff_map,
+ bug_anno_map)
# Add diff info about skipped/non-skipped test.
prev_time = datetime.strptime(prev_time, '%Y-%m-%d-%H')
prev_time = time.mktime(prev_time.timetuple())