1 /*
2 * Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved.
3 * Copyright (c) 2024, Red Hat, Inc. All rights reserved.
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 *
6 * This code is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 only, as
8 * published by the Free Software Foundation.
9 *
10 * This code is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
38 /**
39 * @test id=nocoops_coh
40 * @summary Test Loading of default archives in all configurations (requires --enable-cds-archive-coh)
41 * @requires vm.cds
42 * @requires vm.cds.default.archive.available
43 * @requires vm.cds.write.archived.java.heap
44 * @requires vm.bits == 64
45 * @library /test/lib
46 * @modules java.base/jdk.internal.misc
47 * java.management
48 * @run driver TestDefaultArchiveLoading nocoops_coh
49 */
50
51 /**
52 * @test id=coops_nocoh
53 * @summary Test Loading of default archives in all configurations
54 * @requires vm.cds
55 * @requires vm.cds.default.archive.available
56 * @requires vm.cds.write.archived.java.heap
57 * @requires vm.bits == 64
58 * @requires !vm.gc.Z
59 * @library /test/lib
60 * @modules java.base/jdk.internal.misc
61 * java.management
62 * @run driver TestDefaultArchiveLoading coops_nocoh
63 */
64
65 /**
66 * @test id=coops_coh
67 * @summary Test Loading of default archives in all configurations (requires --enable-cds-archive-coh)
68 * @requires vm.cds
69 * @requires vm.cds.default.archive.available
70 * @requires vm.cds.write.archived.java.heap
71 * @requires vm.bits == 64
72 * @requires !vm.gc.Z
73 * @library /test/lib
74 * @modules java.base/jdk.internal.misc
75 * java.management
76 * @run driver TestDefaultArchiveLoading coops_coh
77 */
78
79 import java.nio.file.Files;
80 import java.nio.file.Path;
81 import java.nio.file.Paths;
82 import jdk.test.lib.Platform;
83 import jdk.test.lib.process.OutputAnalyzer;
84 import jdk.test.lib.process.ProcessTools;
85
86 import jtreg.SkippedException;
87
88 public class TestDefaultArchiveLoading {
89
90 private static String archiveName(String archiveSuffix) {
91 return "classes" + archiveSuffix + ".jsa";
92 }
93
94 private static Path archivePath(String archiveSuffix) {
95 return Paths.get(System.getProperty("java.home"), "lib",
96 "server", archiveName(archiveSuffix));
97 }
98
99 private static boolean isArchiveAvailable(char coops, char coh,
100 String archiveSuffix) throws Exception {
101 Path archive= archivePath(archiveSuffix);
102 return Files.exists(archive);
103 }
104
105 public static void main(String[] args) throws Exception {
106
107 if (args.length != 1) {
108 throw new RuntimeException("Expected argument");
109 }
110
111 String archiveSuffix;
112 char coh, coops;
113
114 switch (args[0]) {
115 case "nocoops_nocoh":
116 coh = coops = '-';
117 archiveSuffix = "_nocoops";
118 if (!isArchiveAvailable(coops, coh, archiveSuffix)) {
119 throw new SkippedException("Skipping test due to " +
120 archivePath(archiveSuffix).toString() + " not available");
121 }
122 break;
123 case "nocoops_coh":
124 coops = '-';
125 coh = '+';
126 archiveSuffix = "_nocoops_coh";
127 if (!isArchiveAvailable(coops, coh, archiveSuffix)) {
128 throw new SkippedException("Skipping test due to " +
129 archivePath(archiveSuffix).toString() + " not available");
130 }
131 break;
132 case "coops_nocoh":
|
1 /*
2 * Copyright (c) 2024, 2026, Oracle and/or its affiliates. All rights reserved.
3 * Copyright (c) 2024, Red Hat, Inc. All rights reserved.
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 *
6 * This code is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 only, as
8 * published by the Free Software Foundation.
9 *
10 * This code is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
38 /**
39 * @test id=nocoops_coh
40 * @summary Test Loading of default archives in all configurations (requires --enable-cds-archive-coh)
41 * @requires vm.cds
42 * @requires vm.cds.default.archive.available
43 * @requires vm.cds.write.archived.java.heap
44 * @requires vm.bits == 64
45 * @library /test/lib
46 * @modules java.base/jdk.internal.misc
47 * java.management
48 * @run driver TestDefaultArchiveLoading nocoops_coh
49 */
50
51 /**
52 * @test id=coops_nocoh
53 * @summary Test Loading of default archives in all configurations
54 * @requires vm.cds
55 * @requires vm.cds.default.archive.available
56 * @requires vm.cds.write.archived.java.heap
57 * @requires vm.bits == 64
58 * @requires vm.gc != "Z"
59 * @library /test/lib
60 * @modules java.base/jdk.internal.misc
61 * java.management
62 * @run driver TestDefaultArchiveLoading coops_nocoh
63 */
64
65 /**
66 * @test id=coops_coh
67 * @summary Test Loading of default archives in all configurations (requires --enable-cds-archive-coh)
68 * @requires vm.cds
69 * @requires vm.cds.default.archive.available
70 * @requires vm.cds.write.archived.java.heap
71 * @requires vm.bits == 64
72 * @requires vm.gc != "Z"
73 * @library /test/lib
74 * @modules java.base/jdk.internal.misc
75 * java.management
76 * @run driver TestDefaultArchiveLoading coops_coh
77 */
78
79 import java.nio.file.Files;
80 import java.nio.file.Path;
81 import java.nio.file.Paths;
82 import jdk.test.lib.Platform;
83 import jdk.test.lib.process.OutputAnalyzer;
84 import jdk.test.lib.process.ProcessTools;
85
86 import jtreg.SkippedException;
87
88 public class TestDefaultArchiveLoading {
89
90 static String archivePreviewSuffix = "";
91
92 private static String archiveName(String archiveSuffix) {
93 return "classes" + archiveSuffix + archivePreviewSuffix + ".jsa";
94 }
95
96 private static Path archivePath(String archiveSuffix) {
97 return Paths.get(System.getProperty("java.home"), "lib",
98 "server", archiveName(archiveSuffix));
99 }
100
101 private static boolean isArchiveAvailable(char coops, char coh,
102 String archiveSuffix) throws Exception {
103 Path archive= archivePath(archiveSuffix);
104 return Files.exists(archive);
105 }
106
107 public static void main(String[] args) throws Exception {
108
109 if (args.length != 1) {
110 throw new RuntimeException("Expected argument");
111 }
112
113 String archiveSuffix;
114 char coh, coops;
115 String preview = System.getProperty("test.java.opts", "");
116 if (preview.contains("--enable-preview")) {
117 archivePreviewSuffix = "_preview";
118 }
119
120 switch (args[0]) {
121 case "nocoops_nocoh":
122 coh = coops = '-';
123 archiveSuffix = "_nocoops";
124 if (!isArchiveAvailable(coops, coh, archiveSuffix)) {
125 throw new SkippedException("Skipping test due to " +
126 archivePath(archiveSuffix).toString() + " not available");
127 }
128 break;
129 case "nocoops_coh":
130 coops = '-';
131 coh = '+';
132 archiveSuffix = "_nocoops_coh";
133 if (!isArchiveAvailable(coops, coh, archiveSuffix)) {
134 throw new SkippedException("Skipping test due to " +
135 archivePath(archiveSuffix).toString() + " not available");
136 }
137 break;
138 case "coops_nocoh":
|