Search in sources :

Example 1 with BuildReport

use of com.facebook.buck.command.BuildReport in project buck by facebook.

the class BuildCommandTest method testGenerateBuildReportForConsole.

@Test
public void testGenerateBuildReportForConsole() {
    String expectedReport = "OK   //fake:rule1 " + "BUILT_LOCALLY " + MorePaths.pathWithPlatformSeparators("buck-out/gen/fake/rule1.txt") + "\n" + "FAIL //fake:rule2\n" + "OK   //fake:rule3 FETCHED_FROM_CACHE\n" + "FAIL //fake:rule4\n";
    String observedReport = new BuildReport(buildExecutionResult, resolver).generateForConsole(new Console(Verbosity.STANDARD_INFORMATION, new CapturingPrintStream(), new CapturingPrintStream(), Ansi.forceTty()));
    assertEquals(expectedReport, observedReport);
}
Also used : BuildReport(com.facebook.buck.command.BuildReport) CapturingPrintStream(com.facebook.buck.util.CapturingPrintStream) Console(com.facebook.buck.util.Console) TestConsole(com.facebook.buck.testutil.TestConsole) Test(org.junit.Test)

Example 2 with BuildReport

use of com.facebook.buck.command.BuildReport in project buck by facebook.

the class BuildCommandTest method testGenerateJsonBuildReport.

@Test
public void testGenerateJsonBuildReport() throws IOException {
    ObjectMapper mapper = ObjectMappers.newDefaultInstance();
    String rule1TxtPath = mapper.valueToTree(MorePaths.pathWithPlatformSeparators("buck-out/gen/fake/rule1.txt")).toString();
    String expectedReport = Joiner.on(System.lineSeparator()).join("{", "  \"success\" : false,", "  \"results\" : {", "    \"//fake:rule1\" : {", "      \"success\" : true,", "      \"type\" : \"BUILT_LOCALLY\",", "      \"output\" : " + rule1TxtPath, "    },", "    \"//fake:rule2\" : {", "      \"success\" : false", "    },", "    \"//fake:rule3\" : {", "      \"success\" : true,", "      \"type\" : \"FETCHED_FROM_CACHE\",", "      \"output\" : null", "    },", "    \"//fake:rule4\" : {", "      \"success\" : false", "    }", "  },", "  \"failures\" : {", "    \"//fake:rule2\" : \"some\"", "  }", "}");
    String observedReport = new BuildReport(buildExecutionResult, resolver).generateJsonBuildReport();
    assertEquals(expectedReport, observedReport);
}
Also used : BuildReport(com.facebook.buck.command.BuildReport) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Test(org.junit.Test)

Example 3 with BuildReport

use of com.facebook.buck.command.BuildReport in project buck by facebook.

the class BuildCommandTest method testGenerateVerboseBuildReportForConsole.

@Test
public void testGenerateVerboseBuildReportForConsole() {
    String expectedReport = "OK   //fake:rule1 BUILT_LOCALLY " + MorePaths.pathWithPlatformSeparators("buck-out/gen/fake/rule1.txt") + "\n" + "FAIL //fake:rule2\n" + "OK   //fake:rule3 FETCHED_FROM_CACHE\n" + "FAIL //fake:rule4\n\n" + " ** Summary of failures encountered during the build **\n" + "Rule //fake:rule2 FAILED because some.\n";
    String observedReport = new BuildReport(buildExecutionResult, resolver).generateForConsole(new TestConsole(Verbosity.COMMANDS));
    assertEquals(expectedReport, observedReport);
}
Also used : BuildReport(com.facebook.buck.command.BuildReport) TestConsole(com.facebook.buck.testutil.TestConsole) Test(org.junit.Test)

Aggregations

BuildReport (com.facebook.buck.command.BuildReport)3 Test (org.junit.Test)3 TestConsole (com.facebook.buck.testutil.TestConsole)2 CapturingPrintStream (com.facebook.buck.util.CapturingPrintStream)1 Console (com.facebook.buck.util.Console)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1