diff --git a/test/hotspot/jtreg/serviceability/attach/RemovingUnixDomainSocketTest.java b/test/hotspot/jtreg/serviceability/attach/RemovingUnixDomainSocketTest.java index 5887d60e93b..e07f91ed193 100644 --- a/test/hotspot/jtreg/serviceability/attach/RemovingUnixDomainSocketTest.java +++ b/test/hotspot/jtreg/serviceability/attach/RemovingUnixDomainSocketTest.java @@ -51,7 +51,8 @@ public class RemovingUnixDomainSocketTest { jcmd.addToolArg(Long.toString(pid)); jcmd.addToolArg("VM.version"); - Process jcmdProc = ProcessTools.startProcess("jcmd", new ProcessBuilder(jcmd.getCommand())); + ProcessBuilder pb = new ProcessBuilder(jcmd.getCommand()); + Process jcmdProc = pb.start(); OutputAnalyzer out = new OutputAnalyzer(jcmdProc); @@ -66,7 +67,7 @@ public class RemovingUnixDomainSocketTest { "jcmd exitValue = " + out.getExitValue()); out.shouldHaveExitValue(0); - out.stderrShouldBeEmptyIgnoreVMWarnings(); + out.stderrShouldBeEmptyIgnoreDeprecatedWarnings(); } public static void main(String... args) throws Exception { diff --git a/test/lib/jdk/test/lib/process/OutputAnalyzer.java b/test/lib/jdk/test/lib/process/OutputAnalyzer.java index a7546252e95..9860eb83b03 100644 --- a/test/lib/jdk/test/lib/process/OutputAnalyzer.java +++ b/test/lib/jdk/test/lib/process/OutputAnalyzer.java @@ -40,6 +40,8 @@ public final class OutputAnalyzer { private static final String jvmwarningmsg = ".* VM warning:.*"; + private static final String deprecatedmsg = ".* VM warning:.* deprecated.*"; + private final OutputBuffer buffer; /** * Create an OutputAnalyzer, a utility class for verifying output and exit @@ -147,6 +149,21 @@ public final class OutputAnalyzer { return this; } + /** + * Verify that the stderr contents of output buffer is empty, + * after filtering out the Hotspot deprecation warning messages + * + * @throws RuntimeException + * If stderr was not empty + */ + public OutputAnalyzer stderrShouldBeEmptyIgnoreDeprecatedWarnings() { + if (!getStderr().replaceAll(deprecatedmsg + "\\R", "").isEmpty()) { + reportDiagnosticSummary(); + throw new RuntimeException("stderr was not empty"); + } + return this; + } + /** * Verify that the stdout contents of output buffer is not empty *