Skip to content

Commit

Permalink
8314831: NMT tests ignore vm flags
Browse files Browse the repository at this point in the history
Reviewed-by: phh
Backport-of: 9bf3dee2424bd8ccbc7ef0175c6e7165ff5cf1c6
  • Loading branch information
GoeLin committed Sep 17, 2024
1 parent e4590bf commit 5b10cd1
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 17 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
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 5b10cd1

@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.