< prev index next >

test/compiler/cpuflags/TestAESIntrinsicsOnUnsupportedConfig.java

Print this page




  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @library /test/lib /
  27  * @modules java.base/jdk.internal.misc
  28  *          java.management
  29  *
  30  * @build sun.hotspot.WhiteBox

  31  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  32  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  33  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  34  *       -XX:+WhiteBoxAPI -Xbatch
  35  *       compiler.cpuflags.TestAESIntrinsicsOnUnsupportedConfig
  36  */
  37 
  38 package compiler.cpuflags;
  39 
  40 import jdk.test.lib.process.OutputAnalyzer;
  41 import jdk.test.lib.process.ProcessTools;
  42 import jdk.test.lib.cli.predicate.NotPredicate;

  43 
  44 public class TestAESIntrinsicsOnUnsupportedConfig extends AESIntrinsicsBase {
  45 
  46     private static final String INTRINSICS_NOT_AVAILABLE_MSG = "warning: AES "
  47             + "intrinsics are not available on this CPU";
  48     private static final String AES_NOT_AVAILABLE_MSG = "warning: AES "
  49             + "instructions are not available on this CPU";
  50 
  51     /**
  52      * Constructs new TestAESIntrinsicsOnUnsupportedConfig that will be
  53      * executed only if AESSupportPredicate returns false
  54      */
  55     private TestAESIntrinsicsOnUnsupportedConfig() {
  56         super(new NotPredicate(AESIntrinsicsBase.AES_SUPPORTED_PREDICATE));
  57     }
  58 
  59     @Override
  60     protected void runTestCases() throws Throwable {
  61         testUseAES();
  62         testUseAESIntrinsics();
  63     }
  64 
  65     /**
  66      * Test checks following situation: <br/>
  67      * UseAESIntrinsics flag is set to true, TestAESMain is executed <br/>
  68      * Expected result: UseAESIntrinsics flag is set to false <br/>
  69      * UseAES flag is set to false <br/>
  70      * Output shouldn't contain intrinsics usage <br/>
  71      * Output should contain message about intrinsics unavailability
  72      * @throws Throwable
  73      */
  74     private void testUseAESIntrinsics() throws Throwable {
  75         OutputAnalyzer outputAnalyzer = ProcessTools.executeTestJvm(
  76                 AESIntrinsicsBase.prepareArguments(prepareBooleanFlag(
  77                         AESIntrinsicsBase.USE_AES_INTRINSICS, true)));
  78         final String errorMessage = "Case testUseAESIntrinsics failed";
  79         verifyOutput(new String[] {INTRINSICS_NOT_AVAILABLE_MSG},


  93      * UseAES flag is set to false <br/>
  94      * Output shouldn't contain intrinsics usage <br/>
  95      * Output should contain message about AES unavailability <br/>
  96      * @throws Throwable
  97      */
  98     private void testUseAES() throws Throwable {
  99         OutputAnalyzer outputAnalyzer = ProcessTools.executeTestJvm(
 100                 AESIntrinsicsBase.prepareArguments(prepareBooleanFlag
 101                         (AESIntrinsicsBase.USE_AES, true)));
 102         final String errorMessage = "Case testUseAES failed";
 103         verifyOutput(new String[] {AES_NOT_AVAILABLE_MSG},
 104                 new String[] {AESIntrinsicsBase.CIPHER_INTRINSIC,
 105                 AESIntrinsicsBase.AES_INTRINSIC}, errorMessage, outputAnalyzer);
 106         verifyOptionValue(AESIntrinsicsBase.USE_AES_INTRINSICS, "false",
 107                 errorMessage, outputAnalyzer);
 108         verifyOptionValue(AESIntrinsicsBase.USE_AES, "false", errorMessage,
 109                 outputAnalyzer);
 110     }
 111 
 112     public static void main(String args[]) throws Throwable {
 113         new TestAESIntrinsicsOnUnsupportedConfig().test();
 114     }
 115 }


  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @library /test/lib /
  27  * @modules java.base/jdk.internal.misc
  28  *          java.management
  29  *
  30  * @build sun.hotspot.WhiteBox
  31  * @requires !(vm.cpu.features ~= ".*aes.*")
  32  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  33  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  34  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  35  *       -XX:+WhiteBoxAPI -Xbatch
  36  *       compiler.cpuflags.TestAESIntrinsicsOnUnsupportedConfig
  37  */
  38 
  39 package compiler.cpuflags;
  40 
  41 import jdk.test.lib.process.OutputAnalyzer;
  42 import jdk.test.lib.process.ProcessTools;
  43 import jdk.test.lib.cli.predicate.NotPredicate;
  44 import static jdk.test.lib.cli.CommandLineOptionTest.*;
  45 
  46 public class TestAESIntrinsicsOnUnsupportedConfig extends AESIntrinsicsBase {
  47 
  48     private static final String INTRINSICS_NOT_AVAILABLE_MSG = "warning: AES "
  49             + "intrinsics are not available on this CPU";
  50     private static final String AES_NOT_AVAILABLE_MSG = "warning: AES "
  51             + "instructions are not available on this CPU";
  52 









  53     protected void runTestCases() throws Throwable {
  54         testUseAES();
  55         testUseAESIntrinsics();
  56     }
  57 
  58     /**
  59      * Test checks following situation: <br/>
  60      * UseAESIntrinsics flag is set to true, TestAESMain is executed <br/>
  61      * Expected result: UseAESIntrinsics flag is set to false <br/>
  62      * UseAES flag is set to false <br/>
  63      * Output shouldn't contain intrinsics usage <br/>
  64      * Output should contain message about intrinsics unavailability
  65      * @throws Throwable
  66      */
  67     private void testUseAESIntrinsics() throws Throwable {
  68         OutputAnalyzer outputAnalyzer = ProcessTools.executeTestJvm(
  69                 AESIntrinsicsBase.prepareArguments(prepareBooleanFlag(
  70                         AESIntrinsicsBase.USE_AES_INTRINSICS, true)));
  71         final String errorMessage = "Case testUseAESIntrinsics failed";
  72         verifyOutput(new String[] {INTRINSICS_NOT_AVAILABLE_MSG},


  86      * UseAES flag is set to false <br/>
  87      * Output shouldn't contain intrinsics usage <br/>
  88      * Output should contain message about AES unavailability <br/>
  89      * @throws Throwable
  90      */
  91     private void testUseAES() throws Throwable {
  92         OutputAnalyzer outputAnalyzer = ProcessTools.executeTestJvm(
  93                 AESIntrinsicsBase.prepareArguments(prepareBooleanFlag
  94                         (AESIntrinsicsBase.USE_AES, true)));
  95         final String errorMessage = "Case testUseAES failed";
  96         verifyOutput(new String[] {AES_NOT_AVAILABLE_MSG},
  97                 new String[] {AESIntrinsicsBase.CIPHER_INTRINSIC,
  98                 AESIntrinsicsBase.AES_INTRINSIC}, errorMessage, outputAnalyzer);
  99         verifyOptionValue(AESIntrinsicsBase.USE_AES_INTRINSICS, "false",
 100                 errorMessage, outputAnalyzer);
 101         verifyOptionValue(AESIntrinsicsBase.USE_AES, "false", errorMessage,
 102                 outputAnalyzer);
 103     }
 104 
 105     public static void main(String args[]) throws Throwable {
 106         new TestAESIntrinsicsOnUnsupportedConfig().runTestCases();
 107     }
 108 }
< prev index next >