< prev index next >

jdk/test/tools/launcher/modules/patch/systemmodules/PatchSystemModules.java

Print this page

        

*** 67,77 **** private void setup() throws Throwable { Path src = TEST_SRC.resolve("src"); for (String name : modules) { assertTrue(CompilerUtils.compile(src.resolve(name), MODS_DIR, ! "-modulesourcepath", src.toString())); } // compile patched source assertTrue(CompilerUtils.compile(PATCH_SRC_DIR.resolve(JAVA_BASE), PATCH_DIR.resolve(JAVA_BASE), --- 67,77 ---- private void setup() throws Throwable { Path src = TEST_SRC.resolve("src"); for (String name : modules) { assertTrue(CompilerUtils.compile(src.resolve(name), MODS_DIR, ! "--module-source-path", src.toString())); } // compile patched source assertTrue(CompilerUtils.compile(PATCH_SRC_DIR.resolve(JAVA_BASE), PATCH_DIR.resolve(JAVA_BASE),
*** 91,110 **** Path patchedJavaBase = PATCH_DIR.resolve(JAVA_BASE); Path patchedM2 = PATCH_DIR.resolve("m2"); Path home = Paths.get(JAVA_HOME); runTest(home, ! "-mp", MODS_DIR.toString(), "-m", "m1/p1.Main", "1"); runTest(home, ! "-Xpatch:java.base=" + patchedJavaBase.toString(), ! "-mp", MODS_DIR.toString(), "-m", "m1/p1.Main", "1"); runTest(home, ! "-Xpatch:m2=" + patchedM2.toString(), ! "-mp", MODS_DIR.toString(), "-m", "m1/p1.Main", "2"); } @Test public void testImage() throws Throwable { --- 91,110 ---- Path patchedJavaBase = PATCH_DIR.resolve(JAVA_BASE); Path patchedM2 = PATCH_DIR.resolve("m2"); Path home = Paths.get(JAVA_HOME); runTest(home, ! "--module-path", MODS_DIR.toString(), "-m", "m1/p1.Main", "1"); runTest(home, ! "--patch-module", "java.base=" + patchedJavaBase, ! "--module-path", MODS_DIR.toString(), "-m", "m1/p1.Main", "1"); runTest(home, ! "--patch-module", "m2=" + patchedM2.toString(), ! "--module-path", MODS_DIR.toString(), "-m", "m1/p1.Main", "2"); } @Test public void testImage() throws Throwable {
*** 115,128 **** Path patchedM2 = PATCH_DIR.resolve("m2"); runTest(IMAGE, "-m", "m1/p1.Main", "1"); runTest(IMAGE, ! "-Xpatch:java.base=" + patchedJavaBase.toString(), "-m", "m1/p1.Main", "1"); runTest(IMAGE, ! "-Xpatch:m2=" + patchedM2.toString(), "-m", "m1/p1.Main", "2"); } @Test public void upgradeTiedModule() throws Throwable { --- 115,128 ---- Path patchedM2 = PATCH_DIR.resolve("m2"); runTest(IMAGE, "-m", "m1/p1.Main", "1"); runTest(IMAGE, ! "--patch-module", "java.base=" + patchedJavaBase, "-m", "m1/p1.Main", "1"); runTest(IMAGE, ! "--patch-module", "m2=" + patchedM2.toString(), "-m", "m1/p1.Main", "2"); } @Test public void upgradeTiedModule() throws Throwable {
*** 136,151 **** "--file=" + m1.toString(), "-C", MODS_DIR.resolve("m1").toString(), "."); // Fail to upgrade m1.jar with mismatched hash runTestWithExitCode(getJava(IMAGE), ! "-upgrademodulepath", m1.toString(), "-m", "m1/p1.Main"); runTestWithExitCode(getJava(IMAGE), ! "-Xpatch:java.base=" + PATCH_DIR.resolve(JAVA_BASE).toString(), ! "-upgrademodulepath", m1.toString(), "-m", "m1/p1.Main", "1"); } private void runTestWithExitCode(String... options) throws Throwable { assertTrue(executeCommand(options) --- 136,151 ---- "--file=" + m1.toString(), "-C", MODS_DIR.resolve("m1").toString(), "."); // Fail to upgrade m1.jar with mismatched hash runTestWithExitCode(getJava(IMAGE), ! "--upgrade-module-path", m1.toString(), "-m", "m1/p1.Main"); runTestWithExitCode(getJava(IMAGE), ! "--patch-module", "java.base=" + PATCH_DIR.resolve(JAVA_BASE), ! "--upgrade-module-path", m1.toString(), "-m", "m1/p1.Main", "1"); } private void runTestWithExitCode(String... options) throws Throwable { assertTrue(executeCommand(options)
*** 183,200 **** "--file=" + m1.toString(), "-C", MODS_DIR.resolve("m1").toString(), "."); jar("--create", "--file=" + m2.toString(), ! "--modulepath", JARS_DIR.toString(), "--hash-modules", "m1", "-C", MODS_DIR.resolve("m2").toString(), "."); String mpath = JARS_DIR.toString() + File.pathSeparator + JMODS.toString(); ! execTool("jlink", "--modulepath", mpath, ! "--addmods", "m1", "--output", IMAGE.toString()); } static void jar(String... args) throws Throwable { execTool("jar", args); --- 183,200 ---- "--file=" + m1.toString(), "-C", MODS_DIR.resolve("m1").toString(), "."); jar("--create", "--file=" + m2.toString(), ! "--module-path", JARS_DIR.toString(), "--hash-modules", "m1", "-C", MODS_DIR.resolve("m2").toString(), "."); String mpath = JARS_DIR.toString() + File.pathSeparator + JMODS.toString(); ! execTool("jlink", "--module-path", mpath, ! "--add-modules", "m1", "--output", IMAGE.toString()); } static void jar(String... args) throws Throwable { execTool("jar", args);
*** 214,224 **** assertTrue(exitValue == 0); } static String getJava(Path image) { ! boolean isWindows = System.getProperty("os.name").toLowerCase().startsWith("win"); Path java = image.resolve("bin").resolve(isWindows ? "java.exe" : "java"); if (Files.notExists(java)) throw new RuntimeException(java + " not found"); return java.toAbsolutePath().toString(); } --- 214,224 ---- assertTrue(exitValue == 0); } static String getJava(Path image) { ! boolean isWindows = System.getProperty("os.name").startsWith("Windows"); Path java = image.resolve("bin").resolve(isWindows ? "java.exe" : "java"); if (Files.notExists(java)) throw new RuntimeException(java + " not found"); return java.toAbsolutePath().toString(); }
< prev index next >