Skip to content

Commit

Permalink
8314831: NMT tests ignore vm flags
Browse files Browse the repository at this point in the history
Backport-of: 9bf3dee2424bd8ccbc7ef0175c6e7165ff5cf1c6
  • Loading branch information
GoeLin committed Dec 21, 2023
1 parent 320cf85 commit ebd5179
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 18 deletions.
4 changes: 2 additions & 2 deletions test/hotspot/jtreg/runtime/NMT/CommandLineDetail.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2023, 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 @@ -37,7 +37,7 @@ public class CommandLineDetail {

public static void main(String args[]) throws Exception {

ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
ProcessBuilder pb = ProcessTools.createTestJvm(
"-XX:NativeMemoryTracking=detail",
"-version");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
Expand Down
3 changes: 2 additions & 1 deletion test/hotspot/jtreg/runtime/NMT/CommandLineEmptyArgument.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2023, 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 All @@ -24,6 +24,7 @@
/*
* @test
* @summary Empty argument to NMT should result in an informative error message
* @requires vm.flagless
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2023, 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 All @@ -24,6 +24,7 @@
/*
* @test
* @summary Invalid argument to NMT should result in an informative error message
* @requires vm.flagless
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
Expand Down
4 changes: 2 additions & 2 deletions test/hotspot/jtreg/runtime/NMT/CommandLineSummary.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2023, 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 @@ -37,7 +37,7 @@ public class CommandLineSummary {

public static void main(String args[]) throws Exception {

ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
ProcessBuilder pb = ProcessTools.createTestJvm(
"-XX:NativeMemoryTracking=summary",
"-version");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
Expand Down
3 changes: 2 additions & 1 deletion test/hotspot/jtreg/runtime/NMT/CommandLineTurnOffNMT.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2023, 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 All @@ -24,6 +24,7 @@
/*
* @test
* @summary Turning off NMT should not result in an error
* @requires vm.flagless
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
Expand Down
3 changes: 2 additions & 1 deletion test/hotspot/jtreg/runtime/NMT/JcmdWithNMTDisabled.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2023, 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 All @@ -24,6 +24,7 @@
/*
* @test
* @summary Verify that jcmd correctly reports that NMT is not enabled
* @requires vm.flagless
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
Expand Down
8 changes: 7 additions & 1 deletion test/hotspot/jtreg/runtime/NMT/MallocLimitTest.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2022 SAP SE. All rights reserved.
* Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2022, 2023, 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 All @@ -26,6 +26,7 @@
/*
* @test id=global-limit-fatal
* @summary Verify -XX:MallocLimit with a global limit
* @requires vm.flagless
* @modules java.base/jdk.internal.misc
* @library /test/lib
* @run driver MallocLimitTest global-limit-fatal
Expand All @@ -34,6 +35,7 @@
/*
* @test id=global-limit-oom
* @summary Verify -XX:MallocLimit with a global limit
* @requires vm.flagless
* @modules java.base/jdk.internal.misc
* @library /test/lib
* @run driver MallocLimitTest global-limit-oom
Expand All @@ -42,6 +44,7 @@
/*
* @test id=compiler-limit-fatal
* @summary Verify -XX:MallocLimit with a compiler-specific limit (for "mtCompiler" category)
* @requires vm.flagless
* @modules java.base/jdk.internal.misc
* @library /test/lib
* @run driver MallocLimitTest compiler-limit-fatal
Expand All @@ -50,6 +53,7 @@
/*
* @test id=compiler-limit-oom
* @summary Verify -XX:MallocLimit with a compiler-specific limit (for "mtCompiler" category)
* @requires vm.flagless
* @modules java.base/jdk.internal.misc
* @library /test/lib
* @run driver MallocLimitTest compiler-limit-oom
Expand All @@ -58,6 +62,7 @@
/*
* @test id=multi-limit
* @summary Verify -XX:MallocLimit with multiple limits
* @requires vm.flagless
* @modules java.base/jdk.internal.misc
* @library /test/lib
* @run driver MallocLimitTest multi-limit
Expand All @@ -66,6 +71,7 @@
/*
* @test id=limit-without-nmt
* @summary Verify that the VM warns if -XX:MallocLimit is given but NMT is disabled
* @requires vm.flagless
* @modules java.base/jdk.internal.misc
* @library /test/lib
* @run driver MallocLimitTest limit-without-nmt
Expand Down
4 changes: 2 additions & 2 deletions test/hotspot/jtreg/runtime/NMT/NMTInitializationTest.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2021 SAP SE. All rights reserved.
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, 2023, 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 @@ -156,7 +156,7 @@ public static void main(String args[]) throws Exception {
}
vmArgs.add("-version");

ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(vmArgs);
ProcessBuilder pb = ProcessTools.createTestJvm(vmArgs);
OutputAnalyzer output = new OutputAnalyzer(pb.start());
if (debug) {
output.reportDiagnosticSummary();
Expand Down
6 changes: 3 additions & 3 deletions test/hotspot/jtreg/runtime/NMT/NMTWithCDS.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2023, 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 @@ -38,14 +38,14 @@ public class NMTWithCDS {

public static void main(String[] args) throws Exception {
ProcessBuilder pb;
pb = ProcessTools.createJavaProcessBuilder(
pb = ProcessTools.createTestJvm(
"-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./NMTWithCDS.jsa", "-Xshare:dump", "-Xlog:cds");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
try {
output.shouldContain("Loading classes to share");
output.shouldHaveExitValue(0);

pb = ProcessTools.createJavaProcessBuilder(
pb = ProcessTools.createTestJvm(
"-XX:+UnlockDiagnosticVMOptions", "-XX:NativeMemoryTracking=detail", "-XX:SharedArchiveFile=./NMTWithCDS.jsa", "-Xshare:on", "-version");
output = new OutputAnalyzer(pb.start());
output.shouldContain("sharing");
Expand Down
6 changes: 3 additions & 3 deletions test/hotspot/jtreg/runtime/NMT/PrintNMTStatistics.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2023, 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 @@ -37,7 +37,7 @@ public class PrintNMTStatistics {

public static void main(String args[]) throws Exception {

ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
ProcessBuilder pb = ProcessTools.createTestJvm(
"-XX:+UnlockDiagnosticVMOptions",
"-XX:+PrintNMTStatistics",
"-XX:NativeMemoryTracking=detail",
Expand All @@ -55,7 +55,7 @@ public static void main(String args[]) throws Exception {
// Make sure memory reserved for Module processing is recorded.
output_detail.shouldContain(" Module (reserved=");

ProcessBuilder pb1 = ProcessTools.createJavaProcessBuilder(
ProcessBuilder pb1 = ProcessTools.createTestJvm(
"-XX:+UnlockDiagnosticVMOptions",
"-XX:+PrintNMTStatistics",
"-XX:NativeMemoryTracking=summary",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2023, 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 All @@ -24,6 +24,7 @@
/*
* @test
* @summary Trying to enable PrintNMTStatistics should result in a warning
* @requires vm.flagless
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
Expand Down

1 comment on commit ebd5179

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.