equal
deleted
inserted
replaced
106 "-version"); |
106 "-version"); |
107 OutputAnalyzer out = TestCommon.executeAndLog(pb, "exec-dst"); |
107 OutputAnalyzer out = TestCommon.executeAndLog(pb, "exec-dst"); |
108 out.shouldNotContain("shared class paths mismatch"); |
108 out.shouldNotContain("shared class paths mismatch"); |
109 out.shouldNotContain("BOOT classpath mismatch"); |
109 out.shouldNotContain("BOOT classpath mismatch"); |
110 } |
110 } |
|
111 |
|
112 // Test with no modules image in the <java home>/lib directory |
|
113 renameModulesFile(java_home_dst); |
|
114 { |
|
115 ProcessBuilder pb = makeBuilder(java_home_dst + "/bin/java", |
|
116 "-version"); |
|
117 OutputAnalyzer out = TestCommon.executeAndLog(pb, "exec-missing-modules"); |
|
118 out.shouldHaveExitValue(1); |
|
119 out.shouldContain("Failed setting boot class path."); |
|
120 } |
111 } |
121 } |
112 |
122 |
113 // Do a cheap clone of the JDK. Most files can be sym-linked. However, $JAVA_HOME/bin/java and $JAVA_HOME/lib/.../libjvm.so" |
123 // Do a cheap clone of the JDK. Most files can be sym-linked. However, $JAVA_HOME/bin/java and $JAVA_HOME/lib/.../libjvm.so" |
114 // must be copied, because the java.home property is derived from the canonicalized paths of these 2 files. |
124 // must be copied, because the java.home property is derived from the canonicalized paths of these 2 files. |
115 static void clone(File src, File dst) throws Exception { |
125 static void clone(File src, File dst) throws Exception { |
142 clone(child_src, child_dst); |
152 clone(child_src, child_dst); |
143 } |
153 } |
144 } |
154 } |
145 } |
155 } |
146 |
156 |
|
157 static void renameModulesFile(String javaHome) throws Exception { |
|
158 String modulesDir = javaHome + File.separator + "lib"; |
|
159 File origModules = new File(modulesDir, "modules"); |
|
160 if (!origModules.exists()) { |
|
161 throw new RuntimeException("modules file not found"); |
|
162 } |
|
163 |
|
164 File renamedModules = new File(modulesDir, "orig_modules"); |
|
165 if (renamedModules.exists()) { |
|
166 throw new RuntimeException("found orig_modules unexpectedly"); |
|
167 } |
|
168 |
|
169 boolean success = origModules.renameTo(renamedModules); |
|
170 if (!success) { |
|
171 throw new RuntimeException("rename modules file failed"); |
|
172 } |
|
173 } |
|
174 |
147 static ProcessBuilder makeBuilder(String... args) throws Exception { |
175 static ProcessBuilder makeBuilder(String... args) throws Exception { |
148 System.out.print("["); |
176 System.out.print("["); |
149 for (String s : args) { |
177 for (String s : args) { |
150 System.out.print(" " + s); |
178 System.out.print(" " + s); |
151 } |
179 } |