author | lana |
Thu, 23 Feb 2017 17:30:12 +0000 (2017-02-23) | |
changeset 44011 | 5eea3031ae7b |
parent 41705 | 332239c052cc |
child 46514 | 38a2f229b094 |
permissions | -rw-r--r-- |
35122
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
1 |
/* |
40631
ed82623d7831
8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents:
40059
diff
changeset
|
2 |
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. |
35122
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
4 |
* |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
8 |
* |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
13 |
* accompanied this code). |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
14 |
* |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
18 |
* |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
21 |
* questions. |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
22 |
*/ |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
23 |
|
39438 | 24 |
/* |
25 |
* @test |
|
40631
ed82623d7831
8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents:
40059
diff
changeset
|
26 |
* @library /test/lib / |
39438 | 27 |
* @modules java.base/jdk.internal.misc |
28 |
* java.management |
|
40059 | 29 |
* |
40631
ed82623d7831
8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents:
40059
diff
changeset
|
30 |
* @build sun.hotspot.WhiteBox |
39438 | 31 |
* @run driver ClassFileInstaller sun.hotspot.WhiteBox |
32 |
* sun.hotspot.WhiteBox$WhiteBoxPermission |
|
33 |
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions |
|
40059 | 34 |
* -XX:+WhiteBoxAPI -Xbatch |
35 |
* compiler.cpuflags.TestAESIntrinsicsOnUnsupportedConfig |
|
39438 | 36 |
*/ |
37 |
||
40059 | 38 |
package compiler.cpuflags; |
39 |
||
40631
ed82623d7831
8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents:
40059
diff
changeset
|
40 |
import jdk.test.lib.process.OutputAnalyzer; |
ed82623d7831
8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents:
40059
diff
changeset
|
41 |
import jdk.test.lib.process.ProcessTools; |
40059 | 42 |
import jdk.test.lib.cli.predicate.NotPredicate; |
35122
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
43 |
|
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
44 |
public class TestAESIntrinsicsOnUnsupportedConfig extends AESIntrinsicsBase { |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
45 |
|
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
46 |
private static final String INTRINSICS_NOT_AVAILABLE_MSG = "warning: AES " |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
47 |
+ "intrinsics are not available on this CPU"; |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
48 |
private static final String AES_NOT_AVAILABLE_MSG = "warning: AES " |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
49 |
+ "instructions are not available on this CPU"; |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
50 |
|
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
51 |
/** |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
52 |
* Constructs new TestAESIntrinsicsOnUnsupportedConfig that will be |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
53 |
* executed only if AESSupportPredicate returns false |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
54 |
*/ |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
55 |
private TestAESIntrinsicsOnUnsupportedConfig() { |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
56 |
super(new NotPredicate(AESIntrinsicsBase.AES_SUPPORTED_PREDICATE)); |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
57 |
} |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
58 |
|
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
59 |
@Override |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
60 |
protected void runTestCases() throws Throwable { |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
61 |
testUseAES(); |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
62 |
testUseAESIntrinsics(); |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
63 |
} |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
64 |
|
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
65 |
/** |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
66 |
* Test checks following situation: <br/> |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
67 |
* UseAESIntrinsics flag is set to true, TestAESMain is executed <br/> |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
68 |
* Expected result: UseAESIntrinsics flag is set to false <br/> |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
69 |
* UseAES flag is set to false <br/> |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
70 |
* Output shouldn't contain intrinsics usage <br/> |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
71 |
* Output should contain message about intrinsics unavailability |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
72 |
* @throws Throwable |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
73 |
*/ |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
74 |
private void testUseAESIntrinsics() throws Throwable { |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
75 |
OutputAnalyzer outputAnalyzer = ProcessTools.executeTestJvm( |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
76 |
AESIntrinsicsBase.prepareArguments(prepareBooleanFlag( |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
77 |
AESIntrinsicsBase.USE_AES_INTRINSICS, true))); |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
78 |
final String errorMessage = "Case testUseAESIntrinsics failed"; |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
79 |
verifyOutput(new String[] {INTRINSICS_NOT_AVAILABLE_MSG}, |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
80 |
new String[] {AESIntrinsicsBase.CIPHER_INTRINSIC, |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
81 |
AESIntrinsicsBase.AES_INTRINSIC}, |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
82 |
errorMessage, outputAnalyzer); |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
83 |
verifyOptionValue(AESIntrinsicsBase.USE_AES_INTRINSICS, "false", |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
84 |
errorMessage, outputAnalyzer); |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
85 |
verifyOptionValue(AESIntrinsicsBase.USE_AES, "false", errorMessage, |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
86 |
outputAnalyzer); |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
87 |
} |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
88 |
|
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
89 |
/** |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
90 |
* Test checks following situation: <br/> |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
91 |
* UseAESIntrinsics flag is set to true, TestAESMain is executed <br/> |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
92 |
* Expected result: UseAES flag is set to false <br/> |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
93 |
* UseAES flag is set to false <br/> |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
94 |
* Output shouldn't contain intrinsics usage <br/> |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
95 |
* Output should contain message about AES unavailability <br/> |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
96 |
* @throws Throwable |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
97 |
*/ |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
98 |
private void testUseAES() throws Throwable { |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
99 |
OutputAnalyzer outputAnalyzer = ProcessTools.executeTestJvm( |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
100 |
AESIntrinsicsBase.prepareArguments(prepareBooleanFlag |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
101 |
(AESIntrinsicsBase.USE_AES, true))); |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
102 |
final String errorMessage = "Case testUseAES failed"; |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
103 |
verifyOutput(new String[] {AES_NOT_AVAILABLE_MSG}, |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
104 |
new String[] {AESIntrinsicsBase.CIPHER_INTRINSIC, |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
105 |
AESIntrinsicsBase.AES_INTRINSIC}, errorMessage, outputAnalyzer); |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
106 |
verifyOptionValue(AESIntrinsicsBase.USE_AES_INTRINSICS, "false", |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
107 |
errorMessage, outputAnalyzer); |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
108 |
verifyOptionValue(AESIntrinsicsBase.USE_AES, "false", errorMessage, |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
109 |
outputAnalyzer); |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
110 |
} |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
111 |
|
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
112 |
public static void main(String args[]) throws Throwable { |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
113 |
new TestAESIntrinsicsOnUnsupportedConfig().test(); |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
114 |
} |
3f7b7fe1bfcb
8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff
changeset
|
115 |
} |