本文整理汇总了Java中jdk.testlibrary.Utils.getVmOptions方法的典型用法代码示例。如果您正苦于以下问题:Java Utils.getVmOptions方法的具体用法?Java Utils.getVmOptions怎么用?Java Utils.getVmOptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jdk.testlibrary.Utils
的用法示例。
在下文中一共展示了Utils.getVmOptions方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import jdk.testlibrary.Utils; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
System.out.println("Starting JMapHeapConfigTest");
if (!Platform.shouldSAAttach()) {
// Silently skip the test if we don't have enough permissions to attach
System.err.println("Error! Insufficient permissions to attach.");
return;
}
if (!LingeredApp.isLastModifiedWorking()) {
// Exact behaviour of the test depends to operating system and the test nature,
// so just print the warning and continue
System.err.println("Warning! Last modified time doesn't work.");
}
boolean mx_found = false;
List<String> jvmOptions = Utils.getVmOptions();
for (String option : jvmOptions) {
if (option.startsWith("-Xmx")) {
System.out.println("INFO: maximum heap size set by JTREG as " + option);
mx_found = true;
break;
}
}
// Forward vm options to LingeredApp
ArrayList<String> cmd = new ArrayList();
cmd.addAll(Utils.getVmOptions());
if (!mx_found) {
cmd.add(desiredMaxHeapSize);
System.out.println("INFO: maximum heap size set explicitly as " + desiredMaxHeapSize);
}
cmd.add("-XX:+PrintFlagsFinal");
TmtoolTestScenario tmt = TmtoolTestScenario.create("jmap", "--heap");
int exitcode = tmt.launch(cmd);
if (exitcode != 0) {
throw new RuntimeException("Test FAILED jmap exits with non zero exit code " + exitcode);
}
Map<String,String> parsedJmapOutput = parseJMapOutput(tmt.getToolOutput());
Map<String,String> parsedVMOutput = tmt.parseFlagsFinal();
compareValues(parsedJmapOutput, parsedVMOutput);
// If test fails it throws RuntimeException
System.out.println("Test PASSED");
}