mirror of
https://github.com/openjdk/jdk.git
synced 2026-03-06 14:10:36 +00:00
8210990: [TESTBUG] Some CDS tests don't respect JVM variant being tested
Use CDSTestUtils.run() instead of CDSTestUtils.executeAndLog(). Reviewed-by: iklam
This commit is contained in:
parent
81721a4b5f
commit
522608c0a7
@ -34,7 +34,6 @@
|
||||
import jdk.test.lib.cds.CDSOptions;
|
||||
import jdk.test.lib.cds.CDSTestUtils;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
|
||||
public class NonBootLoaderClasses {
|
||||
public static void main(String[] args) throws Exception {
|
||||
@ -50,16 +49,16 @@ public class NonBootLoaderClasses {
|
||||
CDSTestUtils.createArchiveAndCheck(opts);
|
||||
|
||||
// Print the shared dictionary and inspect the output
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
|
||||
"-cp", "\"\"",
|
||||
opts = (new CDSOptions())
|
||||
.setUseVersion(false)
|
||||
.addSuffix( "-cp", "\"\"",
|
||||
"-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./" + archiveName,
|
||||
"-XX:+PrintSharedArchiveAndExit", "-XX:+PrintSharedDictionary");
|
||||
OutputAnalyzer out = CDSTestUtils.executeAndLog(pb, "print-shared-archive");
|
||||
CDSTestUtils.checkMappingFailure(out);
|
||||
|
||||
out.shouldContain("archive is valid")
|
||||
.shouldHaveExitValue(0) // Should report success in error code.
|
||||
.shouldContain(PLATFORM_CLASS.replace('/', '.'))
|
||||
.shouldContain(APP_CLASS.replace('/', '.'));
|
||||
CDSTestUtils.run(opts)
|
||||
.assertNormalExit(output -> {
|
||||
output.shouldContain("archive is valid");
|
||||
output.shouldContain(PLATFORM_CLASS.replace('/', '.'));
|
||||
output.shouldContain(APP_CLASS.replace('/', '.'));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -33,7 +33,6 @@
|
||||
|
||||
import jdk.test.lib.cds.CDSOptions;
|
||||
import jdk.test.lib.cds.CDSTestUtils;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
|
||||
public class PrintSharedArchiveAndExit {
|
||||
@ -44,23 +43,24 @@ public class PrintSharedArchiveAndExit {
|
||||
CDSTestUtils.checkDump(out);
|
||||
|
||||
// (1) With a valid archive
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
|
||||
"-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./" + archiveName,
|
||||
opts = (new CDSOptions())
|
||||
.setUseVersion(false)
|
||||
.addSuffix( "-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./" + archiveName,
|
||||
"-XX:+PrintSharedArchiveAndExit", "-version");
|
||||
out = CDSTestUtils.executeAndLog(pb, "print-shared-archive-and-version");
|
||||
CDSTestUtils.checkMappingFailure(out);
|
||||
CDSTestUtils.run(opts)
|
||||
.assertNormalExit(output -> {
|
||||
output.shouldContain("archive is valid");
|
||||
output.shouldNotContain("java version"); // Should not print JVM version
|
||||
});
|
||||
|
||||
out.shouldContain("archive is valid")
|
||||
.shouldNotContain("java version") // Should not print JVM version
|
||||
.shouldHaveExitValue(0); // Should report success in error code.
|
||||
|
||||
pb = ProcessTools.createJavaProcessBuilder(
|
||||
"-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./" + archiveName,
|
||||
opts = (new CDSOptions())
|
||||
.setUseVersion(false)
|
||||
.addSuffix( "-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./" + archiveName,
|
||||
"-XX:+PrintSharedArchiveAndExit");
|
||||
out = CDSTestUtils.executeAndLog(pb, "print-shared-archive");
|
||||
CDSTestUtils.checkMappingFailure(out);
|
||||
out.shouldContain("archive is valid")
|
||||
.shouldNotContain("Usage:") // Should not print JVM help message
|
||||
.shouldHaveExitValue(0); // Should report success in error code.
|
||||
CDSTestUtils.run(opts)
|
||||
.assertNormalExit(output -> {
|
||||
output.shouldContain("archive is valid");
|
||||
output.shouldNotContain("Usage:"); // Should not print JVM help message
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user