mirror of
https://github.com/openjdk/jdk.git
synced 2026-04-06 21:18:42 +00:00
fix TestVMConfigInHsErrFile
This commit is contained in:
parent
436ca1fd10
commit
c8b5e95e7e
@ -30,7 +30,7 @@
|
||||
* @requires vm.debug
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* java.management
|
||||
* @run driver TestVMConfigInHsErrFile coh-off
|
||||
* @run driver TestVMConfigInHsErrFile false
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -42,75 +42,42 @@
|
||||
* @requires vm.debug
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* java.management
|
||||
* @run driver TestVMConfigInHsErrFile coh-on
|
||||
* @run driver TestVMConfigInHsErrFile true
|
||||
*/
|
||||
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class TestVMConfigInHsErrFile {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
switch (args[0]) {
|
||||
case "coh-on" -> testCompactObjectHeaders();
|
||||
case "coh-off" -> testCompressedClassPointers();
|
||||
test(Boolean.parseBoolean(args[0]));
|
||||
}
|
||||
|
||||
private static void test(boolean coh) throws Exception {
|
||||
final String argument = "-XX:%cUseCompactObjectHeaders".formatted(coh ? '+' : '-');
|
||||
final Pattern[] pattern = new Pattern[] { Pattern.compile("# Java VM: .*compact obj headers.*") };
|
||||
|
||||
ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(
|
||||
"-XX:+UnlockDiagnosticVMOptions",
|
||||
"-XX:+UnlockExperimentalVMOptions",
|
||||
argument,
|
||||
"-Xmx100M",
|
||||
"-XX:-CreateCoredumpOnCrash",
|
||||
"-XX:ErrorHandlerTest=14",
|
||||
"-version");
|
||||
|
||||
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||
output.shouldNotHaveExitValue(0);
|
||||
|
||||
// extract hs-err file
|
||||
File f = HsErrFileUtils.openHsErrFileFromOutput(output);
|
||||
if (coh) {
|
||||
HsErrFileUtils.checkHsErrFileContent(f, pattern, null, true, true);
|
||||
} else {
|
||||
HsErrFileUtils.checkHsErrFileContent(f, null, pattern, true, true);
|
||||
}
|
||||
}
|
||||
|
||||
private static void testCompactObjectHeaders() throws Exception {
|
||||
ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(
|
||||
"-XX:+UnlockDiagnosticVMOptions",
|
||||
"-XX:+UnlockExperimentalVMOptions",
|
||||
"-XX:+UseCompactObjectHeaders",
|
||||
"-Xmx100M",
|
||||
"-XX:-CreateCoredumpOnCrash",
|
||||
"-XX:ErrorHandlerTest=14",
|
||||
"-version");
|
||||
|
||||
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||
output.shouldNotHaveExitValue(0);
|
||||
|
||||
// extract hs-err file
|
||||
File f = HsErrFileUtils.openHsErrFileFromOutput(output);
|
||||
|
||||
Pattern[] expectedPatterns = new Pattern[] {
|
||||
Pattern.compile("# Java VM: .*compact obj headers.*")
|
||||
};
|
||||
Pattern[] notExpectedPatterns = new Pattern[] {
|
||||
Pattern.compile("# Java VM: .*compressed class ptrs.*")
|
||||
};
|
||||
|
||||
HsErrFileUtils.checkHsErrFileContent(f, expectedPatterns, notExpectedPatterns, true, true);
|
||||
|
||||
}
|
||||
|
||||
private static void testCompressedClassPointers() throws Exception {
|
||||
ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(
|
||||
"-XX:+UnlockDiagnosticVMOptions",
|
||||
"-XX:+UnlockExperimentalVMOptions",
|
||||
"-XX:-UseCompactObjectHeaders",
|
||||
"-Xmx100M",
|
||||
"-XX:-CreateCoredumpOnCrash",
|
||||
"-XX:ErrorHandlerTest=14",
|
||||
"-version");
|
||||
|
||||
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||
output.shouldNotHaveExitValue(0);
|
||||
|
||||
// extract hs-err file
|
||||
File f = HsErrFileUtils.openHsErrFileFromOutput(output);
|
||||
|
||||
Pattern[] expectedPatterns = new Pattern[] {
|
||||
Pattern.compile("# Java VM: .*compressed class ptrs.*")
|
||||
};
|
||||
Pattern[] notExpectedPatterns = new Pattern[] {
|
||||
Pattern.compile("# Java VM: .*compact obj headers.*")
|
||||
};
|
||||
|
||||
HsErrFileUtils.checkHsErrFileContent(f, expectedPatterns, notExpectedPatterns, true, true);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user