Changeset 91214 in webkit


Ignore:
Timestamp:
Jul 18, 2011 3:27:54 PM (13 years ago)
Author:
abarth@webkit.org
Message:

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:
Location:
trunk/Tools
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r91212 r91214  
     12011-07-18  Adam Barth  <abarth@webkit.org>
     2
     3        simplejson has trouble on chromium-linux
     4        https://bugs.webkit.org/show_bug.cgi?id=64757
     5
     6        Reviewed by Eric Seidel.
     7
     8        Use the native JSON, if available.
     9
     10        * Scripts/webkitpy/layout_tests/layout_package/json_results_generator.py:
     11
    1122011-07-18  Ojan Vafai  <ojan@chromium.org>
    213
  • trunk/Tools/Scripts/webkitpy/layout_tests/layout_package/json_layout_results_generator.py

    r90789 r91214  
    3232from webkitpy.layout_tests.models import test_expectations
    3333from webkitpy.layout_tests.models import test_failures
    34 import webkitpy.thirdparty.simplejson as simplejson
    35 
    3634
    3735class JSONLayoutResultsGenerator(json_results_generator.JSONResultsGeneratorBase):
  • trunk/Tools/Scripts/webkitpy/layout_tests/layout_package/json_results_generator.py

    r90789 r91214  
    3636
    3737from webkitpy.layout_tests.layout_package import test_results_uploader
    38 import webkitpy.thirdparty.simplejson as simplejson
     38
     39try:
     40    import json
     41except ImportError:
     42    # python 2.5 compatibility
     43    import webkitpy.thirdparty.simplejson as json
    3944
    4045# A JSON results generator for generic tests.
     
    5863    content = filesystem.read_text_file(file_path)
    5964    content = strip_json_wrapper(content)
    60     return simplejson.loads(content)
     65    return json.loads(content)
    6166
    6267
    6368def write_json(filesystem, json_object, file_path):
    6469    # Specify separators in order to get compact encoding.
    65     json_data = simplejson.dumps(json_object, separators=(',', ':'))
     70    json_data = json.dumps(json_object, separators=(',', ':'))
    6671    json_string = _JSON_PREFIX + json_data + _JSON_SUFFIX
    6772    filesystem.write_text_file(file_path, json_string)
     
    238243
    239244    def generate_json_output(self):
    240         json = self.get_json()
    241         if json:
     245        json_object = self.get_json()
     246        if json_object:
    242247            file_path = self._fs.join(self._results_directory, self.INCREMENTAL_RESULTS_FILENAME)
    243             write_json(self._fs, json, file_path)
     248            write_json(self._fs, json_object, file_path)
    244249
    245250    def generate_times_ms_file(self):
     
    430435
    431436            try:
    432                 results_json = simplejson.loads(old_results)
     437                results_json = json.loads(old_results)
    433438            except:
    434439                _log.debug("results.json was not valid JSON. Clobbering.")
  • trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py

    r91166 r91214  
    3636import re
    3737
    38 import webkitpy.thirdparty.simplejson as simplejson
     38try:
     39    import json
     40except ImportError:
     41    # python 2.5 compatibility
     42    import webkitpy.thirdparty.simplejson as json
    3943
    4044
     
    127131
    128132
    129 class ExpectationsJsonEncoder(simplejson.JSONEncoder):
     133class ExpectationsJsonEncoder(json.JSONEncoder):
    130134    """JSON encoder that can handle ModifiersAndExpectations objects."""
    131135    def default(self, obj):
  • trunk/Tools/Scripts/webkitpy/tool/servers/rebaselineserver_unittest.py

    r91210 r91214  
    2929import unittest
    3030
     31try:
     32    import json
     33except ImportError:
     34    # python 2.5 compatibility
     35    import webkitpy.thirdparty.simplejson as json
     36
    3137from webkitpy.common.net import resultsjsonparser_unittest
    3238from webkitpy.common.system import filesystem_mock
    3339from webkitpy.layout_tests.layout_package.json_results_generator import strip_json_wrapper
    3440from webkitpy.layout_tests.port.webkit import WebKitPort
    35 import webkitpy.thirdparty.simplejson as simplejson
    3641from webkitpy.tool.commands.rebaselineserver import TestConfig, RebaselineServer
    3742from webkitpy.tool.mocktool import MockSCM
     
    208213    def test_gather_baselines(self):
    209214        example_json = resultsjsonparser_unittest.ResultsJSONParserTest._example_full_results_json
    210         results_json = simplejson.loads(strip_json_wrapper(example_json))
     215        results_json = json.loads(strip_json_wrapper(example_json))
    211216        server = RebaselineServer()
    212217        server._test_config = get_test_config()
Note: See TracChangeset for help on using the changeset viewer.