author | ccheung |
Thu, 16 Jan 2014 10:51:16 -0800 | |
changeset 22518 | e23c5545e376 |
child 29678 | dd2f3932c21e |
permissions | -rw-r--r-- |
22518
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff
changeset
|
1 |
/* |
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff
changeset
|
2 |
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff
changeset
|
4 |
* |
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff
changeset
|
8 |
* |
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff
changeset
|
13 |
* accompanied this code). |
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff
changeset
|
14 |
* |
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff
changeset
|
18 |
* |
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff
changeset
|
21 |
* questions. |
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff
changeset
|
22 |
*/ |
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff
changeset
|
23 |
|
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff
changeset
|
24 |
/* |
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff
changeset
|
25 |
* @test |
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff
changeset
|
26 |
* @bug 8027314 |
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff
changeset
|
27 |
* @summary Warn if diagnostic or experimental vm option is used and -XX:+UnlockDiagnosticVMOptions or -XX:+UnlockExperimentalVMOptions, respectively, isn't specified. Warn if develop or notproduct vm option is used with product version of VM. |
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff
changeset
|
28 |
* @library /testlibrary |
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff
changeset
|
29 |
*/ |
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff
changeset
|
30 |
|
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff
changeset
|
31 |
import com.oracle.java.testlibrary.*; |
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff
changeset
|
32 |
|
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff
changeset
|
33 |
public class VMOptionWarning { |
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff
changeset
|
34 |
public static void main(String[] args) throws Exception { |
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff
changeset
|
35 |
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+PredictedLoadedClassCount", "-version"); |
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff
changeset
|
36 |
OutputAnalyzer output = new OutputAnalyzer(pb.start()); |
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff
changeset
|
37 |
output.shouldContain("Error: VM option 'PredictedLoadedClassCount' is experimental and must be enabled via -XX:+UnlockExperimentalVMOptions."); |
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff
changeset
|
38 |
|
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff
changeset
|
39 |
if (Platform.isDebugBuild()) { |
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff
changeset
|
40 |
System.out.println("Skip the rest of the tests on debug builds since diagnostic, develop, and notproduct options are available on debug builds."); |
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff
changeset
|
41 |
return; |
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff
changeset
|
42 |
} |
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff
changeset
|
43 |
|
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff
changeset
|
44 |
pb = ProcessTools.createJavaProcessBuilder("-XX:+PrintInlining", "-version"); |
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff
changeset
|
45 |
output = new OutputAnalyzer(pb.start()); |
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff
changeset
|
46 |
output.shouldContain("Error: VM option 'PrintInlining' is diagnostic and must be enabled via -XX:+UnlockDiagnosticVMOptions."); |
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff
changeset
|
47 |
|
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff
changeset
|
48 |
pb = ProcessTools.createJavaProcessBuilder("-XX:+TraceJNICalls", "-version"); |
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff
changeset
|
49 |
output = new OutputAnalyzer(pb.start()); |
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff
changeset
|
50 |
output.shouldContain("Error: VM option 'TraceJNICalls' is develop and is available only in debug version of VM."); |
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff
changeset
|
51 |
|
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff
changeset
|
52 |
pb = ProcessTools.createJavaProcessBuilder("-XX:+TraceJVMCalls", "-version"); |
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff
changeset
|
53 |
output = new OutputAnalyzer(pb.start()); |
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff
changeset
|
54 |
output.shouldContain("Error: VM option 'TraceJVMCalls' is notproduct and is available only in debug version of VM."); |
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff
changeset
|
55 |
} |
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff
changeset
|
56 |
} |