test/hotspot/jtreg/runtime/appcds/jigsaw/modulepath/JvmtiAddPath.java
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File open Sdiff test/hotspot/jtreg/runtime/appcds/jigsaw/modulepath

test/hotspot/jtreg/runtime/appcds/jigsaw/modulepath/JvmtiAddPath.java

Print this page




  98         JarBuilder.build("jvmti_app", "JvmtiApp", "ExtraClass");
  99         JarBuilder.build(true, "WhiteBox", "sun/hotspot/WhiteBox");
 100 
 101         // In all the test cases below, appJar does not contain Hello.class. Instead, we
 102         // append JAR file(s) that contain Hello.class to the boot classpath, the app
 103         // classpath, or both, and verify that Hello.class is loaded by the expected ClassLoader.
 104         String appJar = TestCommon.getTestJar("jvmti_app.jar");         // contains JvmtiApp.class
 105         String addappJar = mainJar.toString();  // contains Main.class
 106         String addbootJar = mainJar.toString(); // contains Main.class
 107         String twoAppJars = appJar + File.pathSeparator + addappJar;
 108         String modulePath = "--module-path=" + moduleDir.toString();
 109         String wbJar = TestCommon.getTestJar("WhiteBox.jar");
 110         use_whitebox_jar = "-Xbootclasspath/a:" + wbJar;
 111 
 112         OutputAnalyzer output = TestCommon.createArchive(
 113                                     appJar,
 114                                     TestCommon.list("JvmtiApp", "ExtraClass", MAIN_CLASS),
 115                                     use_whitebox_jar,
 116                                     "-Xlog:class+load=trace",
 117                                     modulePath);
 118         TestCommon.checkExecReturn(output, 0, true, "Loading classes to share");
 119 
 120         System.out.println("Test case 1: not adding module path - Hello.class should not be found");
 121         run(check_appcds_enabled, appJar,
 122             "-Xlog:class+load", "JvmtiApp", "noadd", MAIN_CLASS); // appcds should be enabled
 123 
 124         System.out.println("Test case 2: add to boot classpath only - should find Hello.class in boot loader");
 125         run(check_appcds_disabled, appJar,
 126             "-Xlog:class+load=trace",
 127             modulePath,
 128             "JvmtiApp", "bootonly", addbootJar, MAIN_CLASS); // appcds should be disabled
 129 
 130         System.out.println("Test case 3: add to app classpath only - should find Hello.class in app loader");
 131         run(appJar, modulePath,
 132             "JvmtiApp", "apponly", addappJar, MAIN_CLASS);
 133 
 134         System.out.println("Test case 4: add to boot and app paths - should find Hello.class in boot loader");
 135         run(appJar, modulePath,
 136             "JvmtiApp", "appandboot", addbootJar, addappJar, MAIN_CLASS);
 137 
 138         System.out.println("Test case 5: add to app using -cp, but add to boot using JVMTI - should find Hello.class in boot loader");
 139         run(appJar, modulePath,
 140             "JvmtiApp", "bootonly", addappJar, MAIN_CLASS);
 141 
 142         System.out.println("Test case 6: add to app using AppCDS, but add to boot using JVMTI - should find Hello.class in boot loader");
 143         output = TestCommon.createArchive(
 144                      appJar, TestCommon.list("JvmtiApp", "ExtraClass"),
 145                      use_whitebox_jar,
 146                      "-Xlog:class+load=trace",
 147                      modulePath);
 148         TestCommon.checkExecReturn(output, 0, true, "Loading classes to share");
 149         run(twoAppJars, modulePath,
 150             "JvmtiApp", "bootonly", addappJar, MAIN_CLASS);
 151 
 152         System.out.println("Test case 7: add to app using AppCDS, no JVMTI calls - should find Hello.class in app loader");
 153         run(twoAppJars, modulePath,
 154             "JvmtiApp", "noadd-appcds", MAIN_CLASS);
 155     }
 156 }


  98         JarBuilder.build("jvmti_app", "JvmtiApp", "ExtraClass");
  99         JarBuilder.build(true, "WhiteBox", "sun/hotspot/WhiteBox");
 100 
 101         // In all the test cases below, appJar does not contain Hello.class. Instead, we
 102         // append JAR file(s) that contain Hello.class to the boot classpath, the app
 103         // classpath, or both, and verify that Hello.class is loaded by the expected ClassLoader.
 104         String appJar = TestCommon.getTestJar("jvmti_app.jar");         // contains JvmtiApp.class
 105         String addappJar = mainJar.toString();  // contains Main.class
 106         String addbootJar = mainJar.toString(); // contains Main.class
 107         String twoAppJars = appJar + File.pathSeparator + addappJar;
 108         String modulePath = "--module-path=" + moduleDir.toString();
 109         String wbJar = TestCommon.getTestJar("WhiteBox.jar");
 110         use_whitebox_jar = "-Xbootclasspath/a:" + wbJar;
 111 
 112         OutputAnalyzer output = TestCommon.createArchive(
 113                                     appJar,
 114                                     TestCommon.list("JvmtiApp", "ExtraClass", MAIN_CLASS),
 115                                     use_whitebox_jar,
 116                                     "-Xlog:class+load=trace",
 117                                     modulePath);
 118         TestCommon.checkDump(output);
 119 
 120         System.out.println("Test case 1: not adding module path - Hello.class should not be found");
 121         run(check_appcds_enabled, appJar,
 122             "-Xlog:class+load", "JvmtiApp", "noadd", MAIN_CLASS); // appcds should be enabled
 123 
 124         System.out.println("Test case 2: add to boot classpath only - should find Hello.class in boot loader");
 125         run(check_appcds_disabled, appJar,
 126             "-Xlog:class+load=trace",
 127             modulePath,
 128             "JvmtiApp", "bootonly", addbootJar, MAIN_CLASS); // appcds should be disabled
 129 
 130         System.out.println("Test case 3: add to app classpath only - should find Hello.class in app loader");
 131         run(appJar, modulePath,
 132             "JvmtiApp", "apponly", addappJar, MAIN_CLASS);
 133 
 134         System.out.println("Test case 4: add to boot and app paths - should find Hello.class in boot loader");
 135         run(appJar, modulePath,
 136             "JvmtiApp", "appandboot", addbootJar, addappJar, MAIN_CLASS);
 137 
 138         System.out.println("Test case 5: add to app using -cp, but add to boot using JVMTI - should find Hello.class in boot loader");
 139         run(appJar, modulePath,
 140             "JvmtiApp", "bootonly", addappJar, MAIN_CLASS);
 141 
 142         System.out.println("Test case 6: add to app using AppCDS, but add to boot using JVMTI - should find Hello.class in boot loader");
 143         output = TestCommon.createArchive(
 144                      appJar, TestCommon.list("JvmtiApp", "ExtraClass"),
 145                      use_whitebox_jar,
 146                      "-Xlog:class+load=trace",
 147                      modulePath);
 148         TestCommon.checkDump(output);
 149         run(twoAppJars, modulePath,
 150             "JvmtiApp", "bootonly", addappJar, MAIN_CLASS);
 151 
 152         System.out.println("Test case 7: add to app using AppCDS, no JVMTI calls - should find Hello.class in app loader");
 153         run(twoAppJars, modulePath,
 154             "JvmtiApp", "noadd-appcds", MAIN_CLASS);
 155     }
 156 }
test/hotspot/jtreg/runtime/appcds/jigsaw/modulepath/JvmtiAddPath.java
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File