# HG changeset patch # User amenkov # Date 1534958914 25200 # Node ID 6b5f3f5fd63c156339b369bd8c4d1e2a497d5e69 # Parent fc80fa0ecac87f112feed3cd62b8834f4d5e0052 8209605: com/sun/jdi/BreakpointWithFullGC.java fails with ZGC Reviewed-by: sspitsyn, dholmes diff -r fc80fa0ecac8 -r 6b5f3f5fd63c test/jdk/ProblemList.txt --- 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 diff -r fc80fa0ecac8 -r 6b5f3f5fd63c test/jdk/com/sun/jdi/BreakpointWithFullGC.java --- 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"); } diff -r fc80fa0ecac8 -r 6b5f3f5fd63c test/jdk/com/sun/jdi/lib/jdb/Jdb.java --- 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 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]; diff -r fc80fa0ecac8 -r 6b5f3f5fd63c test/jdk/com/sun/jdi/lib/jdb/JdbTest.java --- 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");