< prev index next >

test/hotspot/jtreg/runtime/cds/appcds/cacheObject/ArchivedModuleWithCustomImageTest.java

Print this page

        

*** 61,93 **** // compile test module class if (!CompilerUtils.compile(src, classes)) { throw new RuntimeException("Compilation failure."); } // create custom runtime image named 'myimage' Files.createDirectories(jmods); Path image = Paths.get("myimage"); runJmod(classes.toString(), TEST_MODULE); runJlink(image, TEST_MODULE); // test using 'myimage' testArchivedModuleUsingImage(image); ! Files.delete(jmods.resolve(TEST_MODULE + ".jmod")); } private static void runJlink(Path image, String modName) throws Throwable { Path jlink = Paths.get(JAVA_HOME, "bin", "jlink"); OutputAnalyzer output = ProcessTools.executeProcess(jlink.toString(), "--output", image.toString(), "--add-modules", modName, "--module-path", jdkMods + File.pathSeparator + jmods); output.shouldHaveExitValue(0); } private static void runJmod(String cp, String modName) throws Throwable { Path jmod = Paths.get(JAVA_HOME, "bin", "jmod"); OutputAnalyzer output = ProcessTools.executeProcess(jmod.toString(), "create", "--class-path", cp, "--module-version", "1.0", "--main-class", "jdk.test.Test", --- 61,109 ---- // compile test module class if (!CompilerUtils.compile(src, classes)) { throw new RuntimeException("Compilation failure."); } + System.out.println("Java Home: " + JAVA_HOME); + System.out.println("JDK Home: " + jdkHome.toString()); + System.out.println("jdkModes: " + jdkMods.toString()); + System.out.println("testSrc: " + testSrc.toString()); + // create custom runtime image named 'myimage' Files.createDirectories(jmods); Path image = Paths.get("myimage"); runJmod(classes.toString(), TEST_MODULE); runJlink(image, TEST_MODULE); // test using 'myimage' testArchivedModuleUsingImage(image); ! // Files.delete(jmods.resolve(TEST_MODULE + ".jmod")); } private static void runJlink(Path image, String modName) throws Throwable { Path jlink = Paths.get(JAVA_HOME, "bin", "jlink"); + String cmd = jlink.toString() + " --output " + image.toString() + " --add-modules " + modName + + " --module-path " + jdkMods + File.pathSeparator + jmods; + System.out.println("Cmd: " + cmd); OutputAnalyzer output = ProcessTools.executeProcess(jlink.toString(), "--output", image.toString(), "--add-modules", modName, "--module-path", jdkMods + File.pathSeparator + jmods); output.shouldHaveExitValue(0); } private static void runJmod(String cp, String modName) throws Throwable { Path jmod = Paths.get(JAVA_HOME, "bin", "jmod"); + String cmd = jmod.toString() + + " create " + + " --class-path " + cp + + " --module-version " + "1.0" + + " --main-class " + " jdk.test.Test " + + jmods.resolve(modName + ".jmod").toString(); + System.out.println("Cmd: " + cmd); + OutputAnalyzer output = ProcessTools.executeProcess(jmod.toString(), "create", "--class-path", cp, "--module-version", "1.0", "--main-class", "jdk.test.Test",
< prev index next >