< prev index next >

test/jdk/tools/jlink/plugins/CDSPluginTest.java

Print this page

 9  * This code is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12  * version 2 for more details (a copy is included in the LICENSE file that
13  * accompanied this code).
14  *
15  * You should have received a copy of the GNU General Public License version
16  * 2 along with this work; if not, write to the Free Software Foundation,
17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18  *
19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20  * or visit www.oracle.com if you need additional information or have any
21  * questions.
22  */
23 
24 import java.io.File;
25 
26 import jdk.test.lib.JDKToolFinder;
27 import jdk.test.lib.Platform;
28 import jdk.test.lib.process.*;

29 
30 import tests.Helper;
31 
32 import jtreg.SkippedException;
33 
34 /* @test
35  * @bug 8264322
36  * @summary Test the --generate-cds-archive plugin
37  * @requires vm.cds
38  * @library ../../lib
39  * @library /test/lib
40  * @modules java.base/jdk.internal.jimage
41  *          jdk.jdeps/com.sun.tools.classfile
42  *          jdk.jlink/jdk.tools.jlink.internal
43  *          jdk.jlink/jdk.tools.jmod
44  *          jdk.jlink/jdk.tools.jimage
45  *          jdk.compiler
46  * @build tests.*
47  * @run main CDSPluginTest


48  */
49 
50 public class CDSPluginTest {
51 
52     public static void main(String[] args) throws Throwable {
53 
54         if (!Platform.isDefaultCDSArchiveSupported())
55             throw new SkippedException("not a supported platform");
56 
57         Helper helper = Helper.newHelper();
58         if (helper == null) {
59             System.err.println("Test not run");
60             return;
61         }
62 
63         var module = "cds";
64         helper.generateDefaultJModule(module);
65         var image = helper.generateDefaultImage(new String[] { "--generate-cds-archive" },
66                                                 module)
67             .assertSuccess();
68 
69         String subDir;
70         String sep = File.separator;
71         if (Platform.isWindows()) {
72             subDir = "bin" + sep;
73         } else {
74             subDir = "lib" + sep;
75         }
76         subDir += "server" + sep;
77 





78         if (Platform.isAArch64() || Platform.isX64()) {
79             helper.checkImage(image, module, null, null,
80                       new String[] { subDir + "classes.jsa", subDir + "classes_nocoops.jsa" });
81         } else {
82             helper.checkImage(image, module, null, null,
83                       new String[] { subDir + "classes.jsa" });
84         }
85     }
86 }

 9  * This code is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12  * version 2 for more details (a copy is included in the LICENSE file that
13  * accompanied this code).
14  *
15  * You should have received a copy of the GNU General Public License version
16  * 2 along with this work; if not, write to the Free Software Foundation,
17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18  *
19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20  * or visit www.oracle.com if you need additional information or have any
21  * questions.
22  */
23 
24 import java.io.File;
25 
26 import jdk.test.lib.JDKToolFinder;
27 import jdk.test.lib.Platform;
28 import jdk.test.lib.process.*;
29 import jdk.test.whitebox.WhiteBox;
30 
31 import tests.Helper;
32 
33 import jtreg.SkippedException;
34 
35 /* @test
36  * @bug 8264322
37  * @summary Test the --generate-cds-archive plugin
38  * @requires vm.cds
39  * @library ../../lib
40  * @library /test/lib
41  * @modules java.base/jdk.internal.jimage
42  *          jdk.jdeps/com.sun.tools.classfile
43  *          jdk.jlink/jdk.tools.jlink.internal
44  *          jdk.jlink/jdk.tools.jmod
45  *          jdk.jlink/jdk.tools.jimage
46  *          jdk.compiler
47  * @build tests.*
48  * @build jdk.test.whitebox.WhiteBox
49  * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
50  * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. CDSPluginTest
51  */
52 
53 public class CDSPluginTest {
54 
55     public static void main(String[] args) throws Throwable {
56 
57         if (!Platform.isDefaultCDSArchiveSupported())
58             throw new SkippedException("not a supported platform");
59 
60         Helper helper = Helper.newHelper();
61         if (helper == null) {
62             System.err.println("Test not run");
63             return;
64         }
65 
66         var module = "cds";
67         helper.generateDefaultJModule(module);
68         var image = helper.generateDefaultImage(new String[] { "--generate-cds-archive" },
69                                                 module)
70             .assertSuccess();
71 
72         String subDir;
73         String sep = File.separator;
74         if (Platform.isWindows()) {
75             subDir = "bin" + sep;
76         } else {
77             subDir = "lib" + sep;
78         }
79         subDir += "server" + sep;
80 
81         boolean COMPACT_HEADERS =
82                 Platform.is64bit() && WhiteBox.getWhiteBox().getBooleanVMFlag("UseCompactObjectHeaders");
83 
84         String suffix = COMPACT_HEADERS ? "_coh.jsa" : ".jsa";
85 
86         if (Platform.isAArch64() || Platform.isX64()) {
87             helper.checkImage(image, module, null, null,
88                       new String[] { subDir + "classes" + suffix, subDir + "classes_nocoops" + suffix });
89         } else {
90             helper.checkImage(image, module, null, null,
91                       new String[] { subDir + "classes" + suffix });
92         }
93     }
94 }
< prev index next >