changeset 14134:a1ff2f35dcc6

7153107: com/sun/jdi/InterruptHangTest.java fails in nightlies Summary: Increased timeouts and added timestamped logging Reviewed-by: sspitsyn
author sla
date Tue, 22 Mar 2016 19:29:27 +0100
parents 5a553039e9fc
children 0442990ca8ad
files test/com/sun/jdi/InterruptHangTest.java test/com/sun/jdi/TestScaffold.java
diffstat 2 files changed, 11 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/test/com/sun/jdi/InterruptHangTest.java	Tue Mar 22 19:29:25 2016 +0100
+++ b/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/test/com/sun/jdi/TestScaffold.java	Tue Mar 22 19:29:25 2016 +0100
+++ b/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) {