author | jdv |
Tue, 09 Aug 2016 13:45:17 +0530 | |
changeset 40432 | 6a878eae7459 |
parent 38152 | 80e5da81fb2c |
child 40631 | ed82623d7831 |
permissions | -rw-r--r-- |
32823
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
1 |
/* |
36099
bb0cc62ab037
8147379: Investigate if ConvertSleepToYield still should be false by default on Sparc
dholmes
parents:
32823
diff
changeset
|
2 |
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. |
32823
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
4 |
* |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
8 |
* |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
13 |
* accompanied this code). |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
14 |
* |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
18 |
* |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
21 |
* questions. |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
22 |
*/ |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
23 |
|
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
24 |
import jdk.test.lib.*; |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
25 |
import jdk.test.lib.cli.*; |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
26 |
|
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
27 |
/* |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
28 |
* @test |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
29 |
* @bug 8066821 |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
30 |
* @summary Test that various options are deprecated. See deprecated_jvm_flags in arguments.cpp. |
38152
80e5da81fb2c
8154258: [TESTBUG] Various serviceability tests fail compilation
dsamersoff
parents:
36099
diff
changeset
|
31 |
* @modules java.base/jdk.internal.misc |
32823
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
32 |
* @library /testlibrary |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
33 |
*/ |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
34 |
public class VMDeprecatedOptions { |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
35 |
|
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
36 |
/** |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
37 |
* each entry is {[0]: option name, [1]: value to set |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
38 |
* (true/false/n/string)}. |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
39 |
*/ |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
40 |
public static final String[][] DEPRECATED_OPTIONS = { |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
41 |
// deprecated non-alias flags: |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
42 |
{"MaxGCMinorPauseMillis", "1032"}, |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
43 |
{"UseParNewGC", "false"}, |
36099
bb0cc62ab037
8147379: Investigate if ConvertSleepToYield still should be false by default on Sparc
dholmes
parents:
32823
diff
changeset
|
44 |
{"ConvertSleepToYield", "false" }, |
bb0cc62ab037
8147379: Investigate if ConvertSleepToYield still should be false by default on Sparc
dholmes
parents:
32823
diff
changeset
|
45 |
{"ConvertYieldToSleep", "false" }, |
32823
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
46 |
|
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
47 |
// deprecated alias flags (see also aliased_jvm_flags): |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
48 |
{"DefaultMaxRAMFraction", "4"}, |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
49 |
{"CMSMarkStackSizeMax", "1032"}, |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
50 |
{"CMSMarkStackSize", "1032"}, |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
51 |
{"G1MarkStackSize", "1032"}, |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
52 |
{"ParallelMarkingThreads", "2"}, |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
53 |
{"ParallelCMSThreads", "2"}, |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
54 |
{"CreateMinidumpOnCrash", "false"} |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
55 |
}; |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
56 |
|
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
57 |
static String getDeprecationString(String optionName) { |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
58 |
return "Option " + optionName |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
59 |
+ " was deprecated in version [\\S]+ and will likely be removed in a future release"; |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
60 |
} |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
61 |
|
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
62 |
static void testDeprecated(String[][] optionInfo) throws Throwable { |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
63 |
String optionNames[] = new String[optionInfo.length]; |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
64 |
String expectedValues[] = new String[optionInfo.length]; |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
65 |
for (int i = 0; i < optionInfo.length; i++) { |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
66 |
optionNames[i] = optionInfo[i][0]; |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
67 |
expectedValues[i] = optionInfo[i][1]; |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
68 |
} |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
69 |
|
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
70 |
OutputAnalyzer output = CommandLineOptionTest.startVMWithOptions(optionNames, expectedValues); |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
71 |
|
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
72 |
// check for option deprecation messages: |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
73 |
output.shouldHaveExitValue(0); |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
74 |
for (String[] deprecated : optionInfo) { |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
75 |
String match = getDeprecationString(deprecated[0]); |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
76 |
output.shouldMatch(match); |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
77 |
} |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
78 |
} |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
79 |
|
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
80 |
public static void main(String[] args) throws Throwable { |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
81 |
testDeprecated(DEPRECATED_OPTIONS); // Make sure that each deprecated option is mentioned in the output. |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
82 |
} |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
diff
changeset
|
83 |
} |