Skip to content

Commit

Permalink
AjcTestCase: Improve forked JVM parameter handling
Browse files Browse the repository at this point in the history
- Recognise more "fork-worthy" JVM parameters
- Pass on program arguments to program in forked JVM

Signed-off-by: Alexander Kriegisch <[email protected]>
  • Loading branch information
kriegaex committed Mar 6, 2024
1 parent 1f1d429 commit 109d9cb
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -694,10 +694,10 @@ else if (moduleName != null) {
else if (
vmargs != null && (
vmargs.contains("--enable-preview") ||
vmargs.contains("--add-modules") ||
vmargs.contains("--limit-modules") ||
vmargs.contains("--add-reads") ||
vmargs.contains("--add-exports")
vmargs.contains("--add-modules") || vmargs.contains("--limit-modules") ||
vmargs.contains("--add-reads") || vmargs.contains("--add-exports") || vmargs.contains("--add-opens") ||
vmargs.contains("-ea") || vmargs.contains("-enableassertions") ||
vmargs.contains("-Xmx")
)
) {
// If --add-modules supplied, need to fork the test
Expand All @@ -708,7 +708,10 @@ else if (
if (cp.indexOf("aspectjrt")==-1) {
cp.append(pathSeparator).append(TestUtil.aspectjrtPath().getPath());
}
String command = LangUtil.getJavaExecutable().getAbsolutePath() + " " +vmargs+ (cp.length()==0?"":" -classpath " + cp) + " " + className ;
String command = LangUtil.getJavaExecutable().getAbsolutePath() + " " +
vmargs +
(cp.length() == 0 ? "" : " -classpath " + cp) + " " +
className + " " + String.join(" ", args);
if (Ajc.verbose)
System.out.println("\nCommand: '" + command + "'\n");
// Command is executed using ProcessBuilder to allow setting CWD for ajc sandbox compliance
Expand Down

0 comments on commit 109d9cb

Please sign in to comment.