8210725: com/sun/jdi/RedefineClearBreakpoint.java fails with waitForPrompt timed out after 60 seconds
authoramenkov
Fri, 21 Sep 2018 10:18:12 -0700
changeset 51836 d62ebdfd8f18
parent 51835 b177af763b82
child 51837 46ca82c15f6c
8210725: com/sun/jdi/RedefineClearBreakpoint.java fails with waitForPrompt timed out after 60 seconds 8210748: [TESTBUG] lib.jdb.Jdb.waitForPrompt() should clarify which output is the pending reply after a timeout Reviewed-by: jcbeyler, gadams, sspitsyn
test/jdk/com/sun/jdi/lib/jdb/Jdb.java
test/jdk/com/sun/jdi/lib/jdb/JdbTest.java
--- a/test/jdk/com/sun/jdi/lib/jdb/Jdb.java	Fri Sep 21 15:11:09 2018 +0200
+++ b/test/jdk/com/sun/jdi/lib/jdb/Jdb.java	Fri Sep 21 10:18:12 2018 -0700
@@ -73,9 +73,9 @@
 
     private static final String lineSeparator = System.getProperty("line.separator");
     // wait time before check jdb output (in ms)
-    private static long sleepTime = 1000;
+    private static final long sleepTime = 1000;
     // max time to wait for  jdb output (in ms)
-    private static long timeout = 60000;
+    private static final long timeout = Utils.adjustTimeout(60000);
 
     // pattern for message of a breakpoint hit
     public static final String BREAKPOINT_HIT = "Breakpoint hit:";
@@ -215,7 +215,7 @@
             throw new RuntimeException("Attempt to send command '" + cmd.cmd + "' to terminated jdb");
         }
 
-        System.out.println("> " + cmd.cmd);
+        log("> " + cmd.cmd);
 
         inputWriter.println(cmd.cmd);
 
@@ -251,13 +251,13 @@
         command(JdbCommand.quit());
     }
 
-    private void log(String s) {
+    void log(String s) {
         System.out.println(s);
     }
 
     private void logJdb(List<String> reply) {
         jdbOutput.addAll(reply);
-        reply.forEach(s -> System.out.println("[jdb] " + s));
+        reply.forEach(s -> log("[jdb] " + s));
     }
 
     // returns the whole jdb output as a string
--- a/test/jdk/com/sun/jdi/lib/jdb/JdbTest.java	Fri Sep 21 15:11:09 2018 +0200
+++ b/test/jdk/com/sun/jdi/lib/jdb/JdbTest.java	Fri Sep 21 10:18:12 2018 -0700
@@ -94,6 +94,11 @@
         try {
             setup();
             runCases();
+        } catch (Throwable e) {
+            jdb.log("=======================================");
+            jdb.log("Exception thrown during test execution: " + e.getMessage());
+            jdb.log("=======================================");
+            throw e;
         } finally {
             shutdown();
         }