Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell11
提交
f1cf48e3
D
dragonwell11
项目概览
openanolis
/
dragonwell11
通知
7
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell11
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f1cf48e3
编写于
12月 16, 2014
作者:
E
eistepan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8054892: Improve compiler's CLI tests error reporting
Reviewed-by: roland, twisti
上级
fc2b6cb8
变更
24
隐藏空白更改
内联
并排
Showing
24 changed file
with
479 addition
and
112 deletion
+479
-112
hotspot/test/compiler/arguments/BMISupportedCPUTest.java
hotspot/test/compiler/arguments/BMISupportedCPUTest.java
+13
-3
hotspot/test/compiler/arguments/BMIUnsupportedCPUTest.java
hotspot/test/compiler/arguments/BMIUnsupportedCPUTest.java
+27
-8
hotspot/test/compiler/arguments/TestUseCountTrailingZerosInstructionOnSupportedCPU.java
...s/TestUseCountTrailingZerosInstructionOnSupportedCPU.java
+6
-0
hotspot/test/compiler/arguments/TestUseCountTrailingZerosInstructionOnUnsupportedCPU.java
...TestUseCountTrailingZerosInstructionOnUnsupportedCPU.java
+6
-0
hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForOtherCPU.java
...rinsics/sha/cli/testcases/GenericTestCaseForOtherCPU.java
+15
-3
hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForSupportedSparcCPU.java
...ha/cli/testcases/GenericTestCaseForSupportedSparcCPU.java
+31
-5
hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedSparcCPU.java
.../cli/testcases/GenericTestCaseForUnsupportedSparcCPU.java
+12
-2
hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedX86CPU.java
...ha/cli/testcases/GenericTestCaseForUnsupportedX86CPU.java
+15
-3
hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHAIntrinsicsSpecificTestCaseForUnsupportedSparcCPU.java
...eSHAIntrinsicsSpecificTestCaseForUnsupportedSparcCPU.java
+5
-2
hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHASpecificTestCaseForSupportedSparcCPU.java
...testcases/UseSHASpecificTestCaseForSupportedSparcCPU.java
+24
-6
hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHASpecificTestCaseForUnsupportedSparcCPU.java
...stcases/UseSHASpecificTestCaseForUnsupportedSparcCPU.java
+16
-5
hotspot/test/compiler/rtm/cli/RTMGenericCommandLineOptionTest.java
...est/compiler/rtm/cli/RTMGenericCommandLineOptionTest.java
+28
-6
hotspot/test/compiler/rtm/cli/RTMLockingAwareTest.java
hotspot/test/compiler/rtm/cli/RTMLockingAwareTest.java
+9
-2
hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsBase.java
...ler/rtm/cli/TestPrintPreciseRTMLockingStatisticsBase.java
+24
-6
hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig.java
...ntPreciseRTMLockingStatisticsOptionOnSupportedConfig.java
+10
-0
hotspot/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnSupportedConfig.java
...piler/rtm/cli/TestUseRTMDeoptOptionOnSupportedConfig.java
+18
-4
hotspot/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnUnsupportedConfig.java
...ler/rtm/cli/TestUseRTMDeoptOptionOnUnsupportedConfig.java
+9
-3
hotspot/test/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnSupportedConfig.java
...m/cli/TestUseRTMForStackLocksOptionOnSupportedConfig.java
+30
-6
hotspot/test/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnUnsupportedConfig.java
...cli/TestUseRTMForStackLocksOptionOnUnsupportedConfig.java
+23
-6
hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnSupportedConfig.java
...ler/rtm/cli/TestUseRTMLockingOptionOnSupportedConfig.java
+14
-3
hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedCPU.java
...iler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedCPU.java
+21
-10
hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedVM.java
...piler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedVM.java
+13
-4
hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionWithBiasedLocking.java
...ler/rtm/cli/TestUseRTMLockingOptionWithBiasedLocking.java
+25
-6
hotspot/test/testlibrary/com/oracle/java/testlibrary/cli/CommandLineOptionTest.java
...om/oracle/java/testlibrary/cli/CommandLineOptionTest.java
+85
-19
未找到文件。
hotspot/test/compiler/arguments/BMISupportedCPUTest.java
浏览文件 @
f1cf48e3
...
...
@@ -60,8 +60,11 @@ public class BMISupportedCPUTest extends BMICommandLineOptionTestBase {
VM will be launched with following flags:
-XX:+<tested option> -version
*/
String
errorString
=
String
.
format
(
"JVM should start with '-XX:+%s'"
+
" flag without any warnings"
,
optionName
);
CommandLineOptionTest
.
verifySameJVMStartup
(
null
,
new
String
[]
{
warningMessage
},
ExitCode
.
OK
,
new
String
[]
{
warningMessage
},
errorString
,
errorString
,
ExitCode
.
OK
,
CommandLineOptionTest
.
prepareBooleanFlag
(
optionName
,
true
));
/*
...
...
@@ -69,8 +72,11 @@ public class BMISupportedCPUTest extends BMICommandLineOptionTestBase {
VM will be launched with following flags:
-XX:-<tested option> -version
*/
errorString
=
String
.
format
(
"JVM should start with '-XX:-%s'"
+
" flag without any warnings"
,
optionName
);
CommandLineOptionTest
.
verifySameJVMStartup
(
null
,
new
String
[]
{
warningMessage
},
ExitCode
.
OK
,
new
String
[]
{
warningMessage
},
errorString
,
errorString
,
ExitCode
.
OK
,
CommandLineOptionTest
.
prepareBooleanFlag
(
optionName
,
false
));
/*
...
...
@@ -78,7 +84,9 @@ public class BMISupportedCPUTest extends BMICommandLineOptionTestBase {
VM will be launched with following flags:
-version
*/
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
optionName
,
"true"
);
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
optionName
,
"true"
,
String
.
format
(
"Option '%s' is expected to have default value "
+
"'true'"
,
optionName
));
/*
Verify that option could be explicitly turned off.
...
...
@@ -86,6 +94,8 @@ public class BMISupportedCPUTest extends BMICommandLineOptionTestBase {
-XX:-<tested option> -version
*/
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
optionName
,
"false"
,
String
.
format
(
"Option '%s' is set to have value 'false'"
,
optionName
),
CommandLineOptionTest
.
prepareBooleanFlag
(
optionName
,
false
));
}
}
...
...
hotspot/test/compiler/arguments/BMIUnsupportedCPUTest.java
浏览文件 @
f1cf48e3
...
...
@@ -75,9 +75,13 @@ public class BMIUnsupportedCPUTest extends BMICommandLineOptionTestBase {
warning. VM will be launched with following options:
-XX:+<tested option> -version
*/
String
errorString
=
String
.
format
(
"JVM should start with '-XX:+%s' "
+
"flag, but output should contain warning."
,
optionName
);
CommandLineOptionTest
.
verifySameJVMStartup
(
new
String
[]
{
warningMessage
},
new
String
[]
{
errorMessage
},
ExitCode
.
OK
,
CommandLineOptionTest
.
prepareBooleanFlag
(
errorString
,
String
.
format
(
"Option '%s' is unsupported.%n"
+
"Warning expected to be shown."
,
optionName
),
ExitCode
.
OK
,
CommandLineOptionTest
.
prepareBooleanFlag
(
optionName
,
true
));
/*
...
...
@@ -85,15 +89,21 @@ public class BMIUnsupportedCPUTest extends BMICommandLineOptionTestBase {
VM will be launched with following options:
-XX:-<tested option> -version
*/
errorString
=
String
.
format
(
"JVM should start with '-XX:-%s' flag "
+
"without any warnings"
,
optionName
);
CommandLineOptionTest
.
verifySameJVMStartup
(
null
,
new
String
[]
{
warningMessage
,
errorMessage
},
ExitCode
.
OK
,
new
String
[]
{
warningMessage
,
errorMessage
},
errorString
,
errorString
,
ExitCode
.
OK
,
CommandLineOptionTest
.
prepareBooleanFlag
(
optionName
,
false
));
/*
Verify that on unsupported CPUs option is off by default.
VM will be launched with following options: -version
*/
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
optionName
,
"false"
);
* Verify that on unsupported CPUs option is off by default. VM will be
* launched with following options: -version
*/
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
optionName
,
"false"
,
String
.
format
(
"Option '%s' is expected to have default value "
+
"'false' since feature required is not supported "
+
"on CPU"
,
optionName
));
/*
Verify that on unsupported CPUs option will be off even if
...
...
@@ -101,6 +111,9 @@ public class BMIUnsupportedCPUTest extends BMICommandLineOptionTestBase {
following options: -XX:+<tested option> -version
*/
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
optionName
,
"false"
,
String
.
format
(
"Option '%s' is expected to have default value"
+
" 'false' since feature required is not supported on"
+
" CPU even if user set another value."
,
optionName
),
CommandLineOptionTest
.
prepareBooleanFlag
(
optionName
,
true
));
}
...
...
@@ -118,11 +131,17 @@ public class BMIUnsupportedCPUTest extends BMICommandLineOptionTestBase {
with following options: -XX:[+-]<tested option> -version
*/
CommandLineOptionTest
.
verifySameJVMStartup
(
new
String
[]
{
errorMessage
},
null
,
ExitCode
.
FAIL
,
new
String
[]
{
errorMessage
},
null
,
String
.
format
(
"JVM startup should fail with '-XX:+%s' flag."
+
"%nOption should be unknown (non-X86CPU)."
,
optionName
),
""
,
ExitCode
.
FAIL
,
CommandLineOptionTest
.
prepareBooleanFlag
(
optionName
,
true
));
CommandLineOptionTest
.
verifySameJVMStartup
(
new
String
[]
{
errorMessage
},
null
,
ExitCode
.
FAIL
,
new
String
[]
{
errorMessage
},
null
,
String
.
format
(
"JVM startup should fail with '-XX:-%s' flag."
+
"%nOption should be unknown (non-X86CPU)"
,
optionName
),
""
,
ExitCode
.
FAIL
,
CommandLineOptionTest
.
prepareBooleanFlag
(
optionName
,
false
));
}
}
...
...
hotspot/test/compiler/arguments/TestUseCountTrailingZerosInstructionOnSupportedCPU.java
浏览文件 @
f1cf48e3
...
...
@@ -59,6 +59,9 @@ public class TestUseCountTrailingZerosInstructionOnSupportedCPU
-XX:-UseBMI1Instructions -version
*/
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
optionName
,
"false"
,
"Option 'UseCountTrailingZerosInstruction' should have "
+
"'false' value if all BMI1 instructions are explicitly"
+
" disabled (-XX:-UseBMI1Instructions flag used)"
,
TestUseCountTrailingZerosInstructionOnSupportedCPU
.
DISABLE_BMI
);
/*
...
...
@@ -68,6 +71,9 @@ public class TestUseCountTrailingZerosInstructionOnSupportedCPU
-XX:+UseCountTrailingZerosInstruction -version
*/
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
optionName
,
"true"
,
"Option 'UseCountTrailingZerosInstruction' should be able to "
+
"be turned on even if all BMI1 instructions are "
+
"disabled (-XX:-UseBMI1Instructions flag used)"
,
TestUseCountTrailingZerosInstructionOnSupportedCPU
.
DISABLE_BMI
,
CommandLineOptionTest
.
prepareBooleanFlag
(
optionName
,
true
));
}
...
...
hotspot/test/compiler/arguments/TestUseCountTrailingZerosInstructionOnUnsupportedCPU.java
浏览文件 @
f1cf48e3
...
...
@@ -59,6 +59,9 @@ public class TestUseCountTrailingZerosInstructionOnUnsupportedCPU
-XX:+UseBMI1Instructions -version
*/
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
optionName
,
"false"
,
"Feature bmi1 is not supported on current CPU. Option "
+
"UseCountTrailingZerosInstruction should have 'false'"
+
" value"
,
TestUseCountTrailingZerosInstructionOnUnsupportedCPU
.
ENABLE_BMI
);
...
...
@@ -68,6 +71,9 @@ public class TestUseCountTrailingZerosInstructionOnUnsupportedCPU
-version
*/
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
optionName
,
"false"
,
"Feature bmi1 is not supported on current CPU. Option "
+
"UseCountTrailingZerosInstruction should have 'false'"
+
" value"
,
CommandLineOptionTest
.
prepareBooleanFlag
(
optionName
,
true
),
TestUseCountTrailingZerosInstructionOnUnsupportedCPU
.
ENABLE_BMI
);
...
...
hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForOtherCPU.java
浏览文件 @
f1cf48e3
...
...
@@ -41,30 +41,42 @@ public class GenericTestCaseForOtherCPU extends
@Override
protected
void
verifyWarnings
()
throws
Throwable
{
String
shouldPassMessage
=
String
.
format
(
"JVM should start with "
+
"option '%s' without any warnings"
,
optionName
);
// Verify that on non-x86 and non-SPARC CPU usage of SHA-related
// options will not cause any warnings.
CommandLineOptionTest
.
verifySameJVMStartup
(
null
,
new
String
[]
{
".*"
+
optionName
+
".*"
},
ExitCode
.
OK
,
new
String
[]
{
".*"
+
optionName
+
".*"
},
shouldPassMessage
,
shouldPassMessage
,
ExitCode
.
OK
,
CommandLineOptionTest
.
prepareBooleanFlag
(
optionName
,
true
));
CommandLineOptionTest
.
verifySameJVMStartup
(
null
,
new
String
[]
{
".*"
+
optionName
+
".*"
},
ExitCode
.
OK
,
new
String
[]
{
".*"
+
optionName
+
".*"
},
shouldPassMessage
,
shouldPassMessage
,
ExitCode
.
OK
,
CommandLineOptionTest
.
prepareBooleanFlag
(
optionName
,
false
));
}
@Override
protected
void
verifyOptionValues
()
throws
Throwable
{
// Verify that option is disabled by default.
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
optionName
,
"false"
);
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
optionName
,
"false"
,
String
.
format
(
"Option '%s' should be disabled by default"
,
optionName
));
// Verify that option is disabled even if it was explicitly enabled
// using CLI options.
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
optionName
,
"false"
,
String
.
format
(
"Option '%s' should be off on unsupported "
+
"CPU even if set to true directly"
,
optionName
),
CommandLineOptionTest
.
prepareBooleanFlag
(
optionName
,
true
));
// Verify that option is disabled when it explicitly disabled
// using CLI options.
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
optionName
,
"false"
,
String
.
format
(
"Option '%s' should be off on unsupported CPU"
+
" even if '%s' flag set to JVM"
,
optionName
,
CommandLineOptionTest
.
prepareBooleanFlag
(
SHAOptionsBase
.
USE_SHA_OPTION
,
true
)),
CommandLineOptionTest
.
prepareBooleanFlag
(
optionName
,
false
));
}
}
hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForSupportedSparcCPU.java
浏览文件 @
f1cf48e3
...
...
@@ -39,17 +39,24 @@ public class GenericTestCaseForSupportedSparcCPU extends
@Override
protected
void
verifyWarnings
()
throws
Throwable
{
String
shouldPassMessage
=
String
.
format
(
"JVM should start with option"
+
" '%s' without any warnings"
,
optionName
);
// Verify that there are no warning when option is explicitly enabled.
CommandLineOptionTest
.
verifySameJVMStartup
(
null
,
new
String
[]
{
SHAOptionsBase
.
getWarningForUnsupportedCPU
(
optionName
)
},
ExitCode
.
OK
,
},
shouldPassMessage
,
shouldPassMessage
,
ExitCode
.
OK
,
CommandLineOptionTest
.
prepareBooleanFlag
(
optionName
,
true
));
// Verify that option could be disabled even if +UseSHA was passed to
// JVM.
CommandLineOptionTest
.
verifySameJVMStartup
(
null
,
new
String
[]
{
SHAOptionsBase
.
getWarningForUnsupportedCPU
(
optionName
)
},
ExitCode
.
OK
,
},
shouldPassMessage
,
String
.
format
(
"It should be able to "
+
"disable option '%s' even if %s was passed to JVM"
,
optionName
,
CommandLineOptionTest
.
prepareBooleanFlag
(
SHAOptionsBase
.
USE_SHA_OPTION
,
true
)),
ExitCode
.
OK
,
CommandLineOptionTest
.
prepareBooleanFlag
(
SHAOptionsBase
.
USE_SHA_OPTION
,
true
),
CommandLineOptionTest
.
prepareBooleanFlag
(
optionName
,
false
));
...
...
@@ -58,7 +65,11 @@ public class GenericTestCaseForSupportedSparcCPU extends
// all SHA intrinsics via -UseSHA without any warnings.
CommandLineOptionTest
.
verifySameJVMStartup
(
null
,
new
String
[]
{
SHAOptionsBase
.
getWarningForUnsupportedCPU
(
optionName
)
},
ExitCode
.
OK
,
},
shouldPassMessage
,
String
.
format
(
"It should be able to "
+
"enable option '%s' even if %s was passed to JVM"
,
optionName
,
CommandLineOptionTest
.
prepareBooleanFlag
(
SHAOptionsBase
.
USE_SHA_OPTION
,
false
)),
ExitCode
.
OK
,
CommandLineOptionTest
.
prepareBooleanFlag
(
SHAOptionsBase
.
USE_SHA_OPTION
,
false
),
CommandLineOptionTest
.
prepareBooleanFlag
(
optionName
,
true
));
...
...
@@ -66,19 +77,30 @@ public class GenericTestCaseForSupportedSparcCPU extends
@Override
protected
void
verifyOptionValues
()
throws
Throwable
{
// Verify that on supported CPU option is enabled by default.
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
optionName
,
"true"
);
// Verify that "It should be able to disable option "
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
optionName
,
"true"
,
String
.
format
(
"Option '%s' should be enabled by default"
,
optionName
));
// Verify that it is possible to explicitly enable the option.
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
optionName
,
"true"
,
String
.
format
(
"Option '%s' was set to have value 'true'"
,
optionName
),
CommandLineOptionTest
.
prepareBooleanFlag
(
optionName
,
true
));
// Verify that it is possible to explicitly disable the option.
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
optionName
,
"false"
,
String
.
format
(
"Option '%s' was set to have value 'false'"
,
optionName
),
CommandLineOptionTest
.
prepareBooleanFlag
(
optionName
,
false
));
// verify that option is disabled when -UseSHA was passed to JVM.
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
optionName
,
"false"
,
String
.
format
(
"Option '%s' should have value 'false' when %s"
+
" flag set to JVM"
,
optionName
,
CommandLineOptionTest
.
prepareBooleanFlag
(
SHAOptionsBase
.
USE_SHA_OPTION
,
false
)),
CommandLineOptionTest
.
prepareBooleanFlag
(
optionName
,
true
),
CommandLineOptionTest
.
prepareBooleanFlag
(
SHAOptionsBase
.
USE_SHA_OPTION
,
false
));
...
...
@@ -86,6 +108,10 @@ public class GenericTestCaseForSupportedSparcCPU extends
// Verify that it is possible to explicitly disable the tested option
// even if +UseSHA was passed to JVM.
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
optionName
,
"false"
,
String
.
format
(
"Option '%s' should have value 'false' if set so"
+
" even if %s flag set to JVM"
,
optionName
,
CommandLineOptionTest
.
prepareBooleanFlag
(
SHAOptionsBase
.
USE_SHA_OPTION
,
true
)),
CommandLineOptionTest
.
prepareBooleanFlag
(
SHAOptionsBase
.
USE_SHA_OPTION
,
true
),
CommandLineOptionTest
.
prepareBooleanFlag
(
optionName
,
false
));
...
...
hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedSparcCPU.java
浏览文件 @
f1cf48e3
...
...
@@ -41,25 +41,35 @@ public class GenericTestCaseForUnsupportedSparcCPU extends
@Override
protected
void
verifyWarnings
()
throws
Throwable
{
String
shouldPassMessage
=
String
.
format
(
"JVM startup should pass with"
+
"option '-XX:-%s' without any warnings"
,
optionName
);
//Verify that option could be disabled without any warnings.
CommandLineOptionTest
.
verifySameJVMStartup
(
null
,
new
String
[]
{
SHAOptionsBase
.
getWarningForUnsupportedCPU
(
optionName
)
},
ExitCode
.
OK
,
},
shouldPassMessage
,
shouldPassMessage
,
ExitCode
.
OK
,
CommandLineOptionTest
.
prepareBooleanFlag
(
optionName
,
false
));
}
@Override
protected
void
verifyOptionValues
()
throws
Throwable
{
// Verify that option is disabled by default.
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
optionName
,
"false"
);
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
optionName
,
"false"
,
String
.
format
(
"Option '%s' should be disabled by default"
,
optionName
));
// Verify that option is disabled even if it was explicitly enabled
// using CLI options.
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
optionName
,
"false"
,
String
.
format
(
"Option '%s' should be off on unsupported "
+
"SparcCPU even if set to true directly"
,
optionName
),
CommandLineOptionTest
.
prepareBooleanFlag
(
optionName
,
true
));
// Verify that option is disabled when +UseSHA was passed to JVM.
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
optionName
,
"false"
,
String
.
format
(
"Option '%s' should be off on unsupported "
+
"SparcCPU even if %s flag set to JVM"
,
optionName
,
CommandLineOptionTest
.
prepareBooleanFlag
(
SHAOptionsBase
.
USE_SHA_OPTION
,
true
)),
CommandLineOptionTest
.
prepareBooleanFlag
(
SHAOptionsBase
.
USE_SHA_OPTION
,
true
));
}
...
...
hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedX86CPU.java
浏览文件 @
f1cf48e3
...
...
@@ -38,33 +38,45 @@ public class GenericTestCaseForUnsupportedX86CPU
@Override
protected
void
verifyWarnings
()
throws
Throwable
{
String
shouldPassMessage
=
String
.
format
(
"JVM should start with '-XX:+"
+
"%s' flag, but output should contain warning."
,
optionName
);
// Verify that when the tested option is explicitly enabled, then
// a warning will occur in VM output.
CommandLineOptionTest
.
verifySameJVMStartup
(
new
String
[]
{
SHAOptionsBase
.
getWarningForUnsupportedCPU
(
optionName
)
},
null
,
ExitCode
.
OK
,
},
null
,
shouldPassMessage
,
shouldPassMessage
,
ExitCode
.
OK
,
CommandLineOptionTest
.
prepareBooleanFlag
(
optionName
,
true
));
shouldPassMessage
=
String
.
format
(
"JVM should start with '-XX:-%s' "
+
"flag without any warnings"
,
optionName
);
// Verify that the tested option could be explicitly disabled without
// a warning.
CommandLineOptionTest
.
verifySameJVMStartup
(
null
,
new
String
[]
{
SHAOptionsBase
.
getWarningForUnsupportedCPU
(
optionName
)
},
ExitCode
.
OK
,
},
shouldPassMessage
,
shouldPassMessage
,
ExitCode
.
OK
,
CommandLineOptionTest
.
prepareBooleanFlag
(
optionName
,
false
));
}
@Override
protected
void
verifyOptionValues
()
throws
Throwable
{
// Verify that the tested option is disabled by default.
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
optionName
,
"false"
);
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
optionName
,
"false"
,
String
.
format
(
"Option '%s' should be disabled by default"
,
optionName
));
// Verify that it is not possible to explicitly enable the option.
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
optionName
,
"false"
,
String
.
format
(
"Option '%s' should be off on unsupported "
+
"X86CPU even if set to true directly"
,
optionName
),
CommandLineOptionTest
.
prepareBooleanFlag
(
optionName
,
true
));
// Verify that the tested option is disabled even if +UseSHA was passed
// to JVM.
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
optionName
,
"false"
,
String
.
format
(
"Option '%s' should be off on unsupported "
+
"X86CPU even if %s flag set to JVM"
,
optionName
,
CommandLineOptionTest
.
prepareBooleanFlag
(
SHAOptionsBase
.
USE_SHA_OPTION
,
true
)),
CommandLineOptionTest
.
prepareBooleanFlag
(
SHAOptionsBase
.
USE_SHA_OPTION
,
true
));
}
...
...
hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHAIntrinsicsSpecificTestCaseForUnsupportedSparcCPU.java
浏览文件 @
f1cf48e3
...
...
@@ -50,10 +50,13 @@ public class UseSHAIntrinsicsSpecificTestCaseForUnsupportedSparcCPU
}
@Override
protected
void
verifyWarnings
()
throws
Throwable
{
// Verify that attempt to enable the tested option will cause a warning.
String
shouldPassMessage
=
String
.
format
(
"JVM should start with "
+
"'-XX:+%s' flag, but output should contain warning."
,
optionName
);
// Verify that attempt to enable the tested option will cause a warning
CommandLineOptionTest
.
verifySameJVMStartup
(
new
String
[]
{
SHAOptionsBase
.
getWarningForUnsupportedCPU
(
optionName
)
},
null
,
ExitCode
.
OK
,
},
null
,
shouldPassMessage
,
shouldPassMessage
,
ExitCode
.
OK
,
CommandLineOptionTest
.
prepareBooleanFlag
(
optionName
,
true
));
}
}
hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHASpecificTestCaseForSupportedSparcCPU.java
浏览文件 @
f1cf48e3
...
...
@@ -39,16 +39,22 @@ public class UseSHASpecificTestCaseForSupportedSparcCPU
IntrinsicPredicates
.
ANY_SHA_INSTRUCTION_AVAILABLE
));
Asserts
.
assertEQ
(
optionName
,
SHAOptionsBase
.
USE_SHA_OPTION
,
"Test case should be used for "
+
SHAOptionsBase
.
USE_SHA_OPTION
+
" option only."
);
String
.
format
(
"Test case should be used for '%s' option only."
,
SHAOptionsBase
.
USE_SHA_OPTION
)
);
}
@Override
protected
void
verifyWarnings
()
throws
Throwable
{
String
shouldPassMessage
=
String
.
format
(
"JVM startup should pass when"
+
" %s was passed and all UseSHA*Intrinsics options "
+
"were disabled"
,
CommandLineOptionTest
.
prepareBooleanFlag
(
SHAOptionsBase
.
USE_SHA_OPTION
,
true
));
// Verify that there will be no warnings when +UseSHA was passed and
// all UseSHA*Intrinsics options were disabled.
CommandLineOptionTest
.
verifySameJVMStartup
(
null
,
new
String
[]
{
".*UseSHA.*"
},
ExitCode
.
OK
,
null
,
new
String
[]
{
".*UseSHA.*"
},
shouldPassMessage
,
shouldPassMessage
,
ExitCode
.
OK
,
CommandLineOptionTest
.
prepareBooleanFlag
(
SHAOptionsBase
.
USE_SHA_OPTION
,
true
),
CommandLineOptionTest
.
prepareBooleanFlag
(
...
...
@@ -61,10 +67,12 @@ public class UseSHASpecificTestCaseForSupportedSparcCPU
@Override
protected
void
verifyOptionValues
()
throws
Throwable
{
// Verify that UseSHA is disabled when all UseSHA*Intrinscs are
// Verify that UseSHA is disabled when all UseSHA*Intrins
i
cs are
// disabled.
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
SHAOptionsBase
.
USE_SHA_OPTION
,
"false"
,
SHAOptionsBase
.
USE_SHA_OPTION
,
"false"
,
String
.
format
(
"'%s' option should be disabled when all UseSHA*Intrinsics are"
+
" disabled"
,
SHAOptionsBase
.
USE_SHA_OPTION
),
CommandLineOptionTest
.
prepareBooleanFlag
(
SHAOptionsBase
.
USE_SHA1_INTRINSICS_OPTION
,
false
),
CommandLineOptionTest
.
prepareBooleanFlag
(
...
...
@@ -73,9 +81,14 @@ public class UseSHASpecificTestCaseForSupportedSparcCPU
SHAOptionsBase
.
USE_SHA512_INTRINSICS_OPTION
,
false
));
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
// Verify that UseSHA is disabled when all UseSHA*Intrinscs are
// Verify that UseSHA is disabled when all UseSHA*Intrins
i
cs are
// disabled even if it was explicitly enabled.
SHAOptionsBase
.
USE_SHA_OPTION
,
"false"
,
String
.
format
(
"'%s' option should be disabled when all "
+
"UseSHA*Intrinsics are disabled even if %s flag set "
+
"to JVM"
,
SHAOptionsBase
.
USE_SHA_OPTION
,
CommandLineOptionTest
.
prepareBooleanFlag
(
SHAOptionsBase
.
USE_SHA_OPTION
,
true
)),
CommandLineOptionTest
.
prepareBooleanFlag
(
SHAOptionsBase
.
USE_SHA_OPTION
,
true
),
CommandLineOptionTest
.
prepareBooleanFlag
(
...
...
@@ -89,6 +102,11 @@ public class UseSHASpecificTestCaseForSupportedSparcCPU
// if all UseSHA*Intrinsics options were enabled.
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
SHAOptionsBase
.
USE_SHA_OPTION
,
"false"
,
String
.
format
(
"'%s' option should be disabled if %s flag "
+
"set even if all UseSHA*Intrinsics were enabled"
,
SHAOptionsBase
.
USE_SHA_OPTION
,
CommandLineOptionTest
.
prepareBooleanFlag
(
SHAOptionsBase
.
USE_SHA_OPTION
,
false
)),
CommandLineOptionTest
.
prepareBooleanFlag
(
SHAOptionsBase
.
USE_SHA_OPTION
,
false
),
CommandLineOptionTest
.
prepareBooleanFlag
(
...
...
hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHASpecificTestCaseForUnsupportedSparcCPU.java
浏览文件 @
f1cf48e3
...
...
@@ -48,18 +48,24 @@ public class UseSHASpecificTestCaseForUnsupportedSparcCPU
@Override
protected
void
verifyWarnings
()
throws
Throwable
{
// Verify that attempt to use UseSHA option will cause a warning.
String
shouldPassMessage
=
String
.
format
(
"JVM startup should pass with"
+
" '%s' option on unsupported SparcCPU, but there should be"
+
"the message shown."
,
optionName
);
CommandLineOptionTest
.
verifySameJVMStartup
(
new
String
[]
{
SHAOptionsBase
.
getWarningForUnsupportedCPU
(
optionName
)
},
null
,
ExitCode
.
OK
,
},
null
,
shouldPassMessage
,
shouldPassMessage
,
ExitCode
.
OK
,
CommandLineOptionTest
.
prepareBooleanFlag
(
optionName
,
true
));
}
@Override
protected
void
verifyOptionValues
()
throws
Throwable
{
// Verify that UseSHA option remains disabled even if all
// UseSHA*Intrin
cs option
s were enabled.
// UseSHA*Intrin
sic
s were enabled.
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
SHAOptionsBase
.
USE_SHA_OPTION
,
"false"
,
SHAOptionsBase
.
USE_SHA_OPTION
,
"false"
,
String
.
format
(
"%s option should be disabled on unsupported SparcCPU"
+
" even if all UseSHA*Intrinsics options were enabled."
,
SHAOptionsBase
.
USE_SHA_OPTION
),
CommandLineOptionTest
.
prepareBooleanFlag
(
SHAOptionsBase
.
USE_SHA1_INTRINSICS_OPTION
,
true
),
CommandLineOptionTest
.
prepareBooleanFlag
(
...
...
@@ -68,9 +74,14 @@ public class UseSHASpecificTestCaseForUnsupportedSparcCPU
SHAOptionsBase
.
USE_SHA512_INTRINSICS_OPTION
,
true
));
// Verify that UseSHA option remains disabled even if all
// UseSHA*Intrincs options were enabled and UseSHA was enabled as well.
// UseSHA*Intrin
si
cs options were enabled and UseSHA was enabled as well.
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
SHAOptionsBase
.
USE_SHA_OPTION
,
"false"
,
SHAOptionsBase
.
USE_SHA_OPTION
,
"false"
,
String
.
format
(
"%s option should be disabled on unsupported SparcCPU"
+
" even if all UseSHA*Intrinsics options were enabled"
+
" and %s was enabled as well"
,
SHAOptionsBase
.
USE_SHA_OPTION
,
SHAOptionsBase
.
USE_SHA_OPTION
),
CommandLineOptionTest
.
prepareBooleanFlag
(
SHAOptionsBase
.
USE_SHA_OPTION
,
true
),
CommandLineOptionTest
.
prepareBooleanFlag
(
...
...
hotspot/test/compiler/rtm/cli/RTMGenericCommandLineOptionTest.java
浏览文件 @
f1cf48e3
...
...
@@ -121,7 +121,9 @@ public abstract class RTMGenericCommandLineOptionTest
*/
protected
void
runNonX86TestCases
()
throws
Throwable
{
CommandLineOptionTest
.
verifySameJVMStartup
(
new
String
[]
{
errorMessage
},
null
,
ExitCode
.
FAIL
,
new
String
[]
{
errorMessage
},
null
,
String
.
format
(
"Option '%s' should be unknown on non-X86CPUs.%n"
+
"JVM startup should fail"
,
optionName
),
""
,
ExitCode
.
FAIL
,
prepareOptionValue
(
defaultValue
));
}
...
...
@@ -136,12 +138,18 @@ public abstract class RTMGenericCommandLineOptionTest
protected
void
verifyJVMStartup
()
throws
Throwable
{
String
optionValue
=
prepareOptionValue
(
defaultValue
);
String
shouldFailMessage
=
String
.
format
(
"VM option '%s' is "
+
"experimental.%nVM startup expected to fail without "
+
"-XX:+UnlockExperimentalVMOptions option"
,
optionName
);
String
shouldPassMessage
=
String
.
format
(
"VM option '%s' is "
+
"experimental%nVM startup should pass with "
+
"-XX:+UnlockExperimentalVMOptions option"
,
optionName
);
if
(
isExperimental
)
{
// verify that option is experimental
CommandLineOptionTest
.
verifySameJVMStartup
(
new
String
[]
{
experimentalOptionError
},
new
String
[]
{
errorMessage
},
ExitCode
.
FAIL
,
optionValue
);
new
String
[]
{
errorMessage
},
shouldFailMessage
,
shouldFailMessage
,
ExitCode
.
FAIL
,
optionValue
);
// verify that it could be passed if experimental options
// are unlocked
CommandLineOptionTest
.
verifySameJVMStartup
(
null
,
...
...
@@ -149,13 +157,19 @@ public abstract class RTMGenericCommandLineOptionTest
experimentalOptionError
,
errorMessage
},
shouldPassMessage
,
"JVM should start without any warnings or errors"
,
ExitCode
.
OK
,
CommandLineOptionTest
.
UNLOCK_EXPERIMENTAL_VM_OPTIONS
,
optionValue
);
}
else
{
// verify that option could be passed
CommandLineOptionTest
.
verifySameJVMStartup
(
null
,
new
String
[]{
errorMessage
},
ExitCode
.
OK
,
optionValue
);
new
String
[]{
errorMessage
},
String
.
format
(
"VM startup shuld pass with '%s' option"
,
optionName
),
"JVM should start without any warnings or errors"
,
ExitCode
.
OK
,
optionValue
);
}
}
...
...
@@ -164,10 +178,14 @@ public abstract class RTMGenericCommandLineOptionTest
if
(
isExperimental
)
{
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
optionName
,
defaultValue
,
String
.
format
(
"Option '%s' is expected to have '%s' "
+
"default value"
,
optionName
,
defaultValue
),
CommandLineOptionTest
.
UNLOCK_EXPERIMENTAL_VM_OPTIONS
);
}
else
{
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
optionName
,
defaultValue
);
defaultValue
,
String
.
format
(
"Option '%s' is expected to have '%s' "
+
"default value"
,
optionName
,
defaultValue
));
}
// verify other specified option values
if
(
optionValues
==
null
)
{
...
...
@@ -178,11 +196,15 @@ public abstract class RTMGenericCommandLineOptionTest
if
(
isExperimental
)
{
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
optionName
,
value
,
String
.
format
(
"Option '%s' is set to have '%s' value"
,
optionName
,
value
),
CommandLineOptionTest
.
UNLOCK_EXPERIMENTAL_VM_OPTIONS
,
prepareOptionValue
(
value
));
}
else
{
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
optionName
,
value
,
prepareOptionValue
(
value
));
value
,
String
.
format
(
"Option '%s' is set to have '%s' value"
,
optionName
,
value
),
prepareOptionValue
(
value
));
}
}
}
...
...
hotspot/test/compiler/rtm/cli/RTMLockingAwareTest.java
浏览文件 @
f1cf48e3
...
...
@@ -131,10 +131,14 @@ public abstract class RTMLockingAwareTest
}
options
.
add
(
prepareOptionValue
(
value
));
String
errorString
=
String
.
format
(
"JVM should start with option '%s'"
+
"'%nWarnings should be shown: %s"
,
optionName
,
isWarningExpected
);
CommandLineOptionTest
.
verifySameJVMStartup
(
(
isWarningExpected
?
warnings
:
null
),
(
isWarningExpected
?
null
:
warnings
),
ExitCode
.
OK
,
options
.
toArray
(
new
String
[
options
.
size
()]));
errorString
,
errorString
,
ExitCode
.
OK
,
options
.
toArray
(
new
String
[
options
.
size
()]));
}
private
void
verifyOptionValues
(
String
value
,
boolean
useRTMLocking
,
...
...
@@ -149,6 +153,9 @@ public abstract class RTMLockingAwareTest
options
.
add
(
prepareOptionValue
(
value
));
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
optionName
,
expectedValue
,
options
.
toArray
(
new
String
[
options
.
size
()]));
expectedValue
,
String
.
format
(
"Option '%s' should have '%s' "
+
"value if '%s' flag set"
,
optionName
,
expectedValue
,
prepareOptionValue
(
value
)),
options
.
toArray
(
new
String
[
options
.
size
()]));
}
}
hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsBase.java
浏览文件 @
f1cf48e3
...
...
@@ -47,27 +47,42 @@ public abstract class TestPrintPreciseRTMLockingStatisticsBase
protected
void
verifyJVMStartup
()
throws
Throwable
{
if
(
Platform
.
isServer
())
{
if
(!
Platform
.
isDebugBuild
())
{
String
shouldFailMessage
=
String
.
format
(
"VM option '%s' is "
+
"diagnostic%nJVM startup should fail without "
+
"-XX:\\+UnlockDiagnosticVMOptions flag"
,
optionName
);
String
shouldPassMessage
=
String
.
format
(
"VM option '%s' is "
+
"diagnostic%nJVM startup should pass with "
+
"-XX:\\+UnlockDiagnosticVMOptions in debug build"
,
optionName
);
String
errorMessage
=
CommandLineOptionTest
.
getDiagnosticOptionErrorMessage
(
optionName
);
// verify that option is actually diagnostic
CommandLineOptionTest
.
verifySameJVMStartup
(
new
String
[]
{
errorMessage
},
null
,
ExitCode
.
FAIL
,
new
String
[]
{
errorMessage
},
null
,
shouldFailMessage
,
shouldFailMessage
,
ExitCode
.
FAIL
,
prepareOptionValue
(
"true"
));
CommandLineOptionTest
.
verifySameJVMStartup
(
null
,
new
String
[]
{
errorMessage
},
ExitCode
.
OK
,
new
String
[]
{
errorMessage
},
shouldPassMessage
,
shouldPassMessage
+
"without any warnings"
,
ExitCode
.
OK
,
CommandLineOptionTest
.
UNLOCK_DIAGNOSTIC_VM_OPTIONS
,
prepareOptionValue
(
"true"
));
}
else
{
CommandLineOptionTest
.
verifySameJVMStartup
(
null
,
null
,
ExitCode
.
OK
,
prepareOptionValue
(
"true"
));
String
shouldPassMessage
=
String
.
format
(
"JVM startup should "
+
"pass with '%s' option in debug build"
,
optionName
);
CommandLineOptionTest
.
verifySameJVMStartup
(
null
,
null
,
shouldPassMessage
,
shouldPassMessage
,
ExitCode
.
OK
,
prepareOptionValue
(
"true"
));
}
}
else
{
String
errorMessage
=
CommandLineOptionTest
.
getUnrecognizedOptionErrorMessage
(
optionName
);
String
shouldFailMessage
=
String
.
format
(
"JVM startup should fail"
+
" with '%s' option in not debug build"
,
optionName
);
CommandLineOptionTest
.
verifySameJVMStartup
(
new
String
[]{
errorMessage
},
null
,
ExitCode
.
FAIL
,
new
String
[]{
errorMessage
},
null
,
shouldFailMessage
,
shouldFailMessage
,
ExitCode
.
FAIL
,
CommandLineOptionTest
.
UNLOCK_DIAGNOSTIC_VM_OPTIONS
,
prepareOptionValue
(
"true"
));
}
...
...
@@ -79,6 +94,9 @@ public abstract class TestPrintPreciseRTMLockingStatisticsBase
// Verify default value
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
optionName
,
TestPrintPreciseRTMLockingStatisticsBase
.
DEFAULT_VALUE
,
String
.
format
(
"Option '%s' should have '%s' default value"
,
optionName
,
TestPrintPreciseRTMLockingStatisticsBase
.
DEFAULT_VALUE
),
CommandLineOptionTest
.
UNLOCK_DIAGNOSTIC_VM_OPTIONS
);
}
}
...
...
hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig.java
浏览文件 @
f1cf48e3
...
...
@@ -53,18 +53,28 @@ public class TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig
// verify default value
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
optionName
,
TestPrintPreciseRTMLockingStatisticsBase
.
DEFAULT_VALUE
,
String
.
format
(
"Option '%s' should have '%s' default value on"
+
" supported CPU"
,
optionName
,
TestPrintPreciseRTMLockingStatisticsBase
.
DEFAULT_VALUE
),
CommandLineOptionTest
.
UNLOCK_DIAGNOSTIC_VM_OPTIONS
,
CommandLineOptionTest
.
UNLOCK_EXPERIMENTAL_VM_OPTIONS
,
"-XX:+UseRTMLocking"
);
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
optionName
,
TestPrintPreciseRTMLockingStatisticsBase
.
DEFAULT_VALUE
,
String
.
format
(
"Option '%s' should have '%s' default value on"
+
" supported CPU when -XX:-UseRTMLocking flag set"
,
optionName
,
TestPrintPreciseRTMLockingStatisticsBase
.
DEFAULT_VALUE
),
CommandLineOptionTest
.
UNLOCK_DIAGNOSTIC_VM_OPTIONS
,
CommandLineOptionTest
.
UNLOCK_EXPERIMENTAL_VM_OPTIONS
,
"-XX:-UseRTMLocking"
,
prepareOptionValue
(
"true"
));
// verify that option could be turned on
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
optionName
,
"true"
,
String
.
format
(
"Option '%s' should have 'true' value when set "
+
"on supported CPU and -XX:+UseRTMLocking flag set"
,
optionName
),
CommandLineOptionTest
.
UNLOCK_DIAGNOSTIC_VM_OPTIONS
,
CommandLineOptionTest
.
UNLOCK_EXPERIMENTAL_VM_OPTIONS
,
"-XX:+UseRTMLocking"
,
prepareOptionValue
(
"true"
));
...
...
hotspot/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnSupportedConfig.java
浏览文件 @
f1cf48e3
...
...
@@ -51,26 +51,40 @@ public class TestUseRTMDeoptOptionOnSupportedConfig
@Override
public
void
runTestCases
()
throws
Throwable
{
String
shouldPassMessage
=
" JVM should startup with option '"
+
"-XX:+UseRTMDeopt' without any warnings"
;
// verify that option could be turned on
CommandLineOptionTest
.
verifySameJVMStartup
(
null
,
null
,
ExitCode
.
OK
,
"-XX:+UseRTMDeopt"
);
null
,
null
,
shouldPassMessage
,
shouldPassMessage
,
ExitCode
.
OK
,
"-XX:+UseRTMDeopt"
);
shouldPassMessage
=
" JVM should startup with option '"
+
"-XX:-UseRTMDeopt' without any warnings"
;
// verify that option could be turned off
CommandLineOptionTest
.
verifySameJVMStartup
(
null
,
null
,
ExitCode
.
OK
,
"-XX:-UseRTMDeopt"
);
null
,
null
,
shouldPassMessage
,
shouldPassMessage
,
ExitCode
.
OK
,
"-XX:-UseRTMDeopt"
);
String
defValMessage
=
String
.
format
(
"UseRTMDeopt should have '%s'"
+
"default value"
,
TestUseRTMDeoptOptionOnSupportedConfig
.
DEFAULT_VALUE
);
// verify default value
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
"UseRTMDeopt"
,
TestUseRTMDeoptOptionOnSupportedConfig
.
DEFAULT_VALUE
);
TestUseRTMDeoptOptionOnSupportedConfig
.
DEFAULT_VALUE
,
defValMessage
);
// verify default value
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
"UseRTMDeopt"
,
TestUseRTMDeoptOptionOnSupportedConfig
.
DEFAULT_VALUE
,
defValMessage
,
CommandLineOptionTest
.
UNLOCK_EXPERIMENTAL_VM_OPTIONS
,
"-XX:+UseRTMLocking"
);
// verify that option is off when UseRTMLocking is off
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
"UseRTMDeopt"
,
"false"
,
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
"UseRTMDeopt"
,
"false"
,
"UseRTMDeopt should be off when UseRTMLocking is off"
,
CommandLineOptionTest
.
UNLOCK_EXPERIMENTAL_VM_OPTIONS
,
"-XX:-UseRTMLocking"
,
"-XX:+UseRTMDeopt"
);
// verify that option could be turned on
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
"UseRTMDeopt"
,
"true"
,
"UseRTMDeopt should be on when UseRTMLocking is on and "
+
"'-XX:+UseRTMDeopt' flag set"
,
CommandLineOptionTest
.
UNLOCK_EXPERIMENTAL_VM_OPTIONS
,
"-XX:+UseRTMLocking"
,
"-XX:+UseRTMDeopt"
);
}
...
...
hotspot/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnUnsupportedConfig.java
浏览文件 @
f1cf48e3
...
...
@@ -50,7 +50,8 @@ public class TestUseRTMDeoptOptionOnUnsupportedConfig
super
(
new
NotPredicate
(
new
AndPredicate
(
new
SupportedCPU
(),
new
SupportedVM
())),
"UseRTMDeopt"
,
true
,
false
,
TestUseRTMDeoptOptionOnUnsupportedConfig
.
DEFAULT_VALUE
,
"true"
);
TestUseRTMDeoptOptionOnUnsupportedConfig
.
DEFAULT_VALUE
,
"true"
);
}
@Override
...
...
@@ -58,11 +59,16 @@ public class TestUseRTMDeoptOptionOnUnsupportedConfig
super
.
verifyJVMStartup
();
// verify default value
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
optionName
,
defaultValue
);
defaultValue
,
String
.
format
(
"'%s' should have '%s' "
+
"default value on unsupported configs."
,
optionName
,
DEFAULT_VALUE
));
// verify that until RTMLocking is not used, value
// will be set to default false.
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
optionName
,
defaultValue
,
"-XX:+UseRTMDeopt"
);
defaultValue
,
String
.
format
(
"'%s' should be off on unsupported"
+
" configs even if '-XX:+%s' flag set"
,
optionName
,
optionName
),
"-XX:+UseRTMDeopt"
);
}
public
static
void
main
(
String
args
[])
throws
Throwable
{
...
...
hotspot/test/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnSupportedConfig.java
浏览文件 @
f1cf48e3
...
...
@@ -58,43 +58,67 @@ public class TestUseRTMForStackLocksOptionOnSupportedConfig
String
warningMessage
=
RTMGenericCommandLineOptionTest
.
RTM_FOR_STACK_LOCKS_WARNING
;
String
shouldFailMessage
=
" VM option 'UseRTMForStackLocks' is "
+
"experimental%nJVM startup should fail without "
+
"-XX:+UnlockExperimentalVMOptions flag"
;
CommandLineOptionTest
.
verifySameJVMStartup
(
new
String
[]
{
errorMessage
},
null
,
ExitCode
.
FAIL
,
new
String
[]
{
errorMessage
},
null
,
shouldFailMessage
,
shouldFailMessage
+
"%nError message expected"
,
ExitCode
.
FAIL
,
"-XX:+UseRTMForStackLocks"
);
String
shouldPassMessage
=
" VM option 'UseRTMForStackLocks'"
+
" is experimental%nJVM startup should pass with "
+
"-XX:+UnlockExperimentalVMOptions flag"
;
// verify that we get a warning when trying to use rtm for stack
// lock, but not using rtm locking.
CommandLineOptionTest
.
verifySameJVMStartup
(
new
String
[]
{
warningMessage
},
null
,
ExitCode
.
OK
,
new
String
[]
{
warningMessage
},
null
,
shouldPassMessage
,
"There should be warning when trying to use rtm for stack "
+
"lock, but not using rtm locking"
,
ExitCode
.
OK
,
CommandLineOptionTest
.
UNLOCK_EXPERIMENTAL_VM_OPTIONS
,
"-XX:+UseRTMForStackLocks"
,
"-XX:-UseRTMLocking"
);
// verify that we don't get a warning when no using rtm for stack
// lock and not using rtm locking.
CommandLineOptionTest
.
verifySameJVMStartup
(
null
,
new
String
[]
{
warningMessage
},
ExitCode
.
OK
,
new
String
[]
{
warningMessage
},
shouldPassMessage
,
"There should not be any warning when use both "
+
"-XX:-UseRTMForStackLocks and -XX:-UseRTMLocking "
+
"flags"
,
ExitCode
.
OK
,
CommandLineOptionTest
.
UNLOCK_EXPERIMENTAL_VM_OPTIONS
,
"-XX:-UseRTMForStackLocks"
,
"-XX:-UseRTMLocking"
);
// verify that we don't get a warning when using rtm for stack
// lock and using rtm locking.
CommandLineOptionTest
.
verifySameJVMStartup
(
null
,
new
String
[]
{
warningMessage
},
ExitCode
.
OK
,
new
String
[]
{
warningMessage
},
shouldPassMessage
,
"There should not be any warning when use both "
+
"-XX:+UseRTMForStackLocks and -XX:+UseRTMLocking"
+
" flags"
,
ExitCode
.
OK
,
CommandLineOptionTest
.
UNLOCK_EXPERIMENTAL_VM_OPTIONS
,
"-XX:+UseRTMForStackLocks"
,
"-XX:+UseRTMLocking"
);
// verify that default value if false
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
"UseRTMForStackLocks"
,
TestUseRTMForStackLocksOptionOnSupportedConfig
.
DEFAULT_VALUE
,
"Default value of option 'UseRTMForStackLocks' should be false"
,
CommandLineOptionTest
.
UNLOCK_EXPERIMENTAL_VM_OPTIONS
);
// verify that default value is false even with +UseRTMLocking
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
"UseRTMForStackLocks"
,
TestUseRTMForStackLocksOptionOnSupportedConfig
.
DEFAULT_VALUE
,
"Default value of option 'UseRTMForStackLocks' should be false"
,
CommandLineOptionTest
.
UNLOCK_EXPERIMENTAL_VM_OPTIONS
,
"-XX:+UseRTMLocking"
);
// verify that we can turn the option on
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
"UseRTMForStackLocks"
,
"true"
,
CommandLineOptionTest
.
UNLOCK_EXPERIMENTAL_VM_OPTIONS
,
"-XX:+UseRTMLocking"
,
"-XX:+UseRTMForStackLocks"
);
"true"
,
"Value of option 'UseRTMForStackLocks' should "
+
"be able to be set as 'true' when both "
+
"-XX:+UseRTMForStackLocks and "
+
"-XX:+UseRTMLocking flags used"
,
CommandLineOptionTest
.
UNLOCK_EXPERIMENTAL_VM_OPTIONS
,
"-XX:+UseRTMLocking"
,
"-XX:+UseRTMForStackLocks"
);
}
public
static
void
main
(
String
args
[])
throws
Throwable
{
...
...
hotspot/test/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnUnsupportedConfig.java
浏览文件 @
f1cf48e3
...
...
@@ -57,33 +57,50 @@ public class TestUseRTMForStackLocksOptionOnUnsupportedConfig
@Override
protected
void
runX86SupportedVMTestCases
()
throws
Throwable
{
String
shouldFailMessage
=
String
.
format
(
"VM option '%s' is "
+
"experimental%nJVM startup should fail without "
+
"-XX:+UnlockExperimentalVMOptions flag"
,
optionName
);
// verify that option is experimental
CommandLineOptionTest
.
verifySameJVMStartup
(
new
String
[]{
experimentalOptionError
},
null
,
ExitCode
.
FAIL
,
prepareOptionValue
(
"true"
));
new
String
[]
{
experimentalOptionError
},
null
,
shouldFailMessage
,
shouldFailMessage
+
"%nError message "
+
"should be shown"
,
ExitCode
.
FAIL
,
prepareOptionValue
(
"true"
));
CommandLineOptionTest
.
verifySameJVMStartup
(
new
String
[]{
experimentalOptionError
},
null
,
ExitCode
.
FAIL
,
prepareOptionValue
(
"false"
));
new
String
[]{
experimentalOptionError
},
null
,
shouldFailMessage
,
shouldFailMessage
+
"%nError message "
+
"should be shown"
,
ExitCode
.
FAIL
,
prepareOptionValue
(
"false"
));
String
shouldPassMessage
=
String
.
format
(
"VM option '%s' is "
+
" experimental%nJVM startup should pass with "
+
"-XX:+UnlockExperimentalVMOptions flag"
,
optionName
);
// verify that if we turn it on, then VM output will contain
// warning saying that this option could be turned on only
// when we use rtm locking
CommandLineOptionTest
.
verifySameJVMStartup
(
new
String
[]{
RTMGenericCommandLineOptionTest
.
RTM_FOR_STACK_LOCKS_WARNING
},
null
,
ExitCode
.
OK
,
},
null
,
shouldPassMessage
,
"There should be warning when try "
+
"to use rtm for stack lock, but not using rtm locking"
,
ExitCode
.
OK
,
CommandLineOptionTest
.
UNLOCK_EXPERIMENTAL_VM_OPTIONS
,
prepareOptionValue
(
"true"
)
);
// verify that options is turned off by default
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
optionName
,
TestUseRTMForStackLocksOptionOnUnsupportedConfig
.
DEFAULT_VALUE
,
String
.
format
(
"Default value of option '%s' should be '%s'"
,
optionName
,
DEFAULT_VALUE
),
CommandLineOptionTest
.
UNLOCK_EXPERIMENTAL_VM_OPTIONS
);
// verify that it could not be turned on without rtm locking
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
optionName
,
TestUseRTMForStackLocksOptionOnUnsupportedConfig
.
DEFAULT_VALUE
,
String
.
format
(
"Value of '%s' shouldn't able to be set to "
+
"'true' without setting -XX:+UseRTMLocking flag"
,
optionName
),
CommandLineOptionTest
.
UNLOCK_EXPERIMENTAL_VM_OPTIONS
,
prepareOptionValue
(
"true"
));
}
...
...
hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnSupportedConfig.java
浏览文件 @
f1cf48e3
...
...
@@ -54,12 +54,16 @@ public class TestUseRTMLockingOptionOnSupportedConfig
String
unrecongnizedOption
=
CommandLineOptionTest
.
getUnrecognizedOptionErrorMessage
(
"UseRTMLocking"
);
String
shouldPassMessage
=
"VM option 'UseRTMLocking' is experimental"
+
"%nJVM startup should pass with "
+
"-XX:+UnlockExperimentalVMOptions flag"
;
// verify that there are no warning or error in VM output
CommandLineOptionTest
.
verifySameJVMStartup
(
null
,
new
String
[]{
RTMGenericCommandLineOptionTest
.
RTM_INSTR_ERROR
,
unrecongnizedOption
},
ExitCode
.
OK
,
},
shouldPassMessage
,
"There should not be any warning when use"
+
"with -XX:+UnlockExperimentalVMOptions"
,
ExitCode
.
OK
,
CommandLineOptionTest
.
UNLOCK_EXPERIMENTAL_VM_OPTIONS
,
"-XX:+UseRTMLocking"
);
...
...
@@ -68,21 +72,28 @@ public class TestUseRTMLockingOptionOnSupportedConfig
new
String
[]{
RTMGenericCommandLineOptionTest
.
RTM_INSTR_ERROR
,
unrecongnizedOption
},
ExitCode
.
OK
,
},
shouldPassMessage
,
"There should not be any warning when use"
+
"with -XX:+UnlockExperimentalVMOptions"
,
ExitCode
.
OK
,
CommandLineOptionTest
.
UNLOCK_EXPERIMENTAL_VM_OPTIONS
,
"-XX:-UseRTMLocking"
);
// verify that UseRTMLocking is of by default
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
"UseRTMLocking"
,
TestUseRTMLockingOptionOnSupportedConfig
.
DEFAULT_VALUE
,
String
.
format
(
"Default value of option 'UseRTMLocking' should "
+
"be '%s'"
,
DEFAULT_VALUE
),
CommandLineOptionTest
.
UNLOCK_EXPERIMENTAL_VM_OPTIONS
);
// verify that we can change UseRTMLocking value
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
"UseRTMLocking"
,
TestUseRTMLockingOptionOnSupportedConfig
.
DEFAULT_VALUE
,
String
.
format
(
"Default value of option 'UseRTMLocking' should "
+
"be '%s'"
,
DEFAULT_VALUE
),
CommandLineOptionTest
.
UNLOCK_EXPERIMENTAL_VM_OPTIONS
,
"-XX:-UseRTMLocking"
);
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
"UseRTMLocking"
,
"true"
,
CommandLineOptionTest
.
UNLOCK_EXPERIMENTAL_VM_OPTIONS
,
"true"
,
"Value of 'UseRTMLocking' should be set "
+
"to 'true' if -XX:+UseRTMLocking flag set"
,
CommandLineOptionTest
.
UNLOCK_EXPERIMENTAL_VM_OPTIONS
,
"-XX:+UseRTMLocking"
);
}
...
...
hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedCPU.java
浏览文件 @
f1cf48e3
...
...
@@ -59,33 +59,44 @@ public class TestUseRTMLockingOptionOnUnsupportedCPU
String
errorMessage
=
RTMGenericCommandLineOptionTest
.
RTM_INSTR_ERROR
;
if
(
Platform
.
isX86
()
||
Platform
.
isX64
())
{
String
shouldFailMessage
=
"JVM startup should fail with option "
+
"-XX:+UseRTMLocking on unsupported CPU"
;
// verify that we get an error when use +UseRTMLocking
// on unsupported CPU
CommandLineOptionTest
.
verifySameJVMStartup
(
new
String
[]
{
errorMessage
},
new
String
[]
{
unrecongnizedOption
},
new
String
[]
{
unrecongnizedOption
},
shouldFailMessage
,
shouldFailMessage
+
". Error message should be shown"
,
ExitCode
.
FAIL
,
"-XX:+UseRTMLocking"
);
String
shouldPassMessage
=
"JVM startup should pass with option "
+
"-XX:-UseRTMLocking even on unsupported CPU"
;
// verify that we can pass -UseRTMLocking without
// getting any error messages
CommandLineOptionTest
.
verifySameJVMStartup
(
null
,
new
String
[]{
errorMessage
,
unrecongnizedOption
},
ExitCode
.
OK
,
"-XX:-UseRTMLocking"
);
CommandLineOptionTest
.
verifySameJVMStartup
(
null
,
new
String
[]
{
errorMessage
,
unrecongnizedOption
},
shouldPassMessage
,
shouldPassMessage
+
" without any warnings"
,
ExitCode
.
OK
,
"-XX:-UseRTMLocking"
);
// verify that UseRTMLocking is false by default
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
"UseRTMLocking"
,
TestUseRTMLockingOptionOnUnsupportedCPU
.
DEFAULT_VALUE
);
TestUseRTMLockingOptionOnUnsupportedCPU
.
DEFAULT_VALUE
,
String
.
format
(
"Default value of option 'UseRTMLocking' "
+
"should be '%s'"
,
DEFAULT_VALUE
));
}
else
{
String
shouldFailMessage
=
"RTMLocking should be unrecognized"
+
" on non-x86 CPUs. JVM startup should fail."
+
"Error message should be shown"
;
// verify that on non-x86 CPUs RTMLocking could not be used
CommandLineOptionTest
.
verifySameJVMStartup
(
new
String
[]
{
unrecongnizedOption
},
null
,
ExitCode
.
FAIL
,
"-XX:+UseRTMLocking"
);
null
,
shouldFailMessage
,
shouldFailMessage
,
ExitCode
.
FAIL
,
"-XX:+UseRTMLocking"
);
CommandLineOptionTest
.
verifySameJVMStartup
(
new
String
[]
{
unrecongnizedOption
},
null
,
ExitCode
.
FAIL
,
"-XX:-UseRTMLocking"
);
null
,
shouldFailMessage
,
shouldFailMessage
,
ExitCode
.
FAIL
,
"-XX:-UseRTMLocking"
);
}
}
...
...
hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedVM.java
浏览文件 @
f1cf48e3
...
...
@@ -54,17 +54,26 @@ public class TestUseRTMLockingOptionOnUnsupportedVM
public
void
runTestCases
()
throws
Throwable
{
String
errorMessage
=
RTMGenericCommandLineOptionTest
.
RTM_UNSUPPORTED_VM_ERROR
;
String
shouldFailMessage
=
"JVM startup should fail with option "
+
"-XX:+UseRTMLocking even on unsupported VM. Error message"
+
" should be shown"
;
String
shouldPassMessage
=
"JVM startup should pass with option "
+
"-XX:-UseRTMLocking even on unsupported VM"
;
// verify that we can't use +UseRTMLocking
CommandLineOptionTest
.
verifySameJVMStartup
(
new
String
[]
{
errorMessage
},
null
,
ExitCode
.
FAIL
,
"-XX:+UseRTMLocking"
);
new
String
[]
{
errorMessage
},
null
,
shouldFailMessage
,
shouldFailMessage
,
ExitCode
.
FAIL
,
"-XX:+UseRTMLocking"
);
// verify that we can turn it off
CommandLineOptionTest
.
verifySameJVMStartup
(
null
,
new
String
[]
{
errorMessage
},
ExitCode
.
OK
,
new
String
[]
{
errorMessage
},
shouldPassMessage
,
shouldPassMessage
+
" without any warnings"
,
ExitCode
.
OK
,
"-XX:-UseRTMLocking"
);
// verify that it is off by default
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
"UseRTMLocking"
,
TestUseRTMLockingOptionOnUnsupportedVM
.
DEFAULT_VALUE
);
TestUseRTMLockingOptionOnUnsupportedVM
.
DEFAULT_VALUE
,
String
.
format
(
"Default value of option 'UseRTMLocking' should"
+
" be '%s'"
,
DEFAULT_VALUE
));
}
public
static
void
main
(
String
args
[])
throws
Throwable
{
...
...
hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionWithBiasedLocking.java
浏览文件 @
f1cf48e3
...
...
@@ -51,25 +51,44 @@ public class TestUseRTMLockingOptionWithBiasedLocking
public
void
runTestCases
()
throws
Throwable
{
String
warningMessage
=
RTMGenericCommandLineOptionTest
.
RTM_BIASED_LOCKING_WARNING
;
String
shouldPassMessage
=
"JVM startup should pass with both "
+
"-XX:+UseRTMLocking and "
+
"-XX:-UseBiasedLocking flags set without any warnings"
;
// verify that we will not get a warning
CommandLineOptionTest
.
verifySameJVMStartup
(
null
,
new
String
[]
{
warningMessage
},
ExitCode
.
OK
,
new
String
[]
{
warningMessage
},
shouldPassMessage
,
shouldPassMessage
,
ExitCode
.
OK
,
CommandLineOptionTest
.
UNLOCK_EXPERIMENTAL_VM_OPTIONS
,
"-XX:+UseRTMLocking"
,
"-XX:-UseBiasedLocking"
);
// verify that we will get a warning
CommandLineOptionTest
.
verifySameJVMStartup
(
new
String
[]
{
warningMessage
},
null
,
ExitCode
.
OK
,
new
String
[]
{
warningMessage
},
null
,
"JVM startup should pass when both -XX:+UseRTMLocking and "
+
"-XX:+UseBiasedLocking flags set"
,
"Flags -XX:+UseRTMLocking"
+
" and -XX:+UseBiasedLocking conflicts. "
+
"Warning should be shown."
,
ExitCode
.
OK
,
CommandLineOptionTest
.
UNLOCK_EXPERIMENTAL_VM_OPTIONS
,
"-XX:+UseRTMLocking"
,
"-XX:+UseBiasedLocking"
);
// verify that UseBiasedLocking is false when we use rtm locking
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
"UseBiasedLocking"
,
"false"
,
CommandLineOptionTest
.
UNLOCK_EXPERIMENTAL_VM_OPTIONS
,
"false"
,
"Value of option 'UseBiasedLocking' should be false if"
+
"-XX:+UseRTMLocking flag set."
,
CommandLineOptionTest
.
UNLOCK_EXPERIMENTAL_VM_OPTIONS
,
"-XX:+UseRTMLocking"
);
// verify that we can't turn on biased locking when
// using rtm locking
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
"UseBiasedLocking"
,
"false"
,
CommandLineOptionTest
.
UNLOCK_EXPERIMENTAL_VM_OPTIONS
,
"-XX:+UseRTMLocking"
,
"-XX:+UseBiasedLocking"
);
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
"UseBiasedLocking"
,
"false"
,
"Value of option 'UseBiasedLocking' should be false if"
+
"both -XX:+UseRTMLocking and "
+
"-XX:+UseBiasedLocking flags set."
,
CommandLineOptionTest
.
UNLOCK_EXPERIMENTAL_VM_OPTIONS
,
"-XX:+UseRTMLocking"
,
"-XX:+UseBiasedLocking"
);
}
public
static
void
main
(
String
args
[])
throws
Throwable
{
...
...
hotspot/test/testlibrary/com/oracle/java/testlibrary/cli/CommandLineOptionTest.java
浏览文件 @
f1cf48e3
...
...
@@ -49,7 +49,7 @@ public abstract class CommandLineOptionTest {
private
static
final
String
PRINT_FLAGS_FINAL_FORMAT
=
"%s\\s*:?=\\s*%s"
;
/**
* Verifies that JVM startup behavio
u
r matches our expectations.
* Verifies that JVM startup behavior matches our expectations.
*
* @param option an option that should be passed to JVM
* @param expectedMessages an array of patterns that should occur
...
...
@@ -58,18 +58,24 @@ public abstract class CommandLineOptionTest {
* @param unexpectedMessages an array of patterns that should not
* occur in JVM output. If {@code null} then
* JVM output could be empty.
* @param exitErrorMessage message that will be shown if exit code is not
* as expected.
* @param wrongWarningMessage message that will be shown if warning
* messages are not as expected.
* @param exitCode expected exit code.
* @throws Throwable if verification fails or some other issues occur.
*/
public
static
void
verifyJVMStartup
(
String
option
,
String
expectedMessages
[],
String
unexpectedMessages
[],
String
exitErrorMessage
,
String
wrongWarningMessage
,
ExitCode
exitCode
)
throws
Throwable
{
CommandLineOptionTest
.
verifyJVMStartup
(
expectedMessages
,
unexpectedMessages
,
exitCode
,
false
,
option
);
unexpectedMessages
,
exitErrorMessage
,
wrongWarningMessage
,
exitCode
,
false
,
option
);
}
/**
* Verifies that JVM startup behavio
u
r matches our expectations.
* Verifies that JVM startup behavior matches our expectations.
*
* @param expectedMessages an array of patterns that should occur
* in JVM output. If {@code null} then
...
...
@@ -77,6 +83,10 @@ public abstract class CommandLineOptionTest {
* @param unexpectedMessages an array of patterns that should not
* occur in JVM output. If {@code null} then
* JVM output could be empty.
* @param exitErrorMessage message that will be shown if exit code is not
* as expected.
* @param wrongWarningMessage message that will be shown if warning
* messages are not as expected.
* @param exitCode expected exit code.
* @param addTestVMOptions if {@code true} then test VM options will be
* passed to VM.
...
...
@@ -85,8 +95,10 @@ public abstract class CommandLineOptionTest {
* @throws Throwable if verification fails or some other issues occur.
*/
public
static
void
verifyJVMStartup
(
String
expectedMessages
[],
String
unexpectedMessages
[],
ExitCode
exitCode
,
boolean
addTestVMOptions
,
String
...
options
)
throws
Throwable
{
String
unexpectedMessages
[],
String
exitErrorMessage
,
String
wrongWarningMessage
,
ExitCode
exitCode
,
boolean
addTestVMOptions
,
String
...
options
)
throws
Throwable
{
List
<
String
>
finalOptions
=
new
ArrayList
<>();
if
(
addTestVMOptions
)
{
Collections
.
addAll
(
finalOptions
,
Utils
.
getTestJavaOpts
());
...
...
@@ -99,23 +111,46 @@ public abstract class CommandLineOptionTest {
new
String
[
finalOptions
.
size
()]));
OutputAnalyzer
outputAnalyzer
=
new
OutputAnalyzer
(
processBuilder
.
start
());
outputAnalyzer
.
shouldHaveExitValue
(
exitCode
.
value
);
try
{
outputAnalyzer
.
shouldHaveExitValue
(
exitCode
.
value
);
}
catch
(
RuntimeException
e
)
{
String
errorMessage
=
String
.
format
(
"JVM process should have exit value '%d'.%n%s"
,
exitCode
.
value
,
exitErrorMessage
);
throw
new
AssertionError
(
errorMessage
,
e
);
}
if
(
expectedMessages
!=
null
)
{
for
(
String
expectedMessage
:
expectedMessages
)
{
outputAnalyzer
.
shouldMatch
(
expectedMessage
);
try
{
outputAnalyzer
.
shouldMatch
(
expectedMessage
);
}
catch
(
RuntimeException
e
)
{
String
errorMessage
=
String
.
format
(
"Expected message not found: '%s'.%n%s"
,
expectedMessage
,
wrongWarningMessage
);
throw
new
AssertionError
(
errorMessage
,
e
);
}
}
}
if
(
unexpectedMessages
!=
null
)
{
for
(
String
unexpectedMessage
:
unexpectedMessages
)
{
outputAnalyzer
.
shouldNotMatch
(
unexpectedMessage
);
try
{
outputAnalyzer
.
shouldNotMatch
(
unexpectedMessage
);
}
catch
(
RuntimeException
e
)
{
String
errorMessage
=
String
.
format
(
"Unexpected message found: '%s'.%n%s"
,
unexpectedMessage
,
wrongWarningMessage
);
throw
new
AssertionError
(
errorMessage
,
e
);
}
}
}
}
/**
* Verifies that JVM startup behavio
u
r matches our expectations when type
* Verifies that JVM startup behavior matches our expectations when type
* of newly started VM is the same as the type of current.
*
* @param expectedMessages an array of patterns that should occur
...
...
@@ -124,20 +159,26 @@ public abstract class CommandLineOptionTest {
* @param unexpectedMessages an array of patterns that should not
* occur in JVM output. If {@code null} then
* JVM output could be empty.
* @param exitErrorMessage Message that will be shown if exit value is not
* as expected.
* @param wrongWarningMessage message that will be shown if warning
* messages are not as expected.
* @param exitCode expected exit code.
* @param options options that should be passed to VM in addition to mode
* flag.
* @throws Throwable if verification fails or some other issues occur.
*/
public
static
void
verifySameJVMStartup
(
String
expectedMessages
[],
String
unexpectedMessages
[],
ExitCode
exitCode
,
String
...
options
)
throws
Throwable
{
String
unexpectedMessages
[],
String
exitErrorMessage
,
String
wrongWarningMessage
,
ExitCode
exitCode
,
String
...
options
)
throws
Throwable
{
List
<
String
>
finalOptions
=
new
ArrayList
<>();
finalOptions
.
add
(
CommandLineOptionTest
.
getVMTypeOption
());
Collections
.
addAll
(
finalOptions
,
options
);
CommandLineOptionTest
.
verifyJVMStartup
(
expectedMessages
,
unexpectedMessages
,
exitCode
,
false
,
unexpectedMessages
,
exitErrorMessage
,
wrongWarningMessage
,
exitCode
,
false
,
finalOptions
.
toArray
(
new
String
[
finalOptions
.
size
()]));
}
...
...
@@ -149,13 +190,17 @@ public abstract class CommandLineOptionTest {
*
* @param optionName a name of tested option.
* @param expectedValue expected value of tested option.
* @param optionErrorString message will be shown if option value is not as
* expected.
* @param additionalVMOpts additional options that should be
* passed to JVM.
* @throws Throwable if verification fails or some other issues occur.
*/
public
static
void
verifyOptionValue
(
String
optionName
,
String
expectedValue
,
String
...
additionalVMOpts
)
throws
Throwable
{
verifyOptionValue
(
optionName
,
expectedValue
,
true
,
additionalVMOpts
);
String
expectedValue
,
String
optionErrorString
,
String
...
additionalVMOpts
)
throws
Throwable
{
verifyOptionValue
(
optionName
,
expectedValue
,
optionErrorString
,
true
,
additionalVMOpts
);
}
/**
...
...
@@ -168,14 +213,17 @@ public abstract class CommandLineOptionTest {
* @param expectedValue expected value of tested option.
* @param addTestVmOptions if {@code true}, then test VM options
* will be used.
* @param optionErrorString message will be shown if option value is not as
* expected.
* @param additionalVMOpts additional options that should be
* passed to JVM.
* @throws Throwable if verification fails or some other issues
* occur.
*/
public
static
void
verifyOptionValue
(
String
optionName
,
String
expectedValue
,
boolean
addTestVmOptions
,
String
...
additionalVMOpts
)
throws
Throwable
{
String
expectedValue
,
String
optionErrorString
,
boolean
addTestVmOptions
,
String
...
additionalVMOpts
)
throws
Throwable
{
List
<
String
>
vmOpts
=
new
ArrayList
<>();
if
(
addTestVmOptions
)
{
...
...
@@ -191,10 +239,25 @@ public abstract class CommandLineOptionTest {
OutputAnalyzer
outputAnalyzer
=
new
OutputAnalyzer
(
processBuilder
.
start
());
outputAnalyzer
.
shouldHaveExitValue
(
0
);
try
{
outputAnalyzer
.
shouldHaveExitValue
(
0
);
}
catch
(
RuntimeException
e
)
{
String
errorMessage
=
String
.
format
(
"JVM should start with option '%s' without errors."
,
optionName
);
throw
new
AssertionError
(
errorMessage
,
e
);
}
try
{
outputAnalyzer
.
shouldMatch
(
String
.
format
(
CommandLineOptionTest
.
PRINT_FLAGS_FINAL_FORMAT
,
optionName
,
expectedValue
));
}
catch
(
RuntimeException
e
)
{
String
errorMessage
=
String
.
format
(
"Option '%s' is expected to have '%s' value%n%s"
,
optionName
,
expectedValue
,
optionErrorString
);
throw
new
AssertionError
(
errorMessage
,
e
);
}
}
/**
...
...
@@ -207,18 +270,21 @@ public abstract class CommandLineOptionTest {
*
* @param optionName name of tested option.
* @param expectedValue expected value of tested option.
* @param optionErrorString message to show if option has another value
* @param additionalVMOpts additional options that should be
* passed to JVM.
* @throws Throwable if verification fails or some other issues occur.
*/
public
static
void
verifyOptionValueForSameVM
(
String
optionName
,
String
expectedValue
,
String
...
additionalVMOpts
)
throws
Throwable
{
String
expectedValue
,
String
optionErrorString
,
String
...
additionalVMOpts
)
throws
Throwable
{
List
<
String
>
finalOptions
=
new
ArrayList
<>();
finalOptions
.
add
(
CommandLineOptionTest
.
getVMTypeOption
());
Collections
.
addAll
(
finalOptions
,
additionalVMOpts
);
CommandLineOptionTest
.
verifyOptionValue
(
optionName
,
expectedValue
,
false
,
finalOptions
.
toArray
(
new
String
[
finalOptions
.
size
()]));
optionErrorString
,
false
,
finalOptions
.
toArray
(
new
String
[
finalOptions
.
size
()]));
}
/**
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录