test/runtime/SharedArchiveFile/SASymbolTableTest.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.

@@ -35,10 +35,11 @@
  * @run main SASymbolTableTest
  */
 
 import java.util.Arrays;
 import java.util.List;
+import jdk.test.lib.cds.CDSTestUtils;
 import jdk.test.lib.process.ProcessTools;
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.JDKToolFinder;
 import jdk.test.lib.Platform;
 import jdk.test.lib.apps.LingeredApp;

@@ -53,30 +54,22 @@
  */
 public class SASymbolTableTest {
     static String jsaName = "./SASymbolTableTest.jsa";
     private static LingeredApp theApp = null;
 
+
     public static void main(String[] args) throws Exception {
         if (!Platform.shouldSAAttach()) {
             System.out.println("SA attach not expected to work - test skipped.");
             return;
         }
-        createArchive();
+
+        CDSTestUtils.createArchiveAndCheck();
         run(true);
         run(false);
     }
 
-    private static void createArchive()  throws Exception {
-        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
-            "-XX:+UnlockDiagnosticVMOptions",
-            "-XX:SharedArchiveFile=" + jsaName,
-            "-Xshare:dump");
-
-        OutputAnalyzer output = new OutputAnalyzer(pb.start());
-        output.shouldContain("Loading classes to share");
-        output.shouldHaveExitValue(0);
-    }
 
     private static void run(boolean useArchive) throws Exception {
         String flag = useArchive ? "auto" : "off";
 
         try {