8314831: NMT tests ignore vm flags

Reviewed-by: lmesnik, stuefe, gziemski
This commit is contained in:
Mikhailo Seledtsov 2023-09-07 17:12:46 +00:00
parent b74805d383
commit 9bf3dee242
11 changed files with 29 additions and 18 deletions

View File

@ -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
@ -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());

View File

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

View File

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

View File

@ -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
@ -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());

View File

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

View File

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

View File

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

View File

@ -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
@ -156,7 +156,7 @@ public class NMTInitializationTest {
}
vmArgs.add("-version");
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(vmArgs);
ProcessBuilder pb = ProcessTools.createTestJvm(vmArgs);
OutputAnalyzer output = new OutputAnalyzer(pb.start());
if (debug) {
output.reportDiagnosticSummary();

View File

@ -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
@ -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");

View File

@ -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
@ -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",
@ -55,7 +55,7 @@ public class PrintNMTStatistics {
// 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",

View File

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