Adds additional error reporting to GWTTestCase to discover flakiness problems.
Change-Id: I39dfcb5f70ea51292e1d601774052f3d22474775
Review-Link: https://gwt-review.googlesource.com/#/c/2080/
Review by: skybrian@google.com
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@11540 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/src/com/google/gwt/junit/public/junit-standards.html b/user/src/com/google/gwt/junit/public/junit-standards.html
index dd86c95..3a7f301 100644
--- a/user/src/com/google/gwt/junit/public/junit-standards.html
+++ b/user/src/com/google/gwt/junit/public/junit-standards.html
@@ -40,12 +40,12 @@
}
function junitLaunchError(msg) {
- junitError("launch", msg);
+ junitError("/launch", msg);
}
function junitError(type, msg) {
var xmlHttpRequest = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP");
- xmlHttpRequest.open('POST', 'junithost/error/' + type, true);
+ xmlHttpRequest.open('POST', 'junithost/error' + type, true);
xmlHttpRequest.setRequestHeader('Content-Type', 'text/x-gwt-rpc; charset=utf-8');
xmlHttpRequest.send(msg);
if (window.console && window.console.log) {
diff --git a/user/src/com/google/gwt/junit/public/junit.html b/user/src/com/google/gwt/junit/public/junit.html
index c443c99..77e0b75 100644
--- a/user/src/com/google/gwt/junit/public/junit.html
+++ b/user/src/com/google/gwt/junit/public/junit.html
@@ -38,12 +38,12 @@
}
function junitLaunchError(msg) {
- junitError("launch", msg);
+ junitError("/launch", msg);
}
function junitError(type, msg) {
var xmlHttpRequest = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP");
- xmlHttpRequest.open('POST', 'junithost/error/' + type, true);
+ xmlHttpRequest.open('POST', 'junithost/error' + type, true);
xmlHttpRequest.setRequestHeader('Content-Type', 'text/x-gwt-rpc; charset=utf-8');
xmlHttpRequest.send(msg);
if (window.console && window.console.log) {
diff --git a/user/src/com/google/gwt/junit/server/JUnitHostImpl.java b/user/src/com/google/gwt/junit/server/JUnitHostImpl.java
index 5654ca7..4708d35 100644
--- a/user/src/com/google/gwt/junit/server/JUnitHostImpl.java
+++ b/user/src/com/google/gwt/junit/server/JUnitHostImpl.java
@@ -127,7 +127,10 @@
protected void service(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
String requestURI = request.getRequestURI();
- if (requestURI.endsWith("/junithost/error/fatal")) {
+ if (requestURI.endsWith("/junithost/error")) {
+ String msg = RPCServletUtils.readContentAsGwtRpc(request);
+ System.err.println("Warning: " + msg);
+ } else if (requestURI.endsWith("/junithost/error/fatal")) {
String msg = RPCServletUtils.readContentAsGwtRpc(request);
System.err.println("Fatal error: " + msg);
System.exit(1);
diff --git a/user/super/com/google/gwt/junit/translatable/com/google/gwt/junit/client/impl/GWTRunner.java b/user/super/com/google/gwt/junit/translatable/com/google/gwt/junit/client/impl/GWTRunner.java
index c1eb239..9d9dd8a 100644
--- a/user/super/com/google/gwt/junit/translatable/com/google/gwt/junit/client/impl/GWTRunner.java
+++ b/user/super/com/google/gwt/junit/translatable/com/google/gwt/junit/client/impl/GWTRunner.java
@@ -82,6 +82,7 @@
*/
public void onFailure(Throwable caught) {
if (maxRetryCount < 0 || curRetryCount < maxRetryCount) {
+ reportWarning("Retrying syncing back to junit backend. (Exception: " + caught + ")");
// Try the call again
curRetryCount++;
new Timer() {
@@ -91,7 +92,7 @@
}
}.schedule(1000);
} else {
- reportFatalError("Cannot sync back to GWT junit backend: " + caught);
+ reportFatalError("Cannot sync back to junit backend: " + caught);
}
}
@@ -394,6 +395,10 @@
}
private static native void reportFatalError(String errorMsg)/*-{
- $wnd.junitError("fatal", errorMsg);
+ $wnd.junitError("/fatal", errorMsg);
+ }-*/;
+
+ private static native void reportWarning(String errorMsg)/*-{
+ $wnd.junitError("", errorMsg);
}-*/;
}