Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EXTRA_OPTIONS are appended to exisiting JVM options #4861

Merged
merged 2 commits into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions jck/jtrunner/JavaTestRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class JavaTestRunner {
private static String testExecutionType;
private static String withAgent;
private static String interactive;
private static String extraJvmOptions;
private static String extraJvmOptions = "";
private static String concurrencyString;
private static String jckVersion;
private static String config;
Expand Down Expand Up @@ -168,8 +168,16 @@ public static void main(String args[]) throws Exception {
}
}
}

jvmOpts = System.getProperty("jvm.options").trim() + " " + System.getProperty("other.opts");

String otherOptions = System.getProperty("other.options");
String jvmOptions = System.getProperty("jvm.options");
if (otherOptions != null) {
jvmOpts += otherOptions.trim() + " ";
}

if (jvmOptions != null) {
jvmOpts += jvmOptions.trim() + " ";
}
task = testArgs.get(TASK);
customJtx = testArgs.get(CUSTOM_JTX);
spec = testArgs.get(SPEC);
Expand Down Expand Up @@ -491,8 +499,6 @@ public static boolean jckConfigurationForMultijvmWithNoAgent() throws Exception
String robotAvailable = "";
String hostname = "";
String ipAddress = "";
extraJvmOptions = jvmOpts;

InetAddress addr = InetAddress.getLocalHost();
ipAddress = addr.getHostAddress();
hostname = addr.getHostName();
Expand Down Expand Up @@ -731,7 +737,7 @@ public static boolean jckConfigurationForMultijvmWithNoAgent() throws Exception
}

// Add the JVM options supplied by the user plus those added in this method to the jtb file option.
fileContent += "set jck.env.runtime.testExecute.otherOpts \" " + extraJvmOptions + " \"" + ";\n";
fileContent += "set jck.env.runtime.testExecute.otherOpts \" " + extraJvmOptions + " " + jvmOpts + " \"" + ";\n";

// Tests that need Display on OSX also require AWT_FORCE_HEADFUL=true
if (spec.contains("osx")) {
Expand Down Expand Up @@ -800,13 +806,14 @@ public static boolean jckConfigurationForMultijvmWithNoAgent() throws Exception
}

extraJvmOptions += suppressOutOfMemoryDumpOptions;


if (jckVersionInt > 11) {
extraJvmOptions += " --enable-preview -Xfuture ";
}

// Add the JVM options supplied by the user plus those added in this method to the jtb file option.
fileContent += "set jck.env.compiler.compRefExecute.otherOpts \" " + extraJvmOptions + " \"" + ";\n";
fileContent += "set jck.env.compiler.compRefExecute.otherOpts \" " + extraJvmOptions + " " + jvmOpts + " \"" + ";\n";
}
// Devtools settings
if (testSuite.equals("DEVTOOLS")) {
Expand Down Expand Up @@ -893,9 +900,10 @@ public static boolean jckConfigurationForMultijvmWithNoAgent() throws Exception
extraJvmOptions += getTestSpecificJvmOptions(jckVersion, tests);

extraJvmOptions += suppressOutOfMemoryDumpOptions;


// Add the JVM options supplied by the user plus those added in this method to the jtb file option.
fileContent += "set jck.env.devtools.refExecute.otherOpts \" " + extraJvmOptions + " \"" + ";\n";
fileContent += "set jck.env.devtools.refExecute.otherOpts \" " + extraJvmOptions + " " + jvmOpts + " \"" + ";\n";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fileContent += "set jck.env.runtime.testExecute.otherOpts \" " + extraJvmOptions + " \"" + ";\n";
should be updated as well.

}
return true;
}
Expand Down
21 changes: 15 additions & 6 deletions jck/jtrunner/JavatestUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public class JavatestUtil {
private static String testExecutionType;
private static String withAgent;
private static String interactive;
private static String extraJvmOptions;
private static String extraJvmOptions = "";
private static String concurrencyString;
private static String jckVersion;
private static String config;
Expand Down Expand Up @@ -177,7 +177,14 @@ public static void main(String args[]) throws Exception {
}
}

