239 /* |
239 /* |
240 * ensures we have indeed exec'ed the correct vm of choice if it exists |
240 * ensures we have indeed exec'ed the correct vm of choice if it exists |
241 */ |
241 */ |
242 @Test |
242 @Test |
243 void testVmSelection() { |
243 void testVmSelection() { |
|
244 boolean haveSomeVM = false; |
244 if (haveClientVM) { |
245 if (haveClientVM) { |
245 TestResult tr = doExec(javaCmd, "-client", "-version"); |
246 tryVmOption("-client", ".*Client VM.*"); |
246 if (!tr.matches(".*Client VM.*")) { |
247 haveSomeVM = true; |
247 flagError(tr, "the expected vm -client did not launch"); |
|
248 } |
|
249 } |
248 } |
250 if (haveServerVM) { |
249 if (haveServerVM) { |
251 TestResult tr = doExec(javaCmd, "-server", "-version"); |
250 tryVmOption("-server", ".*Server VM.*"); |
252 if (!tr.matches(".*Server VM.*")) { |
251 haveSomeVM = true; |
253 flagError(tr, "the expected vm -server did not launch"); |
252 } |
254 } |
253 if (!haveSomeVM) { |
|
254 String msg = "Don't have a known VM"; |
|
255 System.err.println(msg); |
|
256 throw new RuntimeException(msg); |
|
257 } |
|
258 } |
|
259 |
|
260 private void tryVmOption(String opt, String expected) { |
|
261 TestResult tr = doExec(javaCmd, opt, "-version"); |
|
262 if (!tr.matches(expected)) { |
|
263 flagError(tr, "the expected vm " + opt + " did not launch"); |
255 } |
264 } |
256 } |
265 } |
257 |
266 |
258 /* |
267 /* |
259 * checks to see there is no extra libjvm.so than needed |
268 * checks to see there is no extra libjvm.so than needed |