本文整理汇总了Java中jdk.testlibrary.Utils.removeGcOpts方法的典型用法代码示例。如果您正苦于以下问题:Java Utils.removeGcOpts方法的具体用法?Java Utils.removeGcOpts怎么用?Java Utils.removeGcOpts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jdk.testlibrary.Utils
的用法示例。
在下文中一共展示了Utils.removeGcOpts方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: runTest
import jdk.testlibrary.Utils; //导入方法依赖的package包/类
/**
* Runs a test in a separate JVM.
* command line like:
* {test_jdk}/bin/java {defaultopts} -cp {test.class.path} {testopts} main
*
* {defaultopts} are the default java options set by the framework.
* Default GC options in {defaultopts} may be removed.
* This is used when the test specifies its own GC options.
*
* @param main Name of the main class.
* @param clearGcOpts true if the default GC options should be removed.
* @param testOpts java options specified by the test.
*/
private static void runTest(String main, boolean clearGcOpts, String... testOpts)
throws Throwable {
List<String> opts = new ArrayList<>();
opts.add(JDKToolFinder.getJDKTool("java"));
opts.addAll(Arrays.asList(Utils.getTestJavaOpts()));
opts.add("-cp");
opts.add(System.getProperty("test.class.path", "test.class.path"));
opts.add("-XX:+PrintGCDetails");
if (clearGcOpts) {
opts = Utils.removeGcOpts(opts);
}
opts.addAll(Arrays.asList(testOpts));
opts.add(main);
OutputAnalyzer output = ProcessTools.executeProcess(opts.toArray(new String[0]));
output.shouldHaveExitValue(0);
if (output.getStdout().indexOf(successMessage) < 0) {
throw new Exception("output missing '" + successMessage + "'");
}
}
示例2: runTest
import jdk.testlibrary.Utils; //导入方法依赖的package包/类
/**
* Runs a test in a separate JVM.
* command line like:
* {test_jdk}/bin/java {defaultopts} -cp {test.class.path} {testopts} main
*
* {defaultopts} are the default java options set by the framework.
* Default GC options in {defaultopts} may be removed.
* This is used when the test specifies its own GC options.
*
* @param main Name of the main class.
* @param clearGcOpts true if the default GC options should be removed.
* @param testOpts java options specified by the test.
*/
private static void runTest(String main, boolean clearGcOpts, String... testOpts)
throws Throwable {
List<String> opts = new ArrayList<>();
opts.add(JDKToolFinder.getJDKTool("java"));
opts.addAll(Arrays.asList(Utils.getTestJavaOpts()));
opts.add("-cp");
opts.add(System.getProperty("test.class.path", "test.class.path"));
opts.add("-Xlog:gc*=debug");
if (clearGcOpts) {
opts = Utils.removeGcOpts(opts);
}
opts.addAll(Arrays.asList(testOpts));
opts.add(main);
OutputAnalyzer output = ProcessTools.executeProcess(opts.toArray(new String[0]));
output.shouldHaveExitValue(0);
if (output.getStdout().indexOf(successMessage) < 0) {
throw new Exception("output missing '" + successMessage + "'");
}
}