use of org.jikesrvm.compilers.opt.OptOptions in project JikesRVM by JikesRVM.
the class OptTestHarnessTest method commandLineArgumentFileSupportsComments.
@Test
@Category(RequiresOptCompiler.class)
public void commandLineArgumentFileSupportsComments() throws Exception {
fileAccess = new TestFileAccess();
String fileName = "commandLineArgsForLongCommandLineTestWithComments";
String fileContent = "-baseline\n" + "#" + "+baseline\n";
fileAccess.putContentForFile(fileName, fileContent);
String[] longCommandLine = { "-longcommandline", fileName };
output = new TestOutput();
OptTestHarness oth = new OptTestHarness(output, new OptOptions(), fileAccess);
oth.mainMethod(longCommandLine);
assertThatNoAdditionalErrorsHaveOccurred();
assertThat(oth.useBaselineCompiler, is(false));
}
use of org.jikesrvm.compilers.opt.OptOptions in project JikesRVM by JikesRVM.
the class OptTestHarnessTest method executeOptTestHarness.
private OptTestHarness executeOptTestHarness(String[] commandLineArguments) throws InvocationTargetException, IllegalAccessException {
output = new TestOutput();
fileAccess = new TestFileAccess();
OptTestHarness oth = new OptTestHarness(output, new OptOptions(), fileAccess);
oth.mainMethod(commandLineArguments);
return oth;
}
use of org.jikesrvm.compilers.opt.OptOptions in project JikesRVM by JikesRVM.
the class OptTestHarnessTest method readingNonExistingFileCausesError.
@Test
public void readingNonExistingFileCausesError() throws Exception {
String fileName = "fileWhichWillNeverExist";
fileAccess = new TestFileAccess();
String[] longCommandLine = { "-longcommandline", fileName };
output = new TestOutput();
OptTestHarness oth = new OptTestHarness(output, new OptOptions(), fileAccess);
oth.mainMethod(longCommandLine);
String fileNotFoundLineStart = "java.io.FileNotFoundException: ";
String firstLineOfStackTrace = fileNotFoundLineStart + fileName + lineEnd;
assertThat(getErrorOutput().startsWith(firstLineOfStackTrace), is(true));
}
use of org.jikesrvm.compilers.opt.OptOptions in project JikesRVM by JikesRVM.
the class OptTestHarnessTest method supportsPerformanceMeasurements.
@Test
public void supportsPerformanceMeasurements() throws Exception {
String[] args = { "-performance" };
output = new TestOutput();
OptTestHarness oth = new OptTestHarness(output, new OptOptions(), new TestFileAccess());
oth.addCallbackForPerformancePrintout = false;
oth.mainMethod(args);
assertThatNoAdditionalErrorsHaveOccurred();
assertThatNumberOfBaselineCompiledMethodsIs(0);
assertThatNumberOfOptCompiledMethodsIs(0);
String output = getStandardOutput();
String patternString = "\nPerformance of executed method\n" + "------------------------------\n" + "Elapsed wallclock time: ";
patternString += "(\\d+\\.\\d+E\\d+)";
patternString += " msec\n";
Pattern p = Pattern.compile(patternString);
Matcher m = p.matcher(output);
assertThat(m.matches(), is(true));
}
use of org.jikesrvm.compilers.opt.OptOptions in project JikesRVM by JikesRVM.
the class OptTestHarnessTest method canReadCommandLineArgumentsFromFile.
@Test
public void canReadCommandLineArgumentsFromFile() throws Exception {
String fileName = "commandLineArgsForLongCommandLineTest";
fileAccess = new TestFileAccess();
String fileContent = "-er\n" + CLASS_WITH_STATIC_METHOD + lineEnd + "printMessage\n" + "-\n";
fileAccess.putContentForFile(fileName, fileContent);
String[] longCommandLine = { "-longcommandline", fileName };
try {
output = new TestOutput();
redirectStandardStreams();
OptTestHarness oth = new OptTestHarness(output, new OptOptions(), fileAccess);
oth.mainMethod(longCommandLine);
} finally {
resetStandardStreams();
}
assertThatNoAdditionalErrorsHaveOccurred();
}
Aggregations