use of com.facebook.buck.command.BuildReport in project buck by facebook.
the class BuildCommandTest method testGenerateBuildReportForConsole.
@Test
public void testGenerateBuildReportForConsole() {
String expectedReport = "[1m[42m[30mOK [0m //fake:rule1 " + "BUILT_LOCALLY " + MorePaths.pathWithPlatformSeparators("buck-out/gen/fake/rule1.txt") + "\n" + "[31mFAIL[0m //fake:rule2\n" + "[1m[42m[30mOK [0m //fake:rule3 FETCHED_FROM_CACHE\n" + "[31mFAIL[0m //fake:rule4\n";
String observedReport = new BuildReport(buildExecutionResult, resolver).generateForConsole(new Console(Verbosity.STANDARD_INFORMATION, new CapturingPrintStream(), new CapturingPrintStream(), Ansi.forceTty()));
assertEquals(expectedReport, observedReport);
}
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);
}
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);
}
Aggregations