< prev index next >

test/hotspot/jtreg/runtime/appcds/jvmti/transformRelatedClasses/TransformRelatedClassesAppCDS.java

Print this page




  96     private void prepareAgent(String[] agentClasses) throws Exception {
  97         String manifest = "../../../../testlibrary/jvmti/TransformerAgent.mf";
  98         agentJar = ClassFileInstaller.writeJar("TransformerAgent.jar",
  99                    ClassFileInstaller.Manifest.fromSourceFile(manifest),
 100                                            agentClasses);
 101     }
 102 
 103 
 104     private void runWithAppLoader(ArrayList<TestEntry> testTable) throws Exception {
 105         String appJar = writeJar("app", testClasses);
 106 
 107         // create an archive
 108         OutputAnalyzer out = TestCommon.dump(appJar, testClasses);
 109         TestCommon.checkDump(out);
 110 
 111         // execute with archive
 112         for (TestEntry entry : testTable) {
 113             log("runTestWithAppLoader(): testCaseId = %d", entry.testCaseId);
 114             String params = TransformTestCommon.getAgentParams(entry, parent, child);
 115             String agentParam = String.format("-javaagent:%s=%s", agentJar, params);

 116             TestCommon.run("-Xlog:class+load=info", "-cp", appJar,
 117                            agentParam, child)
 118               .assertNormalExit(output -> TransformTestCommon.checkResults(entry, output, parent, child));
 119         }
 120     }
 121 
 122 
 123     private String[] getCustomClassList(String loaderType, String customJar) {
 124         String type = child + "-" + loaderType;
 125 
 126         switch (type) {
 127 
 128         case "SubClass-unregistered":
 129             return new String[] {
 130                 "CustomLoaderApp",
 131                 "java/lang/Object id: 0",
 132                 parent + " id: 1 super: 0 source: " + customJar,
 133                 child +  " id: 2 super: 1 source: " + customJar,
 134             };
 135 




  96     private void prepareAgent(String[] agentClasses) throws Exception {
  97         String manifest = "../../../../testlibrary/jvmti/TransformerAgent.mf";
  98         agentJar = ClassFileInstaller.writeJar("TransformerAgent.jar",
  99                    ClassFileInstaller.Manifest.fromSourceFile(manifest),
 100                                            agentClasses);
 101     }
 102 
 103 
 104     private void runWithAppLoader(ArrayList<TestEntry> testTable) throws Exception {
 105         String appJar = writeJar("app", testClasses);
 106 
 107         // create an archive
 108         OutputAnalyzer out = TestCommon.dump(appJar, testClasses);
 109         TestCommon.checkDump(out);
 110 
 111         // execute with archive
 112         for (TestEntry entry : testTable) {
 113             log("runTestWithAppLoader(): testCaseId = %d", entry.testCaseId);
 114             String params = TransformTestCommon.getAgentParams(entry, parent, child);
 115             String agentParam = String.format("-javaagent:%s=%s", agentJar, params);
 116 
 117             TestCommon.run("-Xlog:class+load=info", "-cp", appJar,
 118                            agentParam, child)
 119               .assertNormalExit(output -> TransformTestCommon.checkResults(entry, output, parent, child));
 120         }
 121     }
 122 
 123 
 124     private String[] getCustomClassList(String loaderType, String customJar) {
 125         String type = child + "-" + loaderType;
 126 
 127         switch (type) {
 128 
 129         case "SubClass-unregistered":
 130             return new String[] {
 131                 "CustomLoaderApp",
 132                 "java/lang/Object id: 0",
 133                 parent + " id: 1 super: 0 source: " + customJar,
 134                 child +  " id: 2 super: 1 source: " + customJar,
 135             };
 136 


< prev index next >