Skip to content

Commit

Permalink
8237111: LingeredApp should be started with getTestJavaOpts
Browse files Browse the repository at this point in the history
Reviewed-by: cjplummer, dholmes
  • Loading branch information
stefank committed Jan 24, 2020
1 parent 46423b0 commit c8e7590
Show file tree
Hide file tree
Showing 49 changed files with 244 additions and 294 deletions.
11 changes: 10 additions & 1 deletion test/hotspot/jtreg/ProblemList-zgc.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -27,15 +27,24 @@
#
#############################################################################

resourcehogs/serviceability/sa/TestHeapDumpForLargeArray.java 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/ClhsdbPrintAs.java 8220624 generic-all
serviceability/sa/ClhsdbPrintStatics.java 8220624 generic-all
serviceability/sa/ClhsdbPstack.java 8220624 generic-all
serviceability/sa/ClhsdbSource.java 8220624 generic-all
serviceability/sa/ClhsdbThread.java 8220624 generic-all
serviceability/sa/ClhsdbWhere.java 8220624 generic-all
serviceability/sa/DeadlockDetectionTest.java 8220624 generic-all
serviceability/sa/JhsdbThreadInfoTest.java 8220624 generic-all
serviceability/sa/TestClhsdbJstackLock.java 8220624 generic-all
serviceability/sa/TestHeapDumpForInvokeDynamic.java 8220624 generic-all
serviceability/sa/TestHeapDumpForLargeArray.java 8220624 generic-all
serviceability/sa/TestJhsdbJstackLock.java 8220624 generic-all
serviceability/sa/TestJhsdbJstackMixed.java 8220624 generic-all
serviceability/sa/TestJmapCore.java 8220624 generic-all
serviceability/sa/TestJmapCoreMetaspace.java 8219443 generic-all
serviceability/sa/sadebugd/DebugdConnectTest.java 8220624 generic-all
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 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
Expand Down Expand Up @@ -45,13 +45,12 @@ public static void main(String[] args) throws Exception {
LingeredAppWithLargeStringArray theApp = null;
try {
ClhsdbLauncher test = new ClhsdbLauncher();
List<String> vmArgs = new ArrayList<String>();
vmArgs.add("-XX:+UseG1GC");
vmArgs.add("-Xmx8g");
vmArgs.add("-XX:G1HeapRegionSize=2m");

theApp = new LingeredAppWithLargeStringArray();
LingeredApp.startApp(vmArgs, theApp);
LingeredApp.startApp(theApp,
"-XX:+UseG1GC",
"-Xmx8g",
"-XX:G1HeapRegionSize=2m");
System.out.println("Started LingeredAppWithLargeStringArray with pid " + theApp.getPid());

List<String> cmds = List.of("g1regiondetails");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 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
Expand Down Expand Up @@ -98,13 +98,12 @@ public static void main (String... args) throws Exception {
// Need to add the default arguments first to have explicit
// -Xmx8g last, otherwise test will fail if default
// arguments contain a smaller -Xmx.
List<String> vmArgs = new ArrayList<String>();
vmArgs.addAll(Utils.getVmOptions());
vmArgs.add("-XX:+UsePerfData");
vmArgs.add("-Xmx8g");
String[] vmArgs = Utils.prependTestJavaOpts(
"-XX:+UsePerfData",
"-Xmx8g");

theApp = new LingeredAppWithLargeArray();
LingeredApp.startApp(vmArgs, theApp);
LingeredApp.startApp(theApp, vmArgs);
attachAndDump(heapDumpFileName, theApp.getPid());
} finally {
LingeredApp.stopApp(theApp);
Expand Down
5 changes: 2 additions & 3 deletions test/hotspot/jtreg/serviceability/sa/CDSJMapClstats.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 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
Expand Down Expand Up @@ -71,11 +71,10 @@ public static void main(String[] args) throws Exception {
CDSOptions opts = (new CDSOptions()).setArchiveName(sharedArchiveName);
CDSTestUtils.createArchiveAndCheck(opts);

List<String> vmArgs = Arrays.asList(
theApp = LingeredApp.startApp(
"-XX:+UnlockDiagnosticVMOptions",
"-XX:SharedArchiveFile=" + sharedArchiveName,
"-Xshare:auto");
theApp = LingeredApp.startApp(vmArgs);
System.out.println("Started LingeredApp with pid " + theApp.getPid());
runClstats(theApp.getPid());
} catch (Exception ex) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 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
Expand Down Expand Up @@ -51,11 +51,10 @@ public static void main(String[] args) throws Exception {
CDSTestUtils.createArchiveAndCheck(opts);

ClhsdbLauncher test = new ClhsdbLauncher();
List<String> vmArgs = Arrays.asList(
theApp = LingeredApp.startApp(
"-XX:+UnlockDiagnosticVMOptions",
"-XX:SharedArchiveFile=" + sharedArchiveName,
"-Xshare:auto");
theApp = LingeredApp.startApp(vmArgs);
System.out.println("Started LingeredApp with pid " + theApp.getPid());

// Ensure that UseSharedSpaces is turned on.
Expand Down
7 changes: 3 additions & 4 deletions test/hotspot/jtreg/serviceability/sa/ClhsdbFindPC.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 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
Expand Down Expand Up @@ -48,9 +48,9 @@ private static void testFindPC(boolean withXcomp) throws Exception {

theApp = new LingeredAppWithTrivialMain();
if (withXcomp) {
LingeredApp.startApp(List.of("-Xcomp"), theApp);
LingeredApp.startApp(theApp, "-Xcomp");
} else {
LingeredApp.startApp(List.of("-Xint"), theApp);
LingeredApp.startApp(theApp, "-Xint");
}
System.out.print("Started LingeredApp ");
if (withXcomp) {
Expand Down Expand Up @@ -114,4 +114,3 @@ public static void main(String[] args) throws Exception {
System.out.println("Test PASSED");
}
}

35 changes: 17 additions & 18 deletions test/hotspot/jtreg/serviceability/sa/ClhsdbFlags.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 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
Expand Down Expand Up @@ -49,11 +49,10 @@ public static void runBasicTest() throws Exception {
LingeredApp theApp = null;
try {
ClhsdbLauncher test = new ClhsdbLauncher();
List<String> vmArgs = new ArrayList<String>();
vmArgs.add("-XX:+UnlockExperimentalVMOptions");
vmArgs.add("-XX:+UnlockDiagnosticVMOptions");
vmArgs.add("-XX:-MaxFDLimit");
vmArgs.addAll(Utils.getVmOptions());
String[] vmArgs = Utils.appendTestJavaOpts(
"-XX:+UnlockExperimentalVMOptions",
"-XX:+UnlockDiagnosticVMOptions",
"-XX:-MaxFDLimit");
theApp = LingeredApp.startApp(vmArgs);
System.out.println("Started LingeredApp with pid " + theApp.getPid());

Expand Down Expand Up @@ -100,18 +99,18 @@ public static void runAllTypesTest() throws Exception {
LingeredApp theApp = null;
try {
ClhsdbLauncher test = new ClhsdbLauncher();
List<String> vmArgs = new ArrayList<String>();
vmArgs.add("-XX:+UnlockDiagnosticVMOptions"); // bool
vmArgs.add("-XX:ActiveProcessorCount=1"); // int
vmArgs.add("-XX:ParallelGCThreads=1"); // uint
vmArgs.add("-XX:MaxJavaStackTraceDepth=1024"); // intx
vmArgs.add("-XX:LogEventsBufferEntries=10"); // uintx
vmArgs.add("-XX:HeapSizePerGCThread=32m"); // size_t
vmArgs.add("-XX:NativeMemoryTracking=off"); // ccstr
vmArgs.add("-XX:OnError='echo error'"); // ccstrlist
vmArgs.add("-XX:CompileThresholdScaling=1.0"); // double
vmArgs.add("-XX:ErrorLogTimeout=120"); // uint64_t
vmArgs.addAll(Utils.getVmOptions());
// *Prepend* options to prevent interference with flags below
String[] vmArgs = Utils.prependTestJavaOpts(
"-XX:+UnlockDiagnosticVMOptions", // bool
"-XX:ActiveProcessorCount=1", // int
"-XX:ParallelGCThreads=1", // uint
"-XX:MaxJavaStackTraceDepth=1024", // intx
"-XX:LogEventsBufferEntries=10", // uintx
"-XX:HeapSizePerGCThread=32m", // size_t
"-XX:NativeMemoryTracking=off", // ccstr
"-XX:OnError='echo error'", // ccstrlist
"-XX:CompileThresholdScaling=1.0", // double
"-XX:ErrorLogTimeout=120"); // uint64_t
theApp = LingeredApp.startApp(vmArgs);
System.out.println("Started LingeredApp with pid " + theApp.getPid());

Expand Down
4 changes: 2 additions & 2 deletions test/hotspot/jtreg/serviceability/sa/ClhsdbInspect.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 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
Expand Down Expand Up @@ -47,7 +47,7 @@ public static void main(String[] args) throws Exception {
ClhsdbLauncher test = new ClhsdbLauncher();

theApp = new LingeredAppWithLock();
LingeredApp.startApp(null, theApp);
LingeredApp.startApp(theApp);
System.out.println("Started LingeredApp with pid " + theApp.getPid());

// Run the 'jstack -v' command to get the address of a Method*,
Expand Down
6 changes: 2 additions & 4 deletions test/hotspot/jtreg/serviceability/sa/ClhsdbJhisto.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 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
Expand Down Expand Up @@ -47,11 +47,9 @@ public static void main(String[] args) throws Exception {
LingeredAppWithInterface theApp = null;
try {
ClhsdbLauncher test = new ClhsdbLauncher();
List<String> vmArgs = new ArrayList<String>();
vmArgs.addAll(Utils.getVmOptions());

theApp = new LingeredAppWithInterface();
LingeredApp.startApp(vmArgs, theApp);
LingeredApp.startApp(theApp);
System.out.println("Started LingeredApp with pid " + theApp.getPid());

List<String> cmds = List.of("jhisto");
Expand Down
4 changes: 2 additions & 2 deletions test/hotspot/jtreg/serviceability/sa/ClhsdbJstack.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 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
Expand Down Expand Up @@ -43,7 +43,7 @@ private static void testJstack(boolean withXcomp) throws Exception {
LingeredApp theApp = null;
try {
ClhsdbLauncher test = new ClhsdbLauncher();
theApp = withXcomp ? LingeredApp.startApp(List.of("-Xcomp"))
theApp = withXcomp ? LingeredApp.startApp("-Xcomp")
: LingeredApp.startApp();
System.out.print("Started LingeredApp ");
if (withXcomp) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, Red Hat Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
Expand Down Expand Up @@ -89,12 +90,12 @@ private static void runJstackInLoop(LingeredApp app) throws Exception {
public static void main(String... args) throws Exception {
LingeredApp app = null;
try {
List<String> vmArgs = List.of("-Xcomp",
"-XX:CompileCommand=dontinline,LingeredAppWithRecComputation.factorial",
"-XX:CompileCommand=compileonly,LingeredAppWithRecComputation.testLoop",
"-XX:CompileCommand=compileonly,LingeredAppWithRecComputation.factorial");
app = new LingeredAppWithRecComputation();
LingeredApp.startApp(vmArgs, app);
LingeredApp.startApp(app,
"-Xcomp",
"-XX:CompileCommand=dontinline,LingeredAppWithRecComputation.factorial",
"-XX:CompileCommand=compileonly,LingeredAppWithRecComputation.testLoop",
"-XX:CompileCommand=compileonly,LingeredAppWithRecComputation.factorial");
System.out.println("Started LingeredAppWithRecComputation with pid " + app.getPid());
runJstackInLoop(app);
System.out.println("Test Completed");
Expand Down
4 changes: 2 additions & 2 deletions test/hotspot/jtreg/serviceability/sa/ClhsdbPrintAll.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 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
Expand Down Expand Up @@ -46,7 +46,7 @@ public static void main(String[] args) throws Exception {
ClhsdbLauncher test = new ClhsdbLauncher();

theApp = new LingeredAppWithEnum();
LingeredApp.startApp(null, theApp);
LingeredApp.startApp(theApp);
System.out.println("Started LingeredAppWithEnum with pid " + theApp.getPid());

List<String> cmds = List.of("printall");
Expand Down
6 changes: 2 additions & 4 deletions test/hotspot/jtreg/serviceability/sa/ClhsdbScanOops.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 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
Expand Down Expand Up @@ -46,9 +46,7 @@ private static void testWithGcType(String gc) throws Exception {

try {
ClhsdbLauncher test = new ClhsdbLauncher();
List<String> vmArgs = new ArrayList<String>();
vmArgs.add(gc);
theApp = LingeredApp.startApp(vmArgs);
theApp = LingeredApp.startApp(gc);

System.out.println ("Started LingeredApp with the GC option " + gc +
" and pid " + theApp.getPid());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 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
Expand Down Expand Up @@ -78,12 +78,10 @@ public static void main(String[] args) throws Exception {
}

try {
List<String> vmArgs = new ArrayList<String>();
vmArgs.add("-XX:+UsePerfData");
vmArgs.addAll(Utils.getVmOptions());
String[] vmArgs = Utils.appendTestJavaOpts("-XX:+UsePerfData");

theApp = new LingeredAppWithDeadlock();
LingeredApp.startApp(vmArgs, theApp);
LingeredApp.startApp(theApp, vmArgs);
OutputAnalyzer output = jstack("--pid", Long.toString(theApp.getPid()));
System.out.println(output.getOutput());

Expand Down
4 changes: 2 additions & 2 deletions test/hotspot/jtreg/serviceability/sa/JhsdbThreadInfoTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 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
Expand Down Expand Up @@ -45,7 +45,7 @@ public static void main(String[] args) throws Exception {
LingeredApp app = null;

try {
app = LingeredApp.startApp(Utils.getVmOptions());
app = LingeredApp.startApp();
System.out.println("Started LingeredApp with pid " + app.getPid());

JDKToolLauncher jhsdbLauncher = JDKToolLauncher.createUsingTestJDK("jhsdb");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 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
Expand Down Expand Up @@ -43,10 +43,9 @@ public static void main (String... args) throws Exception {
LingeredAppWithLock app = null;
try {
ClhsdbLauncher test = new ClhsdbLauncher();
List<String> vmArgs = new ArrayList<String>(Utils.getVmOptions());

app = new LingeredAppWithLock();
LingeredApp.startApp(vmArgs, app);
LingeredApp.startApp(app);

System.out.println ("Started LingeredAppWithLock with pid " + app.getPid());

Expand All @@ -73,4 +72,3 @@ public static void main (String... args) throws Exception {
System.out.println("Test PASSED");
}
}

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 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
Expand Down Expand Up @@ -122,12 +122,11 @@ public static void main (String... args) throws Exception {

if (args == null || args.length == 0) {
try {
List<String> vmArgs = new ArrayList<String>();
vmArgs.add("-XX:+UsePerfData");
vmArgs.addAll(Utils.getVmOptions());
String[] vmArgs = Utils.appendTestJavaOpts(
"-XX:+UsePerfData");

theApp = new LingeredAppWithInvokeDynamic();
LingeredApp.startApp(vmArgs, theApp);
LingeredApp.startApp(theApp, vmArgs);
createAnotherToAttach(instanceKlassNames,
theApp.getPid());
} finally {
Expand Down
Loading

0 comments on commit c8e7590

Please sign in to comment.