Commit 84b122c3 authored by Lubomir Bulej's avatar Lubomir Bulej

src-test: allow specifying separate Java homes for the client, server, and shadow VMs.

parent 287b56a6
......@@ -14,6 +14,20 @@ import ch.usi.dag.util.Lists;
public class ClientServerEvaluationRunner extends Runner {
private static final String __CLIENT_JAVA_COMMAND__ = _getJavaCommand (
System.getProperty ("disl.java.home")
);
private static final String __SERVER_JAVA_COMMAND__ = _getJavaCommand (
System.getProperty ("disl.server.java.home")
);
private static final String __SHADOW_JAVA_COMMAND__ = _getJavaCommand (
System.getProperty ("shvm.server.java.home")
);
//
private Job __client;
private Job __server;
......@@ -48,7 +62,7 @@ public class ClientServerEvaluationRunner extends Runner {
final File testInstJar, final File statusFile
) throws IOException {
final List <String> command = Lists.newLinkedList (
_JAVA_COMMAND_,
__SERVER_JAVA_COMMAND__,
"-classpath", Runner.classPath (_DISL_SERVER_JAR_, testInstJar)
);
......@@ -74,7 +88,7 @@ public class ClientServerEvaluationRunner extends Runner {
final File testInstJar, final File statusFile
) throws IOException {
final List <String> command = Lists.newLinkedList (
_JAVA_COMMAND_, "-Xms1G", "-Xmx2G",
__SHADOW_JAVA_COMMAND__, "-Xms1G", "-Xmx2G",
"-classpath", Runner.classPath (_SHVM_SERVER_JAR_, testInstJar)
);
......@@ -99,7 +113,7 @@ public class ClientServerEvaluationRunner extends Runner {
final File testInstJar, final File testAppJar
) throws IOException {
final List <String> command = Lists.newLinkedList (
_JAVA_COMMAND_,
__CLIENT_JAVA_COMMAND__,
String.format ("-agentpath:%s", _DISL_AGENT_LIB_),
String.format ("-agentpath:%s", _SHVM_AGENT_LIB_),
String.format ("-Xbootclasspath/a:%s", Runner.classPath (
......
......@@ -13,6 +13,16 @@ import ch.usi.dag.util.Lists;
public class ClientServerRunner extends Runner {
private static final String __CLIENT_JAVA_COMMAND__ = _getJavaCommand (
System.getProperty ("disl.java.home")
);
private static final String __SERVER_JAVA_COMMAND__ = _getJavaCommand (
System.getProperty ("disl.server.java.home")
);
//
private Job __client;
private Job __server;
......@@ -62,7 +72,7 @@ public class ClientServerRunner extends Runner {
final File testInstJar, final File testAppJar
) throws IOException {
final List <String> command = Lists.newLinkedList (
_JAVA_COMMAND_,
__CLIENT_JAVA_COMMAND__,
String.format ("-agentpath:%s", _DISL_AGENT_LIB_),
String.format ("-Xbootclasspath/a:%s", Runner.classPath (
_DISL_BYPASS_JAR_, testInstJar
......@@ -84,7 +94,7 @@ public class ClientServerRunner extends Runner {
final File testInstJar, final File statusFile
) throws IOException {
final List <String> command = Lists.newLinkedList (
_JAVA_COMMAND_,
__SERVER_JAVA_COMMAND__,
"-classpath", Runner.classPath (_DISL_SERVER_JAR_, testInstJar)
);
......
......@@ -23,7 +23,6 @@ public abstract class Runner {
protected static final Duration _WATCH_DELAY_ = Duration.of (100, MILLISECONDS);
protected static final String _ENV_JAVA_HOME_ = "JAVA_HOME";
protected static final String _JAVA_COMMAND_ = __getJavaCommand ();
protected static final File _DISL_LIB_DIR_ = new File (System.getProperty ("disl.lib.dir", "lib"));
......@@ -58,10 +57,14 @@ public abstract class Runner {
__testName = __extractTestName (testClass);
}
private static String __getJavaCommand () {
final String javaHome = System.getenv (_ENV_JAVA_HOME_);
if (javaHome != null) {
return Strings.join (File.separator, javaHome, "jre", "bin", "java");
protected static String _getJavaCommand (final String javaHome) {
final String home = (javaHome != null) ? javaHome : System.getenv (_ENV_JAVA_HOME_);
if (home != null) {
if (new File (home, "jre").exists ()) {
return Strings.join (File.separator, home, "jre", "bin", "java");
} else {
return Strings.join (File.separator, home, "bin", "java");
}
} else {
return "java";
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment