--- old/test/compiler/arguments/BMISupportedCPUTest.java 2014-12-02 13:40:53.846144952 +0300 +++ new/test/compiler/arguments/BMISupportedCPUTest.java 2014-12-02 13:40:53.622144958 +0300 @@ -60,8 +60,11 @@ VM will be launched with following flags: -XX:+ -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:- -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:- -version */ CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "false", + String.format("Option '%s' is set to have value 'false'", + optionName), CommandLineOptionTest.prepareBooleanFlag(optionName, false)); } } --- old/test/compiler/arguments/BMIUnsupportedCPUTest.java 2014-12-02 13:40:54.814144923 +0300 +++ new/test/compiler/arguments/BMIUnsupportedCPUTest.java 2014-12-02 13:40:54.550144931 +0300 @@ -75,9 +75,13 @@ warning. VM will be launched with following options: -XX:+ -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:- -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:+ -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:[+-] -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)); } } --- old/test/compiler/arguments/TestUseCountTrailingZerosInstructionOnSupportedCPU.java 2014-12-02 13:40:55.722144897 +0300 +++ new/test/compiler/arguments/TestUseCountTrailingZerosInstructionOnSupportedCPU.java 2014-12-02 13:40:55.478144904 +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)); } --- old/test/compiler/arguments/TestUseCountTrailingZerosInstructionOnUnsupportedCPU.java 2014-12-02 13:40:56.606144871 +0300 +++ new/test/compiler/arguments/TestUseCountTrailingZerosInstructionOnUnsupportedCPU.java 2014-12-02 13:40:56.382144877 +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); --- old/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForOtherCPU.java 2014-12-02 13:40:57.650144840 +0300 +++ new/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForOtherCPU.java 2014-12-02 13:40:57.458144846 +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)); } } --- old/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForSupportedSparcCPU.java 2014-12-02 13:40:58.626144812 +0300 +++ new/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForSupportedSparcCPU.java 2014-12-02 13:40:58.402144818 +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)); --- old/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedSparcCPU.java 2014-12-02 13:40:59.482144787 +0300 +++ new/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedSparcCPU.java 2014-12-02 13:40:59.254144793 +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)); } --- old/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedX86CPU.java 2014-12-02 13:41:00.346144761 +0300 +++ new/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedX86CPU.java 2014-12-02 13:41:00.078144769 +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)); } --- old/test/compiler/intrinsics/sha/cli/testcases/UseSHAIntrinsicsSpecificTestCaseForUnsupportedSparcCPU.java 2014-12-02 13:41:01.202144736 +0300 +++ new/test/compiler/intrinsics/sha/cli/testcases/UseSHAIntrinsicsSpecificTestCaseForUnsupportedSparcCPU.java 2014-12-02 13:41:00.974144743 +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)); } } --- old/test/compiler/intrinsics/sha/cli/testcases/UseSHASpecificTestCaseForSupportedSparcCPU.java 2014-12-02 13:41:02.046144711 +0300 +++ new/test/compiler/intrinsics/sha/cli/testcases/UseSHASpecificTestCaseForSupportedSparcCPU.java 2014-12-02 13:41:01.814144718 +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( --- old/test/compiler/intrinsics/sha/cli/testcases/UseSHASpecificTestCaseForUnsupportedSparcCPU.java 2014-12-02 13:41:02.862144688 +0300 +++ new/test/compiler/intrinsics/sha/cli/testcases/UseSHASpecificTestCaseForUnsupportedSparcCPU.java 2014-12-02 13:41:02.626144694 +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,11 +74,16 @@ 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), + SHAOptionsBase.USE_SHA_OPTION, true), CommandLineOptionTest.prepareBooleanFlag( SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION, true), CommandLineOptionTest.prepareBooleanFlag( --- old/test/compiler/rtm/cli/RTMGenericCommandLineOptionTest.java 2014-12-02 13:41:03.750144662 +0300 +++ new/test/compiler/rtm/cli/RTMGenericCommandLineOptionTest.java 2014-12-02 13:41:03.542144668 +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 }, - ExitCode.OK, + 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); } } @@ -163,11 +177,15 @@ // verify default value if (isExperimental) { CommandLineOptionTest.verifyOptionValueForSameVM(optionName, - defaultValue, + 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) { @@ -177,12 +195,16 @@ for (String value : optionValues) { if (isExperimental) { CommandLineOptionTest.verifyOptionValueForSameVM(optionName, - value, + 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)); } } } --- old/test/compiler/rtm/cli/RTMLockingAwareTest.java 2014-12-02 13:41:04.602144637 +0300 +++ new/test/compiler/rtm/cli/RTMLockingAwareTest.java 2014-12-02 13:41:04.362144644 +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()])); } } --- old/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsBase.java 2014-12-02 13:41:05.446144612 +0300 +++ new/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsBase.java 2014-12-02 13:41:05.230144618 +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); } } --- old/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig.java 2014-12-02 13:41:06.338144586 +0300 +++ new/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig.java 2014-12-02 13:41:06.098144593 +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")); --- old/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnSupportedConfig.java 2014-12-02 13:41:07.178144561 +0300 +++ new/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnSupportedConfig.java 2014-12-02 13:41:06.950144568 +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"); + 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"); } --- old/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnUnsupportedConfig.java 2014-12-02 13:41:08.038144536 +0300 +++ new/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnUnsupportedConfig.java 2014-12-02 13:41:07.794144543 +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 { --- old/test/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnSupportedConfig.java 2014-12-02 13:41:08.830144513 +0300 +++ new/test/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnSupportedConfig.java 2014-12-02 13:41:08.586144520 +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 { --- old/test/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnUnsupportedConfig.java 2014-12-02 13:41:09.730144486 +0300 +++ new/test/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnUnsupportedConfig.java 2014-12-02 13:41:09.502144493 +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")); } --- old/test/compiler/rtm/cli/TestUseRTMLockingOptionOnSupportedConfig.java 2014-12-02 13:41:10.610144461 +0300 +++ new/test/compiler/rtm/cli/TestUseRTMLockingOptionOnSupportedConfig.java 2014-12-02 13:41:10.354144468 +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"); } --- old/test/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedCPU.java 2014-12-02 13:41:11.510144434 +0300 +++ new/test/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedCPU.java 2014-12-02 13:41:11.266144441 +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"); } } --- old/test/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedVM.java 2014-12-02 13:41:12.362144409 +0300 +++ new/test/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedVM.java 2014-12-02 13:41:12.114144417 +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 { --- old/test/compiler/rtm/cli/TestUseRTMLockingOptionWithBiasedLocking.java 2014-12-02 13:41:13.202144385 +0300 +++ new/test/compiler/rtm/cli/TestUseRTMLockingOptionWithBiasedLocking.java 2014-12-02 13:41:12.962144392 +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, + CommandLineOptionTest.verifySameJVMStartup( + 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 { --- old/test/testlibrary/com/oracle/java/testlibrary/cli/CommandLineOptionTest.java 2014-12-02 13:41:14.102144358 +0300 +++ new/test/testlibrary/com/oracle/java/testlibrary/cli/CommandLineOptionTest.java 2014-12-02 13:41:13.890144365 +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 @@ -59,17 +59,24 @@ * occur in JVM output. If {@code null} then * JVM output could be empty. * @param exitCode expected exit code. + * @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. * @throws Throwable if verification fails or some other issues occur. */ public static void verifyJVMStartup(String option, String expectedMessages[], String unexpectedMessages[], - ExitCode exitCode) throws Throwable { + ExitCode exitCode, String exitErrorMessage, + String wrongWarningMessage) + throws Throwable { CommandLineOptionTest.verifyJVMStartup(expectedMessages, - unexpectedMessages, exitCode, false, option); + unexpectedMessages, exitCode, exitErrorMessage, + wrongWarningMessage, 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 @@ -78,6 +85,10 @@ * occur in JVM output. If {@code null} then * JVM output could be empty. * @param exitCode expected exit code. + * @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 addTestVMOptions if {@code true} then test VM options will be * passed to VM. * @param options options that should be passed to VM in addition to mode @@ -85,8 +96,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[], ExitCode exitCode, + String exitErrorMessage, String wrongWarningMessage, + boolean addTestVMOptions, String... options) + throws Throwable { List finalOptions = new ArrayList<>(); if (addTestVMOptions) { Collections.addAll(finalOptions, Utils.getTestJavaOpts()); @@ -99,23 +112,46 @@ new String[finalOptions.size()])); OutputAnalyzer outputAnalyzer = new OutputAnalyzer(processBuilder.start()); - outputAnalyzer.shouldHaveExitValue(exitCode.value); - if (expectedMessages != null) { + 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 @@ -125,19 +161,25 @@ * occur in JVM output. If {@code null} then * JVM output could be empty. * @param exitCode expected exit code. + * @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 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 finalOptions = new ArrayList<>(); finalOptions.add(CommandLineOptionTest.getVMTypeOption()); Collections.addAll(finalOptions, options); CommandLineOptionTest.verifyJVMStartup(expectedMessages, - unexpectedMessages, exitCode, false, + unexpectedMessages, exitCode, exitErrorMessage, + wrongWarningMessage, false, finalOptions.toArray(new String[finalOptions.size()])); } @@ -149,13 +191,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 +214,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 vmOpts = new ArrayList<>(); if (addTestVmOptions) { @@ -191,10 +240,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 +271,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 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()])); } /**