--- a/test/hotspot/jtreg/runtime/appcds/MoveJDKTest.java Tue Jul 10 10:24:08 2018 -0700
+++ b/test/hotspot/jtreg/runtime/appcds/MoveJDKTest.java Tue Jul 10 19:04:13 2018 -0700
@@ -108,6 +108,16 @@
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("Failed setting boot class path.");
+ }
}
// Do a cheap clone of the JDK. Most files can be sym-linked. However, $JAVA_HOME/bin/java and $JAVA_HOME/lib/.../libjvm.so"
@@ -144,6 +154,24 @@
}
}
+ 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) {