use of com.oracle.truffle.llvm.tests.pipe.CaptureNativeOutput in project graal by oracle.
the class CaptureOutputTest method testErrCapturing.
@Test
public void testErrCapturing() throws IOException {
String string = "Testoutput";
String captured;
try (CaptureOutput out = new CaptureNativeOutput()) {
System.err.print(string);
captured = out.getStdErr();
}
System.err.println("MUST NOT BE IN CAPTURE");
assertEquals(string, captured);
}
use of com.oracle.truffle.llvm.tests.pipe.CaptureNativeOutput in project graal by oracle.
the class BaseSulongOnlyHarness method test.
@Test
public void test() throws IOException {
ProcessResult out = ProcessUtil.executeSulongTestMain(getPath().toAbsolutePath().toFile(), getConfiguration().args, getContextOptions(), c -> new CaptureNativeOutput());
int sulongResult = out.getReturnValue();
String sulongStdOut = out.getStdOutput();
if (sulongResult != (sulongResult & 0xFF)) {
Assert.fail("Broken unittest " + getPath() + ". Test exits with invalid value (" + sulongResult + ").");
}
String testName = getPath().getFileName().toString();
Assert.assertEquals(testName + " failed. Posix return value missmatch.", getConfiguration().expectedPosixReturn, sulongResult);
if (getConfiguration().expectedOutput != null) {
Assert.assertEquals(testName + " failed. Output (stdout) missmatch.", getConfiguration().expectedOutput, sulongStdOut);
}
}
Aggregations