Skip to content

Commit

Permalink
8314831: NMT tests ignore vm flags
Browse files Browse the repository at this point in the history
Reviewed-by: lmesnik, stuefe, gziemski
  • Loading branch information
Mikhailo Seledtsov committed Sep 7, 2023
1 parent b74805d commit 9bf3dee
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

3 comments on commit 9bf3dee

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

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

@GoeLin
Copy link
Member

@GoeLin GoeLin commented on 9bf3dee Dec 17, 2023

Choose a reason for hiding this comment

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

/backport jdk21u-dev

@openjdk
Copy link

@openjdk openjdk bot commented on 9bf3dee Dec 17, 2023

Choose a reason for hiding this comment

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

@GoeLin the backport was successfully created on the branch backport-GoeLin-9bf3dee2 in my personal fork of openjdk/jdk21u-dev. To create a pull request with this backport targeting openjdk/jdk21u-dev:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit 9bf3dee2 from the openjdk/jdk repository.

The commit being backported was authored by Mikhailo Seledtsov on 7 Sep 2023 and was reviewed by Leonid Mesnik, Thomas Stuefe and Gerard Ziemski.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk21u-dev:

$ git fetch https://github.com/openjdk-bots/jdk21u-dev.git backport-GoeLin-9bf3dee2:backport-GoeLin-9bf3dee2
$ git checkout backport-GoeLin-9bf3dee2
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk21u-dev.git backport-GoeLin-9bf3dee2

Please sign in to comment.