changeset 48053:88ec5fca7726

8191914: New SA test timeout on windows Summary: Avoid test hangs in a few SA tests by ensuring that OutputAnalyzer gets created before waitFor() gets called Reviewed-by: dholmes, sballal
author jgeorge
date Fri, 01 Dec 2017 11:40:39 +0530
parents 0e18f6334aec
children 34fe70d22e9c
files test/hotspot/jtreg/ProblemList.txt test/hotspot/jtreg/serviceability/sa/JhsdbThreadInfoTest.java test/hotspot/jtreg/serviceability/sa/TestClhsdbJstackLock.java test/hotspot/jtreg/serviceability/sa/TestJhsdbJstackLock.java test/hotspot/jtreg/serviceability/sa/TestPrintMdo.java
diffstat 5 files changed, 11 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/test/hotspot/jtreg/ProblemList.txt	Thu Nov 30 21:28:12 2017 -0800
+++ b/test/hotspot/jtreg/ProblemList.txt	Fri Dec 01 11:40:39 2017 +0530
@@ -86,7 +86,6 @@
 serviceability/sa/sadebugd/SADebugDTest.java 8163805 generic-all
 serviceability/jvmti/ModuleAwareAgents/ClassFileLoadHook/MAAClassFileLoadHook.java 8173936 generic-all
 serviceability/sa/TestRevPtrsForInvokeDynamic.java 8191270 generic-all
-serviceability/sa/TestJhsdbJstackLock.java 8191914 windows-all
 #############################################################################
 
 # :hotspot_misc
--- a/test/hotspot/jtreg/serviceability/sa/JhsdbThreadInfoTest.java	Thu Nov 30 21:28:12 2017 -0800
+++ b/test/hotspot/jtreg/serviceability/sa/JhsdbThreadInfoTest.java	Fri Dec 01 11:40:39 2017 +0530
@@ -56,10 +56,10 @@
             pb.command(jhsdbLauncher.getCommand());
             Process jhsdb = pb.start();
 
+            OutputAnalyzer out = new OutputAnalyzer(jhsdb);
+
             jhsdb.waitFor();
 
-            OutputAnalyzer out = new OutputAnalyzer(jhsdb);
-
             System.out.println(out.getStdout());
             System.err.println(out.getStderr());
 
--- a/test/hotspot/jtreg/serviceability/sa/TestClhsdbJstackLock.java	Thu Nov 30 21:28:12 2017 -0800
+++ b/test/hotspot/jtreg/serviceability/sa/TestClhsdbJstackLock.java	Fri Dec 01 11:40:39 2017 +0530
@@ -129,22 +129,16 @@
             throw new Error("Problem issuing the jstack command: " + str, ioe);
         }
 
+        OutputAnalyzer output = new OutputAnalyzer(p);
+
         try {
             p.waitFor();
         } catch (InterruptedException ie) {
+            p.destroyForcibly();
             throw new Error("Problem awaiting the child process: " + ie, ie);
         }
 
-        int exitValue = p.exitValue();
-        if (exitValue != 0) {
-            String output;
-            try {
-                output = new OutputAnalyzer(p).getOutput();
-            } catch (IOException ioe) {
-                throw new Error("Can't get failed clhsdb process output: " + ioe, ioe);
-            }
-            throw new AssertionError("clhsdb wasn't run successfully: " + output);
-        }
+        output.shouldHaveExitValue(0);
     }
 
     public static void main (String... args) throws Exception {
--- a/test/hotspot/jtreg/serviceability/sa/TestJhsdbJstackLock.java	Thu Nov 30 21:28:12 2017 -0800
+++ b/test/hotspot/jtreg/serviceability/sa/TestJhsdbJstackLock.java	Fri Dec 01 11:40:39 2017 +0530
@@ -65,10 +65,10 @@
             ProcessBuilder pb = new ProcessBuilder();
             pb.command(launcher.getCommand());
             Process jhsdb = pb.start();
+            OutputAnalyzer out = new OutputAnalyzer(jhsdb);
 
             jhsdb.waitFor();
 
-            OutputAnalyzer out = new OutputAnalyzer(jhsdb);
             System.out.println(out.getStdout());
             System.err.println(out.getStderr());
 
--- a/test/hotspot/jtreg/serviceability/sa/TestPrintMdo.java	Thu Nov 30 21:28:12 2017 -0800
+++ b/test/hotspot/jtreg/serviceability/sa/TestPrintMdo.java	Fri Dec 01 11:40:39 2017 +0530
@@ -132,22 +132,16 @@
             throw new Error("Problem issuing the printmdo command: " + str, ioe);
         }
 
+        OutputAnalyzer output = new OutputAnalyzer(p);
+
         try {
             p.waitFor();
         } catch (InterruptedException ie) {
+            p.destroyForcibly();
             throw new Error("Problem awaiting the child process: " + ie, ie);
         }
 
-        int exitValue = p.exitValue();
-        if (exitValue != 0) {
-            String output;
-            try {
-                output = new OutputAnalyzer(p).getOutput();
-            } catch (IOException ioe) {
-                throw new Error("Can't get failed clhsdb process output: " + ioe, ioe);
-            }
-            throw new AssertionError("clhsdb wasn't run successfully: " + output);
-        }
+        output.shouldHaveExitValue(0);
     }
 
     public static void main (String... args) throws Exception {