Skip to content

Commit 8528c52

Browse files
committed
8244078: ProcessTools executeTestJvm and createJavaProcessBuilder have inconsistent handling of test.*.opts
Reviewed-by: lucy Backport-of: 81597d9
1 parent 003bdbb commit 8528c52

File tree

78 files changed

+166
-185
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+166
-185
lines changed

test/hotspot/jtreg/compiler/aot/verification/ClassAndLibraryNotMatchTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ private void compileAotLibrary() {
9292
private void runAndCheckHelloWorld(String checkString) {
9393
ProcessBuilder pb;
9494
try {
95-
pb = ProcessTools.createJavaProcessBuilder(true, "-cp", ".",
95+
pb = ProcessTools.createTestJvm("-cp", ".",
9696
"-XX:+UnlockExperimentalVMOptions", "-XX:+UseAOT",
9797
"-XX:AOTLibrary=./" + LIB_NAME, HELLO_WORLD_CLASS_NAME);
9898
} catch (Exception e) {

test/hotspot/jtreg/compiler/aot/verification/vmflags/BasicFlagsChange.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ private static void runAndCheck(String option, String libName,
8787
so, a message like "skipped $pathTolibrary aot library" or
8888
"loaded $pathToLibrary aot library" is present for cases of
8989
incompatible or compatible flags respectively */
90-
pb = ProcessTools.createJavaProcessBuilder(true, "-XX:+UnlockExperimentalVMOptions",
90+
pb = ProcessTools.createTestJvm("-XX:+UnlockExperimentalVMOptions",
9191
"-XX:+UseAOT", "-XX:+PrintAOT", "-XX:AOTLibrary=./" + libName, option,
9292
HelloWorldPrinter.class.getName());
9393
} catch (Exception ex) {

test/hotspot/jtreg/compiler/arraycopy/stress/TestStressArrayCopy.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ public static void main(String... args) throws Exception {
172172
for (String className : classNames) {
173173
// Start a new job
174174
{
175-
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, mix(c, "-Xmx256m", className).toArray(new String[0]));
175+
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(mix(c, "-Xmx256m", className).toArray(new String[0]));
176176
Process p = pb.start();
177177
OutputAnalyzer oa = new OutputAnalyzer(p);
178178
forks.add(new Fork(p, oa));

test/hotspot/jtreg/compiler/ciReplay/CiReplayBase.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,10 @@ public boolean generateReplay(boolean needCoreDump, String... vmopts) {
137137
options.add(needCoreDump ? ENABLE_COREDUMP_ON_CRASH : DISABLE_COREDUMP_ON_CRASH);
138138
options.add(VERSION_OPTION);
139139
if (needCoreDump) {
140-
crashOut = ProcessTools.executeProcess(getTestJavaCommandlineWithPrefix(
140+
crashOut = ProcessTools.executeProcess(getTestJvmCommandlineWithPrefix(
141141
RUN_SHELL_NO_LIMIT, options.toArray(new String[0])));
142142
} else {
143-
crashOut = ProcessTools.executeProcess(ProcessTools.createJavaProcessBuilder(true,
144-
options));
143+
crashOut = ProcessTools.executeProcess(ProcessTools.createTestJvm(options));
145144
}
146145
crashOutputString = crashOut.getOutput();
147146
Asserts.assertNotEquals(crashOut.getExitValue(), 0, "Crash JVM exits gracefully");
@@ -185,7 +184,7 @@ public int startTest(String... additionalVmOpts) {
185184
List<String> allAdditionalOpts = new ArrayList<>();
186185
allAdditionalOpts.addAll(Arrays.asList(REPLAY_OPTIONS));
187186
allAdditionalOpts.addAll(Arrays.asList(additionalVmOpts));
188-
OutputAnalyzer oa = ProcessTools.executeProcess(getTestJavaCommandlineWithPrefix(
187+
OutputAnalyzer oa = ProcessTools.executeProcess(getTestJvmCommandlineWithPrefix(
189188
RUN_SHELL_ZERO_LIMIT, allAdditionalOpts.toArray(new String[0])));
190189
return oa.getExitValue();
191190
} catch (Throwable t) {
@@ -285,9 +284,9 @@ private String getCoreFileLocation(String crashOutputString) {
285284
return null;
286285
}
287286

288-
private String[] getTestJavaCommandlineWithPrefix(String prefix, String... args) {
287+
private String[] getTestJvmCommandlineWithPrefix(String prefix, String... args) {
289288
try {
290-
String cmd = ProcessTools.getCommandLine(ProcessTools.createJavaProcessBuilder(true, args));
289+
String cmd = ProcessTools.getCommandLine(ProcessTools.createTestJvm(args));
291290
return new String[]{"sh", "-c", prefix
292291
+ (Platform.isWindows() ? cmd.replace('\\', '/').replace(";", "\\;").replace("|", "\\|") : cmd)};
293292
} catch(Throwable t) {

test/hotspot/jtreg/compiler/ciReplay/SABase.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public void testAction() {
5757
}
5858
ProcessBuilder pb;
5959
try {
60-
pb = ProcessTools.createJavaProcessBuilder(true, "--add-modules", "jdk.hotspot.agent",
60+
pb = ProcessTools.createTestJvm("--add-modules", "jdk.hotspot.agent",
6161
"--add-exports=jdk.hotspot.agent/sun.jvm.hotspot=ALL-UNNAMED",
6262
"sun.jvm.hotspot.CLHSDB", JDKToolFinder.getTestJDKTool("java"),
6363
TEST_CORE_FILE_NAME);

test/hotspot/jtreg/compiler/graalunit/common/GraalUnitTestLauncher.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ static ArrayList<String> getListOfTestsByPrefix(String testPrefix, Set<String> e
112112
String classPath = String.join(File.pathSeparator, System.getProperty("java.class.path"),
113113
String.join(File.separator, libsDir, MXTOOL_JARFILE));
114114

115-
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(false,
115+
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
116116
"-cp", classPath,
117117
"com.oracle.mxtool.junit.FindClassesByAnnotatedMethods", graalUnitTestFilePath, testAnnotationName);
118118

@@ -263,8 +263,7 @@ public static void main(String... args) throws Exception {
263263

264264
javaFlags.add("@"+GENERATED_TESTCLASSES_FILENAME);
265265

266-
ProcessBuilder javaPB = ProcessTools.createJavaProcessBuilder(true,
267-
javaFlags);
266+
ProcessBuilder javaPB = ProcessTools.createTestJvm(javaFlags);
268267
System.out.println("INFO: run command: " + String.join(" ", javaPB.command()));
269268

270269
OutputAnalyzer outputAnalyzer = new OutputAnalyzer(javaPB.start());

test/hotspot/jtreg/compiler/runtime/cr8015436/Driver8015436.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ public class Driver8015436 {
3030
public static void main(String args[]) {
3131
OutputAnalyzer oa;
3232
try {
33-
oa = ProcessTools.executeProcess(ProcessTools.createJavaProcessBuilder(
34-
/* add test vm options */ true, Test8015436.class.getName()));
33+
oa = ProcessTools.executeProcess(ProcessTools.createTestJvm(
34+
Test8015436.class.getName()));
3535
} catch (Exception ex) {
3636
throw new Error("TESTBUG: exception while running child process: " + ex, ex);
3737
}

test/hotspot/jtreg/compiler/types/correctness/OffTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ private static void runTest() throws Exception {
8787
OPTIONS[TYPE_PROFILE_INDEX] = typeProfileLevel;
8888
OPTIONS[USE_TYPE_SPECULATION_INDEX] = useTypeSpeculation;
8989
OPTIONS[PROFILING_TYPE_INDEX] = type.name();
90-
ProcessBuilder processBuilder = ProcessTools.createJavaProcessBuilder(/* addTestVmOptions= */ true, OPTIONS);
90+
ProcessBuilder processBuilder = ProcessTools.createTestJvm(OPTIONS);
9191
OutputAnalyzer outputAnalyzer = new OutputAnalyzer(processBuilder.start());
9292
outputAnalyzer.shouldHaveExitValue(0);
9393
}

test/hotspot/jtreg/gc/TestAllocateHeapAt.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@
4040

4141
public class TestAllocateHeapAt {
4242
public static void main(String args[]) throws Exception {
43-
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
44-
true,
43+
ProcessBuilder pb = ProcessTools.createTestJvm(
4544
"-XX:AllocateHeapAt=" + System.getProperty("test.dir", "."),
4645
"-Xlog:gc+heap=info",
4746
"-Xmx32m",

test/hotspot/jtreg/gc/TestAllocateHeapAtError.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ public static void main(String args[]) throws Exception {
4646
f = new File(test_dir, UUID.randomUUID().toString());
4747
} while(f.exists());
4848

49-
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
50-
true,
49+
ProcessBuilder pb = ProcessTools.createTestJvm(
5150
"-XX:AllocateHeapAt=" + f.getName(),
5251
"-Xlog:gc+heap=info",
5352
"-Xmx32m",

0 commit comments

Comments
 (0)