8054892: Improve compiler's CLI tests error reporting
Reviewed-by: roland, twisti
--- a/hotspot/test/compiler/arguments/BMISupportedCPUTest.java Tue Dec 16 17:56:24 2014 +0300
+++ b/hotspot/test/compiler/arguments/BMISupportedCPUTest.java Tue Dec 16 14:52:57 2014 +0300
@@ -60,8 +60,11 @@
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 @@
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 @@
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 @@
-XX:-<tested option> -version
*/
CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "false",
+ String.format("Option '%s' is set to have value 'false'",
+ optionName),
CommandLineOptionTest.prepareBooleanFlag(optionName, false));
}
}
--- a/hotspot/test/compiler/arguments/BMIUnsupportedCPUTest.java Tue Dec 16 17:56:24 2014 +0300
+++ b/hotspot/test/compiler/arguments/BMIUnsupportedCPUTest.java Tue Dec 16 14:52:57 2014 +0300
@@ -75,9 +75,13 @@
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 @@
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 @@
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 @@
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));
}
}
--- a/hotspot/test/compiler/arguments/TestUseCountTrailingZerosInstructionOnSupportedCPU.java Tue Dec 16 17:56:24 2014 +0300
+++ b/hotspot/test/compiler/arguments/TestUseCountTrailingZerosInstructionOnSupportedCPU.java Tue Dec 16 14:52:57 2014 +0300
@@ -59,6 +59,9 @@
-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 @@
-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));
}
--- a/hotspot/test/compiler/arguments/TestUseCountTrailingZerosInstructionOnUnsupportedCPU.java Tue Dec 16 17:56:24 2014 +0300
+++ b/hotspot/test/compiler/arguments/TestUseCountTrailingZerosInstructionOnUnsupportedCPU.java Tue Dec 16 14:52:57 2014 +0300
@@ -59,6 +59,9 @@
-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 @@
-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);
--- a/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForOtherCPU.java Tue Dec 16 17:56:24 2014 +0300
+++ b/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForOtherCPU.java Tue Dec 16 14:52:57 2014 +0300
@@ -41,30 +41,42 @@
@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));
}
}
--- a/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForSupportedSparcCPU.java Tue Dec 16 17:56:24 2014 +0300
+++ b/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForSupportedSparcCPU.java Tue Dec 16 14:52:57 2014 +0300
@@ -39,17 +39,24 @@
@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 @@
// 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 @@
@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 @@
// 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));
--- a/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedSparcCPU.java Tue Dec 16 17:56:24 2014 +0300
+++ b/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedSparcCPU.java Tue Dec 16 14:52:57 2014 +0300
@@ -41,25 +41,35 @@
@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));
}
--- a/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedX86CPU.java Tue Dec 16 17:56:24 2014 +0300
+++ b/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedX86CPU.java Tue Dec 16 14:52:57 2014 +0300
@@ -38,33 +38,45 @@
@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));
}
--- a/hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHAIntrinsicsSpecificTestCaseForUnsupportedSparcCPU.java Tue Dec 16 17:56:24 2014 +0300
+++ b/hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHAIntrinsicsSpecificTestCaseForUnsupportedSparcCPU.java Tue Dec 16 14:52:57 2014 +0300
@@ -50,10 +50,13 @@
}
@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));
}
}
--- a/hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHASpecificTestCaseForSupportedSparcCPU.java Tue Dec 16 17:56:24 2014 +0300
+++ b/hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHASpecificTestCaseForSupportedSparcCPU.java Tue Dec 16 14:52:57 2014 +0300
@@ -39,16 +39,22 @@
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 @@
@Override
protected void verifyOptionValues() throws Throwable {
- // Verify that UseSHA is disabled when all UseSHA*Intrinscs are
+ // Verify that UseSHA is disabled when all UseSHA*Intrinsics 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 @@
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*Intrinsics 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 @@
// 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(
--- a/hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHASpecificTestCaseForUnsupportedSparcCPU.java Tue Dec 16 17:56:24 2014 +0300
+++ b/hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHASpecificTestCaseForUnsupportedSparcCPU.java Tue Dec 16 14:52:57 2014 +0300
@@ -48,18 +48,24 @@
@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*Intrincs options were enabled.
+ // UseSHA*Intrinsics 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 @@
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*Intrinsics 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(
--- a/hotspot/test/compiler/rtm/cli/RTMGenericCommandLineOptionTest.java Tue Dec 16 17:56:24 2014 +0300
+++ b/hotspot/test/compiler/rtm/cli/RTMGenericCommandLineOptionTest.java Tue Dec 16 14:52:57 2014 +0300
@@ -121,7 +121,9 @@
*/
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 @@
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 @@
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 @@
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 @@
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));
}
}
}
--- a/hotspot/test/compiler/rtm/cli/RTMLockingAwareTest.java Tue Dec 16 17:56:24 2014 +0300
+++ b/hotspot/test/compiler/rtm/cli/RTMLockingAwareTest.java Tue Dec 16 14:52:57 2014 +0300
@@ -131,10 +131,14 @@
}
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 @@
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()]));
}
}
--- a/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsBase.java Tue Dec 16 17:56:24 2014 +0300
+++ b/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsBase.java Tue Dec 16 14:52:57 2014 +0300
@@ -47,27 +47,42 @@
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 @@
// 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);
}
}
--- a/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig.java Tue Dec 16 17:56:24 2014 +0300
+++ b/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig.java Tue Dec 16 14:52:57 2014 +0300
@@ -53,18 +53,28 @@
// 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"));
--- a/hotspot/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnSupportedConfig.java Tue Dec 16 17:56:24 2014 +0300
+++ b/hotspot/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnSupportedConfig.java Tue Dec 16 14:52:57 2014 +0300
@@ -51,26 +51,40 @@
@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");
- // verify default value
- CommandLineOptionTest.verifyOptionValueForSameVM("UseRTMDeopt",
- TestUseRTMDeoptOptionOnSupportedConfig.DEFAULT_VALUE);
+ 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,
+ 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");
}
--- a/hotspot/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnUnsupportedConfig.java Tue Dec 16 17:56:24 2014 +0300
+++ b/hotspot/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnUnsupportedConfig.java Tue Dec 16 14:52:57 2014 +0300
@@ -50,7 +50,8 @@
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 @@
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 {
--- a/hotspot/test/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnSupportedConfig.java Tue Dec 16 17:56:24 2014 +0300
+++ b/hotspot/test/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnSupportedConfig.java Tue Dec 16 14:52:57 2014 +0300
@@ -58,43 +58,67 @@
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 {
--- a/hotspot/test/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnUnsupportedConfig.java Tue Dec 16 17:56:24 2014 +0300
+++ b/hotspot/test/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnUnsupportedConfig.java Tue Dec 16 14:52:57 2014 +0300
@@ -57,33 +57,50 @@
@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"));
}
--- a/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnSupportedConfig.java Tue Dec 16 17:56:24 2014 +0300
+++ b/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnSupportedConfig.java Tue Dec 16 14:52:57 2014 +0300
@@ -54,12 +54,16 @@
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 @@
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");
}
--- a/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedCPU.java Tue Dec 16 17:56:24 2014 +0300
+++ b/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedCPU.java Tue Dec 16 14:52:57 2014 +0300
@@ -59,33 +59,44 @@
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");
}
}
--- a/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedVM.java Tue Dec 16 17:56:24 2014 +0300
+++ b/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedVM.java Tue Dec 16 14:52:57 2014 +0300
@@ -54,17 +54,26 @@
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 {
--- a/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionWithBiasedLocking.java Tue Dec 16 17:56:24 2014 +0300
+++ b/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionWithBiasedLocking.java Tue Dec 16 14:52:57 2014 +0300
@@ -51,25 +51,44 @@
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 {
--- a/hotspot/test/testlibrary/com/oracle/java/testlibrary/cli/CommandLineOptionTest.java Tue Dec 16 17:56:24 2014 +0300
+++ b/hotspot/test/testlibrary/com/oracle/java/testlibrary/cli/CommandLineOptionTest.java Tue Dec 16 14:52:57 2014 +0300
@@ -49,7 +49,7 @@
private static final String PRINT_FLAGS_FINAL_FORMAT = "%s\\s*:?=\\s*%s";
/**
- * Verifies that JVM startup behaviour 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 @@
* @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 behaviour 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 @@
* @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 @@
* @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 @@
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 behaviour 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 @@
* @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 @@
*
* @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 @@
* @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 @@
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 @@
*
* @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()]));
}
/**