Diff
Modified: trunk/Tools/ChangeLog (90541 => 90542)
--- trunk/Tools/ChangeLog 2011-07-07 05:36:13 UTC (rev 90541)
+++ trunk/Tools/ChangeLog 2011-07-07 06:19:21 UTC (rev 90542)
@@ -1,5 +1,20 @@
2011-07-06 Adam Barth <[email protected]>
+ Wean rebaseline-server off unexpected_results.json
+ https://bugs.webkit.org/show_bug.cgi?id=64063
+
+ Reviewed by Eric Seidel.
+
+ In the process of changing this code to use full_results.json, I
+ noticed that the code was broken (because it wasn't tested). This
+ patch also adds test coverage for the broken code.
+
+ * Scripts/webkitpy/tool/commands/rebaselineserver.py:
+ * Scripts/webkitpy/tool/servers/rebaselineserver.py:
+ * Scripts/webkitpy/tool/servers/rebaselineserver_unittest.py:
+
+2011-07-06 Adam Barth <[email protected]>
+
Wean resultsjsonparser off unexpected_results.json
https://bugs.webkit.org/show_bug.cgi?id=64061
Modified: trunk/Tools/Scripts/webkitpy/tool/commands/rebaselineserver.py (90541 => 90542)
--- trunk/Tools/Scripts/webkitpy/tool/commands/rebaselineserver.py 2011-07-07 05:36:13 UTC (rev 90541)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/rebaselineserver.py 2011-07-07 06:19:21 UTC (rev 90542)
@@ -34,11 +34,11 @@
import os.path
from webkitpy.common import system
-from webkitpy.common.net import resultsjsonparser
+from webkitpy.common.net.resultsjsonparser import for_each_test, JSONTestResult
from webkitpy.layout_tests.layout_package import json_results_generator
from webkitpy.layout_tests.port import factory
from webkitpy.tool.commands.abstractlocalservercommand import AbstractLocalServerCommand
-from webkitpy.tool.servers.rebaselineserver import RebaselineHTTPServer, STATE_NEEDS_REBASELINE
+from webkitpy.tool.servers.rebaselineserver import get_test_baselines, RebaselineHTTPServer, STATE_NEEDS_REBASELINE
class TestConfig(object):
@@ -58,36 +58,42 @@
server = RebaselineHTTPServer
+ def _gather_baselines(self, results_json):
+ # Rebaseline server and it's associated _javascript_ expected the tests subtree to
+ # be key-value pairs instead of hierarchical.
+ # FIXME: make the rebaseline server use the hierarchical tree.
+ new_tests_subtree = {}
+
+ def gather_baselines_for_test(test_name, result_dict):
+ result = JSONTestResult(test_name, result_dict)
+ if result.did_pass_or_run_as_expected():
+ return
+ result_dict['state'] = STATE_NEEDS_REBASELINE
+ result_dict['baselines'] = get_test_baselines(test_name, self._test_config)
+ new_tests_subtree[test_name] = result_dict
+
+ for_each_test(results_json['tests'], gather_baselines_for_test)
+ results_json['tests'] = new_tests_subtree
+
def _prepare_config(self, options, args, tool):
results_directory = args[0]
filesystem = system.filesystem.FileSystem()
scm = self._tool.scm()
print 'Parsing unexpected_results.json...'
- results_json_path = filesystem.join(results_directory, 'unexpected_results.json')
+ results_json_path = filesystem.join(results_directory, 'full_results.json')
results_json = json_results_generator.load_json(filesystem, results_json_path)
port = factory.get()
layout_tests_directory = port.layout_tests_dir()
platforms = filesystem.listdir(filesystem.join(layout_tests_directory, 'platform'))
- test_config = TestConfig(port, layout_tests_directory, results_directory, platforms, filesystem, scm)
+ self._test_config = TestConfig(port, layout_tests_directory, results_directory, platforms, filesystem, scm)
print 'Gathering current baselines...'
- # Rebaseline server and it's associated _javascript_ expected the tests subtree to
- # be key-value pairs instead of hierarchical.
- # FIXME: make the rebaseline server use the hierarchical tree.
- new_tests_subtree = {}
+ self._gather_baselines(results_json)
- def gather_baselines(test, result):
- result['state'] = STATE_NEEDS_REBASELINE
- result['baselines'] = _get_test_baselines(test, test_config)
- new_tests_subtree[test] = result
-
- resultsjsonparser.for_each_test(results_json['tests'], gather_baselines)
- results_json['tests'] = new_tests_subtree
-
return {
- 'test_config': test_config,
+ 'test_config': self._test_config,
"results_json": results_json,
"platforms_json": {
'platforms': platforms,
Modified: trunk/Tools/Scripts/webkitpy/tool/servers/rebaselineserver.py (90541 => 90542)
--- trunk/Tools/Scripts/webkitpy/tool/servers/rebaselineserver.py 2011-07-07 05:36:13 UTC (rev 90541)
+++ trunk/Tools/Scripts/webkitpy/tool/servers/rebaselineserver.py 2011-07-07 06:19:21 UTC (rev 90542)
@@ -72,7 +72,7 @@
test_config.results_directory, test_directory)
# If requested, move current baselines out
- current_baselines = _get_test_baselines(test_file, test_config)
+ current_baselines = get_test_baselines(test_file, test_config)
if baseline_target in current_baselines and baseline_move_to != 'none':
log(' Moving current %s baselines to %s' %
(baseline_target, baseline_move_to))
@@ -160,7 +160,7 @@
return True
-def _get_test_baselines(test_file, test_config):
+def get_test_baselines(test_file, test_config):
# FIXME: This seems like a hack. This only seems used to access the Port.expected_baselines logic.
class AllPlatformsPort(WebKitPort):
def __init__(self):
Modified: trunk/Tools/Scripts/webkitpy/tool/servers/rebaselineserver_unittest.py (90541 => 90542)
--- trunk/Tools/Scripts/webkitpy/tool/servers/rebaselineserver_unittest.py 2011-07-07 05:36:13 UTC (rev 90541)
+++ trunk/Tools/Scripts/webkitpy/tool/servers/rebaselineserver_unittest.py 2011-07-07 06:19:21 UTC (rev 90542)
@@ -28,9 +28,12 @@
import unittest
+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
-from webkitpy.tool.commands.rebaselineserver import TestConfig
+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
@@ -202,6 +205,15 @@
' Updated image-expected.png',
])
+ def test_gather_baselines(self):
+ example_json = resultsjsonparser_unittest.ResultsJSONParserTest._example_unexpected_results_json
+ results_json = simplejson.loads(strip_json_wrapper(example_json))
+ server = RebaselineServer()
+ server._test_config = get_test_config()
+ server._gather_baselines(results_json)
+ self.assertEqual(results_json['tests']['svg/dynamic-updates/SVGFEDropShadowElement-dom-stdDeviation-attr.html']['state'], 'needs_rebaseline')
+ self.assertFalse('prototype-chocolate.html' in results_json['tests'])
+
def _assertRebaseline(self, test_files, results_files, test_name, baseline_target, baseline_move_to, expected_success, expected_log):
log = []
test_config = get_test_config(test_files, results_files)
@@ -274,7 +286,7 @@
expected_baselines={'base': {'.txt': True}})
def _assertBaselines(self, test_files, test_name, expected_baselines):
- actual_baselines = rebaselineserver._get_test_baselines(test_name, get_test_config(test_files))
+ actual_baselines = rebaselineserver.get_test_baselines(test_name, get_test_config(test_files))
self.assertEqual(expected_baselines, actual_baselines)