mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8145606: [TESTBUG] MonitorInflationTest.java should be rewritten to be more predictable
Logging/MonitorInflationTest.java now forced an object inflation and looks for that object. It no longer tests for object deflation. Reviewed-by: gtriantafill, coleenp, iklam
This commit is contained in:
parent
88f4fdeddc
commit
dbab9fe1f8
1 changed files with 21 additions and 6 deletions
|
@ -26,7 +26,6 @@
|
||||||
* @bug 8133885
|
* @bug 8133885
|
||||||
* @summary monitorinflation=debug should have logging from each of the statements in the code
|
* @summary monitorinflation=debug should have logging from each of the statements in the code
|
||||||
* @library /testlibrary
|
* @library /testlibrary
|
||||||
* @ignore 8145587
|
|
||||||
* @modules java.base/sun.misc
|
* @modules java.base/sun.misc
|
||||||
* java.management
|
* java.management
|
||||||
* @build jdk.test.lib.OutputAnalyzer jdk.test.lib.ProcessTools
|
* @build jdk.test.lib.OutputAnalyzer jdk.test.lib.ProcessTools
|
||||||
|
@ -40,7 +39,8 @@ public class MonitorInflationTest {
|
||||||
static void analyzeOutputOn(ProcessBuilder pb) throws Exception {
|
static void analyzeOutputOn(ProcessBuilder pb) throws Exception {
|
||||||
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||||
output.shouldContain("Inflating object");
|
output.shouldContain("Inflating object");
|
||||||
output.shouldContain("Deflating object ");
|
output.shouldContain("type MonitorInflationTest$Waiter");
|
||||||
|
output.shouldContain("I've been waiting.");
|
||||||
output.shouldHaveExitValue(0);
|
output.shouldHaveExitValue(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,19 +52,34 @@ public class MonitorInflationTest {
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
|
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
|
||||||
"-Xlog:monitorinflation=debug", "-version");
|
"-Xlog:monitorinflation=debug", InnerClass.class.getName());
|
||||||
analyzeOutputOn(pb);
|
analyzeOutputOn(pb);
|
||||||
|
|
||||||
pb = ProcessTools.createJavaProcessBuilder(
|
pb = ProcessTools.createJavaProcessBuilder(
|
||||||
"-XX:+TraceMonitorInflation", "-version");
|
"-XX:+TraceMonitorInflation", InnerClass.class.getName());
|
||||||
analyzeOutputOn(pb);
|
analyzeOutputOn(pb);
|
||||||
|
|
||||||
pb = ProcessTools.createJavaProcessBuilder(
|
pb = ProcessTools.createJavaProcessBuilder(
|
||||||
"-Xlog:monitorinflation=off", "-version");
|
"-Xlog:monitorinflation=off", InnerClass.class.getName());
|
||||||
analyzeOutputOff(pb);
|
analyzeOutputOff(pb);
|
||||||
|
|
||||||
pb = ProcessTools.createJavaProcessBuilder(
|
pb = ProcessTools.createJavaProcessBuilder(
|
||||||
"-XX:-TraceMonitorInflation", "-version");
|
"-XX:-TraceMonitorInflation", InnerClass.class.getName());
|
||||||
analyzeOutputOff(pb);
|
analyzeOutputOff(pb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class Waiter {
|
||||||
|
public static void foo() {
|
||||||
|
System.out.println("I've been waiting.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static class InnerClass {
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
Waiter w = new Waiter();
|
||||||
|
synchronized (w) {
|
||||||
|
w.wait(100);
|
||||||
|
w.foo();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue