use of com.facebook.buck.testutil.integration.ProjectWorkspace.ProcessResult in project buck by facebook.
the class AndroidPrebuiltAarIntegrationTest method testExtraDepsDontResultInWarning.
@Test
public void testExtraDepsDontResultInWarning() throws IOException {
ProcessResult result = workspace.runBuckBuild("//:app-extra-res-entry").assertSuccess();
String buildOutput = result.getStderr();
assertThat("No warnings are shown", buildOutput, not(containsString("Cannot find resource")));
}
use of com.facebook.buck.testutil.integration.ProjectWorkspace.ProcessResult in project buck by facebook.
the class BuildKeepGoingIntegrationTest method testVariousSuccessTypesInReport.
@Test
public void testVariousSuccessTypesInReport() throws IOException {
ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "keep_going", tmp).setUp();
workspace.enableDirCache();
ProcessResult result1 = buildTwoGoodRulesAndAssertSuccess(workspace);
String expectedReport1 = "OK //:rule_with_output BUILT_LOCALLY " + GENRULE_OUTPUT_PATH + "\n" + "OK //:rule_without_output BUILT_LOCALLY\n";
assertThat(result1.getStderr(), containsString(expectedReport1));
ProcessResult result2 = buildTwoGoodRulesAndAssertSuccess(workspace);
String expectedReport2 = "OK //:rule_with_output MATCHING_RULE_KEY " + GENRULE_OUTPUT_PATH + "\n" + "OK //:rule_without_output MATCHING_RULE_KEY\n";
assertThat(result2.getStderr(), containsString(expectedReport2));
workspace.runBuckCommand("clean").assertSuccess();
ProcessResult result3 = buildTwoGoodRulesAndAssertSuccess(workspace);
String expectedReport3 = "OK //:rule_with_output FETCHED_FROM_CACHE " + GENRULE_OUTPUT_PATH + "\n" + "OK //:rule_without_output BUILT_LOCALLY\n";
assertThat(result3.getStderr(), containsString(expectedReport3));
}
use of com.facebook.buck.testutil.integration.ProjectWorkspace.ProcessResult in project buck by facebook.
the class BuildKeepGoingIntegrationTest method testKeepGoingWithMultipleSuccessfulTargets.
@Test
public void testKeepGoingWithMultipleSuccessfulTargets() throws IOException {
ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "keep_going", tmp).setUp();
ProcessResult result = buildTwoGoodRulesAndAssertSuccess(workspace);
String expectedReport = "OK //:rule_with_output BUILT_LOCALLY " + GENRULE_OUTPUT_PATH + "\n" + "OK //:rule_without_output BUILT_LOCALLY\n";
assertThat(result.getStderr(), containsString(expectedReport));
}
use of com.facebook.buck.testutil.integration.ProjectWorkspace.ProcessResult in project buck by facebook.
the class BuildWithNoTargetSpecifiedIntegrationTest method testBuckBuildWithoutTargetWithUnderTenAliasesConfigured.
/**
* Ensure that if there are multiple aliases (but less than ten) they
* are all displayed as targets in the order specified in .buckconfig.
*/
@Test
public void testBuckBuildWithoutTargetWithUnderTenAliasesConfigured() throws IOException {
ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "project_with_five_aliases", temporaryFolder);
workspace.setUp();
ProcessResult result = workspace.runBuckCommand("build");
result.assertFailure("buck build should exit with an error.");
assertThat(Joiner.on(' ').join("`buck build` should suggest the five aliases found in .buckconfig", "(in the order in which they are listed in) as targets."), result.getStderr(), containsString(Joiner.on('\n').join("BUILD FAILED: Must specify at least one build target.", "Try building one of the following targets:", "myapp my_app mi_app mon_app mein_app") + '\n'));
}
use of com.facebook.buck.testutil.integration.ProjectWorkspace.ProcessResult in project buck by facebook.
the class DaemonIntegrationTest method whenClientDisconnectionDetectedThenBuildIsInterrupted.
/**
* This verifies that a client timeout will be detected by a Nailgun
* NGInputStream reading from an empty heartbeat stream and that the generated
* InterruptedException will cause command execution to fail after timeout.
*/
@Test
public void whenClientDisconnectionDetectedThenBuildIsInterrupted() throws InterruptedException, IOException {
// Sub process interruption not supported on Windows.
assumeTrue(Platform.detect() != Platform.WINDOWS);
// Stream timeout > test timeout.
final long timeoutMillis = 2000;
// Disconnect before test timeout.
final long disconnectMillis = 100;
final ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "exclusive_execution", tmp);
workspace.setUp();
// Build an NGContext connected to an NGInputStream reading from stream that will timeout.
try (TestContext context = new TestContext(ImmutableMap.copyOf(System.getenv()), TestContext.createDisconnectionStream(disconnectMillis), timeoutMillis)) {
ProcessResult result = workspace.runBuckdCommand(context, "build", "//:sleep");
result.assertFailure();
assertThat(result.getStderr(), containsString("InterruptedException"));
}
}
Aggregations