Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell11
提交
33f799ea
D
dragonwell11
项目概览
openanolis
/
dragonwell11
通知
7
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell11
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
33f799ea
编写于
9月 03, 2014
作者:
F
fzhinkin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8055904: Develop tests for new command-line options related to SHA intrinsics
Reviewed-by: kvn, iignatyev
上级
7f56dca0
变更
16
显示空白变更内容
内联
并排
Showing
16 changed file
with
1068 addition
and
0 deletion
+1068
-0
hotspot/test/compiler/intrinsics/sha/cli/SHAOptionsBase.java
hotspot/test/compiler/intrinsics/sha/cli/SHAOptionsBase.java
+169
-0
hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA1IntrinsicsOptionOnSupportedCPU.java
...cs/sha/cli/TestUseSHA1IntrinsicsOptionOnSupportedCPU.java
+40
-0
hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA1IntrinsicsOptionOnUnsupportedCPU.java
.../sha/cli/TestUseSHA1IntrinsicsOptionOnUnsupportedCPU.java
+48
-0
hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA256IntrinsicsOptionOnSupportedCPU.java
.../sha/cli/TestUseSHA256IntrinsicsOptionOnSupportedCPU.java
+41
-0
hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA256IntrinsicsOptionOnUnsupportedCPU.java
...ha/cli/TestUseSHA256IntrinsicsOptionOnUnsupportedCPU.java
+48
-0
hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA512IntrinsicsOptionOnSupportedCPU.java
.../sha/cli/TestUseSHA512IntrinsicsOptionOnSupportedCPU.java
+41
-0
hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA512IntrinsicsOptionOnUnsupportedCPU.java
...ha/cli/TestUseSHA512IntrinsicsOptionOnUnsupportedCPU.java
+48
-0
hotspot/test/compiler/intrinsics/sha/cli/TestUseSHAOptionOnSupportedCPU.java
...er/intrinsics/sha/cli/TestUseSHAOptionOnSupportedCPU.java
+43
-0
hotspot/test/compiler/intrinsics/sha/cli/TestUseSHAOptionOnUnsupportedCPU.java
.../intrinsics/sha/cli/TestUseSHAOptionOnUnsupportedCPU.java
+47
-0
hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForOtherCPU.java
...rinsics/sha/cli/testcases/GenericTestCaseForOtherCPU.java
+70
-0
hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForSupportedSparcCPU.java
...ha/cli/testcases/GenericTestCaseForSupportedSparcCPU.java
+93
-0
hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedSparcCPU.java
.../cli/testcases/GenericTestCaseForUnsupportedSparcCPU.java
+66
-0
hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedX86CPU.java
...ha/cli/testcases/GenericTestCaseForUnsupportedX86CPU.java
+71
-0
hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHAIntrinsicsSpecificTestCaseForUnsupportedSparcCPU.java
...eSHAIntrinsicsSpecificTestCaseForUnsupportedSparcCPU.java
+59
-0
hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHASpecificTestCaseForSupportedSparcCPU.java
...testcases/UseSHASpecificTestCaseForSupportedSparcCPU.java
+101
-0
hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHASpecificTestCaseForUnsupportedSparcCPU.java
...stcases/UseSHASpecificTestCaseForUnsupportedSparcCPU.java
+83
-0
未找到文件。
hotspot/test/compiler/intrinsics/sha/cli/SHAOptionsBase.java
0 → 100644
浏览文件 @
33f799ea
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import
com.oracle.java.testlibrary.Platform
;
import
com.oracle.java.testlibrary.cli.CommandLineOptionTest
;
import
sha.predicate.IntrinsicPredicates
;
import
java.util.function.BooleanSupplier
;
/**
* Base class for all CLI tests on SHA-related options.
*
* Instead of using huge complex tests for each option, each test is constructed
* from several test cases shared among different tests.
*/
public
class
SHAOptionsBase
extends
CommandLineOptionTest
{
protected
static
final
String
USE_SHA_OPTION
=
"UseSHA"
;
protected
static
final
String
USE_SHA1_INTRINSICS_OPTION
=
"UseSHA1Intrinsics"
;
protected
static
final
String
USE_SHA256_INTRINSICS_OPTION
=
"UseSHA256Intrinsics"
;
protected
static
final
String
USE_SHA512_INTRINSICS_OPTION
=
"UseSHA512Intrinsics"
;
// Note that strings below will be passed to
// CommandLineOptionTest.verifySameJVMStartup and thus are regular
// expressions, not just a plain strings.
protected
static
final
String
SHA_INSTRUCTIONS_ARE_NOT_AVAILABLE
=
"SHA instructions are not available on this CPU"
;
protected
static
final
String
SHA1_INSTRUCTION_IS_NOT_AVAILABLE
=
"SHA1 instruction is not available on this CPU\\."
;
protected
static
final
String
SHA256_INSTRUCTION_IS_NOT_AVAILABLE
=
"SHA256 instruction \\(for SHA-224 and SHA-256\\) "
+
"is not available on this CPU\\."
;
protected
static
final
String
SHA512_INSTRUCTION_IS_NOT_AVAILABLE
=
"SHA512 instruction \\(for SHA-384 and SHA-512\\) "
+
"is not available on this CPU\\."
;
protected
static
final
String
SHA_INTRINSICS_ARE_NOT_AVAILABLE
=
"SHA intrinsics are not available on this CPU"
;
private
final
TestCase
[]
testCases
;
/**
* Returns warning message that should occur in VM output if an option with
* the name {@code optionName} was turned on and CPU does not support
* required instructions.
*
* @param optionName The name of the option for which warning message should
* be returned.
* @return A warning message that will be printed out to VM output if CPU
* instructions required by the option are not supported.
*/
protected
static
String
getWarningForUnsupportedCPU
(
String
optionName
)
{
if
(
Platform
.
isSparc
())
{
switch
(
optionName
)
{
case
SHAOptionsBase
.
USE_SHA_OPTION
:
return
SHAOptionsBase
.
SHA_INSTRUCTIONS_ARE_NOT_AVAILABLE
;
case
SHAOptionsBase
.
USE_SHA1_INTRINSICS_OPTION
:
return
SHAOptionsBase
.
SHA1_INSTRUCTION_IS_NOT_AVAILABLE
;
case
SHAOptionsBase
.
USE_SHA256_INTRINSICS_OPTION
:
return
SHAOptionsBase
.
SHA256_INSTRUCTION_IS_NOT_AVAILABLE
;
case
SHAOptionsBase
.
USE_SHA512_INTRINSICS_OPTION
:
return
SHAOptionsBase
.
SHA512_INSTRUCTION_IS_NOT_AVAILABLE
;
default
:
throw
new
Error
(
"Unexpected option "
+
optionName
);
}
}
else
if
(
Platform
.
isX64
()
||
Platform
.
isX86
())
{
switch
(
optionName
)
{
case
SHAOptionsBase
.
USE_SHA_OPTION
:
return
SHAOptionsBase
.
SHA_INSTRUCTIONS_ARE_NOT_AVAILABLE
;
case
SHAOptionsBase
.
USE_SHA1_INTRINSICS_OPTION
:
case
SHAOptionsBase
.
USE_SHA256_INTRINSICS_OPTION
:
case
SHAOptionsBase
.
USE_SHA512_INTRINSICS_OPTION
:
return
SHAOptionsBase
.
SHA_INTRINSICS_ARE_NOT_AVAILABLE
;
default
:
throw
new
Error
(
"Unexpected option "
+
optionName
);
}
}
else
{
throw
new
Error
(
"Support for CPUs other then X86 or SPARC is not "
+
"implemented."
);
}
}
/**
* Returns the predicate indicating whether or not CPU instructions required
* by the option with name {@code optionName} are available.
*
* @param optionName The name of the option for which a predicate should be
* returned.
* @return The predicate on availability of CPU instructions required by the
* option.
*/
protected
static
BooleanSupplier
getPredicateForOption
(
String
optionName
)
{
switch
(
optionName
)
{
case
SHAOptionsBase
.
USE_SHA_OPTION
:
return
IntrinsicPredicates
.
ANY_SHA_INSTRUCTION_AVAILABLE
;
case
SHAOptionsBase
.
USE_SHA1_INTRINSICS_OPTION
:
return
IntrinsicPredicates
.
SHA1_INSTRUCTION_AVAILABLE
;
case
SHAOptionsBase
.
USE_SHA256_INTRINSICS_OPTION
:
return
IntrinsicPredicates
.
SHA256_INSTRUCTION_AVAILABLE
;
case
SHAOptionsBase
.
USE_SHA512_INTRINSICS_OPTION
:
return
IntrinsicPredicates
.
SHA512_INSTRUCTION_AVAILABLE
;
default
:
throw
new
Error
(
"Unexpected option "
+
optionName
);
}
}
public
SHAOptionsBase
(
TestCase
...
testCases
)
{
super
(
Boolean
.
TRUE
::
booleanValue
);
this
.
testCases
=
testCases
;
}
@Override
protected
void
runTestCases
()
throws
Throwable
{
for
(
TestCase
testCase
:
testCases
)
{
testCase
.
test
();
}
}
public
static
abstract
class
TestCase
{
protected
final
String
optionName
;
private
final
BooleanSupplier
predicate
;
protected
TestCase
(
String
optionName
,
BooleanSupplier
predicate
)
{
this
.
optionName
=
optionName
;
this
.
predicate
=
predicate
;
}
protected
final
void
test
()
throws
Throwable
{
String
testCaseName
=
this
.
getClass
().
getName
();
if
(!
predicate
.
getAsBoolean
())
{
System
.
out
.
println
(
"Skipping "
+
testCaseName
+
" due to predicate failure."
);
return
;
}
else
{
System
.
out
.
println
(
"Running "
+
testCaseName
);
}
verifyWarnings
();
verifyOptionValues
();
}
protected
void
verifyWarnings
()
throws
Throwable
{
}
protected
void
verifyOptionValues
()
throws
Throwable
{
}
}
}
hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA1IntrinsicsOptionOnSupportedCPU.java
0 → 100644
浏览文件 @
33f799ea
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @test
* @bug 8035968
* @summary Verify UseSHA1Intrinsics option processing on supported CPU,
* @library /testlibrary /testlibrary/whitebox /compiler/testlibrary testcases
* @build TestUseSHA1IntrinsicsOptionOnSupportedCPU
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI TestUseSHA1IntrinsicsOptionOnSupportedCPU
*/
public
class
TestUseSHA1IntrinsicsOptionOnSupportedCPU
{
public
static
void
main
(
String
args
[])
throws
Throwable
{
new
SHAOptionsBase
(
new
GenericTestCaseForSupportedSparcCPU
(
SHAOptionsBase
.
USE_SHA1_INTRINSICS_OPTION
)).
test
();
}
}
hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA1IntrinsicsOptionOnUnsupportedCPU.java
0 → 100644
浏览文件 @
33f799ea
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @test
* @bug 8035968
* @summary Verify UseSHA1Intrinsics option processing on unsupported CPU,
* @library /testlibrary /testlibrary/whitebox /compiler/testlibrary testcases
* @build TestUseSHA1IntrinsicsOptionOnUnsupportedCPU
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI
* TestUseSHA1IntrinsicsOptionOnUnsupportedCPU
*/
public
class
TestUseSHA1IntrinsicsOptionOnUnsupportedCPU
{
public
static
void
main
(
String
args
[])
throws
Throwable
{
new
SHAOptionsBase
(
new
GenericTestCaseForUnsupportedSparcCPU
(
SHAOptionsBase
.
USE_SHA1_INTRINSICS_OPTION
),
new
UseSHAIntrinsicsSpecificTestCaseForUnsupportedSparcCPU
(
SHAOptionsBase
.
USE_SHA1_INTRINSICS_OPTION
),
new
GenericTestCaseForUnsupportedX86CPU
(
SHAOptionsBase
.
USE_SHA1_INTRINSICS_OPTION
),
new
GenericTestCaseForOtherCPU
(
SHAOptionsBase
.
USE_SHA1_INTRINSICS_OPTION
)).
test
();
}
}
hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA256IntrinsicsOptionOnSupportedCPU.java
0 → 100644
浏览文件 @
33f799ea
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @test
* @bug 8035968
* @summary Verify UseSHA256Intrinsics option processing on supported CPU,
* @library /testlibrary /testlibrary/whitebox /compiler/testlibrary testcases
* @build TestUseSHA256IntrinsicsOptionOnSupportedCPU
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI
* TestUseSHA256IntrinsicsOptionOnSupportedCPU
*/
public
class
TestUseSHA256IntrinsicsOptionOnSupportedCPU
{
public
static
void
main
(
String
args
[])
throws
Throwable
{
new
SHAOptionsBase
(
new
GenericTestCaseForSupportedSparcCPU
(
SHAOptionsBase
.
USE_SHA256_INTRINSICS_OPTION
)).
test
();
}
}
hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA256IntrinsicsOptionOnUnsupportedCPU.java
0 → 100644
浏览文件 @
33f799ea
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @test
* @bug 8035968
* @summary Verify UseSHA256Intrinsics option processing on unsupported CPU,
* @library /testlibrary /testlibrary/whitebox /compiler/testlibrary testcases
* @build TestUseSHA256IntrinsicsOptionOnUnsupportedCPU
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI
* TestUseSHA256IntrinsicsOptionOnUnsupportedCPU
*/
public
class
TestUseSHA256IntrinsicsOptionOnUnsupportedCPU
{
public
static
void
main
(
String
args
[])
throws
Throwable
{
new
SHAOptionsBase
(
new
GenericTestCaseForUnsupportedSparcCPU
(
SHAOptionsBase
.
USE_SHA256_INTRINSICS_OPTION
),
new
UseSHAIntrinsicsSpecificTestCaseForUnsupportedSparcCPU
(
SHAOptionsBase
.
USE_SHA256_INTRINSICS_OPTION
),
new
GenericTestCaseForUnsupportedX86CPU
(
SHAOptionsBase
.
USE_SHA256_INTRINSICS_OPTION
),
new
GenericTestCaseForOtherCPU
(
SHAOptionsBase
.
USE_SHA256_INTRINSICS_OPTION
)).
test
();
}
}
hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA512IntrinsicsOptionOnSupportedCPU.java
0 → 100644
浏览文件 @
33f799ea
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @test
* @bug 8035968
* @summary Verify UseSHA512Intrinsics option processing on supported CPU.
* @library /testlibrary /testlibrary/whitebox /compiler/testlibrary testcases
* @build TestUseSHA512IntrinsicsOptionOnSupportedCPU
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI
* TestUseSHA512IntrinsicsOptionOnSupportedCPU
*/
public
class
TestUseSHA512IntrinsicsOptionOnSupportedCPU
{
public
static
void
main
(
String
args
[])
throws
Throwable
{
new
SHAOptionsBase
(
new
GenericTestCaseForSupportedSparcCPU
(
SHAOptionsBase
.
USE_SHA512_INTRINSICS_OPTION
)).
test
();
}
}
hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA512IntrinsicsOptionOnUnsupportedCPU.java
0 → 100644
浏览文件 @
33f799ea
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @test
* @bug 8035968
* @summary Verify UseSHA512Intrinsics option processing on unsupported CPU,
* @library /testlibrary /testlibrary/whitebox /compiler/testlibrary testcases
* @build TestUseSHA512IntrinsicsOptionOnUnsupportedCPU
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI
* TestUseSHA512IntrinsicsOptionOnUnsupportedCPU
*/
public
class
TestUseSHA512IntrinsicsOptionOnUnsupportedCPU
{
public
static
void
main
(
String
args
[])
throws
Throwable
{
new
SHAOptionsBase
(
new
GenericTestCaseForUnsupportedSparcCPU
(
SHAOptionsBase
.
USE_SHA512_INTRINSICS_OPTION
),
new
UseSHAIntrinsicsSpecificTestCaseForUnsupportedSparcCPU
(
SHAOptionsBase
.
USE_SHA512_INTRINSICS_OPTION
),
new
GenericTestCaseForUnsupportedX86CPU
(
SHAOptionsBase
.
USE_SHA512_INTRINSICS_OPTION
),
new
GenericTestCaseForOtherCPU
(
SHAOptionsBase
.
USE_SHA512_INTRINSICS_OPTION
)).
test
();
}
}
hotspot/test/compiler/intrinsics/sha/cli/TestUseSHAOptionOnSupportedCPU.java
0 → 100644
浏览文件 @
33f799ea
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @test
* @bug 8035968
* @summary Verify UseSHA option processing on supported CPU,
* @library /testlibrary /testlibrary/whitebox /compiler/testlibrary testcases
* @build TestUseSHAOptionOnSupportedCPU
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI TestUseSHAOptionOnSupportedCPU
*/
public
class
TestUseSHAOptionOnSupportedCPU
{
public
static
void
main
(
String
args
[])
throws
Throwable
{
new
SHAOptionsBase
(
new
GenericTestCaseForSupportedSparcCPU
(
SHAOptionsBase
.
USE_SHA_OPTION
),
new
UseSHASpecificTestCaseForSupportedSparcCPU
(
SHAOptionsBase
.
USE_SHA_OPTION
)).
test
();
}
}
hotspot/test/compiler/intrinsics/sha/cli/TestUseSHAOptionOnUnsupportedCPU.java
0 → 100644
浏览文件 @
33f799ea
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @test
* @bug 8035968
* @summary Verify UseSHA option processing on unsupported CPU.
* @library /testlibrary /testlibrary/whitebox /compiler/testlibrary testcases
* @build TestUseSHAOptionOnUnsupportedCPU
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI TestUseSHAOptionOnUnsupportedCPU
*/
public
class
TestUseSHAOptionOnUnsupportedCPU
{
public
static
void
main
(
String
args
[])
throws
Throwable
{
new
SHAOptionsBase
(
new
GenericTestCaseForUnsupportedSparcCPU
(
SHAOptionsBase
.
USE_SHA_OPTION
),
new
UseSHASpecificTestCaseForUnsupportedSparcCPU
(
SHAOptionsBase
.
USE_SHA_OPTION
),
new
GenericTestCaseForUnsupportedX86CPU
(
SHAOptionsBase
.
USE_SHA_OPTION
),
new
GenericTestCaseForOtherCPU
(
SHAOptionsBase
.
USE_SHA_OPTION
)).
test
();
}
}
hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForOtherCPU.java
0 → 100644
浏览文件 @
33f799ea
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import
com.oracle.java.testlibrary.ExitCode
;
import
com.oracle.java.testlibrary.Platform
;
import
com.oracle.java.testlibrary.cli.CommandLineOptionTest
;
import
com.oracle.java.testlibrary.cli.predicate.NotPredicate
;
import
com.oracle.java.testlibrary.cli.predicate.OrPredicate
;
/**
* Generic test case for SHA-related options targeted to non-x86 and
* non-SPARC CPUs.
*/
public
class
GenericTestCaseForOtherCPU
extends
SHAOptionsBase
.
TestCase
{
public
GenericTestCaseForOtherCPU
(
String
optionName
)
{
// Execute the test case on any CPU except SPARC and X86
super
(
optionName
,
new
NotPredicate
(
new
OrPredicate
(
Platform:
:
isSparc
,
new
OrPredicate
(
Platform:
:
isX64
,
Platform:
:
isX86
))));
}
@Override
protected
void
verifyWarnings
()
throws
Throwable
{
// 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
,
CommandLineOptionTest
.
prepareBooleanFlag
(
optionName
,
true
));
CommandLineOptionTest
.
verifySameJVMStartup
(
null
,
new
String
[]
{
".*"
+
optionName
+
".*"
},
ExitCode
.
OK
,
CommandLineOptionTest
.
prepareBooleanFlag
(
optionName
,
false
));
}
@Override
protected
void
verifyOptionValues
()
throws
Throwable
{
// Verify that option is disabled by default.
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
optionName
,
"false"
);
// Verify that option is disabled even if it was explicitly enabled
// using CLI options.
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
optionName
,
"false"
,
CommandLineOptionTest
.
prepareBooleanFlag
(
optionName
,
true
));
// Verify that option is disabled when it explicitly disabled
// using CLI options.
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
optionName
,
"false"
,
CommandLineOptionTest
.
prepareBooleanFlag
(
optionName
,
false
));
}
}
hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForSupportedSparcCPU.java
0 → 100644
浏览文件 @
33f799ea
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import
com.oracle.java.testlibrary.ExitCode
;
import
com.oracle.java.testlibrary.Platform
;
import
com.oracle.java.testlibrary.cli.CommandLineOptionTest
;
import
com.oracle.java.testlibrary.cli.predicate.AndPredicate
;
/**
* Generic test case for SHA-related options targeted to SPARC CPUs which
* support instructions required by the tested option.
*/
public
class
GenericTestCaseForSupportedSparcCPU
extends
SHAOptionsBase
.
TestCase
{
public
GenericTestCaseForSupportedSparcCPU
(
String
optionName
)
{
super
(
optionName
,
new
AndPredicate
(
Platform:
:
isSparc
,
SHAOptionsBase
.
getPredicateForOption
(
optionName
)));
}
@Override
protected
void
verifyWarnings
()
throws
Throwable
{
// Verify that there are no warning when option is explicitly enabled.
CommandLineOptionTest
.
verifySameJVMStartup
(
null
,
new
String
[]
{
SHAOptionsBase
.
getWarningForUnsupportedCPU
(
optionName
)
},
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
,
CommandLineOptionTest
.
prepareBooleanFlag
(
SHAOptionsBase
.
USE_SHA_OPTION
,
true
),
CommandLineOptionTest
.
prepareBooleanFlag
(
optionName
,
false
));
// Verify that it is possible to enable the tested option and disable
// all SHA intrinsics via -UseSHA without any warnings.
CommandLineOptionTest
.
verifySameJVMStartup
(
null
,
new
String
[]
{
SHAOptionsBase
.
getWarningForUnsupportedCPU
(
optionName
)
},
ExitCode
.
OK
,
CommandLineOptionTest
.
prepareBooleanFlag
(
SHAOptionsBase
.
USE_SHA_OPTION
,
false
),
CommandLineOptionTest
.
prepareBooleanFlag
(
optionName
,
true
));
}
@Override
protected
void
verifyOptionValues
()
throws
Throwable
{
// Verify that on supported CPU option is enabled by default.
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
optionName
,
"true"
);
// Verify that it is possible to explicitly enable the option.
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
optionName
,
"true"
,
CommandLineOptionTest
.
prepareBooleanFlag
(
optionName
,
true
));
// Verify that it is possible to explicitly disable the option.
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
optionName
,
"false"
,
CommandLineOptionTest
.
prepareBooleanFlag
(
optionName
,
false
));
// verify that option is disabled when -UseSHA was passed to JVM.
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
optionName
,
"false"
,
CommandLineOptionTest
.
prepareBooleanFlag
(
optionName
,
true
),
CommandLineOptionTest
.
prepareBooleanFlag
(
SHAOptionsBase
.
USE_SHA_OPTION
,
false
));
// Verify that it is possible to explicitly disable the tested option
// even if +UseSHA was passed to JVM.
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
optionName
,
"false"
,
CommandLineOptionTest
.
prepareBooleanFlag
(
SHAOptionsBase
.
USE_SHA_OPTION
,
true
),
CommandLineOptionTest
.
prepareBooleanFlag
(
optionName
,
false
));
}
}
hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedSparcCPU.java
0 → 100644
浏览文件 @
33f799ea
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import
com.oracle.java.testlibrary.ExitCode
;
import
com.oracle.java.testlibrary.Platform
;
import
com.oracle.java.testlibrary.cli.CommandLineOptionTest
;
import
com.oracle.java.testlibrary.cli.predicate.AndPredicate
;
import
com.oracle.java.testlibrary.cli.predicate.NotPredicate
;
/**
* Generic test case for SHA-related options targeted to SPARC CPUs which don't
* support instruction required by the tested option.
*/
public
class
GenericTestCaseForUnsupportedSparcCPU
extends
SHAOptionsBase
.
TestCase
{
public
GenericTestCaseForUnsupportedSparcCPU
(
String
optionName
)
{
super
(
optionName
,
new
AndPredicate
(
Platform:
:
isSparc
,
new
NotPredicate
(
SHAOptionsBase
.
getPredicateForOption
(
optionName
))));
}
@Override
protected
void
verifyWarnings
()
throws
Throwable
{
//Verify that option could be disabled without any warnings.
CommandLineOptionTest
.
verifySameJVMStartup
(
null
,
new
String
[]
{
SHAOptionsBase
.
getWarningForUnsupportedCPU
(
optionName
)
},
ExitCode
.
OK
,
CommandLineOptionTest
.
prepareBooleanFlag
(
optionName
,
false
));
}
@Override
protected
void
verifyOptionValues
()
throws
Throwable
{
// Verify that option is disabled by default.
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
optionName
,
"false"
);
// Verify that option is disabled even if it was explicitly enabled
// using CLI options.
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
optionName
,
"false"
,
CommandLineOptionTest
.
prepareBooleanFlag
(
optionName
,
true
));
// Verify that option is disabled when +UseSHA was passed to JVM.
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
optionName
,
"false"
,
CommandLineOptionTest
.
prepareBooleanFlag
(
SHAOptionsBase
.
USE_SHA_OPTION
,
true
));
}
}
hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedX86CPU.java
0 → 100644
浏览文件 @
33f799ea
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import
com.oracle.java.testlibrary.ExitCode
;
import
com.oracle.java.testlibrary.Platform
;
import
com.oracle.java.testlibrary.cli.CommandLineOptionTest
;
import
com.oracle.java.testlibrary.cli.predicate.OrPredicate
;
/**
* Generic test case for SHA-related options targeted to X86 CPUs that don't
* support SHA-related instructions.
*/
public
class
GenericTestCaseForUnsupportedX86CPU
extends
SHAOptionsBase
.
TestCase
{
public
GenericTestCaseForUnsupportedX86CPU
(
String
optionName
)
{
super
(
optionName
,
new
OrPredicate
(
Platform:
:
isX64
,
Platform:
:
isX86
));
}
@Override
protected
void
verifyWarnings
()
throws
Throwable
{
// 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
,
CommandLineOptionTest
.
prepareBooleanFlag
(
optionName
,
true
));
// Verify that the tested option could be explicitly disabled without
// a warning.
CommandLineOptionTest
.
verifySameJVMStartup
(
null
,
new
String
[]
{
SHAOptionsBase
.
getWarningForUnsupportedCPU
(
optionName
)
},
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"
);
// Verify that it is not possible to explicitly enable the option.
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
optionName
,
"false"
,
CommandLineOptionTest
.
prepareBooleanFlag
(
optionName
,
true
));
// Verify that the tested option is disabled even if +UseSHA was passed
// to JVM.
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
optionName
,
"false"
,
CommandLineOptionTest
.
prepareBooleanFlag
(
SHAOptionsBase
.
USE_SHA_OPTION
,
true
));
}
}
hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHAIntrinsicsSpecificTestCaseForUnsupportedSparcCPU.java
0 → 100644
浏览文件 @
33f799ea
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import
com.oracle.java.testlibrary.ExitCode
;
import
com.oracle.java.testlibrary.Platform
;
import
com.oracle.java.testlibrary.cli.CommandLineOptionTest
;
import
com.oracle.java.testlibrary.cli.predicate.AndPredicate
;
import
com.oracle.java.testlibrary.cli.predicate.NotPredicate
;
import
sha.predicate.IntrinsicPredicates
;
/**
* Test case specific to UseSHA*Intrinsics options targeted to SPARC CPUs which
* don't support required instruction, but support other SHA-related
* instructions.
*
* For example, CPU support sha1 instruction, but don't support sha256 or
* sha512.
*/
public
class
UseSHAIntrinsicsSpecificTestCaseForUnsupportedSparcCPU
extends
SHAOptionsBase
.
TestCase
{
public
UseSHAIntrinsicsSpecificTestCaseForUnsupportedSparcCPU
(
String
optionName
)
{
// execute test case on SPARC CPU that support any sha* instructions,
// but does not support sha* instruction required by the tested option.
super
(
optionName
,
new
AndPredicate
(
Platform:
:
isSparc
,
new
AndPredicate
(
IntrinsicPredicates
.
ANY_SHA_INSTRUCTION_AVAILABLE
,
new
NotPredicate
(
SHAOptionsBase
.
getPredicateForOption
(
optionName
)))));
}
@Override
protected
void
verifyWarnings
()
throws
Throwable
{
// Verify that attempt to enable the tested option will cause a warning.
CommandLineOptionTest
.
verifySameJVMStartup
(
new
String
[]
{
SHAOptionsBase
.
getWarningForUnsupportedCPU
(
optionName
)
},
null
,
ExitCode
.
OK
,
CommandLineOptionTest
.
prepareBooleanFlag
(
optionName
,
true
));
}
}
hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHASpecificTestCaseForSupportedSparcCPU.java
0 → 100644
浏览文件 @
33f799ea
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import
com.oracle.java.testlibrary.Asserts
;
import
com.oracle.java.testlibrary.ExitCode
;
import
com.oracle.java.testlibrary.Platform
;
import
com.oracle.java.testlibrary.cli.CommandLineOptionTest
;
import
com.oracle.java.testlibrary.cli.predicate.AndPredicate
;
import
sha.predicate.IntrinsicPredicates
;
/**
* UseSHA specific test case targeted to SPARC CPUs which support any sha*
* instruction.
*/
public
class
UseSHASpecificTestCaseForSupportedSparcCPU
extends
SHAOptionsBase
.
TestCase
{
public
UseSHASpecificTestCaseForSupportedSparcCPU
(
String
optionName
)
{
super
(
SHAOptionsBase
.
USE_SHA_OPTION
,
new
AndPredicate
(
Platform:
:
isSparc
,
IntrinsicPredicates
.
ANY_SHA_INSTRUCTION_AVAILABLE
));
Asserts
.
assertEQ
(
optionName
,
SHAOptionsBase
.
USE_SHA_OPTION
,
"Test case should be used for "
+
SHAOptionsBase
.
USE_SHA_OPTION
+
" option only."
);
}
@Override
protected
void
verifyWarnings
()
throws
Throwable
{
// 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
,
CommandLineOptionTest
.
prepareBooleanFlag
(
SHAOptionsBase
.
USE_SHA_OPTION
,
true
),
CommandLineOptionTest
.
prepareBooleanFlag
(
SHAOptionsBase
.
USE_SHA1_INTRINSICS_OPTION
,
false
),
CommandLineOptionTest
.
prepareBooleanFlag
(
SHAOptionsBase
.
USE_SHA256_INTRINSICS_OPTION
,
false
),
CommandLineOptionTest
.
prepareBooleanFlag
(
SHAOptionsBase
.
USE_SHA512_INTRINSICS_OPTION
,
false
));
}
@Override
protected
void
verifyOptionValues
()
throws
Throwable
{
// Verify that UseSHA is disabled when all UseSHA*Intrinscs are
// disabled.
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
SHAOptionsBase
.
USE_SHA_OPTION
,
"false"
,
CommandLineOptionTest
.
prepareBooleanFlag
(
SHAOptionsBase
.
USE_SHA1_INTRINSICS_OPTION
,
false
),
CommandLineOptionTest
.
prepareBooleanFlag
(
SHAOptionsBase
.
USE_SHA256_INTRINSICS_OPTION
,
false
),
CommandLineOptionTest
.
prepareBooleanFlag
(
SHAOptionsBase
.
USE_SHA512_INTRINSICS_OPTION
,
false
));
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
// Verify that UseSHA is disabled when all UseSHA*Intrinscs are
// disabled even if it was explicitly enabled.
SHAOptionsBase
.
USE_SHA_OPTION
,
"false"
,
CommandLineOptionTest
.
prepareBooleanFlag
(
SHAOptionsBase
.
USE_SHA_OPTION
,
true
),
CommandLineOptionTest
.
prepareBooleanFlag
(
SHAOptionsBase
.
USE_SHA1_INTRINSICS_OPTION
,
false
),
CommandLineOptionTest
.
prepareBooleanFlag
(
SHAOptionsBase
.
USE_SHA256_INTRINSICS_OPTION
,
false
),
CommandLineOptionTest
.
prepareBooleanFlag
(
SHAOptionsBase
.
USE_SHA512_INTRINSICS_OPTION
,
false
));
// Verify that explicitly disabled UseSHA option remains disabled even
// if all UseSHA*Intrinsics options were enabled.
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
SHAOptionsBase
.
USE_SHA_OPTION
,
"false"
,
CommandLineOptionTest
.
prepareBooleanFlag
(
SHAOptionsBase
.
USE_SHA_OPTION
,
false
),
CommandLineOptionTest
.
prepareBooleanFlag
(
SHAOptionsBase
.
USE_SHA1_INTRINSICS_OPTION
,
true
),
CommandLineOptionTest
.
prepareBooleanFlag
(
SHAOptionsBase
.
USE_SHA256_INTRINSICS_OPTION
,
true
),
CommandLineOptionTest
.
prepareBooleanFlag
(
SHAOptionsBase
.
USE_SHA512_INTRINSICS_OPTION
,
true
));
}
}
hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHASpecificTestCaseForUnsupportedSparcCPU.java
0 → 100644
浏览文件 @
33f799ea
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import
com.oracle.java.testlibrary.Asserts
;
import
com.oracle.java.testlibrary.ExitCode
;
import
com.oracle.java.testlibrary.Platform
;
import
com.oracle.java.testlibrary.cli.CommandLineOptionTest
;
import
com.oracle.java.testlibrary.cli.predicate.AndPredicate
;
import
com.oracle.java.testlibrary.cli.predicate.NotPredicate
;
import
sha.predicate.IntrinsicPredicates
;
/**
* UseSHA specific test case targeted to SPARC CPUs which don't support all sha*
* instructions.
*/
public
class
UseSHASpecificTestCaseForUnsupportedSparcCPU
extends
SHAOptionsBase
.
TestCase
{
public
UseSHASpecificTestCaseForUnsupportedSparcCPU
(
String
optionName
)
{
super
(
SHAOptionsBase
.
USE_SHA_OPTION
,
new
AndPredicate
(
Platform:
:
isSparc
,
new
NotPredicate
(
IntrinsicPredicates
.
ANY_SHA_INSTRUCTION_AVAILABLE
)));
Asserts
.
assertEQ
(
optionName
,
SHAOptionsBase
.
USE_SHA_OPTION
,
"Test case should be used for "
+
SHAOptionsBase
.
USE_SHA_OPTION
+
" option only."
);
}
@Override
protected
void
verifyWarnings
()
throws
Throwable
{
// Verify that attempt to use UseSHA option will cause a warning.
CommandLineOptionTest
.
verifySameJVMStartup
(
new
String
[]
{
SHAOptionsBase
.
getWarningForUnsupportedCPU
(
optionName
)
},
null
,
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.
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
SHAOptionsBase
.
USE_SHA_OPTION
,
"false"
,
CommandLineOptionTest
.
prepareBooleanFlag
(
SHAOptionsBase
.
USE_SHA1_INTRINSICS_OPTION
,
true
),
CommandLineOptionTest
.
prepareBooleanFlag
(
SHAOptionsBase
.
USE_SHA256_INTRINSICS_OPTION
,
true
),
CommandLineOptionTest
.
prepareBooleanFlag
(
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.
CommandLineOptionTest
.
verifyOptionValueForSameVM
(
SHAOptionsBase
.
USE_SHA_OPTION
,
"false"
,
CommandLineOptionTest
.
prepareBooleanFlag
(
SHAOptionsBase
.
USE_SHA_OPTION
,
true
),
CommandLineOptionTest
.
prepareBooleanFlag
(
SHAOptionsBase
.
USE_SHA1_INTRINSICS_OPTION
,
true
),
CommandLineOptionTest
.
prepareBooleanFlag
(
SHAOptionsBase
.
USE_SHA256_INTRINSICS_OPTION
,
true
),
CommandLineOptionTest
.
prepareBooleanFlag
(
SHAOptionsBase
.
USE_SHA512_INTRINSICS_OPTION
,
true
));
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录