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

Unified Diff: Tools/Scripts/webkitpy/layout_tests/process_json_data.py

Issue 339623002: Added support for versioning of layout test results of run-webkit-tests runs (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added unittest Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: Tools/Scripts/webkitpy/layout_tests/process_json_data.py
diff --git a/Tools/Scripts/webkitpy/layout_tests/process_json_data.py b/Tools/Scripts/webkitpy/layout_tests/process_json_data.py
new file mode 100644
index 0000000000000000000000000000000000000000..2d634d6b13a39229bb6c4b2ddfd723b56c9d2f98
--- /dev/null
+++ b/Tools/Scripts/webkitpy/layout_tests/process_json_data.py
@@ -0,0 +1,83 @@
+# Copyright (C) 2014 Google Inc. All rights reserved.
Dirk Pranke 2014/07/25 00:42:55 I would leave this as part of generate_results_das
patro 2014/07/25 05:14:34 Done.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+class ProcessJsonData(object):
+
+ def __init__(self, current_result_json_dict, old_failing_results_list, old_full_results_list):
+ self._current_result_json_dict = current_result_json_dict
+ self._old_failing_results_list = old_failing_results_list
+ self._old_full_results_list = old_full_results_list
+ self._final_result = []
+
+ def _get_test_result(self, test_result_data):
+ actual = test_result_data['actual']
+ expected = test_result_data['expected']
+ if actual == 'SKIP':
+ return actual
+ if actual == expected:
+ return 'HASSTDERR' if test_result_data.get('has_stderr') == 'true' else 'PASS'
+ else:
+ return actual
+
+ def _recurse_json_object(self, json_object, key_list):
+ for key in key_list:
+ try:
+ json_object = json_object[key]
+ except KeyError:
+ return 'NOTFOUND'
+ return self._get_test_result(json_object)
+
+ def _process_previous_json_results(self, key_list):
+ row = []
+ length = len(self._old_failing_results_list)
+ for index in range(0, length):
+ result = self._recurse_json_object(self._old_failing_results_list[index]["tests"], key_list)
+ if result == 'NOTFOUND':
+ result = self._recurse_json_object(self._old_full_results_list[index]["tests"], key_list)
+ row.append(result)
+ return row
+
+ def _add_archived_result(self, json_object, result):
+ json_object['archived_results'] = result
+
+ def _process_json_object(self, json_object, keyList):
+ for key, subdict in json_object.iteritems():
+ if type(subdict) == dict:
+ self._process_json_object(subdict, keyList + [key])
+ else:
+ row = [self._get_test_result(json_object)]
+ row += self._process_previous_json_results(keyList)
+ json_object.clear()
+ self._add_archived_result(json_object, row)
+ return
+
+ def generate_archived_result(self):
+ for key in self._current_result_json_dict["tests"]:
+ self._process_json_object(self._current_result_json_dict["tests"][key], [key])
+ return self._current_result_json_dict

Powered by Google App Engine
This is Rietveld 408576698