test/runtime/SharedArchiveFile/SpaceUtilizationCheck.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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.

@@ -28,11 +28,11 @@
  * @modules java.base/jdk.internal.misc
  *          java.management
  * @run main SpaceUtilizationCheck
  */
 
-import jdk.test.lib.process.ProcessTools;
+import jdk.test.lib.cds.CDSTestUtils;
 import jdk.test.lib.process.OutputAnalyzer;
 
 import java.util.regex.Pattern;
 import java.util.regex.Matcher;
 import java.util.ArrayList;

@@ -47,16 +47,13 @@
     // Only RO and RW regions are considered for this check, since they
     // currently account for the bulk of the shared space
     private static final int NUMBER_OF_CHECKED_SHARED_REGIONS = 2;
 
     public static void main(String[] args) throws Exception {
-        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
-           "-XX:+UnlockDiagnosticVMOptions",
-           "-XX:SharedArchiveFile=./SpaceUtilizationCheck.jsa",
-           "-Xshare:dump");
+        OutputAnalyzer output = CDSTestUtils.createArchive();
+        CDSTestUtils.checkDump(output);
 
-        OutputAnalyzer output = new OutputAnalyzer(pb.start());
         String stdout = output.getStdout();
         ArrayList<String> utilization = findUtilization(stdout);
 
         if (utilization.size() != NUMBER_OF_CHECKED_SHARED_REGIONS )
             throw new RuntimeException("The output format of sharing summary has changed");