Wed, 03 Sep 2014 15:29:57 +0400
8055904: Develop tests for new command-line options related to SHA intrinsics
Reviewed-by: kvn, iignatyev
fzhinkin@7141 | 1 | /* |
fzhinkin@7141 | 2 | * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
fzhinkin@7141 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
fzhinkin@7141 | 4 | * |
fzhinkin@7141 | 5 | * This code is free software; you can redistribute it and/or modify it |
fzhinkin@7141 | 6 | * under the terms of the GNU General Public License version 2 only, as |
fzhinkin@7141 | 7 | * published by the Free Software Foundation. |
fzhinkin@7141 | 8 | * |
fzhinkin@7141 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
fzhinkin@7141 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
fzhinkin@7141 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
fzhinkin@7141 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
fzhinkin@7141 | 13 | * accompanied this code). |
fzhinkin@7141 | 14 | * |
fzhinkin@7141 | 15 | * You should have received a copy of the GNU General Public License version |
fzhinkin@7141 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
fzhinkin@7141 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
fzhinkin@7141 | 18 | * |
fzhinkin@7141 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
fzhinkin@7141 | 20 | * or visit www.oracle.com if you need additional information or have any |
fzhinkin@7141 | 21 | * questions. |
fzhinkin@7141 | 22 | */ |
fzhinkin@7141 | 23 | |
fzhinkin@7141 | 24 | import com.oracle.java.testlibrary.ExitCode; |
fzhinkin@7141 | 25 | import com.oracle.java.testlibrary.Platform; |
fzhinkin@7141 | 26 | import com.oracle.java.testlibrary.cli.CommandLineOptionTest; |
fzhinkin@7141 | 27 | import com.oracle.java.testlibrary.cli.predicate.NotPredicate; |
fzhinkin@7141 | 28 | import com.oracle.java.testlibrary.cli.predicate.OrPredicate; |
fzhinkin@7141 | 29 | |
fzhinkin@7141 | 30 | /** |
fzhinkin@7141 | 31 | * Generic test case for SHA-related options targeted to non-x86 and |
fzhinkin@7141 | 32 | * non-SPARC CPUs. |
fzhinkin@7141 | 33 | */ |
fzhinkin@7141 | 34 | public class GenericTestCaseForOtherCPU extends |
fzhinkin@7141 | 35 | SHAOptionsBase.TestCase { |
fzhinkin@7141 | 36 | public GenericTestCaseForOtherCPU(String optionName) { |
fzhinkin@7141 | 37 | // Execute the test case on any CPU except SPARC and X86 |
fzhinkin@7141 | 38 | super(optionName, new NotPredicate(new OrPredicate(Platform::isSparc, |
fzhinkin@7141 | 39 | new OrPredicate(Platform::isX64, Platform::isX86)))); |
fzhinkin@7141 | 40 | } |
fzhinkin@7141 | 41 | |
fzhinkin@7141 | 42 | @Override |
fzhinkin@7141 | 43 | protected void verifyWarnings() throws Throwable { |
fzhinkin@7141 | 44 | // Verify that on non-x86 and non-SPARC CPU usage of SHA-related |
fzhinkin@7141 | 45 | // options will not cause any warnings. |
fzhinkin@7141 | 46 | CommandLineOptionTest.verifySameJVMStartup(null, |
fzhinkin@7141 | 47 | new String[] { ".*" + optionName + ".*" }, ExitCode.OK, |
fzhinkin@7141 | 48 | CommandLineOptionTest.prepareBooleanFlag(optionName, true)); |
fzhinkin@7141 | 49 | |
fzhinkin@7141 | 50 | CommandLineOptionTest.verifySameJVMStartup(null, |
fzhinkin@7141 | 51 | new String[] { ".*" + optionName + ".*" }, ExitCode.OK, |
fzhinkin@7141 | 52 | CommandLineOptionTest.prepareBooleanFlag(optionName, false)); |
fzhinkin@7141 | 53 | } |
fzhinkin@7141 | 54 | |
fzhinkin@7141 | 55 | @Override |
fzhinkin@7141 | 56 | protected void verifyOptionValues() throws Throwable { |
fzhinkin@7141 | 57 | // Verify that option is disabled by default. |
fzhinkin@7141 | 58 | CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "false"); |
fzhinkin@7141 | 59 | |
fzhinkin@7141 | 60 | // Verify that option is disabled even if it was explicitly enabled |
fzhinkin@7141 | 61 | // using CLI options. |
fzhinkin@7141 | 62 | CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "false", |
fzhinkin@7141 | 63 | CommandLineOptionTest.prepareBooleanFlag(optionName, true)); |
fzhinkin@7141 | 64 | |
fzhinkin@7141 | 65 | // Verify that option is disabled when it explicitly disabled |
fzhinkin@7141 | 66 | // using CLI options. |
fzhinkin@7141 | 67 | CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "false", |
fzhinkin@7141 | 68 | CommandLineOptionTest.prepareBooleanFlag(optionName, false)); |
fzhinkin@7141 | 69 | } |
fzhinkin@7141 | 70 | } |