7153107: com/sun/jdi/InterruptHangTest.java fails in nightlies
authorsla
Tue, 22 Mar 2016 19:29:27 +0100
changeset 37321 d069569242e3
parent 37320 a802ccc88c30
child 37323 e41872ef1390
7153107: com/sun/jdi/InterruptHangTest.java fails in nightlies Summary: Increased timeouts and added timestamped logging Reviewed-by: sspitsyn
jdk/test/com/sun/jdi/InterruptHangTest.java
jdk/test/com/sun/jdi/TestScaffold.java
--- a/jdk/test/com/sun/jdi/InterruptHangTest.java	Tue Mar 22 19:29:25 2016 +0100
+++ b/jdk/test/com/sun/jdi/InterruptHangTest.java	Tue Mar 22 19:29:27 2016 +0100
@@ -153,14 +153,17 @@
         timerThread = new Thread("test timer") {
                 public void run() {
                     int mySteps = 0;
+                    float timeoutFactor = Float.parseFloat(System.getProperty("test.timeout.factor", "1.0"));
+                    long sleepSeconds = (long)(20 * timeoutFactor);
+                    println("Timer watching for steps every " + sleepSeconds + " seconds");
                     while (true) {
                         try {
-                            Thread.sleep(20000);
+                            Thread.sleep(sleepSeconds * 1000);
                             synchronized(sync) {
-                                System.out.println("steps = " + nSteps);
+                                println("steps = " + nSteps);
                                 if (mySteps == nSteps) {
-                                    // no step for 10 secs
-                                    failure("failure: Debuggee appears to be hung");
+                                    // no step for a long time
+                                    failure("failure: Debuggee appears to be hung (no steps for " + sleepSeconds + "s)");
                                     vm().exit(-1);
                                     break;
                                 }
--- a/jdk/test/com/sun/jdi/TestScaffold.java	Tue Mar 22 19:29:25 2016 +0100
+++ b/jdk/test/com/sun/jdi/TestScaffold.java	Tue Mar 22 19:29:27 2016 +0100
@@ -64,6 +64,7 @@
     boolean vmDisconnected = false;
     final String[] args;
     protected boolean testFailed = false;
+    protected long startTime;
 
     static private class ArgInfo {
         String targetVMArgs = "";
@@ -425,6 +426,7 @@
     abstract protected void runTests() throws Exception;
 
     final public void startTests() throws Exception {
+        startTime = System.currentTimeMillis();
         try {
             runTests();
         } finally {
@@ -433,7 +435,8 @@
     }
 
     protected void println(String str) {
-        System.err.println(str);
+        long elapsed = System.currentTimeMillis() - startTime;
+        System.err.println("[" + elapsed + "ms] " + str);
     }
 
     protected void print(String str) {