test/runtime/SharedArchiveFile/TestInterpreterMethodEntries.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.

@@ -33,11 +33,12 @@
  */
 
 import java.lang.Math;
 import java.util.zip.CRC32;
 import java.util.zip.CRC32C;
-import jdk.test.lib.process.ProcessTools;
+import jdk.test.lib.cds.CDSOptions;
+import jdk.test.lib.cds.CDSTestUtils;
 import jdk.test.lib.process.OutputAnalyzer;
 
 public class TestInterpreterMethodEntries {
 
     public static void main(String[] args) throws Exception {

@@ -66,31 +67,15 @@
         String dumpCRC32C = "-XX:" + dump + "UseCRC32CIntrinsics";
         String useFMA     = "-XX:" + use  + "UseFMA";
         String useCRC32   = "-XX:" + use  + "UseCRC32Intrinsics";
         String useCRC32C  = "-XX:" + use  + "UseCRC32CIntrinsics";
 
-        // Dump shared archive
-        String filename = "./TestInterpreterMethodEntries" + dump + ".jsa";
-        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
-            "-XX:+UnlockDiagnosticVMOptions",
-            "-XX:SharedArchiveFile=" + filename,
-            "-Xshare:dump",
-            dumpFMA, dumpCRC32, dumpCRC32C);
-        OutputAnalyzer output = new OutputAnalyzer(pb.start());
-        CDSTestUtils.checkDump(output);
-
-        // Use shared archive
-        pb = ProcessTools.createJavaProcessBuilder(
-            "-XX:+UnlockDiagnosticVMOptions",
-            "-XX:SharedArchiveFile=" + filename,
-            "-Xshare:on",
-            useFMA, useCRC32, useCRC32C,
-            "TestInterpreterMethodEntries", "run");
-        output = new OutputAnalyzer(pb.start());
-        if (CDSTestUtils.isUnableToMap(output)) {
-          System.out.println("Unable to map shared archive: test did not complete; assumed PASS");
-          return;
-        }
-        output.shouldHaveExitValue(0);
+        CDSTestUtils.createArchiveAndCheck(dumpFMA, dumpCRC32, dumpCRC32C);
+
+        CDSOptions opts = (new CDSOptions())
+            .addPrefix(useFMA, useCRC32, useCRC32C, "-showversion")
+            .addSuffix("TestInterpreterMethodEntries", "run")
+            .setUseVersion(false);
+        CDSTestUtils.runWithArchiveAndCheck(opts);
     }
 }