8240698: LingeredApp does not pass getTestJavaOpts() to the children process if vmArguments is already specified
Reviewed-by: iignatyev, iklam, cjplummer
This commit is contained in:
parent
e08f25a942
commit
13af7bb9ad
test
hotspot/jtreg
ProblemList-aot.txtProblemList-zgc.txtProblemList.txt
resourcehogs/serviceability/sa
serviceability/sa
ClhsdbFindPC.javaClhsdbFlags.javaClhsdbJstack.javaClhsdbScanOops.javaDeadlockDetectionTest.javaTestCpoolForInvokeDynamic.javaTestDefaultMethods.javaTestG1HeapRegion.javaTestHeapDumpForInvokeDynamic.javaTestInstanceKlassSize.javaTestJhsdbJstackMixed.javaTestPrintMdo.javaTestRevPtrsForInvokeDynamic.java
jdk/sun
jvmstat/monitor/MonitoredVm
tools
lib/jdk/test/lib/apps
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2019, 2020, 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
|
||||
@ -32,12 +32,15 @@ serviceability/sa/ClhsdbAttach.java 8216181 generic-all
|
||||
serviceability/sa/ClhsdbCDSCore.java 8216181 generic-all
|
||||
serviceability/sa/ClhsdbCDSJstackPrintAll.java 8216181 generic-all
|
||||
serviceability/sa/ClhsdbField.java 8216181 generic-all
|
||||
serviceability/sa/ClhsdbFindPC.java 8216181 generic-all
|
||||
serviceability/sa/ClhsdbFindPC.java#id0 8216181 generic-all
|
||||
serviceability/sa/ClhsdbFindPC.java#id1 8216181 generic-all
|
||||
serviceability/sa/ClhsdbFlags.java 8216181 generic-all
|
||||
serviceability/sa/ClhsdbInspect.java 8216181 generic-all
|
||||
serviceability/sa/ClhsdbJdis.java 8216181 generic-all
|
||||
serviceability/sa/ClhsdbJhisto.java 8216181 generic-all
|
||||
serviceability/sa/ClhsdbJstack.java 8216181 generic-all
|
||||
serviceability/sa/ClhsdbJstack.java#id0 8216181 generic-all
|
||||
serviceability/sa/ClhsdbJstack.java#id1 8216181 generic-all
|
||||
serviceability/sa/ClhsdbJstackXcompStress.java 8216181 generic-all
|
||||
serviceability/sa/ClhsdbLongConstant.java 8216181 generic-all
|
||||
serviceability/sa/ClhsdbPmap.java 8216181 generic-all
|
||||
serviceability/sa/ClhsdbPrintAll.java 8216181 generic-all
|
||||
@ -45,7 +48,8 @@ serviceability/sa/ClhsdbPrintAs.java 8216181 generic-all
|
||||
serviceability/sa/ClhsdbPrintStatics.java 8216181 generic-all
|
||||
serviceability/sa/ClhsdbPstack.java 8216181 generic-all
|
||||
serviceability/sa/ClhsdbRegionDetailsScanOopsForG1.java 8216181 generic-all
|
||||
serviceability/sa/ClhsdbScanOops.java 8216181 generic-all
|
||||
serviceability/sa/ClhsdbScanOops.java#id0 8216181 generic-all
|
||||
serviceability/sa/ClhsdbScanOops.java#id1 8216181 generic-all
|
||||
serviceability/sa/ClhsdbSource.java 8216181 generic-all
|
||||
serviceability/sa/ClhsdbThread.java 8216181 generic-all
|
||||
serviceability/sa/ClhsdbVmStructsDump.java 8216181 generic-all
|
||||
|
@ -28,10 +28,16 @@
|
||||
#############################################################################
|
||||
|
||||
resourcehogs/serviceability/sa/TestHeapDumpForLargeArray.java 8220624 generic-all
|
||||
serviceability/sa/CDSJMapClstats.java 8220624 generic-all
|
||||
serviceability/sa/ClhsdbCDSJstackPrintAll.java 8220624 generic-all
|
||||
serviceability/sa/ClhsdbFindPC.java#id0 8220624 generic-all
|
||||
serviceability/sa/ClhsdbFindPC.java#id1 8220624 generic-all
|
||||
serviceability/sa/ClhsdbInspect.java 8220624 generic-all
|
||||
serviceability/sa/ClhsdbJdis.java 8220624 generic-all
|
||||
serviceability/sa/ClhsdbJhisto.java 8220624 generic-all
|
||||
serviceability/sa/ClhsdbJstack.java 8220624 generic-all
|
||||
serviceability/sa/ClhsdbJstack.java#id0 8220624 generic-all
|
||||
serviceability/sa/ClhsdbJstack.java#id1 8220624 generic-all
|
||||
serviceability/sa/ClhsdbJstackXcompStress.java 8220624 generic-all
|
||||
serviceability/sa/ClhsdbPrintAs.java 8220624 generic-all
|
||||
serviceability/sa/ClhsdbPrintStatics.java 8220624 generic-all
|
||||
serviceability/sa/ClhsdbPstack.java 8220624 generic-all
|
||||
|
@ -103,7 +103,8 @@ serviceability/sa/ClhsdbCDSCore.java 8193639 solaris-all
|
||||
serviceability/sa/ClhsdbCDSJstackPrintAll.java 8193639 solaris-all
|
||||
serviceability/sa/CDSJMapClstats.java 8193639 solaris-all
|
||||
serviceability/sa/ClhsdbField.java 8193639 solaris-all
|
||||
serviceability/sa/ClhsdbFindPC.java 8193639 solaris-all
|
||||
serviceability/sa/ClhsdbFindPC.java#id0 8193639 solaris-all
|
||||
serviceability/sa/ClhsdbFindPC.java#id1 8193639 solaris-all
|
||||
serviceability/sa/ClhsdbFlags.java 8193639 solaris-all
|
||||
serviceability/sa/ClhsdbInspect.java 8193639 solaris-all
|
||||
serviceability/sa/ClhsdbJdis.java 8193639 solaris-all
|
||||
@ -117,7 +118,8 @@ serviceability/sa/ClhsdbPrintAs.java 8193639 solaris-all
|
||||
serviceability/sa/ClhsdbPrintStatics.java 8193639 solaris-all
|
||||
serviceability/sa/ClhsdbPstack.java 8193639 solaris-all
|
||||
serviceability/sa/ClhsdbRegionDetailsScanOopsForG1.java 8193639 solaris-all
|
||||
serviceability/sa/ClhsdbScanOops.java 8193639,8235220,8230731 solaris-all,linux-x64,macosx-x64,windows-x64
|
||||
serviceability/sa/ClhsdbScanOops.java#id0 8193639,8235220,8230731 solaris-all,linux-x64,macosx-x64,windows-x64
|
||||
serviceability/sa/ClhsdbScanOops.java#id1 8193639,8235220,8230731 solaris-all,linux-x64,macosx-x64,windows-x64
|
||||
serviceability/sa/ClhsdbSource.java 8193639 solaris-all
|
||||
serviceability/sa/ClhsdbThread.java 8193639 solaris-all
|
||||
serviceability/sa/ClhsdbVmStructsDump.java 8193639 solaris-all
|
||||
@ -125,7 +127,7 @@ serviceability/sa/ClhsdbWhere.java 8193639 solaris-all
|
||||
serviceability/sa/DeadlockDetectionTest.java 8193639 solaris-all
|
||||
serviceability/sa/JhsdbThreadInfoTest.java 8193639 solaris-all
|
||||
serviceability/sa/jmap-hprof/JMapHProfLargeHeapTest.java 8193639 solaris-all
|
||||
serviceability/sa/sadebugd/DebugdConnectTest.java 8239062 macosx-x64
|
||||
serviceability/sa/sadebugd/DebugdConnectTest.java 8239062 macosx-x64
|
||||
serviceability/sa/TestClassDump.java 8193639 solaris-all
|
||||
serviceability/sa/TestClhsdbJstackLock.java 8193639 solaris-all
|
||||
serviceability/sa/TestCpoolForInvokeDynamic.java 8193639 solaris-all
|
||||
|
@ -25,6 +25,7 @@
|
||||
* @test
|
||||
* @bug 8175312
|
||||
* @summary Test clhsdb 'g1regiondetails' and 'scanoops' commands for G1GC
|
||||
* @requires vm.gc.G1
|
||||
* @requires vm.hasSA & (vm.bits == "64" & os.maxMemory > 8g)
|
||||
* @library /test/lib /test/hotspot/jtreg/serviceability/sa
|
||||
* @run main/othervm/timeout=2400 ClhsdbRegionDetailsScanOopsForG1
|
||||
|
@ -21,23 +21,11 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.io.File;
|
||||
import java.nio.file.Files;
|
||||
import java.io.IOException;
|
||||
import java.io.BufferedInputStream;
|
||||
import java.util.stream.Collectors;
|
||||
import java.io.FileInputStream;
|
||||
|
||||
import sun.jvm.hotspot.HotSpotAgent;
|
||||
import sun.jvm.hotspot.debugger.*;
|
||||
|
||||
import jdk.test.lib.apps.LingeredApp;
|
||||
import jdk.test.lib.Asserts;
|
||||
import jdk.test.lib.JDKToolLauncher;
|
||||
import jdk.test.lib.JDKToolFinder;
|
||||
import jdk.test.lib.Platform;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
import jdk.test.lib.SA.SATestUtils;
|
||||
@ -104,7 +92,7 @@ public class TestHeapDumpForLargeArray {
|
||||
"-Xmx8g");
|
||||
|
||||
theApp = new LingeredAppWithLargeArray();
|
||||
LingeredApp.startApp(theApp, vmArgs);
|
||||
LingeredApp.startAppExactJvmOpts(theApp, vmArgs);
|
||||
attachAndDump(heapDumpFileName, theApp.getPid());
|
||||
} finally {
|
||||
LingeredApp.stopApp(theApp);
|
||||
|
@ -36,7 +36,18 @@ import jtreg.SkippedException;
|
||||
* @requires vm.hasSA
|
||||
* @requires vm.compiler1.enabled
|
||||
* @library /test/lib
|
||||
* @run main/othervm/timeout=480 ClhsdbFindPC
|
||||
* @run main/othervm/timeout=480 ClhsdbFindPC true
|
||||
*/
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @bug 8193124
|
||||
* @summary Test the clhsdb 'findpc' command
|
||||
* @requires vm.compMode != "Xcomp"
|
||||
* @requires vm.hasSA
|
||||
* @requires vm.compiler1.enabled
|
||||
* @library /test/lib
|
||||
* @run main/othervm/timeout=480 ClhsdbFindPC false
|
||||
*/
|
||||
|
||||
public class ClhsdbFindPC {
|
||||
@ -104,9 +115,9 @@ public class ClhsdbFindPC {
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
boolean xComp = Boolean.parseBoolean(args[0]);
|
||||
System.out.println("Starting the ClhsdbFindPC test");
|
||||
testFindPC(true);
|
||||
testFindPC(false);
|
||||
testFindPC(xComp);
|
||||
System.out.println("Test PASSED");
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,6 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -49,11 +48,10 @@ public class ClhsdbFlags {
|
||||
LingeredApp theApp = null;
|
||||
try {
|
||||
ClhsdbLauncher test = new ClhsdbLauncher();
|
||||
String[] vmArgs = Utils.appendTestJavaOpts(
|
||||
"-XX:+UnlockExperimentalVMOptions",
|
||||
"-XX:+UnlockDiagnosticVMOptions",
|
||||
"-XX:-MaxFDLimit");
|
||||
theApp = LingeredApp.startApp(vmArgs);
|
||||
theApp = LingeredApp.startApp(
|
||||
"-XX:+UnlockExperimentalVMOptions",
|
||||
"-XX:+UnlockDiagnosticVMOptions",
|
||||
"-XX:-MaxFDLimit");
|
||||
System.out.println("Started LingeredApp with pid " + theApp.getPid());
|
||||
|
||||
List<String> cmds = List.of(
|
||||
@ -111,7 +109,8 @@ public class ClhsdbFlags {
|
||||
"-XX:OnError='echo error'", // ccstrlist
|
||||
"-XX:CompileThresholdScaling=1.0", // double
|
||||
"-XX:ErrorLogTimeout=120"); // uint64_t
|
||||
theApp = LingeredApp.startApp(vmArgs);
|
||||
theApp = new LingeredApp();
|
||||
LingeredApp.startAppExactJvmOpts(theApp, vmArgs);
|
||||
System.out.println("Started LingeredApp with pid " + theApp.getPid());
|
||||
|
||||
List<String> cmds = List.of("flags");
|
||||
|
@ -34,7 +34,17 @@ import jtreg.SkippedException;
|
||||
* @summary Test clhsdb Jstack command
|
||||
* @requires vm.hasSA
|
||||
* @library /test/lib
|
||||
* @run main/othervm/timeout=480 ClhsdbJstack
|
||||
* @run main/othervm/timeout=480 ClhsdbJstack true
|
||||
*/
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @bug 8190198
|
||||
* @requires vm.compMode != "Xcomp"
|
||||
* @summary Test clhsdb Jstack command
|
||||
* @requires vm.hasSA
|
||||
* @library /test/lib
|
||||
* @run main/othervm/timeout=480 ClhsdbJstack false
|
||||
*/
|
||||
|
||||
public class ClhsdbJstack {
|
||||
@ -74,9 +84,9 @@ public class ClhsdbJstack {
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
boolean xComp = Boolean.parseBoolean(args[0]);
|
||||
System.out.println("Starting ClhsdbJstack test");
|
||||
testJstack(false);
|
||||
testJstack(true);
|
||||
testJstack(xComp);
|
||||
System.out.println("Test PASSED");
|
||||
}
|
||||
}
|
||||
|
@ -25,9 +25,20 @@
|
||||
* @test
|
||||
* @bug 8192985
|
||||
* @summary Test the clhsdb 'scanoops' command
|
||||
* @requires vm.gc.ParallelGC
|
||||
* @requires vm.hasSA
|
||||
* @library /test/lib
|
||||
* @run main/othervm/timeout=1200 ClhsdbScanOops
|
||||
* @run main/othervm/timeout=1200 ClhsdbScanOops UseParallelGC
|
||||
*/
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @bug 8192985
|
||||
* @summary Test the clhsdb 'scanoops' command
|
||||
* @requires vm.gc.SerialGC
|
||||
* @requires vm.hasSA
|
||||
* @library /test/lib
|
||||
* @run main/othervm/timeout=1200 ClhsdbScanOops UseSerialGC
|
||||
*/
|
||||
|
||||
import java.util.HashMap;
|
||||
@ -99,9 +110,9 @@ public class ClhsdbScanOops {
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
String gc = args[0];
|
||||
System.out.println("Starting the ClhsdbScanOops test");
|
||||
testWithGcType("-XX:+UseParallelGC");
|
||||
testWithGcType("-XX:+UseSerialGC");
|
||||
testWithGcType("-XX:+" + gc);
|
||||
System.out.println("Test PASSED");
|
||||
}
|
||||
}
|
||||
|
@ -77,10 +77,8 @@ public class DeadlockDetectionTest {
|
||||
}
|
||||
|
||||
try {
|
||||
String[] vmArgs = Utils.appendTestJavaOpts("-XX:+UsePerfData");
|
||||
|
||||
theApp = new LingeredAppWithDeadlock();
|
||||
LingeredApp.startApp(theApp, vmArgs);
|
||||
LingeredApp.startApp(theApp, "-XX:+UsePerfData");
|
||||
OutputAnalyzer output = jstack("--pid", Long.toString(theApp.getPid()));
|
||||
System.out.println(output.getOutput());
|
||||
|
||||
|
@ -125,11 +125,8 @@ public class TestCpoolForInvokeDynamic {
|
||||
|
||||
if (args == null || args.length == 0) {
|
||||
try {
|
||||
String[] vmArgs = Utils.appendTestJavaOpts(
|
||||
"-XX:+UsePerfData");
|
||||
|
||||
theApp = new LingeredAppWithInvokeDynamic();
|
||||
LingeredApp.startApp(theApp, vmArgs);
|
||||
LingeredApp.startApp(theApp, "-XX:+UsePerfData");
|
||||
createAnotherToAttach(instanceKlassNames,
|
||||
theApp.getPid());
|
||||
} finally {
|
||||
|
@ -135,10 +135,8 @@ public class TestDefaultMethods {
|
||||
|
||||
if (args == null || args.length == 0) {
|
||||
try {
|
||||
String[] vmArgs = Utils.appendTestJavaOpts("-XX:+UsePerfData");
|
||||
|
||||
theApp = new LingeredAppWithDefaultMethods();
|
||||
LingeredApp.startApp(theApp, vmArgs);
|
||||
LingeredApp.startApp(theApp, "-XX:+UsePerfData");
|
||||
createAnotherToAttach(instanceKlassNames,
|
||||
theApp.getPid());
|
||||
} finally {
|
||||
|
@ -93,12 +93,8 @@ public class TestG1HeapRegion {
|
||||
SATestUtils.skipIfCannotAttach(); // throws SkippedException if attach not expected to work.
|
||||
if (args == null || args.length == 0) {
|
||||
try {
|
||||
String[] vmArgs = Utils.appendTestJavaOpts(
|
||||
"-XX:+UsePerfData",
|
||||
"-XX:+UseG1GC");
|
||||
|
||||
theApp = new LingeredApp();
|
||||
LingeredApp.startApp(theApp, vmArgs);
|
||||
LingeredApp.startApp(theApp, "-XX:+UsePerfData", "-XX:+UseG1GC");
|
||||
createAnotherToAttach(theApp.getPid());
|
||||
} finally {
|
||||
LingeredApp.stopApp(theApp);
|
||||
|
@ -121,12 +121,8 @@ public class TestHeapDumpForInvokeDynamic {
|
||||
}
|
||||
|
||||
try {
|
||||
String[] vmArgs = Utils.appendTestJavaOpts(
|
||||
"-XX:+UsePerfData",
|
||||
"-Xmx512m");
|
||||
|
||||
theApp = new LingeredAppWithInvokeDynamic();
|
||||
LingeredApp.startApp(theApp, vmArgs);
|
||||
LingeredApp.startApp(theApp, "-XX:+UsePerfData", "-Xmx512m");
|
||||
attachDumpAndVerify(heapDumpFileName, theApp.getPid());
|
||||
} finally {
|
||||
LingeredApp.stopApp(theApp);
|
||||
|
@ -74,8 +74,7 @@ public class TestInstanceKlassSize {
|
||||
LingeredApp app = null;
|
||||
OutputAnalyzer output = null;
|
||||
try {
|
||||
String[] vmArgs = Utils.appendTestJavaOpts("-XX:+UsePerfData");
|
||||
app = LingeredApp.startApp(vmArgs);
|
||||
app = LingeredApp.startApp("-XX:+UsePerfData");
|
||||
System.out.println ("Started LingeredApp with pid " + app.getPid());
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
|
@ -172,7 +172,7 @@ public class TestJhsdbJstackMixed {
|
||||
: Utils.getTestJavaOpts();
|
||||
|
||||
app = new LingeredAppWithNativeMethod();
|
||||
LingeredApp.startApp(app, vmArgs);
|
||||
LingeredApp.startAppExactJvmOpts(app, vmArgs);
|
||||
System.out.println("Started LingeredApp with pid " + app.getPid());
|
||||
runJstackMixedInLoop(app);
|
||||
System.out.println("Test Completed");
|
||||
|
@ -45,10 +45,7 @@ public class TestPrintMdo {
|
||||
LingeredApp app = null;
|
||||
try {
|
||||
ClhsdbLauncher test = new ClhsdbLauncher();
|
||||
String[] vmArgs = Utils.appendTestJavaOpts(
|
||||
"-XX:+ProfileInterpreter");
|
||||
|
||||
app = LingeredApp.startApp(vmArgs);
|
||||
app = LingeredApp.startApp("-XX:+ProfileInterpreter");
|
||||
System.out.println ("Started LingeredApp with pid " + app.getPid());
|
||||
List<String> cmds = List.of("printmdo -a");
|
||||
|
||||
|
@ -85,10 +85,8 @@ public class TestRevPtrsForInvokeDynamic {
|
||||
SATestUtils.skipIfCannotAttach(); // throws SkippedException if attach not expected to work.
|
||||
if (args == null || args.length == 0) {
|
||||
try {
|
||||
String[] vmArgs = Utils.appendTestJavaOpts("-XX:+UsePerfData");
|
||||
|
||||
theApp = new LingeredAppWithInvokeDynamic();
|
||||
LingeredApp.startApp(theApp, vmArgs);
|
||||
LingeredApp.startApp(theApp, "-XX:+UsePerfData");
|
||||
createAnotherToAttach(theApp.getPid());
|
||||
} finally {
|
||||
LingeredApp.stopApp(theApp);
|
||||
|
@ -54,8 +54,7 @@ public class TestPollingInterval {
|
||||
MonitorException, URISyntaxException {
|
||||
LingeredApp app = null;
|
||||
try {
|
||||
String[] vmArgs = Utils.appendTestJavaOpts("-XX:+UsePerfData");
|
||||
app = LingeredApp.startApp(vmArgs);
|
||||
app = LingeredApp.startApp("-XX:+UsePerfData");
|
||||
|
||||
MonitoredHost localHost = MonitoredHost.getMonitoredHost("localhost");
|
||||
String uriString = "//" + app.getPid() + "?mode=r"; // NOI18N
|
||||
|
@ -99,7 +99,8 @@ public class TmtoolTestScenario {
|
||||
List<String> vmArgsExtended = new ArrayList<String>();
|
||||
vmArgsExtended.add("-XX:+UsePerfData");
|
||||
Collections.addAll(vmArgsExtended, vmArgs);
|
||||
theApp = LingeredApp.startApp(vmArgsExtended.toArray(new String[0]));
|
||||
theApp = new LingeredApp();
|
||||
LingeredApp.startAppExactJvmOpts(theApp, vmArgsExtended.toArray(new String[0]));
|
||||
|
||||
System.out.println("Starting " + toolName + " against " + theApp.getPid());
|
||||
JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jhsdb");
|
||||
@ -112,7 +113,7 @@ public class TmtoolTestScenario {
|
||||
launcher.addToolArg(Long.toString(theApp.getPid()));
|
||||
|
||||
ProcessBuilder processBuilder = SATestUtils.createProcessBuilder(launcher);
|
||||
processBuilder.redirectError(ProcessBuilder.Redirect.INHERIT);
|
||||
processBuilder.redirectError(ProcessBuilder.Redirect.INHERIT);
|
||||
Process toolProcess = processBuilder.start();
|
||||
|
||||
// By default child process output stream redirected to pipe, so we are reading it in foreground.
|
||||
|
@ -60,8 +60,8 @@ public class JInfoTest {
|
||||
LingeredApp app2 = new JInfoTestLingeredApp();
|
||||
try {
|
||||
String[] params = new String[0];;
|
||||
LingeredApp.startApp(app1, params);
|
||||
LingeredApp.startApp(app2, params);
|
||||
LingeredApp.startAppExactJvmOpts(app1, params);
|
||||
LingeredApp.startAppExactJvmOpts(app2, params);
|
||||
OutputAnalyzer output = jinfo("-flag", "MinHeapFreeRatio=1", "JInfoTestLingeredApp");
|
||||
output.shouldHaveExitValue(0);
|
||||
output = jinfo("-flag", "MinHeapFreeRatio", "JInfoTestLingeredApp");
|
||||
@ -85,8 +85,8 @@ public class JInfoTest {
|
||||
LingeredApp app2 = new JInfoTestLingeredApp();
|
||||
try {
|
||||
String[] params = new String[0];
|
||||
LingeredApp.startApp(app1, params);
|
||||
LingeredApp.startApp(app2, params);
|
||||
LingeredApp.startAppExactJvmOpts(app1, params);
|
||||
LingeredApp.startAppExactJvmOpts(app2, params);
|
||||
OutputAnalyzer output = jinfo("JInfoTestLingeredApp");
|
||||
output.shouldHaveExitValue(0);
|
||||
// "Runtime Environment" written once per proc
|
||||
|
@ -57,7 +57,7 @@ import jdk.test.lib.process.StreamPumper;
|
||||
*
|
||||
* a = new SmartTestApp("MyLock.lck");
|
||||
* a.createLock();
|
||||
* a.runApp();
|
||||
* a.runAppExactJvmOpts(Utils.getTestJavaOpts());
|
||||
* a.waitAppReady();
|
||||
* // do something
|
||||
* a.deleteLock();
|
||||
@ -283,7 +283,7 @@ public class LingeredApp {
|
||||
* Analyze an environment and prepare a command line to
|
||||
* run the app, app name should be added explicitly
|
||||
*/
|
||||
public List<String> runAppPrepare(String[] vmArguments) {
|
||||
private List<String> runAppPrepare(String[] vmArguments) {
|
||||
// We should always use testjava or throw an exception,
|
||||
// so we can't use JDKToolFinder.getJDKTool("java");
|
||||
// that falls back to compile java on error
|
||||
@ -303,13 +303,6 @@ public class LingeredApp {
|
||||
|
||||
List<String> cmd = new ArrayList<String>();
|
||||
cmd.add(javapath);
|
||||
|
||||
if (vmArguments == null) {
|
||||
// Propagate getTestJavaOpts() to LingeredApp
|
||||
vmArguments = Utils.getTestJavaOpts();
|
||||
} else {
|
||||
// Lets user manage LingeredApp options
|
||||
}
|
||||
Collections.addAll(cmd, vmArguments);
|
||||
|
||||
// Make sure we set correct classpath to run the app
|
||||
@ -335,14 +328,14 @@ public class LingeredApp {
|
||||
|
||||
/**
|
||||
* Run the app.
|
||||
*
|
||||
* @param vmArguments
|
||||
* User should provide exact options to run app. Might use #Utils.getTestJavaOpts() to set default test options.
|
||||
* @param vmOpts
|
||||
* @throws IOException
|
||||
*/
|
||||
public void runApp(String[] vmArguments)
|
||||
public void runAppExactJvmOpts(String[] vmOpts)
|
||||
throws IOException {
|
||||
|
||||
List<String> cmd = runAppPrepare(vmArguments);
|
||||
List<String> cmd = runAppPrepare(vmOpts);
|
||||
|
||||
cmd.add(this.getAppName());
|
||||
cmd.add(lockFileName);
|
||||
@ -392,17 +385,19 @@ public class LingeredApp {
|
||||
/**
|
||||
* High level interface for test writers
|
||||
*/
|
||||
|
||||
/**
|
||||
* Factory method that starts pre-created LingeredApp
|
||||
* lock name is autogenerated
|
||||
* @param cmd - vm options, could be null to auto add Utils.getTestJavaOpts()
|
||||
* User should provide exact options to run app. Might use #Utils.getTestJavaOpts() to set default test options.
|
||||
* @param jvmOpts - the exact vm options used to start LingeredApp
|
||||
* @param theApp - app to start
|
||||
* @throws IOException
|
||||
*/
|
||||
public static void startApp(LingeredApp theApp, String... cmd) throws IOException {
|
||||
public static void startAppExactJvmOpts(LingeredApp theApp, String... jvmOpts) throws IOException {
|
||||
theApp.createLock();
|
||||
try {
|
||||
theApp.runApp(cmd);
|
||||
theApp.runAppExactJvmOpts(jvmOpts);
|
||||
theApp.waitAppReady(appWaitTime);
|
||||
} catch (Exception ex) {
|
||||
theApp.deleteLock();
|
||||
@ -410,17 +405,28 @@ public class LingeredApp {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Factory method that starts pre-created LingeredApp
|
||||
* lock name is autogenerated, additionalJvmOpts are appended to default test options
|
||||
* @param additionalJvmOpts - additional Jvm options, appended to #Utils.getTestJavaOpts();
|
||||
* @param theApp - app to start
|
||||
* @throws IOException
|
||||
*/
|
||||
public static void startApp(LingeredApp theApp, String... additionalJvmOpts) throws IOException {
|
||||
startAppExactJvmOpts(theApp, Utils.prependTestJavaOpts(additionalJvmOpts));
|
||||
}
|
||||
|
||||
/**
|
||||
* Factory method that creates LingeredApp object with ready to use application
|
||||
* lock name is autogenerated
|
||||
* @param cmd - vm options, could be null to auto add Utils.getTestJavaOpts()
|
||||
* lock name is autogenerated, additionalJvmOpts are appended to default test options
|
||||
* @param additionalJvmOpts - additional Jvm options, appended to #Utils.getTestJavaOpts();
|
||||
* @return LingeredApp object
|
||||
* @throws IOException
|
||||
*/
|
||||
public static LingeredApp startApp(String... cmd) throws IOException {
|
||||
public static LingeredApp startApp(String... additionalJvmOpts) throws IOException {
|
||||
LingeredApp a = new LingeredApp();
|
||||
try {
|
||||
startApp(a, cmd);
|
||||
startApp(a, additionalJvmOpts);
|
||||
} catch (Exception ex) {
|
||||
System.err.println("LingeredApp failed to start: " + ex);
|
||||
a.finishApp();
|
||||
|
Loading…
x
Reference in New Issue
Block a user