8210118: better jdb test diagnostics when getting "Prompt is not received during ... milliseconds" failures
authorcjplummer
Thu, 30 Aug 2018 17:59:40 -0700
changeset 51601 e469480420dc
parent 51600 56309b1b9d9b
child 51602 dbb0e798deeb
8210118: better jdb test diagnostics when getting "Prompt is not received during ... milliseconds" failures Summary: print pending reply when prompt is not recieved Reviewed-by: dholmes, gadams, sspitsyn, jcbeyler
test/hotspot/jtreg/vmTestbase/nsk/share/jdb/Jdb.java
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/jdb/Jdb.java	Thu Aug 30 17:03:46 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jdb/Jdb.java	Thu Aug 30 17:59:40 2018 -0700
@@ -399,8 +399,14 @@
      * @param count number of prompt instances to wait for.
      */
     public String[] receiveReply(int startPos, boolean compoundPromptOnly, int count) {
-
-        int found = waitForPrompt(startPos, compoundPromptOnly, count);
+        nsk.share.Failure e = null;
+        try {
+            waitForPrompt(startPos, compoundPromptOnly, count);
+        } catch (nsk.share.Failure nsf) {
+            e = nsf;
+            launcher.getLog().display("receiveReply FAILED due to \"" + e + "\".");
+            launcher.getLog().display("Pending reply output follows:");
+        }
 
         String reply = stdoutBuffer.substring(startPos, stdoutBuffer.length());
         String[] replyArr = toStringArray(reply);
@@ -410,6 +416,7 @@
             launcher.getLog().display("reply[" + i + "]: " + replyArr[i]);
         }
 
+        if (e != null) throw e;
         return replyArr;
     }
 
@@ -443,7 +450,7 @@
         long max = getLauncher().getJdbArgumentHandler().getWaitTime() * 60 * 1000;  // maximum time to wait.
 
         if (count <= 0) {
-            throw new TestBug("Wrong number of promts count in Jdb.waitForPrompt(): " + count);
+            throw new TestBug("Wrong number of prompts count in Jdb.waitForPrompt(): " + count);
         }
 
         Object dummy = new Object();