comparison test/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedVM.java @ 18058:54bc75c144b0

Merge
author asaha
date Thu, 29 May 2014 13:14:25 -0700
parents 124e98cd679a
children cabe05c85665
comparison
equal deleted inserted replaced
18055:1fa005fb28f5 18058:54bc75c144b0
1 /*
2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 /**
26 * @test
27 * @bug 8031320
28 * @summary Verify UseRTMLocking option processing on CPU with rtm support
29 * in case when VM should not support this option.
30 * @library /testlibrary /testlibrary/whitebox /compiler/testlibrary
31 * @build TestUseRTMLockingOptionOnUnsupportedVM
32 * @run main ClassFileInstaller sun.hotspot.WhiteBox
33 * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
34 * -XX:+WhiteBoxAPI TestUseRTMLockingOptionOnUnsupportedVM
35 */
36
37 import com.oracle.java.testlibrary.ExitCode;
38 import com.oracle.java.testlibrary.cli.*;
39 import com.oracle.java.testlibrary.cli.predicate.AndPredicate;
40 import com.oracle.java.testlibrary.cli.predicate.NotPredicate;
41 import rtm.predicate.SupportedCPU;
42 import rtm.predicate.SupportedVM;
43
44 public class TestUseRTMLockingOptionOnUnsupportedVM
45 extends CommandLineOptionTest {
46 private static final String DEFAULT_VALUE = "false";
47
48 private TestUseRTMLockingOptionOnUnsupportedVM() {
49 super(new AndPredicate(new SupportedCPU(),
50 new NotPredicate(new SupportedVM())));
51 }
52 @Override
53 public void runTestCases() throws Throwable {
54 String errorMessage
55 = RTMGenericCommandLineOptionTest.RTM_UNSUPPORTED_VM_ERROR;
56 String experimentalOptionError
57 = CommandLineOptionTest.getExperimentalOptionErrorMessage(
58 "UseRTMLocking");
59 // verify that options is experimental
60 CommandLineOptionTest.verifySameJVMStartup(
61 new String[] { experimentalOptionError }, null, ExitCode.FAIL,
62 "-XX:+UseRTMLocking");
63 // verify that we can't use +UseRTMLocking
64 CommandLineOptionTest.verifySameJVMStartup(
65 new String[] { errorMessage }, null, ExitCode.FAIL,
66 CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,
67 "-XX:+UseRTMLocking");
68 // verify that we can turn it off
69 CommandLineOptionTest.verifySameJVMStartup(null,
70 new String[] { errorMessage }, ExitCode.OK,
71 CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,
72 "-XX:-UseRTMLocking");
73 // verify that it is off by default
74 CommandLineOptionTest.verifyOptionValueForSameVM("UseRTMLocking",
75 TestUseRTMLockingOptionOnUnsupportedVM.DEFAULT_VALUE,
76 CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS);
77 }
78
79 public static void main(String args[]) throws Throwable {
80 new TestUseRTMLockingOptionOnUnsupportedVM().test();
81 }
82 }