Search in sources :

Example 6 with CaptureNativeOutput

use of com.oracle.truffle.llvm.tests.pipe.CaptureNativeOutput in project graal by oracle.

the class PolyglotToolchainTest method testLDLibraryPath.

@Test
public void testLDLibraryPath() throws IOException {
    try (CaptureOutput out = new CaptureNativeOutput()) {
        testLibrary.getMember("print_ld_library_path").execute();
        Assert.assertEquals(String.format("LD_LIBRARY_PATH=%s\n", getToolchain().getPaths("LD_LIBRARY_PATH").stream().map(TruffleFile::toString).collect(Collectors.joining(":"))), out.getStdOut());
    }
}
Also used : CaptureOutput(com.oracle.truffle.llvm.tests.pipe.CaptureOutput) CaptureNativeOutput(com.oracle.truffle.llvm.tests.pipe.CaptureNativeOutput) Test(org.junit.Test)

Example 7 with CaptureNativeOutput

use of com.oracle.truffle.llvm.tests.pipe.CaptureNativeOutput in project graal by oracle.

the class PolyglotToolchainTest method testCC.

@Test
public void testCC() throws IOException {
    try (CaptureOutput out = new CaptureNativeOutput()) {
        testLibrary.getMember("print_cc").execute();
        Assert.assertEquals(String.format("CC=%s\n", getToolchain().getToolPath("CC").toString()), out.getStdOut());
    }
}
Also used : CaptureOutput(com.oracle.truffle.llvm.tests.pipe.CaptureOutput) CaptureNativeOutput(com.oracle.truffle.llvm.tests.pipe.CaptureNativeOutput) Test(org.junit.Test)

Example 8 with CaptureNativeOutput

use of com.oracle.truffle.llvm.tests.pipe.CaptureNativeOutput in project graal by oracle.

the class PolyglotToolchainTest method testIdentifier.

@Test
public void testIdentifier() throws IOException {
    try (CaptureOutput out = new CaptureNativeOutput()) {
        testLibrary.getMember("print_id").execute();
        Assert.assertEquals(String.format("ID=%s\n", getToolchain().getIdentifier().toString()), out.getStdOut());
    }
}
Also used : CaptureOutput(com.oracle.truffle.llvm.tests.pipe.CaptureOutput) CaptureNativeOutput(com.oracle.truffle.llvm.tests.pipe.CaptureNativeOutput) Test(org.junit.Test)

Example 9 with CaptureNativeOutput

use of com.oracle.truffle.llvm.tests.pipe.CaptureNativeOutput in project graal by oracle.

the class CaptureOutputTest method testOutputCapturing2.

@Test
public void testOutputCapturing2() throws IOException {
    String string = "Does it work again?";
    String captured;
    try (CaptureOutput out = new CaptureNativeOutput()) {
        System.out.print(string);
        captured = out.getStdOut();
    }
    System.out.println("MUST NOT BE IN CAPTURE");
    assertEquals(string, captured);
}
Also used : CaptureOutput(com.oracle.truffle.llvm.tests.pipe.CaptureOutput) CaptureNativeOutput(com.oracle.truffle.llvm.tests.pipe.CaptureNativeOutput) Test(org.junit.Test)

Example 10 with CaptureNativeOutput

use of com.oracle.truffle.llvm.tests.pipe.CaptureNativeOutput in project graal by oracle.

the class CaptureOutputTest method testErrCapturing2.

@Test
public void testErrCapturing2() throws IOException {
    String string = "Does it work again?";
    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);
}
Also used : CaptureOutput(com.oracle.truffle.llvm.tests.pipe.CaptureOutput) CaptureNativeOutput(com.oracle.truffle.llvm.tests.pipe.CaptureNativeOutput) Test(org.junit.Test)

Aggregations

CaptureNativeOutput (com.oracle.truffle.llvm.tests.pipe.CaptureNativeOutput)12 Test (org.junit.Test)11 CaptureOutput (com.oracle.truffle.llvm.tests.pipe.CaptureOutput)10 TruffleFile (com.oracle.truffle.api.TruffleFile)2 File (java.io.File)2 DebuggerSession (com.oracle.truffle.api.debug.DebuggerSession)1 ProcessResult (com.oracle.truffle.llvm.tests.util.ProcessUtil.ProcessResult)1