test/hotspot/jtreg/runtime/appcds/MoveJDKTest.java
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File
*** old/test/hotspot/jtreg/runtime/appcds/MoveJDKTest.java	Mon Jul  9 09:52:28 2018
--- new/test/hotspot/jtreg/runtime/appcds/MoveJDKTest.java	Mon Jul  9 09:52:28 2018

*** 106,115 **** --- 106,125 ---- "-version"); OutputAnalyzer out = TestCommon.executeAndLog(pb, "exec-dst"); out.shouldNotContain("shared class paths mismatch"); out.shouldNotContain("BOOT classpath mismatch"); } + + // Test with no modules image in the <java home>/lib directory + renameModulesFile(java_home_dst); + { + ProcessBuilder pb = makeBuilder(java_home_dst + "/bin/java", + "-version"); + OutputAnalyzer out = TestCommon.executeAndLog(pb, "exec-missing-modules"); + out.shouldHaveExitValue(1); + out.shouldContain("System boot class path should not be NULL"); + } } // Do a cheap clone of the JDK. Most files can be sym-linked. However, $JAVA_HOME/bin/java and $JAVA_HOME/lib/.../libjvm.so" // must be copied, because the java.home property is derived from the canonicalized paths of these 2 files. static void clone(File src, File dst) throws Exception {
*** 142,151 **** --- 152,179 ---- clone(child_src, child_dst); } } } + static void renameModulesFile(String javaHome) throws Exception { + String modulesDir = javaHome + File.separator + "lib"; + File origModules = new File(modulesDir, "modules"); + if (!origModules.exists()) { + throw new RuntimeException("modules file not found"); + } + + File renamedModules = new File(modulesDir, "orig_modules"); + if (renamedModules.exists()) { + throw new RuntimeException("found orig_modules unexpectedly"); + } + + boolean success = origModules.renameTo(renamedModules); + if (!success) { + throw new RuntimeException("rename modules file failed"); + } + } + static ProcessBuilder makeBuilder(String... args) throws Exception { System.out.print("["); for (String s : args) { System.out.print(" " + s); }

test/hotspot/jtreg/runtime/appcds/MoveJDKTest.java
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File