Skip to content
Permalink
Browse files
8258057: serviceability/attach/RemovingUnixDomainSocketTest.java does…
…n't ignore VM warnings

Reviewed-by: cjplummer, amenkov, dholmes
  • Loading branch information
pchilano committed Dec 17, 2020
1 parent 143998e commit 7b05439dcc5a8c46bbbd7e2c820c020aacd3f08f
Showing with 20 additions and 2 deletions.
  1. +3 −2 test/hotspot/jtreg/serviceability/attach/RemovingUnixDomainSocketTest.java
  2. +17 −0 test/lib/jdk/test/lib/process/OutputAnalyzer.java
@@ -51,7 +51,8 @@ private static void runJCmd(long pid) throws InterruptedException, IOException {
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 @@ private static void runJCmd(long pid) throws InterruptedException, IOException {
"jcmd exitValue = " + out.getExitValue());

out.shouldHaveExitValue(0);
out.stderrShouldBeEmptyIgnoreVMWarnings();
out.stderrShouldBeEmptyIgnoreDeprecatedWarnings();
}

public static void main(String... args) throws Exception {
@@ -40,6 +40,8 @@

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 OutputAnalyzer stderrShouldBeEmptyIgnoreVMWarnings() {
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
*

1 comment on commit 7b05439

@openjdk-notifier

This comment has been minimized.

Copy link

@openjdk-notifier openjdk-notifier bot commented on 7b05439 Dec 17, 2020

Please sign in to comment.