47 */
48
49 /*
50 * @test
51 * @key gc
52 * @bug 8114823
53 * @comment Graal does not support CMS
54 * @requires vm.gc=="null" & !vm.graal.enabled
55 * @requires vm.opt.ExplicitGCInvokesConcurrent != true
56 * @requires vm.opt.ClassUnloading != true
57 * @library /test/lib
58 * @modules java.base/jdk.internal.misc
59 * java.management
60 * @build sun.hotspot.WhiteBox
61 * @run driver ClassFileInstaller sun.hotspot.WhiteBox
62 * sun.hotspot.WhiteBox$WhiteBoxPermission
63 * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
64 * -XX:-ClassUnloading -XX:+UseConcMarkSweepGC TestClassUnloadingDisabled
65 */
66
67 import java.io.File;
68 import java.io.IOException;
69 import java.nio.file.Files;
70 import java.nio.file.Path;
71 import java.nio.file.Paths;
72
73 import sun.hotspot.WhiteBox;
74
75 import static jdk.test.lib.Asserts.*;
76
77 public class TestClassUnloadingDisabled {
78 public static void main(String args[]) throws Exception {
79 final WhiteBox wb = WhiteBox.getWhiteBox();
80 // Fetch the dir where the test class and the class
81 // to be loaded resides.
82 String classDir = TestClassUnloadingDisabled.class.getProtectionDomain().getCodeSource().getLocation().getPath();
83 String className = "ClassToLoadUnload";
84
85 assertFalse(wb.isClassAlive(className), "Should not be loaded yet");
86
|
47 */
48
49 /*
50 * @test
51 * @key gc
52 * @bug 8114823
53 * @comment Graal does not support CMS
54 * @requires vm.gc=="null" & !vm.graal.enabled
55 * @requires vm.opt.ExplicitGCInvokesConcurrent != true
56 * @requires vm.opt.ClassUnloading != true
57 * @library /test/lib
58 * @modules java.base/jdk.internal.misc
59 * java.management
60 * @build sun.hotspot.WhiteBox
61 * @run driver ClassFileInstaller sun.hotspot.WhiteBox
62 * sun.hotspot.WhiteBox$WhiteBoxPermission
63 * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
64 * -XX:-ClassUnloading -XX:+UseConcMarkSweepGC TestClassUnloadingDisabled
65 */
66
67 /*
68 * @test TestClassUnloadingDisabledShenandoah
69 * @key gc
70 * @bug 8114823
71 * @comment Graal does not support Shenandoah
72 * @requires vm.gc.Shenandoah & !vm.graal.enabled
73 * @requires vm.opt.ExplicitGCInvokesConcurrent != true
74 * @requires vm.opt.ClassUnloading != true
75 * @library /test/lib
76 * @modules java.base/jdk.internal.misc
77 * java.management
78 * @build sun.hotspot.WhiteBox
79 * @run driver ClassFileInstaller sun.hotspot.WhiteBox
80 * sun.hotspot.WhiteBox$WhiteBoxPermission
81 * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
82 * -XX:-ClassUnloading -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC TestClassUnloadingDisabled
83 */
84
85 import java.io.File;
86 import java.io.IOException;
87 import java.nio.file.Files;
88 import java.nio.file.Path;
89 import java.nio.file.Paths;
90
91 import sun.hotspot.WhiteBox;
92
93 import static jdk.test.lib.Asserts.*;
94
95 public class TestClassUnloadingDisabled {
96 public static void main(String args[]) throws Exception {
97 final WhiteBox wb = WhiteBox.getWhiteBox();
98 // Fetch the dir where the test class and the class
99 // to be loaded resides.
100 String classDir = TestClassUnloadingDisabled.class.getProtectionDomain().getCodeSource().getLocation().getPath();
101 String className = "ClassToLoadUnload";
102
103 assertFalse(wb.isClassAlive(className), "Should not be loaded yet");
104
|