8209605: com/sun/jdi/BreakpointWithFullGC.java fails with ZGC
Reviewed-by: sspitsyn, dholmes
--- a/test/jdk/ProblemList.txt Wed Aug 22 08:31:15 2018 -0700
+++ b/test/jdk/ProblemList.txt Wed Aug 22 10:28:34 2018 -0700
@@ -836,8 +836,6 @@
com/sun/jdi/BasicJDWPConnectionTest.java 8195703 generic-all
-com/sun/jdi/BreakpointWithFullGC.java 8209605 generic-all
-
com/sun/jdi/RedefineImplementor.sh 8004127 generic-all
com/sun/jdi/JdbExprTest.sh 8203393 solaris-all
--- a/test/jdk/com/sun/jdi/BreakpointWithFullGC.java Wed Aug 22 08:31:15 2018 -0700
+++ b/test/jdk/com/sun/jdi/BreakpointWithFullGC.java Wed Aug 22 10:28:34 2018 -0700
@@ -72,9 +72,8 @@
}
private static final String DEBUGGEE_CLASS = BreakpointWithFullGCTarg.class.getName();
- // Hijacking the mode parameter to make sure we use a small amount
- // of memory and can see what GC is doing.
- private static final String[] DEBUGGEE_OPTIONS = {"-Xmx32m", "-verbose:gc"};
+ // We don't specify "-Xmx" for debuggee as we have full GCs with any value.
+ private static final String[] DEBUGGEE_OPTIONS = {"-verbose:gc"};
@Override
protected void runCases() {
@@ -99,9 +98,6 @@
// make sure we hit the last breakpoint
.stdoutShouldMatch("System\\..*end of test");
new OutputAnalyzer(jdb.getDebuggeeOutput())
- // make sure we had at least one full GC
- // Prior to JDK9-B95, the pattern was 'Full GC'
- .stdoutShouldContain("Pause Full (System.gc())")
// check for error message due to thread ID change
.stderrShouldNotContain("Exception in thread \"event-handler\" java.lang.NullPointerException");
}
--- a/test/jdk/com/sun/jdi/lib/jdb/Jdb.java Wed Aug 22 08:31:15 2018 -0700
+++ b/test/jdk/com/sun/jdi/lib/jdb/Jdb.java Wed Aug 22 10:28:34 2018 -0700
@@ -104,26 +104,31 @@
}
// launch jdb
- ProcessBuilder pb = new ProcessBuilder(JDKToolFinder.getTestJDKTool("jdb"));
- pb.command().add("-connect");
- pb.command().add("com.sun.jdi.SocketAttach:port=" + debuggeeListen[1]);
- System.out.println("Launching jdb:" + pb.command().stream().collect(Collectors.joining(" ")));
try {
- jdb = pb.start();
- } catch (IOException ex) {
- throw new RuntimeException("failed to launch pdb", ex);
+ ProcessBuilder pb = new ProcessBuilder(JDKToolFinder.getTestJDKTool("jdb"));
+ pb.command().add("-connect");
+ pb.command().add("com.sun.jdi.SocketAttach:port=" + debuggeeListen[1]);
+ System.out.println("Launching jdb:" + pb.command().stream().collect(Collectors.joining(" ")));
+ try {
+ jdb = pb.start();
+ } catch (IOException ex) {
+ throw new RuntimeException("failed to launch pdb", ex);
+ }
+ StreamPumper stdout = new StreamPumper(jdb.getInputStream());
+ StreamPumper stderr = new StreamPumper(jdb.getErrorStream());
+
+ stdout.addPump(new StreamPumper.StreamPump(outputHandler));
+ stderr.addPump(new StreamPumper.StreamPump(outputHandler));
+
+ stdout.process();
+ stderr.process();
+
+ inputWriter = new PrintWriter(jdb.getOutputStream(), true);
+ } catch (Throwable ex) {
+ // terminate debuggee if something went wrong
+ debuggee.destroy();
+ throw ex;
}
- StreamPumper stdout = new StreamPumper(jdb.getInputStream());
- StreamPumper stderr = new StreamPumper(jdb.getErrorStream());
-
- stdout.addPump(new StreamPumper.StreamPump(outputHandler));
- stderr.addPump(new StreamPumper.StreamPump(outputHandler));
-
- stdout.process();
- stderr.process();
-
- inputWriter = new PrintWriter(jdb.getOutputStream(), true);
-
}
private final Process jdb;
@@ -357,7 +362,8 @@
// returned data becomes invalid after {@reset}.
public synchronized List<String> get() {
if (updated()) {
- String[] newLines = outStream.toString().split(lineSeparator);
+ // we don't want to discard empty lines
+ String[] newLines = outStream.toString().split("\\R", -1);
if (!cachedData.isEmpty()) {
// concat the last line if previous data had no EOL
newLines[0] = cachedData.remove(cachedData.size()-1) + newLines[0];
--- a/test/jdk/com/sun/jdi/lib/jdb/JdbTest.java Wed Aug 22 08:31:15 2018 -0700
+++ b/test/jdk/com/sun/jdi/lib/jdb/JdbTest.java Wed Aug 22 10:28:34 2018 -0700
@@ -63,7 +63,9 @@
protected abstract void runCases();
protected void shutdown() {
- jdb.shutdown();
+ if (jdb != null) {
+ jdb.shutdown();
+ }
}
protected static final String lineSeparator = System.getProperty("line.separator");