Commit b5019959 authored by apavlov@chromium.org's avatar apavlov@chromium.org

Garden-o-matic: Fix rebaseline-json results handling

The rebaseline-json results are returned as a JSON object
with |return_code| and optional error |output| fields.

R=eseidel,dglazkov@chromium.org
NOTRY=true

Review URL: https://codereview.chromium.org/183383008

git-svn-id: svn://svn.chromium.org/blink/trunk@168446 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 42a20bda
...@@ -82,7 +82,7 @@ checkout.rebaseline = function(failureInfoList, progressCallback, debugBotsCallb ...@@ -82,7 +82,7 @@ checkout.rebaseline = function(failureInfoList, progressCallback, debugBotsCallb
tests[failureInfo.testName][failureInfo.builderName] = tests[failureInfo.testName][failureInfo.builderName] =
base.uniquifyArray(base.flattenArray(failureInfo.failureTypeList.map(results.failureTypeToExtensionList))); base.uniquifyArray(base.flattenArray(failureInfo.failureTypeList.map(results.failureTypeToExtensionList)));
} }
return net.post('/rebaselineall', JSON.stringify(tests)); net.post('/rebaselineall', JSON.stringify(tests)).then(progressCallback, progressCallback);
}); });
}; };
......
...@@ -53,8 +53,19 @@ function rebaselineWithStatusUpdates(failureInfoList, resultsByTest) ...@@ -53,8 +53,19 @@ function rebaselineWithStatusUpdates(failureInfoList, resultsByTest)
}); });
if (failuresToRebaseline.length) { if (failuresToRebaseline.length) {
checkout.rebaseline(failuresToRebaseline, function() { // FIXME: checkout.rebaseline() accepts only 3 arguments, we pass 5.
statusView.addFinalMessage(id, 'Rebaseline done! Please land with "webkit-patch land-cowhand".'); checkout.rebaseline(failuresToRebaseline, function(response) {
try {
var json = JSON.parse(response);
if (!json.result_code) {
statusView.addFinalMessage(id, 'Rebaseline done! Please commit locally and land with "git cl dcommit".');
} else {
statusView.addMessage(id, 'Rebaseline failed (code=' + json.result_code + ')!');
statusView.addFinalMessage(id, json.output);
}
} catch (e) {
statusView.addFinalMessage(id, 'Invalid response received: "' + response + '"');
}
}, function(failureInfo) { }, function(failureInfo) {
statusView.addMessage(id, failureInfo.testName + ' on ' + ui.displayNameForBuilder(failureInfo.builderName)); statusView.addMessage(id, failureInfo.testName + ' on ' + ui.displayNameForBuilder(failureInfo.builderName));
}, function() { }, function() {
...@@ -88,7 +99,7 @@ function updateExpectationsWithStatusUpdates(failureInfoList) ...@@ -88,7 +99,7 @@ function updateExpectationsWithStatusUpdates(failureInfoList)
statusView.addMessage(id, 'Updating expectations of ' + testName + '...'); statusView.addMessage(id, 'Updating expectations of ' + testName + '...');
checkout.updateExpectations(failureInfoList, function() { checkout.updateExpectations(failureInfoList, function() {
statusView.addFinalMessage(id, 'Expectations update done! Please land with "webkit-patch land-cowhand".'); statusView.addFinalMessage(id, 'Expectations update done! Please commit them locally and land with "git cl dcommit".');
}, function() { }, function() {
statusView.addFinalMessage(id, kCheckoutUnavailableMessage); statusView.addFinalMessage(id, kCheckoutUnavailableMessage);
}); });
......
...@@ -112,13 +112,14 @@ class GardeningHTTPRequestHandler(ReflectionHandler): ...@@ -112,13 +112,14 @@ class GardeningHTTPRequestHandler(ReflectionHandler):
_log.debug("calling %s, input='%s'", command, json_input) _log.debug("calling %s, input='%s'", command, json_input)
return_code, output, error = self._run_webkit_patch(command, json_input) return_code, output, error = self._run_webkit_patch(command, json_input)
print >> sys.stderr, error print >> sys.stderr, error
json_result = {"return_code": return_code}
if return_code: if return_code:
_log.error("rebaseline-json failed: %d, output='%s'" % (return_code, output)) _log.error("rebaseline-json failed: %d, output='%s'" % (return_code, output))
json_result["output"] = output
else: else:
_log.debug("rebaseline-json succeeded") _log.debug("rebaseline-json succeeded")
# FIXME: propagate error and/or log messages back to the UI. self._serve_text(json.dumps(json_result))
self._serve_text('success')
def localresult(self): def localresult(self):
path = self.query['path'][0] path = self.query['path'][0]
......
...@@ -60,7 +60,7 @@ class MockServer(object): ...@@ -60,7 +60,7 @@ class MockServer(object):
# The real GardeningHTTPRequestHandler has a constructor that's too hard to # The real GardeningHTTPRequestHandler has a constructor that's too hard to
# call in a unit test, so we create a subclass that's easier to constrcut. # call in a unit test, so we create a subclass that's easier to construct.
class TestGardeningHTTPRequestHandler(GardeningHTTPRequestHandler): class TestGardeningHTTPRequestHandler(GardeningHTTPRequestHandler):
def __init__(self, server): def __init__(self, server):
self.server = server self.server = server
...@@ -121,7 +121,7 @@ class GardeningServerTest(unittest.TestCase): ...@@ -121,7 +121,7 @@ class GardeningServerTest(unittest.TestCase):
def disabled_test_rebaselineall(self): def disabled_test_rebaselineall(self):
expected_stderr = "MOCK run_command: ['echo', 'rebaseline-json'], cwd=/mock-checkout, input={\"user-scripts/another-test.html\":{\"%s\": [%s]}}\n" expected_stderr = "MOCK run_command: ['echo', 'rebaseline-json'], cwd=/mock-checkout, input={\"user-scripts/another-test.html\":{\"%s\": [%s]}}\n"
expected_stdout = "== Begin Response ==\nsuccess\n== End Response ==\n" expected_stdout = "== Begin Response ==\n{result_code: 0}\n== End Response ==\n"
server = MockServer() server = MockServer()
self.output = ['{"add": [], "delete": []}', ''] self.output = ['{"add": [], "delete": []}', '']
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment