|
52 | 52 | * @run main/othervm/timeout=180 -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. DynamicLoaderConstraintsTest custom
|
53 | 53 | */
|
54 | 54 |
|
| 55 | +/** |
| 56 | + * @test id=custom-cl-zgc |
| 57 | + * @requires vm.cds.custom.loaders |
| 58 | + * @requires vm.gc.Z |
| 59 | + * @summary Test dumptime_table entries are removed with zgc eager class unloading |
| 60 | + * @bug 8274935 |
| 61 | + * @library /test/lib |
| 62 | + * /test/hotspot/jtreg/runtime/cds/appcds |
| 63 | + * /test/hotspot/jtreg/runtime/cds/appcds/test-classes |
| 64 | + * /test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive |
| 65 | + * @modules java.base/jdk.internal.misc |
| 66 | + * jdk.httpserver |
| 67 | + * @build sun.hotspot.WhiteBox |
| 68 | + * @run driver jdk.test.lib.helpers.ClassFileInstaller sun.hotspot.WhiteBox |
| 69 | + * @run main/othervm/timeout=180 -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. DynamicLoaderConstraintsTest custom-zgc |
| 70 | + */ |
| 71 | + |
55 | 72 | import com.sun.net.httpserver.HttpExchange;
|
56 | 73 | import com.sun.net.httpserver.HttpHandler;
|
57 | 74 | import jdk.test.lib.Asserts;
|
@@ -83,9 +100,11 @@ public class DynamicLoaderConstraintsTest extends DynamicArchiveTestBase {
|
83 | 100 | * if false, LoaderConstraintsApp will be loaded by the built-in AppClassLoader.
|
84 | 101 | */
|
85 | 102 | static boolean useCustomLoader;
|
| 103 | + static boolean useZGC; |
86 | 104 |
|
87 | 105 | public static void main(String[] args) throws Exception {
|
88 | 106 | useCustomLoader = (args.length != 0);
|
| 107 | + useZGC = (args.length != 0 && args[0].equals("custom-zgc")); |
89 | 108 | runTest(DynamicLoaderConstraintsTest::doTest);
|
90 | 109 | }
|
91 | 110 |
|
@@ -124,8 +143,15 @@ static void doTest(boolean errorInDump) throws Exception {
|
124 | 143 | };
|
125 | 144 |
|
126 | 145 | if (useCustomLoader) {
|
127 |
| - cmdLine = TestCommon.concat(cmdLine, "-cp", loaderJar, |
128 |
| - loaderMainClass, appJar); |
| 146 | + if (useZGC) { |
| 147 | + // Add options to force eager class unloading. |
| 148 | + cmdLine = TestCommon.concat(cmdLine, "-cp", loaderJar, |
| 149 | + "-XX:+UseZGC", "-XX:ZCollectionInterval=0.01", |
| 150 | + loaderMainClass, appJar); |
| 151 | + } else { |
| 152 | + cmdLine = TestCommon.concat(cmdLine, "-cp", loaderJar, |
| 153 | + loaderMainClass, appJar); |
| 154 | + } |
129 | 155 | } else {
|
130 | 156 | cmdLine = TestCommon.concat(cmdLine, "-cp", appJar);
|
131 | 157 | }
|
|
0 commit comments