本文整理汇总了Java中com.oracle.java.testlibrary.cli.CommandLineOptionTest类的典型用法代码示例。如果您正苦于以下问题:Java CommandLineOptionTest类的具体用法?Java CommandLineOptionTest怎么用?Java CommandLineOptionTest使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CommandLineOptionTest类属于com.oracle.java.testlibrary.cli包,在下文中一共展示了CommandLineOptionTest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: verifyUseRTMDeopt
import com.oracle.java.testlibrary.cli.CommandLineOptionTest; //导入依赖的package包/类
private void verifyUseRTMDeopt(boolean useRTMDeopt) throws Throwable {
AbortProvoker provoker = AbortType.XABORT.provoker();
String logFileName = String.format("rtm_%s_deopt.xml",
useRTMDeopt ? "use" : "no");
OutputAnalyzer outputAnalyzer = RTMTestBase.executeRTMTest(
logFileName,
provoker,
CommandLineOptionTest.prepareBooleanFlag("UseRTMDeopt",
useRTMDeopt),
AbortProvoker.class.getName(),
AbortType.XABORT.toString()
);
outputAnalyzer.shouldHaveExitValue(0);
int expectedUncommonTraps = useRTMDeopt ? 1 : 0;
int installedUncommonTraps
= RTMTestBase.installedRTMStateChangeTraps(logFileName);
Asserts.assertEQ(expectedUncommonTraps, installedUncommonTraps,
String.format("Expected to find %d uncommon traps "
+ "installed with reason rtm_state_change.",
expectedUncommonTraps));
}
示例2: runTestCases
import com.oracle.java.testlibrary.cli.CommandLineOptionTest; //导入依赖的package包/类
@Override
public void runTestCases() throws Throwable {
// verify that option could be turned on
CommandLineOptionTest.verifySameJVMStartup(
null, null, ExitCode.OK, "-XX:+UseRTMDeopt");
// verify that option could be turned off
CommandLineOptionTest.verifySameJVMStartup(
null, null, ExitCode.OK, "-XX:-UseRTMDeopt");
// verify default value
CommandLineOptionTest.verifyOptionValueForSameVM("UseRTMDeopt",
TestUseRTMDeoptOptionOnSupportedConfig.DEFAULT_VALUE);
// verify default value
CommandLineOptionTest.verifyOptionValueForSameVM("UseRTMDeopt",
TestUseRTMDeoptOptionOnSupportedConfig.DEFAULT_VALUE,
CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,
"-XX:+UseRTMLocking");
// verify that option is off when UseRTMLocking is off
CommandLineOptionTest.verifyOptionValueForSameVM("UseRTMDeopt", "false",
CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,
"-XX:-UseRTMLocking", "-XX:+UseRTMDeopt");
// verify that option could be turned on
CommandLineOptionTest.verifyOptionValueForSameVM("UseRTMDeopt", "true",
CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,
"-XX:+UseRTMLocking", "-XX:+UseRTMDeopt");
}
开发者ID:ojdkbuild,项目名称:lookaside_java-1.8.0-openjdk,代码行数:26,代码来源:TestUseRTMDeoptOptionOnSupportedConfig.java
示例3: verifyWarnings
import com.oracle.java.testlibrary.cli.CommandLineOptionTest; //导入依赖的package包/类
@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));
}
开发者ID:ojdkbuild,项目名称:lookaside_java-1.8.0-openjdk,代码行数:17,代码来源:GenericTestCaseForUnsupportedX86CPU.java
示例4: verifyWarnings
import com.oracle.java.testlibrary.cli.CommandLineOptionTest; //导入依赖的package包/类
@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));
}
开发者ID:ojdkbuild,项目名称:lookaside_java-1.8.0-openjdk,代码行数:27,代码来源:GenericTestCaseForSupportedSparcCPU.java
示例5: verifyOptionValues
import com.oracle.java.testlibrary.cli.CommandLineOptionTest; //导入依赖的package包/类
@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));
}
开发者ID:ojdkbuild,项目名称:lookaside_java-1.8.0-openjdk,代码行数:27,代码来源:GenericTestCaseForSupportedSparcCPU.java
示例6: verifyOptionValues
import com.oracle.java.testlibrary.cli.CommandLineOptionTest; //导入依赖的package包/类
@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));
}
开发者ID:ojdkbuild,项目名称:lookaside_java-1.8.0-openjdk,代码行数:27,代码来源:UseSHASpecificTestCaseForUnsupportedSparcCPU.java
示例7: verifyOption
import com.oracle.java.testlibrary.cli.CommandLineOptionTest; //导入依赖的package包/类
public void verifyOption(boolean useStackLock) throws Throwable {
AbortProvoker provoker = AbortType.XABORT.provoker();
String logFileName = String.format("rtm_deopt_%s_stack_lock.xml",
(useStackLock ? "use" : "no"));
String methodOption = String.format("-XX:CompileCommand=option," +
"%s,NoRTMLockEliding", provoker.getMethodWithLockName());
OutputAnalyzer outputAnalyzer = RTMTestBase.executeRTMTest(
logFileName,
provoker,
CommandLineOptionTest.prepareBooleanFlag("UseRTMForStackLocks",
useStackLock),
methodOption,
"-XX:RTMTotalCountIncrRate=1",
"-XX:+UseRTMDeopt",
"-XX:+PrintPreciseRTMLockingStatistics",
AbortProvoker.class.getName(),
AbortType.XABORT.toString(),
Boolean.toString(!useStackLock)
);
outputAnalyzer.shouldHaveExitValue(0);
int firedTraps = RTMTestBase.firedRTMStateChangeTraps(logFileName);
Asserts.assertEQ(firedTraps, 0,
"No deoptimizations with rtm_state_change reason are expected");
List<RTMLockingStatistics> statistics = RTMLockingStatistics.fromString(
provoker.getMethodWithLockName(), outputAnalyzer.getOutput());
Asserts.assertEQ(statistics.size(), 0,
"VM output should not contain RTM locking statistics entries "
+ "for method " + provoker.getMethodWithLockName());
}
示例8: verifyRTMRetryCount
import com.oracle.java.testlibrary.cli.CommandLineOptionTest; //导入依赖的package包/类
private void verifyRTMRetryCount(int retryCount) throws Throwable {
CompilableTest busyLock = new BusyLock();
long expectedAborts = retryCount + 1L;
OutputAnalyzer outputAnalyzer = RTMTestBase.executeRTMTest(
busyLock,
"-XX:-UseRTMXendForLockBusy",
"-XX:RTMTotalCountIncrRate=1",
CommandLineOptionTest.prepareNumericFlag("RTMRetryCount",
retryCount),
"-XX:RTMTotalCountIncrRate=1",
"-XX:+PrintPreciseRTMLockingStatistics",
BusyLock.class.getName(),
Boolean.toString(TestRTMRetryCount.INFLATE_MONITOR),
Integer.toString(TestRTMRetryCount.LOCKING_TIME)
);
outputAnalyzer.shouldHaveExitValue(0);
List<RTMLockingStatistics> statistics = RTMLockingStatistics.fromString(
busyLock.getMethodWithLockName(), outputAnalyzer.getStdout());
Asserts.assertEQ(statistics.size(), 1, "VM output should contain "
+ "exactly one rtm locking statistics entry for method "
+ busyLock.getMethodWithLockName());
Asserts.assertEQ(statistics.get(0).getTotalAborts(), expectedAborts,
String.format("It is expected to get %d aborts",
expectedAborts));
}
示例9: getAbortsCountOnLockBusy
import com.oracle.java.testlibrary.cli.CommandLineOptionTest; //导入依赖的package包/类
private long getAbortsCountOnLockBusy(int spinLoopCount) throws Throwable {
CompilableTest test = new BusyLock();
OutputAnalyzer outputAnalyzer = RTMTestBase.executeRTMTest(
test,
CommandLineOptionTest.prepareNumericFlag("RTMRetryCount",
TestRTMSpinLoopCount.RTM_RETRY_COUNT),
CommandLineOptionTest.prepareNumericFlag("RTMSpinLoopCount",
spinLoopCount),
"-XX:-UseRTMXendForLockBusy",
"-XX:RTMTotalCountIncrRate=1",
"-XX:+PrintPreciseRTMLockingStatistics",
BusyLock.class.getName(),
Boolean.toString(TestRTMSpinLoopCount.INFLATE_MONITOR),
Integer.toString(TestRTMSpinLoopCount.LOCKING_TIME)
);
outputAnalyzer.shouldHaveExitValue(0);
List<RTMLockingStatistics> statistics = RTMLockingStatistics.fromString(
test.getMethodWithLockName(), outputAnalyzer.getOutput());
Asserts.assertEQ(statistics.size(), 1,
"VM output should contain exactly one entry for method "
+ test.getMethodWithLockName());
RTMLockingStatistics lock = statistics.get(0);
Asserts.assertLTE(lock.getTotalAborts(),
TestRTMSpinLoopCount.MAX_ABORTS, String.format("Total aborts "
+ "count (%d) should be less or equal to %d",
lock.getTotalAborts(),
TestRTMSpinLoopCount.MAX_ABORTS));
return lock.getTotalAborts();
}
示例10: verifyAbortThreshold
import com.oracle.java.testlibrary.cli.CommandLineOptionTest; //导入依赖的package包/类
private void verifyAbortThreshold(boolean useStackLock,
long abortThreshold) throws Throwable {
AbortProvoker provoker = AbortType.XABORT.provoker();
OutputAnalyzer outputAnalyzer = RTMTestBase.executeRTMTest(
provoker,
"-XX:+UseRTMDeopt",
"-XX:RTMAbortRatio=0",
CommandLineOptionTest.prepareNumericFlag("RTMAbortThreshold",
abortThreshold),
CommandLineOptionTest.prepareBooleanFlag("UseRTMForStackLocks",
useStackLock),
"-XX:RTMTotalCountIncrRate=1",
"-XX:+PrintPreciseRTMLockingStatistics",
AbortProvoker.class.getName(),
AbortType.XABORT.toString(),
Boolean.toString(!useStackLock));
outputAnalyzer.shouldHaveExitValue(0);
List<RTMLockingStatistics> statistics = RTMLockingStatistics.fromString(
provoker.getMethodWithLockName(), outputAnalyzer.getOutput());
Asserts.assertEQ(statistics.size(), 1, "VM output should contain "
+ "exactly one RTM locking statistics entry for method "
+ provoker.getMethodWithLockName());
Asserts.assertEQ(statistics.get(0).getTotalLocks(), abortThreshold,
String.format("Expected that method with rtm lock elision was"
+ " deoptimized after %d lock attempts",
abortThreshold));
}
示例11: verifyLocksCount
import com.oracle.java.testlibrary.cli.CommandLineOptionTest; //导入依赖的package包/类
private void verifyLocksCount(int incrRate, boolean useStackLock)
throws Throwable{
CompilableTest test = new Test();
OutputAnalyzer outputAnalyzer = RTMTestBase.executeRTMTest(
test,
CommandLineOptionTest.prepareBooleanFlag("UseRTMForStackLocks",
useStackLock),
CommandLineOptionTest.prepareNumericFlag(
"RTMTotalCountIncrRate", incrRate),
"-XX:RTMRetryCount=0",
"-XX:+PrintPreciseRTMLockingStatistics",
Test.class.getName(),
Boolean.toString(!useStackLock)
);
outputAnalyzer.shouldHaveExitValue(0);
List<RTMLockingStatistics> statistics = RTMLockingStatistics.fromString(
test.getMethodWithLockName(), outputAnalyzer.getOutput());
Asserts.assertEQ(statistics.size(), 1, "VM output should contain "
+ "exactly one RTM locking statistics entry for method "
+ test.getMethodWithLockName());
RTMLockingStatistics lock = statistics.get(0);
if (incrRate == 1) {
Asserts.assertEQ(lock.getTotalLocks(), Test.TOTAL_ITERATIONS,
"Total locks should be exactly the same as amount of "
+ "iterations.");
} else {
Asserts.assertGT(lock.getTotalLocks(), 0L, "RTM statistics "
+ "should contain information for at least on lock.");
}
}
示例12: verifyXendForLockBusy
import com.oracle.java.testlibrary.cli.CommandLineOptionTest; //导入依赖的package包/类
private void verifyXendForLockBusy(boolean inflateMonitor,
boolean useXend) throws Throwable {
CompilableTest test = new BusyLock();
OutputAnalyzer outputAnalyzer = RTMTestBase.executeRTMTest(
test,
CommandLineOptionTest.prepareBooleanFlag("UseRTMForStackLocks",
inflateMonitor),
CommandLineOptionTest.prepareBooleanFlag(
"UseRTMXendForLockBusy",
useXend),
"-XX:RTMRetryCount=0",
"-XX:RTMTotalCountIncrRate=1",
"-XX:+PrintPreciseRTMLockingStatistics",
BusyLock.class.getName(),
Boolean.toString(inflateMonitor),
Integer.toString(TestUseRTMXendForLockBusy.LOCKING_TIME)
);
outputAnalyzer.shouldHaveExitValue(0);
List<RTMLockingStatistics> statistics = RTMLockingStatistics.fromString(
test.getMethodWithLockName(), outputAnalyzer.getOutput());
Asserts.assertEQ(statistics.size(), 1, "VM output should contain "
+ "exactly one rtm locking statistics entry for method "
+ test.getMethodWithLockName());
long aborts = statistics.get(0).getAborts(AbortType.XABORT);
if (useXend) {
Asserts.assertEQ(aborts, 0L,
"Expected to get no aborts on busy lock");
} else {
Asserts.assertGT(aborts, 0L,
"Expected to get at least one abort on busy lock");
}
}
示例13: verifyLockingCalculationDelay
import com.oracle.java.testlibrary.cli.CommandLineOptionTest; //导入依赖的package包/类
private void verifyLockingCalculationDelay(long delay, long testDelay,
boolean deoptExpected) throws Throwable {
AbortProvoker provoker = AbortType.XABORT.provoker();
String logFileName = String.format("rtm_delay_%d_%d.xml", delay,
testDelay);
OutputAnalyzer outputAnalyzer = RTMTestBase.executeRTMTest(
logFileName,
provoker,
"-XX:+UseRTMDeopt",
CommandLineOptionTest.prepareNumericFlag(
"RTMLockingCalculationDelay", delay),
"-XX:RTMAbortRatio=0",
"-XX:RTMAbortThreshold=0",
AbortProvoker.class.getName(),
AbortType.XABORT.toString(),
Boolean.toString(
TestRTMLockingCalculationDelay.INFLATE_MONITOR),
Long.toString(AbortProvoker.DEFAULT_ITERATIONS),
Long.toString(testDelay)
);
outputAnalyzer.shouldHaveExitValue(0);
int deopts = RTMTestBase.firedRTMStateChangeTraps(logFileName);
if (deoptExpected) {
Asserts.assertGT(deopts, 0, "At least one deoptimization due to "
+ "rtm_state_chage is expected");
} else {
Asserts.assertEQ(deopts, 0, "No deoptimizations due to "
+ "rtm_state_chage are expected");
}
}
示例14: runX86SupportedVMTestCases
import com.oracle.java.testlibrary.cli.CommandLineOptionTest; //导入依赖的package包/类
@Override
protected void runX86SupportedVMTestCases() throws Throwable {
// verify that option is experimental
CommandLineOptionTest.verifySameJVMStartup(
new String[]{ experimentalOptionError },
null, ExitCode.FAIL, prepareOptionValue("true"));
CommandLineOptionTest.verifySameJVMStartup(
new String[]{ experimentalOptionError },
null, ExitCode.FAIL, prepareOptionValue("false"));
// verify that if we turn it on, then VM output will contain
// warning saying that this option could be turned on only
// when we use rtm locking
CommandLineOptionTest.verifySameJVMStartup(
new String[]{
RTMGenericCommandLineOptionTest.RTM_FOR_STACK_LOCKS_WARNING
},
null, ExitCode.OK,
CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,
prepareOptionValue("true")
);
// verify that options is turned off by default
CommandLineOptionTest.verifyOptionValueForSameVM(optionName,
TestUseRTMForStackLocksOptionOnUnsupportedConfig.DEFAULT_VALUE,
CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS);
// verify that it could not be turned on without rtm locking
CommandLineOptionTest.verifyOptionValueForSameVM(optionName,
TestUseRTMForStackLocksOptionOnUnsupportedConfig.DEFAULT_VALUE,
CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,
prepareOptionValue("true"));
}
开发者ID:ojdkbuild,项目名称:lookaside_java-1.8.0-openjdk,代码行数:33,代码来源:TestUseRTMForStackLocksOptionOnUnsupportedConfig.java
示例15: runX86SupportedVMTestCases
import com.oracle.java.testlibrary.cli.CommandLineOptionTest; //导入依赖的package包/类
@Override
protected void runX86SupportedVMTestCases() throws Throwable {
super.verifyJVMStartup();
// verify default value
CommandLineOptionTest.verifyOptionValueForSameVM(optionName,
defaultValue);
// verify that until RTMLocking is not used, value
// will be set to default false.
CommandLineOptionTest.verifyOptionValueForSameVM(optionName,
defaultValue, "-XX:+UseRTMDeopt");
}
开发者ID:ojdkbuild,项目名称:lookaside_java-1.8.0-openjdk,代码行数:12,代码来源:TestUseRTMDeoptOptionOnUnsupportedConfig.java