mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
Add support for alias options and automatically expiring deprecated options Reviewed-by: dholmes, kbarrett, acorn
This commit is contained in:
parent
26254f4645
commit
23813ce92e
13 changed files with 736 additions and 384 deletions
80
hotspot/test/runtime/CommandLine/VMDeprecatedOptions.java
Normal file
80
hotspot/test/runtime/CommandLine/VMDeprecatedOptions.java
Normal file
|
@ -0,0 +1,80 @@
|
|||
/*
|
||||
* Copyright (c) 2015, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import jdk.test.lib.*;
|
||||
import jdk.test.lib.cli.*;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8066821
|
||||
* @summary Test that various options are deprecated. See deprecated_jvm_flags in arguments.cpp.
|
||||
* @library /testlibrary
|
||||
*/
|
||||
public class VMDeprecatedOptions {
|
||||
|
||||
/**
|
||||
* each entry is {[0]: option name, [1]: value to set
|
||||
* (true/false/n/string)}.
|
||||
*/
|
||||
public static final String[][] DEPRECATED_OPTIONS = {
|
||||
// deprecated non-alias flags:
|
||||
{"MaxGCMinorPauseMillis", "1032"},
|
||||
{"UseParNewGC", "false"},
|
||||
|
||||
// deprecated alias flags (see also aliased_jvm_flags):
|
||||
{"DefaultMaxRAMFraction", "4"},
|
||||
{"CMSMarkStackSizeMax", "1032"},
|
||||
{"CMSMarkStackSize", "1032"},
|
||||
{"G1MarkStackSize", "1032"},
|
||||
{"ParallelMarkingThreads", "2"},
|
||||
{"ParallelCMSThreads", "2"},
|
||||
{"CreateMinidumpOnCrash", "false"}
|
||||
};
|
||||
|
||||
static String getDeprecationString(String optionName) {
|
||||
return "Option " + optionName
|
||||
+ " was deprecated in version [\\S]+ and will likely be removed in a future release";
|
||||
}
|
||||
|
||||
static void testDeprecated(String[][] optionInfo) throws Throwable {
|
||||
String optionNames[] = new String[optionInfo.length];
|
||||
String expectedValues[] = new String[optionInfo.length];
|
||||
for (int i = 0; i < optionInfo.length; i++) {
|
||||
optionNames[i] = optionInfo[i][0];
|
||||
expectedValues[i] = optionInfo[i][1];
|
||||
}
|
||||
|
||||
OutputAnalyzer output = CommandLineOptionTest.startVMWithOptions(optionNames, expectedValues);
|
||||
|
||||
// check for option deprecation messages:
|
||||
output.shouldHaveExitValue(0);
|
||||
for (String[] deprecated : optionInfo) {
|
||||
String match = getDeprecationString(deprecated[0]);
|
||||
output.shouldMatch(match);
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Throwable {
|
||||
testDeprecated(DEPRECATED_OPTIONS); // Make sure that each deprecated option is mentioned in the output.
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue