1 /* |
1 /* |
2 * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2014, 2015 Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
21 * questions. |
21 * questions. |
22 */ |
22 */ |
23 |
23 |
24 /* |
24 /* |
25 * @test |
25 * @test |
26 * @bug 8060449 |
26 * @bug 8060449 8073989 |
27 * @summary Newly obsolete command line options should still give useful error messages when used improperly. |
27 * @summary Newly obsolete command line options should still give useful error messages when used improperly. |
28 * @library /testlibrary |
28 * @library /testlibrary |
29 * @modules java.base/sun.misc |
|
30 * java.management |
|
31 */ |
29 */ |
32 |
30 |
33 import com.oracle.java.testlibrary.*; |
31 import com.oracle.java.testlibrary.*; |
34 |
32 |
35 public class ObsoleteFlagErrorMessage { |
33 public class ObsoleteFlagErrorMessage { |
36 public static void main(String[] args) throws Exception { |
34 public static void main(String[] args) throws Exception { |
|
35 |
|
36 // Case 1: Newly obsolete flags with extra junk appended should not be treated as newly obsolete (8060449) |
37 ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( |
37 ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( |
38 "-XX:UseBoundThreadsPlusJunk", "-version"); |
38 "-XX:UseOldInliningPlusJunk", "-version"); |
39 |
39 |
40 OutputAnalyzer output = new OutputAnalyzer(pb.start()); |
40 OutputAnalyzer output = new OutputAnalyzer(pb.start()); |
41 output.shouldContain("Unrecognized VM option 'UseBoundThreadsPlusJunk'"); // Must identify bad option. |
41 output.shouldContain("Unrecognized VM option 'UseOldInliningPlusJunk'"); // Must identify bad option. |
42 output.shouldContain("UseBoundThreads"); // Should apply fuzzy matching to find correct option. |
|
43 output.shouldContain("support").shouldContain("removed"); // Should warn user that the option they are trying to use is no longer supported. |
|
44 output.shouldHaveExitValue(1); |
42 output.shouldHaveExitValue(1); |
|
43 |
|
44 // Case 2: Newly obsolete integer-valued flags should be recognized as newly obsolete (8073989) |
|
45 ProcessBuilder pb2 = ProcessTools.createJavaProcessBuilder( |
|
46 "-XX:NmethodSweepFraction=10", "-version"); |
|
47 |
|
48 OutputAnalyzer output2 = new OutputAnalyzer(pb2.start()); |
|
49 output2.shouldContain("ignoring option").shouldContain("support was removed"); |
|
50 output2.shouldContain("NmethodSweepFraction"); |
45 } |
51 } |
46 } |
52 } |