58 if (Platform.isX86() || Platform.isX64()) { 59 unsupportedX86CPUTestCases(); 60 } else { 61 unsupportedNonX86CPUTestCases(); 62 } 63 } 64 65 /** 66 * Run test cases common for all bit manipulation related VM options 67 * targeted to X86 CPU that does not support required features. 68 * 69 * @throws Throwable if test failed. 70 */ 71 public void unsupportedX86CPUTestCases() throws Throwable { 72 73 /* 74 Verify that VM will successfully start up, but output will contain a 75 warning. VM will be launched with following options: 76 -XX:+<tested option> -version 77 */ 78 CommandLineOptionTest.verifySameJVMStartup( 79 new String[] { warningMessage }, new String[] { errorMessage }, 80 ExitCode.OK, CommandLineOptionTest.prepareBooleanFlag( 81 optionName, true)); 82 83 /* 84 Verify that VM will successfully startup without any warnings. 85 VM will be launched with following options: 86 -XX:-<tested option> -version 87 */ 88 CommandLineOptionTest.verifySameJVMStartup(null, 89 new String[] { warningMessage, errorMessage }, ExitCode.OK, 90 CommandLineOptionTest.prepareBooleanFlag(optionName, false)); 91 92 /* 93 Verify that on unsupported CPUs option is off by default. 94 VM will be launched with following options: -version 95 */ 96 CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "false"); 97 98 /* 99 Verify that on unsupported CPUs option will be off even if 100 it was explicitly turned on by user. VM will be launched with 101 following options: -XX:+<tested option> -version 102 */ 103 CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "false", 104 CommandLineOptionTest.prepareBooleanFlag(optionName, true)); 105 106 } 107 108 /** 109 * Run test cases common for all bit manipulation related VM options 110 * targeted to non-X86 CPU that does not support required features. 111 * 112 * @throws Throwable if test failed. 113 */ 114 public void unsupportedNonX86CPUTestCases() throws Throwable { 115 116 /* 117 Verify that VM known nothing about tested option. VM will be launched 118 with following options: -XX:[+-]<tested option> -version 119 */ 120 CommandLineOptionTest.verifySameJVMStartup( 121 new String[] { errorMessage }, null, ExitCode.FAIL, 122 CommandLineOptionTest.prepareBooleanFlag(optionName, true)); 123 124 CommandLineOptionTest.verifySameJVMStartup( 125 new String[] { errorMessage }, null, ExitCode.FAIL, 126 CommandLineOptionTest.prepareBooleanFlag(optionName, false)); 127 } 128 } 129 | 58 if (Platform.isX86() || Platform.isX64()) { 59 unsupportedX86CPUTestCases(); 60 } else { 61 unsupportedNonX86CPUTestCases(); 62 } 63 } 64 65 /** 66 * Run test cases common for all bit manipulation related VM options 67 * targeted to X86 CPU that does not support required features. 68 * 69 * @throws Throwable if test failed. 70 */ 71 public void unsupportedX86CPUTestCases() throws Throwable { 72 73 /* 74 Verify that VM will successfully start up, but output will contain a 75 warning. VM will be launched with following options: 76 -XX:+<tested option> -version 77 */ 78 String errorString = String.format("JVM should start with '-XX:+%s' " 79 + "flag, but output should contain warning.", optionName); 80 CommandLineOptionTest.verifySameJVMStartup( 81 new String[] { warningMessage }, new String[] { errorMessage }, 82 errorString, String.format("Option '%s' is unsupported.%n" 83 + "Warning expected to be shown.", optionName), ExitCode.OK, 84 CommandLineOptionTest.prepareBooleanFlag( 85 optionName, true)); 86 87 /* 88 Verify that VM will successfully startup without any warnings. 89 VM will be launched with following options: 90 -XX:-<tested option> -version 91 */ 92 errorString = String.format("JVM should start with '-XX:-%s' flag " 93 + "without any warnings", optionName); 94 CommandLineOptionTest.verifySameJVMStartup(null, 95 new String[] { warningMessage, errorMessage }, 96 errorString, errorString, ExitCode.OK, 97 CommandLineOptionTest.prepareBooleanFlag(optionName, false)); 98 99 /* 100 * Verify that on unsupported CPUs option is off by default. VM will be 101 * launched with following options: -version 102 */ 103 CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "false", 104 String.format("Option '%s' is expected to have default value " 105 + "'false' since feature required is not supported " 106 + "on CPU", optionName)); 107 108 /* 109 Verify that on unsupported CPUs option will be off even if 110 it was explicitly turned on by user. VM will be launched with 111 following options: -XX:+<tested option> -version 112 */ 113 CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "false", 114 String.format("Option '%s' is expected to have default value" 115 + " 'false' since feature required is not supported on" 116 + " CPU even if user set another value.", optionName), 117 CommandLineOptionTest.prepareBooleanFlag(optionName, true)); 118 119 } 120 121 /** 122 * Run test cases common for all bit manipulation related VM options 123 * targeted to non-X86 CPU that does not support required features. 124 * 125 * @throws Throwable if test failed. 126 */ 127 public void unsupportedNonX86CPUTestCases() throws Throwable { 128 129 /* 130 Verify that VM known nothing about tested option. VM will be launched 131 with following options: -XX:[+-]<tested option> -version 132 */ 133 CommandLineOptionTest.verifySameJVMStartup( 134 new String[] { errorMessage }, null, 135 String.format("JVM startup should fail with '-XX:+%s' flag." 136 + "%nOption should be unknown (non-X86CPU).", 137 optionName), "", ExitCode.FAIL, 138 CommandLineOptionTest.prepareBooleanFlag(optionName, true)); 139 140 CommandLineOptionTest.verifySameJVMStartup( 141 new String[] { errorMessage }, null, 142 String.format("JVM startup should fail with '-XX:-%s' flag." 143 + "%nOption should be unknown (non-X86CPU)", 144 optionName), "", ExitCode.FAIL, 145 CommandLineOptionTest.prepareBooleanFlag(optionName, false)); 146 } 147 } 148 |