< prev index next >

test/hotspot/jtreg/runtime/cds/serviceability/ReplaceCriticalClasses.java

Print this page

 40 import jdk.test.lib.helpers.ClassFileInstaller;
 41 import jdk.test.whitebox.WhiteBox;
 42 
 43 public class ReplaceCriticalClasses {
 44     public static void main(String args[]) throws Throwable {
 45         ReplaceCriticalClasses rcc = new ReplaceCriticalClasses();
 46         rcc.process(args);
 47     }
 48 
 49     public void process(String args[]) throws Throwable {
 50         if (args.length == 0) {
 51             // Add an extra class to provoke JDK-8262376. This will be ignored if this class doesn't exist
 52             // in the JDK that's being tested (e.g., if the "jdk.localedata" module is somehow missing).
 53             String extraClasses[] = {"sun/util/resources/cldr/provider/CLDRLocaleDataMetaInfo"};
 54 
 55             // Dump the shared archive in case it was not generated during the JDK build.
 56             // Put the archive at separate file to avoid clashes with concurrent tests.
 57             CDSOptions opts = new CDSOptions()
 58                 .setClassList(extraClasses)
 59                 .setArchiveName(ReplaceCriticalClasses.class.getName() + ".jsa");

 60             CDSTestUtils.createArchiveAndCheck(opts);
 61 
 62             launchChildProcesses(getTests());
 63         } else if (args.length == 3 && args[0].equals("child")) {
 64             Class klass = Class.forName(args[2].replace("/", "."));
 65             if (args[1].equals("-shared")) {
 66                 testInChild(true, klass);
 67             } else if (args[1].equals("-notshared")) {
 68                 testInChild(false, klass);
 69             } else {
 70                 throw new RuntimeException("Unknown child exec option " + args[1]);
 71             }
 72             return;
 73         } else {
 74             throw new RuntimeException("Usage: @run main/othervm/native ReplaceCriticalClasses");
 75         }
 76     }
 77 
 78     public String[] getTests() {
 79         String tests[] = {

 40 import jdk.test.lib.helpers.ClassFileInstaller;
 41 import jdk.test.whitebox.WhiteBox;
 42 
 43 public class ReplaceCriticalClasses {
 44     public static void main(String args[]) throws Throwable {
 45         ReplaceCriticalClasses rcc = new ReplaceCriticalClasses();
 46         rcc.process(args);
 47     }
 48 
 49     public void process(String args[]) throws Throwable {
 50         if (args.length == 0) {
 51             // Add an extra class to provoke JDK-8262376. This will be ignored if this class doesn't exist
 52             // in the JDK that's being tested (e.g., if the "jdk.localedata" module is somehow missing).
 53             String extraClasses[] = {"sun/util/resources/cldr/provider/CLDRLocaleDataMetaInfo"};
 54 
 55             // Dump the shared archive in case it was not generated during the JDK build.
 56             // Put the archive at separate file to avoid clashes with concurrent tests.
 57             CDSOptions opts = new CDSOptions()
 58                 .setClassList(extraClasses)
 59                 .setArchiveName(ReplaceCriticalClasses.class.getName() + ".jsa");
 60             opts.addSuffix("-XX:-PreloadSharedClasses");
 61             CDSTestUtils.createArchiveAndCheck(opts);
 62 
 63             launchChildProcesses(getTests());
 64         } else if (args.length == 3 && args[0].equals("child")) {
 65             Class klass = Class.forName(args[2].replace("/", "."));
 66             if (args[1].equals("-shared")) {
 67                 testInChild(true, klass);
 68             } else if (args[1].equals("-notshared")) {
 69                 testInChild(false, klass);
 70             } else {
 71                 throw new RuntimeException("Unknown child exec option " + args[1]);
 72             }
 73             return;
 74         } else {
 75             throw new RuntimeException("Usage: @run main/othervm/native ReplaceCriticalClasses");
 76         }
 77     }
 78 
 79     public String[] getTests() {
 80         String tests[] = {
< prev index next >