mirror of
https://github.com/openjdk/jdk.git
synced 2026-05-14 07:29:51 +00:00
8164944: Refactor ProcessTools to get rid of dependency on java.management
Reviewed-by: kvn, gtriantafill, dfazunen, dholmes
This commit is contained in:
parent
c6675bd02f
commit
48440aaf23
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -26,7 +26,6 @@ package compiler.c2.cr7200264;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import jdk.test.lib.Asserts;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
@ -45,7 +44,7 @@ public class TestDriver {
|
||||
}
|
||||
|
||||
private List<String> executeApplication() throws Throwable {
|
||||
OutputAnalyzer outputAnalyzer = ProcessTools.executeTestJvmAllArgs(
|
||||
OutputAnalyzer outputAnalyzer = ProcessTools.executeTestJvm(
|
||||
"-Xbatch",
|
||||
"-XX:-TieredCompilation",
|
||||
"-XX:+PrintCompilation",
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -25,6 +25,7 @@ package compiler.compilercontrol.share.scenario;
|
||||
|
||||
import compiler.compilercontrol.share.actions.BaseAction;
|
||||
import jdk.test.lib.Asserts;
|
||||
import jdk.test.lib.management.InputArguments;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
import jdk.test.lib.dcmd.CommandExecutor;
|
||||
@ -38,6 +39,7 @@ import java.lang.reflect.Executable;
|
||||
import java.net.ServerSocket;
|
||||
import java.net.Socket;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -97,9 +99,13 @@ public class Executor {
|
||||
// Start separate thread to connect with test VM
|
||||
new Thread(() -> connectTestVM(serverSocket)).start();
|
||||
}
|
||||
// Start test VM
|
||||
output = ProcessTools.executeTestJvmAllArgs(
|
||||
vmOptions.toArray(new String[vmOptions.size()]));
|
||||
// Start a test VM using vm flags from @run and from vm options
|
||||
String[] vmInputArgs = InputArguments.getVmInputArgs();
|
||||
String[] cmds = Arrays.copyOf(vmInputArgs,
|
||||
vmInputArgs.length + vmOptions.size());
|
||||
System.arraycopy(vmOptions.toArray(), 0, cmds, vmInputArgs.length,
|
||||
vmOptions.size());
|
||||
output = ProcessTools.executeTestJvm(cmds);
|
||||
} catch (Throwable thr) {
|
||||
throw new Error("Execution failed: " + thr.getMessage(), thr);
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -30,11 +30,9 @@
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @modules jdk.internal.vm.ci/jdk.vm.ci.hotspot
|
||||
* @build jdk.internal.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
|
||||
* @run main/othervm compiler.jvmci.compilerToVM.DebugOutputTest
|
||||
* @run driver compiler.jvmci.compilerToVM.DebugOutputTest
|
||||
*/
|
||||
|
||||
// as soon as CODETOOLS-7901589 fixed, '@run main/othervm' should be replaced w/ '@run driver'
|
||||
|
||||
package compiler.jvmci.compilerToVM;
|
||||
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
@ -42,8 +40,11 @@ import jdk.test.lib.process.ProcessTools;
|
||||
import jdk.vm.ci.hotspot.CompilerToVMHelper;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
public class DebugOutputTest {
|
||||
private static final String VM_CI_MODULE = "jdk.internal.vm.ci";
|
||||
public static void main(String[] args) {
|
||||
new DebugOutputTest().test();
|
||||
}
|
||||
@ -53,10 +54,18 @@ public class DebugOutputTest {
|
||||
System.out.println(testCase);
|
||||
OutputAnalyzer oa;
|
||||
try {
|
||||
oa = ProcessTools.executeTestJvmAllArgs(
|
||||
Path patch = Paths.get(System.getProperty("test.patch.path"));
|
||||
Path jvmciPath = patch.resolve(VM_CI_MODULE).toAbsolutePath();
|
||||
if (!jvmciPath.toFile().exists()) {
|
||||
throw new Error("TESTBUG: patch for " + VM_CI_MODULE + " : "
|
||||
+ jvmciPath.toString() + " does not exist");
|
||||
}
|
||||
oa = ProcessTools.executeTestJvm(
|
||||
"-XX:+UnlockExperimentalVMOptions",
|
||||
"-XX:+EnableJVMCI",
|
||||
"-Xbootclasspath/a:.",
|
||||
"--add-exports", "java.base/jdk.internal.misc=ALL-UNNAMED",
|
||||
"--add-exports", "jdk.internal.vm.ci/jdk.vm.ci.hotspot=ALL-UNNAMED",
|
||||
"--patch-module", VM_CI_MODULE + "=" + jvmciPath.toString(),
|
||||
DebugOutputTest.Worker.class.getName(),
|
||||
testCase.name());
|
||||
} catch (Throwable e) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user