annotate test/runtime/CommandLine/VMOptionWarning.java @ 21213:0028ab94d268

Make cache in HotSpotConstantPool.lookupType thread safe.
author Stefan Anzinger <stefan.anzinger@oracle.com>
date Mon, 04 May 2015 19:12:50 +0200
parents 234d576115b5
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14276
234d576115b5 8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff changeset
1 /*
234d576115b5 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.
234d576115b5 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.
234d576115b5 8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff changeset
4 *
234d576115b5 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
234d576115b5 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
234d576115b5 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.
234d576115b5 8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff changeset
8 *
234d576115b5 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
234d576115b5 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
234d576115b5 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
234d576115b5 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
234d576115b5 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).
234d576115b5 8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff changeset
14 *
234d576115b5 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
234d576115b5 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,
234d576115b5 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.
234d576115b5 8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff changeset
18 *
234d576115b5 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
234d576115b5 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
234d576115b5 8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff changeset
21 * questions.
234d576115b5 8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff changeset
22 */
234d576115b5 8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff changeset
23
234d576115b5 8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff changeset
24 /*
234d576115b5 8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff changeset
25 * @test
234d576115b5 8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff changeset
26 * @bug 8027314
234d576115b5 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.
234d576115b5 8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff changeset
28 * @library /testlibrary
234d576115b5 8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff changeset
29 */
234d576115b5 8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff changeset
30
234d576115b5 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.*;
234d576115b5 8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff changeset
32
234d576115b5 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 {
234d576115b5 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 {
234d576115b5 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");
234d576115b5 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());
234d576115b5 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.");
234d576115b5 8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff changeset
38
234d576115b5 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()) {
234d576115b5 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.");
234d576115b5 8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff changeset
41 return;
234d576115b5 8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff changeset
42 }
234d576115b5 8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff changeset
43
234d576115b5 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");
234d576115b5 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());
234d576115b5 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.");
234d576115b5 8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff changeset
47
234d576115b5 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");
234d576115b5 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());
234d576115b5 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.");
234d576115b5 8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff changeset
51
234d576115b5 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");
234d576115b5 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());
234d576115b5 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.");
234d576115b5 8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff changeset
55 }
234d576115b5 8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
diff changeset
56 }