< prev index next >

test/hotspot/jtreg/runtime/cds/appcds/jvmti/ClassFileLoadHookTest.java

Print this page

 50         String wbJar =
 51             ClassFileInstaller.writeJar("WhiteBox.jar", "jdk.test.whitebox.WhiteBox");
 52         String appJar =
 53             ClassFileInstaller.writeJar("ClassFileLoadHook.jar", sharedClasses);
 54         String useWb = "-Xbootclasspath/a:" + wbJar;
 55 
 56         // First, run the test class directly, w/o sharing, as a baseline reference
 57         CDSOptions opts = (new CDSOptions())
 58             .setUseVersion(false)
 59             .setXShareMode("off")
 60             .addSuffix("-XX:+UnlockDiagnosticVMOptions",
 61                        "-XX:+WhiteBoxAPI",
 62                        useWb,
 63                        "-agentlib:SimpleClassFileLoadHook=LoadMe,beforeHook,after_Hook",
 64                        "ClassFileLoadHook",
 65                        "" + ClassFileLoadHook.TestCaseId.SHARING_OFF_CFLH_ON);
 66         CDSTestUtils.run(opts)
 67                     .assertNormalExit();
 68 
 69         // Run with AppCDS, but w/o CFLH - second baseline
 70         TestCommon.testDump(appJar, sharedClasses, useWb);
 71         OutputAnalyzer out = TestCommon.exec(appJar,
 72                 "-XX:+UnlockDiagnosticVMOptions",
 73                 "-XX:+WhiteBoxAPI", useWb,
 74                 "ClassFileLoadHook",
 75                 "" + ClassFileLoadHook.TestCaseId.SHARING_ON_CFLH_OFF);
 76 
 77         TestCommon.checkExec(out);
 78 
 79 
 80         // Now, run with AppCDS with -Xshare:auto and CFLH
 81         out = TestCommon.execAuto("-cp", appJar,
 82                 "-XX:+UnlockDiagnosticVMOptions",
 83                 "-XX:+WhiteBoxAPI", useWb,
 84                 "-agentlib:SimpleClassFileLoadHook=LoadMe,beforeHook,after_Hook",
 85                 "ClassFileLoadHook",
 86                 "" + ClassFileLoadHook.TestCaseId.SHARING_AUTO_CFLH_ON);
 87 
 88         opts = (new CDSOptions()).setXShareMode("auto");
 89         TestCommon.checkExec(out, opts);
 90 

 50         String wbJar =
 51             ClassFileInstaller.writeJar("WhiteBox.jar", "jdk.test.whitebox.WhiteBox");
 52         String appJar =
 53             ClassFileInstaller.writeJar("ClassFileLoadHook.jar", sharedClasses);
 54         String useWb = "-Xbootclasspath/a:" + wbJar;
 55 
 56         // First, run the test class directly, w/o sharing, as a baseline reference
 57         CDSOptions opts = (new CDSOptions())
 58             .setUseVersion(false)
 59             .setXShareMode("off")
 60             .addSuffix("-XX:+UnlockDiagnosticVMOptions",
 61                        "-XX:+WhiteBoxAPI",
 62                        useWb,
 63                        "-agentlib:SimpleClassFileLoadHook=LoadMe,beforeHook,after_Hook",
 64                        "ClassFileLoadHook",
 65                        "" + ClassFileLoadHook.TestCaseId.SHARING_OFF_CFLH_ON);
 66         CDSTestUtils.run(opts)
 67                     .assertNormalExit();
 68 
 69         // Run with AppCDS, but w/o CFLH - second baseline
 70         TestCommon.testDump(appJar, sharedClasses, useWb, "-XX:-PreloadSharedClasses");
 71         OutputAnalyzer out = TestCommon.exec(appJar,
 72                 "-XX:+UnlockDiagnosticVMOptions",
 73                 "-XX:+WhiteBoxAPI", useWb,
 74                 "ClassFileLoadHook",
 75                 "" + ClassFileLoadHook.TestCaseId.SHARING_ON_CFLH_OFF);
 76 
 77         TestCommon.checkExec(out);
 78 
 79 
 80         // Now, run with AppCDS with -Xshare:auto and CFLH
 81         out = TestCommon.execAuto("-cp", appJar,
 82                 "-XX:+UnlockDiagnosticVMOptions",
 83                 "-XX:+WhiteBoxAPI", useWb,
 84                 "-agentlib:SimpleClassFileLoadHook=LoadMe,beforeHook,after_Hook",
 85                 "ClassFileLoadHook",
 86                 "" + ClassFileLoadHook.TestCaseId.SHARING_AUTO_CFLH_ON);
 87 
 88         opts = (new CDSOptions()).setXShareMode("auto");
 89         TestCommon.checkExec(out, opts);
 90 
< prev index next >