< prev index next >

test/hotspot/jtreg/runtime/appcds/UseAppCDS.java

Print this page

        

*** 72,111 **** TestCommon.executeAndLog(pb, "jar01").shouldHaveExitValue(0); pb = new ProcessBuilder(jar.getCommand()); TestCommon.executeAndLog(pb, "jar02").shouldHaveExitValue(0); ! // In all tests the BOOTCLASS should be loaded/dumped/used ! // Test 1: No AppCDS - dumping loaded classes excludes the "test" classes ! dumpLoadedClasses(false, new String[] { BOOTCLASS }, ! new String[] { TESTNAME }); ! // Test 2: AppCDS - dumping loaded classes includes "test" classes dumpLoadedClasses(true, new String[] { BOOTCLASS, TESTNAME }, new String[0]); // Next tests rely on the classlist we just dumped ! // Test 3: No AppCDS - "test" classes in classlist ignored when dumping ! // Although AppCDS isn't used, all classes will be found during dumping ! // after the fix for JDK-8193434. Classes which are not in the boot ! // loader dictionary will not be saved into the archive. ! dumpArchive(false, new String[] { BOOTCLASS }, new String[0]); ! // Test 4: AppCDS - "test" classes in classlist are dumped dumpArchive(true, new String[] { BOOTCLASS, TESTNAME }, new String[0]); // Next tests rely on the archive we just dumped ! // Test 5: No AppCDS - Using archive containing "test" classes ignores them ! useArchive(false, new String[] { BOOTCLASS }, ! new String[] { TESTNAME }); ! // Test 6: AppCDS - Using archive containing "test" classes loads them useArchive(true, new String[] { BOOTCLASS, TESTNAME }, new String[0]); } public static List<String> toClassNames(String filename) throws IOException { --- 72,108 ---- TestCommon.executeAndLog(pb, "jar01").shouldHaveExitValue(0); pb = new ProcessBuilder(jar.getCommand()); TestCommon.executeAndLog(pb, "jar02").shouldHaveExitValue(0); ! // In all tests the BOOTCLASS and TESTNAME should be loaded/dumped/used ! // Test 1: -XX:-UseAppCDS - No effect, dumping loaded classes includes "test" classes ! dumpLoadedClasses(false, new String[] { BOOTCLASS, TESTNAME }, ! new String[0]); ! // Test 2: -XX:+UseAppCDS - dumping loaded classes includes "test" classes dumpLoadedClasses(true, new String[] { BOOTCLASS, TESTNAME }, new String[0]); // Next tests rely on the classlist we just dumped ! // Test 3: -XX:-UseAppCDS - No effect, "test" classes in classlist are dumped ! dumpArchive(false, new String[] { BOOTCLASS, TESTNAME }, new String[0]); ! // Test 4: -XX:+UseAppCDS - "test" classes in classlist are dumped dumpArchive(true, new String[] { BOOTCLASS, TESTNAME }, new String[0]); // Next tests rely on the archive we just dumped ! // Test 5: -XX:-UseAppCDS - No effect, using archive containing "test" loads them ! useArchive(false, new String[] { BOOTCLASS, TESTNAME }, ! new String[0]); ! // Test 6: -XX:+UseAppCDS - Using archive containing "test" classes loads them useArchive(true, new String[] { BOOTCLASS, TESTNAME }, new String[0]); } public static List<String> toClassNames(String filename) throws IOException {
*** 127,137 **** ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, TestCommon.makeCommandLineForAppCDS( "-XX:DumpLoadedClassList=" + CLASSLIST_FILE, "-cp", TESTJAR, ! useAppCDS ? "-XX:+UseAppCDS" : "-XX:-UseAppCDS", TESTNAME, TEST_OUT)); OutputAnalyzer output = TestCommon.executeAndLog(pb, "dump-loaded-classes") .shouldHaveExitValue(0).shouldContain(TEST_OUT); --- 124,134 ---- ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, TestCommon.makeCommandLineForAppCDS( "-XX:DumpLoadedClassList=" + CLASSLIST_FILE, "-cp", TESTJAR, ! (useAppCDS) ? "-XX:+UseAppCDS" : "-XX:-UseAppCDS", TESTNAME, TEST_OUT)); OutputAnalyzer output = TestCommon.executeAndLog(pb, "dump-loaded-classes") .shouldHaveExitValue(0).shouldContain(TEST_OUT);
*** 154,165 **** static void dumpArchive(boolean useAppCDS, String[] expectedClasses, String[] unexpectedClasses) throws Exception { ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, TestCommon.makeCommandLineForAppCDS( - useAppCDS ? "-XX:-UnlockDiagnosticVMOptions" : - "-XX:+UnlockDiagnosticVMOptions", "-cp", TESTJAR, useAppCDS ? "-XX:+UseAppCDS" : "-XX:-UseAppCDS", "-XX:SharedClassListFile=" + CLASSLIST_FILE, "-XX:SharedArchiveFile=" + ARCHIVE_FILE, --- 151,160 ----
*** 181,192 **** static void useArchive(boolean useAppCDS, String[] expectedClasses, String[] unexpectedClasses) throws Exception { ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, TestCommon.makeCommandLineForAppCDS( - useAppCDS ? "-XX:-UnlockDiagnosticVMOptions" : - "-XX:+UnlockDiagnosticVMOptions", "-cp", TESTJAR, useAppCDS ? "-XX:+UseAppCDS" : "-XX:-UseAppCDS", "-XX:SharedArchiveFile=" + ARCHIVE_FILE, "-verbose:class", --- 176,185 ----
< prev index next >