8152950: BasicLauncherTest.java fails due to type error

Better handle js engine initialization error

Reviewed-by: jbachorik
This commit is contained in:
Dmitry Samersoff 2016-05-27 19:31:41 +03:00
parent 62c695b852
commit df511d0dcc

View File

@ -49,14 +49,26 @@ import jdk.testlibrary.Platform;
public class BasicLauncherTest {
private final static String toolName = "jhsdb";
private static LingeredApp theApp = null;
private static boolean useJavaLauncher = false;
/**
*
* @return exit code of tool
*/
public static int launchCLHSDB()
private static JDKToolLauncher createSALauncher() {
JDKToolLauncher launcher = null;
if (useJavaLauncher) {
// Use java launcher if we need to pass additional parameters to VM
// for debugging purpose
// e.g. -Xlog:class+load=info:file=/tmp/BasicLauncherTest.log
launcher = JDKToolLauncher.createUsingTestJDK("java");
launcher.addToolArg("sun.jvm.hotspot.SALauncher");
}
else {
launcher = JDKToolLauncher.createUsingTestJDK("jhsdb");
}
return launcher;
}
public static void launchCLHSDB()
throws IOException {
System.out.println("Starting LingeredApp");
@ -64,7 +76,7 @@ public class BasicLauncherTest {
theApp = LingeredApp.startApp();
System.out.println("Starting clhsdb against " + theApp.getPid());
JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK(toolName);
JDKToolLauncher launcher = createSALauncher();
launcher.addToolArg("clhsdb");
launcher.addToolArg("--pid=" + Long.toString(theApp.getPid()));
@ -84,7 +96,9 @@ public class BasicLauncherTest {
toolProcess.waitFor();
return toolProcess.exitValue();
if (toolProcess.exitValue() != 0) {
throw new RuntimeException("FAILED CLHSDB terminated with non-zero exit code " + toolProcess.exitValue());
}
} catch (Exception ex) {
throw new RuntimeException("Test ERROR " + ex, ex);
} finally {
@ -104,8 +118,8 @@ public class BasicLauncherTest {
try {
theApp = LingeredApp.startApp(Arrays.asList("-Xmx256m"));
System.out.println("Starting " + toolName + " " + toolArgs.get(0) + " against " + theApp.getPid());
JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK(toolName);
System.out.println("Starting " + toolArgs.get(0) + " against " + theApp.getPid());
JDKToolLauncher launcher = createSALauncher();
for (String cmd : toolArgs) {
launcher.addToolArg(cmd);