jvmOpts = System.getProperty("jvm.options").trim() + " " + System.getProperty("other.opts");
String otherOptions = System.getProperty("other.options");
String jvmOptions = System.getProperty("jvm.options");
if (otherOptions != null) {
jvmOpts += otherOptions.trim() + " ";
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not quite correct. We need to check jvm.options as well.

if (System.getProperty("other.options") != null) {
   jvmOpts += System.getProperty("other.options").trim() + " ";
}
if (System.getProperty("jvm.options") != null) {
   jvmOpts += System.getProperty("jvm.options").trim() + " ";
}

if (jvmOptions != null) {
jvmOpts += jvmOptions.trim() + " ";
}
testFlag = System.getenv("TEST_FLAG");
task = testArgs.get(TASK).trim();
customJtx = testArgs.get(CUSTOM_JTX) == null ? "" : testArgs.get(CUSTOM_JTX);
Expand Down Expand Up @@ -419,7 +426,6 @@ private static boolean generateJTB() throws Exception {
String robotAvailable = "";
String hostname = "";
String ipAddress = "";
extraJvmOptions = jvmOpts;

// Use escaped backslashes for paths on Windows
if (spec.contains("win")) {
Expand Down Expand Up @@ -664,13 +670,14 @@ private static boolean generateJTB() throws Exception {
// Get any additional jvm options for specific tests.
extraJvmOptions += getTestSpecificJvmOptions(jckVersion, tests);
extraJvmOptions += suppressOutOfMemoryDumpOptions;


if (jckVersionInt > 11) {
extraJvmOptions += " --enable-preview -Xfuture ";
}

// Add the JVM options supplied by the user plus those added in this method to the jtb file option.
fileContent += "set jck.env.runtime.testExecute.otherOpts \" " + extraJvmOptions + " \"" + ";\n";
fileContent += "set jck.env.runtime.testExecute.otherOpts \" " + extraJvmOptions + " " + jvmOpts + " \"" + ";\n";

// Tests that need Display on OSX also require AWT_FORCE_HEADFUL=true
if (spec.contains("osx")) {
Expand Down Expand Up @@ -746,14 +753,15 @@ private static boolean generateJTB() throws Exception {
}

extraJvmOptions += suppressOutOfMemoryDumpOptions;


if (jckVersionInt > 11) {
extraJvmOptions += " --enable-preview -Xfuture ";
}

// Add the JVM options supplied by the user plus those added in this method to the jtb file option.
if (!testExecutionType.equals("multijvm")) {
fileContent += "set jck.env.compiler.compRefExecute.otherOpts \" " + extraJvmOptions + " \"" + ";\n";
fileContent += "set jck.env.compiler.compRefExecute.otherOpts \" " + extraJvmOptions + " " + jvmOpts + " \"" + ";\n";
}
}
// Devtools settings
Expand Down Expand Up @@ -839,9 +847,10 @@ private static boolean generateJTB() throws Exception {
// Get any additional jvm options for specific tests.
extraJvmOptions += getTestSpecificJvmOptions(jckVersion, tests);
extraJvmOptions += suppressOutOfMemoryDumpOptions;


// Add the JVM options supplied by the user plus those added in this method to the jtb file option.
fileContent += "set jck.env.devtools.refExecute.otherOpts \" " + extraJvmOptions + " \"" + ";\n";
fileContent += "set jck.env.devtools.refExecute.otherOpts \" " + extraJvmOptions + " " + jvmOpts + " \"" + ";\n";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fileContent += "set jck.env.runtime.testExecute.otherOpts \" " + extraJvmOptions + " \"" + ";\n";
should be updated as well.

}

// Only use default initial jtx exclude and disregard the rest of jck exclude lists
Expand Down