author | jdv |
Tue, 09 Aug 2016 13:45:17 +0530 | |
changeset 40432 | 6a878eae7459 |
parent 38152 | 80e5da81fb2c |
child 40631 | ed82623d7831 |
permissions | -rw-r--r-- |
27659
82af5d5e777b
8060449: Obsolete command line flags accept arbitrary appendix
coleenp
parents:
diff
changeset
|
1 |
/* |
30242
5b15a65d4373
8073989: Deprecated integer options are considered as invalid instead of deprecated in Java 9
mockner
parents:
29678
diff
changeset
|
2 |
* Copyright (c) 2014, 2015 Oracle and/or its affiliates. All rights reserved. |
27659
82af5d5e777b
8060449: Obsolete command line flags accept arbitrary appendix
coleenp
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
82af5d5e777b
8060449: Obsolete command line flags accept arbitrary appendix
coleenp
parents:
diff
changeset
|
4 |
* |
82af5d5e777b
8060449: Obsolete command line flags accept arbitrary appendix
coleenp
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
82af5d5e777b
8060449: Obsolete command line flags accept arbitrary appendix
coleenp
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
82af5d5e777b
8060449: Obsolete command line flags accept arbitrary appendix
coleenp
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
82af5d5e777b
8060449: Obsolete command line flags accept arbitrary appendix
coleenp
parents:
diff
changeset
|
8 |
* |
82af5d5e777b
8060449: Obsolete command line flags accept arbitrary appendix
coleenp
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
82af5d5e777b
8060449: Obsolete command line flags accept arbitrary appendix
coleenp
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
82af5d5e777b
8060449: Obsolete command line flags accept arbitrary appendix
coleenp
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
82af5d5e777b
8060449: Obsolete command line flags accept arbitrary appendix
coleenp
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
82af5d5e777b
8060449: Obsolete command line flags accept arbitrary appendix
coleenp
parents:
diff
changeset
|
13 |
* accompanied this code). |
82af5d5e777b
8060449: Obsolete command line flags accept arbitrary appendix
coleenp
parents:
diff
changeset
|
14 |
* |
82af5d5e777b
8060449: Obsolete command line flags accept arbitrary appendix
coleenp
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
82af5d5e777b
8060449: Obsolete command line flags accept arbitrary appendix
coleenp
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
82af5d5e777b
8060449: Obsolete command line flags accept arbitrary appendix
coleenp
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
82af5d5e777b
8060449: Obsolete command line flags accept arbitrary appendix
coleenp
parents:
diff
changeset
|
18 |
* |
82af5d5e777b
8060449: Obsolete command line flags accept arbitrary appendix
coleenp
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
82af5d5e777b
8060449: Obsolete command line flags accept arbitrary appendix
coleenp
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
82af5d5e777b
8060449: Obsolete command line flags accept arbitrary appendix
coleenp
parents:
diff
changeset
|
21 |
* questions. |
82af5d5e777b
8060449: Obsolete command line flags accept arbitrary appendix
coleenp
parents:
diff
changeset
|
22 |
*/ |
82af5d5e777b
8060449: Obsolete command line flags accept arbitrary appendix
coleenp
parents:
diff
changeset
|
23 |
|
82af5d5e777b
8060449: Obsolete command line flags accept arbitrary appendix
coleenp
parents:
diff
changeset
|
24 |
/* |
82af5d5e777b
8060449: Obsolete command line flags accept arbitrary appendix
coleenp
parents:
diff
changeset
|
25 |
* @test |
30242
5b15a65d4373
8073989: Deprecated integer options are considered as invalid instead of deprecated in Java 9
mockner
parents:
29678
diff
changeset
|
26 |
* @bug 8060449 8073989 |
27659
82af5d5e777b
8060449: Obsolete command line flags accept arbitrary appendix
coleenp
parents:
diff
changeset
|
27 |
* @summary Newly obsolete command line options should still give useful error messages when used improperly. |
38152
80e5da81fb2c
8154258: [TESTBUG] Various serviceability tests fail compilation
dsamersoff
parents:
32823
diff
changeset
|
28 |
* @modules java.base/jdk.internal.misc |
27659
82af5d5e777b
8060449: Obsolete command line flags accept arbitrary appendix
coleenp
parents:
diff
changeset
|
29 |
* @library /testlibrary |
82af5d5e777b
8060449: Obsolete command line flags accept arbitrary appendix
coleenp
parents:
diff
changeset
|
30 |
*/ |
82af5d5e777b
8060449: Obsolete command line flags accept arbitrary appendix
coleenp
parents:
diff
changeset
|
31 |
|
30604
b8d532cb6420
8067013: Rename the com.oracle.java.testlibary package
ykantser
parents:
30242
diff
changeset
|
32 |
import jdk.test.lib.*; |
27659
82af5d5e777b
8060449: Obsolete command line flags accept arbitrary appendix
coleenp
parents:
diff
changeset
|
33 |
|
82af5d5e777b
8060449: Obsolete command line flags accept arbitrary appendix
coleenp
parents:
diff
changeset
|
34 |
public class ObsoleteFlagErrorMessage { |
82af5d5e777b
8060449: Obsolete command line flags accept arbitrary appendix
coleenp
parents:
diff
changeset
|
35 |
public static void main(String[] args) throws Exception { |
30242
5b15a65d4373
8073989: Deprecated integer options are considered as invalid instead of deprecated in Java 9
mockner
parents:
29678
diff
changeset
|
36 |
|
5b15a65d4373
8073989: Deprecated integer options are considered as invalid instead of deprecated in Java 9
mockner
parents:
29678
diff
changeset
|
37 |
// Case 1: Newly obsolete flags with extra junk appended should not be treated as newly obsolete (8060449) |
27659
82af5d5e777b
8060449: Obsolete command line flags accept arbitrary appendix
coleenp
parents:
diff
changeset
|
38 |
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( |
30242
5b15a65d4373
8073989: Deprecated integer options are considered as invalid instead of deprecated in Java 9
mockner
parents:
29678
diff
changeset
|
39 |
"-XX:UseOldInliningPlusJunk", "-version"); |
27659
82af5d5e777b
8060449: Obsolete command line flags accept arbitrary appendix
coleenp
parents:
diff
changeset
|
40 |
|
82af5d5e777b
8060449: Obsolete command line flags accept arbitrary appendix
coleenp
parents:
diff
changeset
|
41 |
OutputAnalyzer output = new OutputAnalyzer(pb.start()); |
30242
5b15a65d4373
8073989: Deprecated integer options are considered as invalid instead of deprecated in Java 9
mockner
parents:
29678
diff
changeset
|
42 |
output.shouldContain("Unrecognized VM option 'UseOldInliningPlusJunk'"); // Must identify bad option. |
27659
82af5d5e777b
8060449: Obsolete command line flags accept arbitrary appendix
coleenp
parents:
diff
changeset
|
43 |
output.shouldHaveExitValue(1); |
30242
5b15a65d4373
8073989: Deprecated integer options are considered as invalid instead of deprecated in Java 9
mockner
parents:
29678
diff
changeset
|
44 |
|
5b15a65d4373
8073989: Deprecated integer options are considered as invalid instead of deprecated in Java 9
mockner
parents:
29678
diff
changeset
|
45 |
// Case 2: Newly obsolete integer-valued flags should be recognized as newly obsolete (8073989) |
5b15a65d4373
8073989: Deprecated integer options are considered as invalid instead of deprecated in Java 9
mockner
parents:
29678
diff
changeset
|
46 |
ProcessBuilder pb2 = ProcessTools.createJavaProcessBuilder( |
5b15a65d4373
8073989: Deprecated integer options are considered as invalid instead of deprecated in Java 9
mockner
parents:
29678
diff
changeset
|
47 |
"-XX:NmethodSweepFraction=10", "-version"); |
5b15a65d4373
8073989: Deprecated integer options are considered as invalid instead of deprecated in Java 9
mockner
parents:
29678
diff
changeset
|
48 |
|
5b15a65d4373
8073989: Deprecated integer options are considered as invalid instead of deprecated in Java 9
mockner
parents:
29678
diff
changeset
|
49 |
OutputAnalyzer output2 = new OutputAnalyzer(pb2.start()); |
32823
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
30604
diff
changeset
|
50 |
output2.shouldContain("Ignoring option").shouldContain("support was removed"); |
30242
5b15a65d4373
8073989: Deprecated integer options are considered as invalid instead of deprecated in Java 9
mockner
parents:
29678
diff
changeset
|
51 |
output2.shouldContain("NmethodSweepFraction"); |
27659
82af5d5e777b
8060449: Obsolete command line flags accept arbitrary appendix
coleenp
parents:
diff
changeset
|
52 |
} |
82af5d5e777b
8060449: Obsolete command line flags accept arbitrary appendix
coleenp
parents:
diff
changeset
|
53 |
} |