< prev index next >
test/hotspot/jtreg/runtime/SharedArchiveFile/PrintSharedArchiveAndExit.java
Print this page
@@ -33,11 +33,11 @@
import jdk.test.lib.cds.CDSOptions;
import jdk.test.lib.cds.CDSTestUtils;
import jdk.test.lib.process.ProcessTools;
import jdk.test.lib.process.OutputAnalyzer;
-
+import jtreg.SkippedException;
public class PrintSharedArchiveAndExit {
public static void main(String[] args) throws Exception {
String archiveName = "PrintSharedArchiveAndExit.jsa";
CDSOptions opts = (new CDSOptions()).setArchiveName(archiveName);
@@ -47,21 +47,27 @@
// (1) With a valid archive
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
"-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./" + archiveName,
"-XX:+PrintSharedArchiveAndExit", "-version");
out = CDSTestUtils.executeAndLog(pb, "print-shared-archive-and-version");
- if (!CDSTestUtils.isUnableToMap(out)) {
+
+ if (CDSTestUtils.isUnableToMap(out)) {
+ throw new SkippedException(CDSTestUtils.UnableToMapMsg);
+ } else {
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,
"-XX:+PrintSharedArchiveAndExit");
out = CDSTestUtils.executeAndLog(pb, "print-shared-archive");
- if (!CDSTestUtils.isUnableToMap(out)) {
+
+ if (CDSTestUtils.isUnableToMap(out)) {
+ throw new SkippedException(CDSTestUtils.UnableToMapMsg);
+ } else {
out.shouldContain("archive is valid")
.shouldNotContain("Usage:") // Should not print JVM help message
.shouldHaveExitValue(0); // Should report success in error code.
}
}
< prev index next >