Diff
Modified: trunk/Tools/ChangeLog (91213 => 91214)
--- trunk/Tools/ChangeLog 2011-07-18 21:59:36 UTC (rev 91213)
+++ trunk/Tools/ChangeLog 2011-07-18 22:27:54 UTC (rev 91214)
@@ -1,3 +1,14 @@
+2011-07-18 Adam Barth <[email protected]>
+
+ simplejson has trouble on chromium-linux
+ https://bugs.webkit.org/show_bug.cgi?id=64757
+
+ Reviewed by Eric Seidel.
+
+ Use the native JSON, if available.
+
+ * Scripts/webkitpy/layout_tests/layout_package/json_results_generator.py:
+
2011-07-18 Ojan Vafai <[email protected]>
update the flakiness dashboard to understand the new platforms/formats in test_expectations
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/layout_package/json_layout_results_generator.py (91213 => 91214)
--- trunk/Tools/Scripts/webkitpy/layout_tests/layout_package/json_layout_results_generator.py 2011-07-18 21:59:36 UTC (rev 91213)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/layout_package/json_layout_results_generator.py 2011-07-18 22:27:54 UTC (rev 91214)
@@ -31,9 +31,7 @@
from webkitpy.layout_tests.layout_package import json_results_generator
from webkitpy.layout_tests.models import test_expectations
from webkitpy.layout_tests.models import test_failures
-import webkitpy.thirdparty.simplejson as simplejson
-
class JSONLayoutResultsGenerator(json_results_generator.JSONResultsGeneratorBase):
"""A JSON results generator for layout tests."""
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/layout_package/json_results_generator.py (91213 => 91214)
--- trunk/Tools/Scripts/webkitpy/layout_tests/layout_package/json_results_generator.py 2011-07-18 21:59:36 UTC (rev 91213)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/layout_package/json_results_generator.py 2011-07-18 22:27:54 UTC (rev 91214)
@@ -35,8 +35,13 @@
import xml.dom.minidom
from webkitpy.layout_tests.layout_package import test_results_uploader
-import webkitpy.thirdparty.simplejson as simplejson
+try:
+ import json
+except ImportError:
+ # python 2.5 compatibility
+ import webkitpy.thirdparty.simplejson as json
+
# A JSON results generator for generic tests.
# FIXME: move this code out of the layout_package directory.
@@ -57,12 +62,12 @@
def load_json(filesystem, file_path):
content = filesystem.read_text_file(file_path)
content = strip_json_wrapper(content)
- return simplejson.loads(content)
+ return json.loads(content)
def write_json(filesystem, json_object, file_path):
# Specify separators in order to get compact encoding.
- json_data = simplejson.dumps(json_object, separators=(',', ':'))
+ json_data = json.dumps(json_object, separators=(',', ':'))
json_string = _JSON_PREFIX + json_data + _JSON_SUFFIX
filesystem.write_text_file(file_path, json_string)
@@ -237,10 +242,10 @@
self._archived_results = None
def generate_json_output(self):
- json = self.get_json()
- if json:
+ json_object = self.get_json()
+ if json_object:
file_path = self._fs.join(self._results_directory, self.INCREMENTAL_RESULTS_FILENAME)
- write_json(self._fs, json, file_path)
+ write_json(self._fs, json_object, file_path)
def generate_times_ms_file(self):
# FIXME: rename to generate_times_ms_file. This needs to be coordinated with
@@ -429,7 +434,7 @@
old_results = strip_json_wrapper(old_results)
try:
- results_json = simplejson.loads(old_results)
+ results_json = json.loads(old_results)
except:
_log.debug("results.json was not valid JSON. Clobbering.")
# The JSON file is not valid JSON. Just clobber the results.
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py (91213 => 91214)
--- trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py 2011-07-18 21:59:36 UTC (rev 91213)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py 2011-07-18 22:27:54 UTC (rev 91214)
@@ -35,7 +35,11 @@
import logging
import re
-import webkitpy.thirdparty.simplejson as simplejson
+try:
+ import json
+except ImportError:
+ # python 2.5 compatibility
+ import webkitpy.thirdparty.simplejson as json
_log = logging.getLogger(__name__)
@@ -126,7 +130,7 @@
self.expectations = expectations
-class ExpectationsJsonEncoder(simplejson.JSONEncoder):
+class ExpectationsJsonEncoder(json.JSONEncoder):
"""JSON encoder that can handle ModifiersAndExpectations objects."""
def default(self, obj):
# A ModifiersAndExpectations object has two fields, each of which
Modified: trunk/Tools/Scripts/webkitpy/tool/servers/rebaselineserver_unittest.py (91213 => 91214)
--- trunk/Tools/Scripts/webkitpy/tool/servers/rebaselineserver_unittest.py 2011-07-18 21:59:36 UTC (rev 91213)
+++ trunk/Tools/Scripts/webkitpy/tool/servers/rebaselineserver_unittest.py 2011-07-18 22:27:54 UTC (rev 91214)
@@ -28,11 +28,16 @@
import unittest
+try:
+ import json
+except ImportError:
+ # python 2.5 compatibility
+ import webkitpy.thirdparty.simplejson as json
+
from webkitpy.common.net import resultsjsonparser_unittest
from webkitpy.common.system import filesystem_mock
from webkitpy.layout_tests.layout_package.json_results_generator import strip_json_wrapper
from webkitpy.layout_tests.port.webkit import WebKitPort
-import webkitpy.thirdparty.simplejson as simplejson
from webkitpy.tool.commands.rebaselineserver import TestConfig, RebaselineServer
from webkitpy.tool.mocktool import MockSCM
from webkitpy.tool.servers import rebaselineserver
@@ -207,7 +212,7 @@
def test_gather_baselines(self):
example_json = resultsjsonparser_unittest.ResultsJSONParserTest._example_full_results_json
- results_json = simplejson.loads(strip_json_wrapper(example_json))
+ results_json = json.loads(strip_json_wrapper(example_json))
server = RebaselineServer()
server._test_config = get_test_config()
server._gather_baselines(results_json)