< prev index next >

test/hotspot/jtreg/runtime/SharedArchiveFile/PrintSharedArchiveAndExit.java

Print this page

        

@@ -34,11 +34,10 @@
 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 {
     public static void main(String[] args) throws Exception {
         String archiveName = "PrintSharedArchiveAndExit.jsa";
         CDSOptions opts = (new CDSOptions()).setArchiveName(archiveName);
         OutputAnalyzer out = CDSTestUtils.createArchive(opts);

@@ -47,22 +46,21 @@
         // (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)) {
+        CDSTestUtils.checkMappingFailure(out);
+
             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)) {
+        CDSTestUtils.checkMappingFailure(out);
             out.shouldContain("archive is valid")
                 .shouldNotContain("Usage:")           // Should not print JVM help message
                 .shouldHaveExitValue(0);               // Should report success in error code.
         }
-    }
 }
< prev index next >