8212221: GraalUnitTestLauncher should generate MX_SUBPROCESS_COMMAND_FILE
Reviewed-by: dlong
--- a/test/hotspot/jtreg/ProblemList-graal.txt Tue Nov 13 12:24:13 2018 -0800
+++ b/test/hotspot/jtreg/ProblemList-graal.txt Tue Nov 13 12:52:37 2018 -0800
@@ -164,20 +164,15 @@
# Graal unit tests
org.graalvm.compiler.core.test.CheckGraalInvariants 8205081
-org.graalvm.compiler.core.test.inlining.PolymorphicInliningTest 8205081
org.graalvm.compiler.core.test.OptionsVerifierTest 8205081
-org.graalvm.compiler.core.test.ProfilingInfoTest 8205081
org.graalvm.compiler.hotspot.test.CompilationWrapperTest 8205081
-org.graalvm.compiler.hotspot.test.HsErrLogTest 8205081
-org.graalvm.compiler.hotspot.test.OptionsInFileTest 8205081
-org.graalvm.compiler.hotspot.test.ReservedStackAccessTest 8205081
org.graalvm.compiler.replacements.test.classfile.ClassfileBytecodeProviderTest 8205081
-org.graalvm.compiler.replacements.test.classfile.RedefineIntrinsicTest 8205081
org.graalvm.compiler.core.test.deopt.CompiledMethodTest 8202955
org.graalvm.compiler.core.test.CountedLoopTest 8211179
org.graalvm.compiler.debug.test.DebugContextTest 8203504
org.graalvm.compiler.hotspot.test.GraalOSRTest 8206947
+org.graalvm.compiler.hotspot.test.ReservedStackAccessTest 8213567 windows-all
org.graalvm.compiler.debug.test.TimerKeyTest 8213598
--- a/test/hotspot/jtreg/compiler/graalunit/common/GraalUnitTestLauncher.java Tue Nov 13 12:24:13 2018 -0800
+++ b/test/hotspot/jtreg/compiler/graalunit/common/GraalUnitTestLauncher.java Tue Nov 13 12:52:37 2018 -0800
@@ -31,6 +31,7 @@
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools;
+import jdk.test.lib.JDKToolFinder;
/*
* This is helper class used to run Graal unit tests.
@@ -262,6 +263,14 @@
ProcessBuilder javaPB = ProcessTools.createJavaProcessBuilder(true,
javaFlags.toArray(new String[javaFlags.size()]));
+
+ // Some tests rely on MX_SUBPROCESS_COMMAND_FILE env variable which contains
+ // name of the file with java executable and java args used to launch the current process.
+ Path cmdFile = Files.createTempFile(Path.of(""), "mx_subprocess_", ".cmd");
+ Files.writeString(cmdFile, JDKToolFinder.getJDKTool("java") + System.lineSeparator());
+ Files.write(cmdFile, javaFlags, StandardOpenOption.APPEND);
+ javaPB.environment().put("MX_SUBPROCESS_COMMAND_FILE", cmdFile.toAbsolutePath().toString());
+
System.out.println("INFO: run command: " + String.join(" ", javaPB.command()));
OutputAnalyzer outputAnalyzer = new OutputAnalyzer(javaPB.start());