Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsBase.java
41152 views
1
/*
2
* Copyright (c) 2014, 2016, 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
package compiler.rtm.cli;
25
26
import jdk.test.lib.process.ExitCode;
27
import jdk.test.lib.Platform;
28
import jdk.test.lib.cli.CommandLineOptionTest;
29
30
public abstract class TestPrintPreciseRTMLockingStatisticsBase
31
extends RTMGenericCommandLineOptionTest {
32
protected static final String DEFAULT_VALUE = "false";
33
34
protected TestPrintPreciseRTMLockingStatisticsBase() {
35
super("PrintPreciseRTMLockingStatistics", true, false,
36
TestPrintPreciseRTMLockingStatisticsBase.DEFAULT_VALUE);
37
}
38
39
@Override
40
protected void runNonX86TestCases() throws Throwable {
41
verifyJVMStartup();
42
verifyOptionValues();
43
}
44
45
@Override
46
protected void verifyJVMStartup() throws Throwable {
47
if (Platform.isServer()) {
48
if (!Platform.isDebugBuild()) {
49
String shouldFailMessage = String.format("VM option '%s' is "
50
+ "diagnostic%nJVM startup should fail without "
51
+ "-XX:\\+UnlockDiagnosticVMOptions flag", optionName);
52
String shouldPassMessage = String.format("VM option '%s' is "
53
+ "diagnostic%nJVM startup should pass with "
54
+ "-XX:\\+UnlockDiagnosticVMOptions in debug build",
55
optionName);
56
String errorMessage = CommandLineOptionTest.
57
getDiagnosticOptionErrorMessage(optionName);
58
// verify that option is actually diagnostic
59
CommandLineOptionTest.verifySameJVMStartup(
60
new String[] { errorMessage }, null, shouldFailMessage,
61
shouldFailMessage, ExitCode.FAIL,
62
prepareOptionValue("true"));
63
64
CommandLineOptionTest.verifySameJVMStartup(null,
65
new String[] { errorMessage }, shouldPassMessage,
66
shouldPassMessage + "without any warnings", ExitCode.OK,
67
CommandLineOptionTest.UNLOCK_DIAGNOSTIC_VM_OPTIONS,
68
prepareOptionValue("true"));
69
} else {
70
String shouldPassMessage = String.format("JVM startup should "
71
+ "pass with '%s' option in debug build",
72
optionName);
73
CommandLineOptionTest.verifySameJVMStartup(null, null,
74
shouldPassMessage, shouldPassMessage,
75
ExitCode.OK, prepareOptionValue("true"));
76
}
77
} else {
78
String errorMessage = CommandLineOptionTest.
79
getUnrecognizedOptionErrorMessage(optionName);
80
String shouldFailMessage = String.format("JVM startup should fail"
81
+ " with '%s' option in not debug build", optionName);
82
CommandLineOptionTest.verifySameJVMStartup(
83
new String[]{errorMessage}, null, shouldFailMessage,
84
shouldFailMessage, ExitCode.FAIL,
85
CommandLineOptionTest.UNLOCK_DIAGNOSTIC_VM_OPTIONS,
86
prepareOptionValue("true"));
87
}
88
}
89
90
@Override
91
protected void verifyOptionValues() throws Throwable {
92
if (Platform.isServer()) {
93
// Verify default value
94
CommandLineOptionTest.verifyOptionValueForSameVM(optionName,
95
TestPrintPreciseRTMLockingStatisticsBase.DEFAULT_VALUE,
96
String.format("Option '%s' should have '%s' default value",
97
optionName,
98
TestPrintPreciseRTMLockingStatisticsBase.DEFAULT_VALUE),
99
CommandLineOptionTest.UNLOCK_DIAGNOSTIC_VM_OPTIONS);
100
}
101
}
102
}
103
104