8225348: serviceability/dcmd/vm/EventsTest.java failed

Reviewed-by: jcbeyler, cjplummer
This commit is contained in:
Thomas Stuefe 2019-06-05 21:14:46 +02:00
parent d45aa9c1a9
commit 19ab931c71

@ -38,27 +38,30 @@ import org.testng.annotations.Test;
*/
public class EventsTest {
static String buildHeaderPattern(String logname) {
return "^" + logname + ".*\\(\\d+ events\\):";
}
public void run_all(CommandExecutor executor) {
OutputAnalyzer output = executor.execute("VM.events");
// This tests for the output to contain the event log *names*. Those are always
// printed even if the corresponding event log is empty (e.g. "Classes redefined (0 events)")
output.shouldContain("Events");
output.shouldContain("Compilation");
output.shouldContain("GC");
output.shouldContain("Deoptimization");
output.shouldContain("Classes unloaded");
// This tests for the output to contain the event log header line (e.g. "Classes unloaded (0 events):").
// Those are always printed even if the corresponding event log is empty.
output.stdoutShouldMatch(buildHeaderPattern("Events"));
output.stdoutShouldMatch(buildHeaderPattern("Compilation"));
output.stdoutShouldMatch(buildHeaderPattern("GC Heap History"));
output.stdoutShouldMatch(buildHeaderPattern("Deoptimization"));
output.stdoutShouldMatch(buildHeaderPattern("Classes unloaded"));
}
public void run_selected(CommandExecutor executor) {
OutputAnalyzer output = executor.execute("VM.events log=deopt");
// This tests for the output to contain the event log *names*. Those are always
// printed even if the corresponding event log is empty (e.g. "Classes redefined (0 events)")
output.shouldContain("Deoptimization");
// We only expect one log to be printed here.
output.stdoutShouldMatch(buildHeaderPattern("Deoptimization"));
output.shouldNotContain("Events");
output.shouldNotContain("Compilation");
output.shouldNotContain("GC");
output.shouldNotContain("Classes unloaded");
output.stdoutShouldNotMatch(buildHeaderPattern("Events"));
output.stdoutShouldNotMatch(buildHeaderPattern("Compilation"));
output.stdoutShouldNotMatch(buildHeaderPattern("GC Heap History"));
output.stdoutShouldNotMatch(buildHeaderPattern("Classes unloaded"));
}
@Test