< prev index next >

test/hotspot/jtreg/runtime/cds/appcds/customLoader/ParallelTestBase.java

Print this page

 38 
 39     public static final int FINGERPRINT_MODE = 1;
 40 
 41     public static void run(String[] args, int loaderType, int mode) throws Exception {
 42         String[] cust_classes = new String[MAX_CLASSES];
 43         String[] cust_list;
 44 
 45         if (mode == FINGERPRINT_MODE) {
 46             cust_list = new String[MAX_CLASSES];
 47         } else {
 48             cust_list = new String[MAX_CLASSES * NUM_THREADS];
 49         }
 50 
 51         for (int i = 0; i<MAX_CLASSES; i++) {
 52             cust_classes[i] = "ParallelClass" + i;
 53         }
 54         String customJarPath = JarBuilder.build("ParallelTestBase", cust_classes);
 55 
 56         for (int i = 0, n=0; i<MAX_CLASSES; i++) {
 57             int super_id = 1;

 58             if (mode == FINGERPRINT_MODE) {
 59                 // fingerprint mode -- no need to use the "loader:" option.
 60                 int id = i + 2;
 61                 cust_list[i] = cust_classes[i] + " id: " + id + " super: " + super_id + " source: " + customJarPath;
 62             } else {
 63                 throw new RuntimeException("Only FINGERPRINT_MODE is supported");
 64             }
 65         }
 66 
 67         String app_list[];
 68         String mainClass;
 69         String appJar;
 70 
 71         if (mode == FINGERPRINT_MODE) {
 72             appJar = JarBuilder.build("parallel_fp",
 73                                       "ParallelLoad",
 74                                       "ParallelLoadThread",
 75                                       "ParallelLoadWatchdog");
 76             app_list = new String[] {
 77                 "java/lang/Object id: 1",

 78                 "ParallelLoad",
 79                 "ParallelLoadThread",
 80                 "ParallelLoadWatchdog"
 81             };
 82             mainClass = "ParallelLoad";
 83         } else {
 84             throw new RuntimeException("Currently only FINGERPRINT_MODE is supported");
 85         }
 86 
 87         OutputAnalyzer output;
 88         TestCommon.testDump(appJar, TestCommon.concat(app_list, cust_list));
 89 
 90         String loaderTypeArg = (loaderType == SINGLE_CUSTOM_LOADER) ? "SINGLE_CUSTOM_LOADER" : "MULTI_CUSTOM_LOADER";
 91         String modeArg = "FINGERPRINT_MODE";
 92 
 93         output = TestCommon.exec(appJar,
 94                                  // command-line arguments ...
 95                                  "--add-opens=java.base/java.security=ALL-UNNAMED",
 96                                  mainClass, loaderTypeArg, modeArg, customJarPath);
 97         TestCommon.checkExec(output);

 38 
 39     public static final int FINGERPRINT_MODE = 1;
 40 
 41     public static void run(String[] args, int loaderType, int mode) throws Exception {
 42         String[] cust_classes = new String[MAX_CLASSES];
 43         String[] cust_list;
 44 
 45         if (mode == FINGERPRINT_MODE) {
 46             cust_list = new String[MAX_CLASSES];
 47         } else {
 48             cust_list = new String[MAX_CLASSES * NUM_THREADS];
 49         }
 50 
 51         for (int i = 0; i<MAX_CLASSES; i++) {
 52             cust_classes[i] = "ParallelClass" + i;
 53         }
 54         String customJarPath = JarBuilder.build("ParallelTestBase", cust_classes);
 55 
 56         for (int i = 0, n=0; i<MAX_CLASSES; i++) {
 57             int super_id = 1;
 58             int identity_object_interf_id = 2;
 59             if (mode == FINGERPRINT_MODE) {
 60                 // fingerprint mode -- no need to use the "loader:" option.
 61                 int id = i + 3;
 62                 cust_list[i] = cust_classes[i] + " id: " + id + " super: " + super_id + " interfaces: " + identity_object_interf_id + " source: " + customJarPath;
 63             } else {
 64                 throw new RuntimeException("Only FINGERPRINT_MODE is supported");
 65             }
 66         }
 67 
 68         String app_list[];
 69         String mainClass;
 70         String appJar;
 71 
 72         if (mode == FINGERPRINT_MODE) {
 73             appJar = JarBuilder.build("parallel_fp",
 74                                       "ParallelLoad",
 75                                       "ParallelLoadThread",
 76                                       "ParallelLoadWatchdog");
 77             app_list = new String[] {
 78                 "java/lang/Object id: 1",
 79                 "java/lang/IdentityObject id: 2",
 80                 "ParallelLoad",
 81                 "ParallelLoadThread",
 82                 "ParallelLoadWatchdog"
 83             };
 84             mainClass = "ParallelLoad";
 85         } else {
 86             throw new RuntimeException("Currently only FINGERPRINT_MODE is supported");
 87         }
 88 
 89         OutputAnalyzer output;
 90         TestCommon.testDump(appJar, TestCommon.concat(app_list, cust_list));
 91 
 92         String loaderTypeArg = (loaderType == SINGLE_CUSTOM_LOADER) ? "SINGLE_CUSTOM_LOADER" : "MULTI_CUSTOM_LOADER";
 93         String modeArg = "FINGERPRINT_MODE";
 94 
 95         output = TestCommon.exec(appJar,
 96                                  // command-line arguments ...
 97                                  "--add-opens=java.base/java.security=ALL-UNNAMED",
 98                                  mainClass, loaderTypeArg, modeArg, customJarPath);
 99         TestCommon.checkExec(output);
< prev index next >