use of com.facebook.buck.testutil.integration.ProjectWorkspace.ProcessResult in project buck by facebook.
the class AuditRulesCommandIntegrationTest method testIncludeEmptyValues.
@Test
public void testIncludeEmptyValues() throws IOException {
ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "audit_rules", tmp);
workspace.setUp();
ProcessResult result1 = workspace.runBuckCommand("audit", "rules", "--include_empty_values", "--type", "genrule", "example/BUCK");
result1.assertSuccess();
assertThat(result1.getStdout(), MoreStringsForTests.equalToIgnoringPlatformNewlines(workspace.getFileContents("stdout.genrule.include_empties")));
ProcessResult result2 = workspace.runBuckCommand("audit", "rules", "--include_empty_values", "--type", "genrule", "--json", "example/BUCK");
result2.assertSuccess();
assertThat(result2.getStdout(), MoreStringsForTests.equalToIgnoringPlatformNewlines(workspace.getFileContents("stdout.genrule.include_empties.json")));
}
use of com.facebook.buck.testutil.integration.ProjectWorkspace.ProcessResult in project buck by facebook.
the class AuditTestsCommandIntegrationTest method testPassingTheJSONFlagCausesJSONOutput.
@Test
public void testPassingTheJSONFlagCausesJSONOutput() throws IOException {
ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "audit_tests", tmp);
workspace.setUp();
// Print all of the inputs to the rule.
ProcessResult result = workspace.runBuckCommand("audit", "tests", "--json", "//example:one", "//example:two", "//example:three", "//example:four", "//example:five", "//example:six");
result.assertSuccess();
String expected = workspace.getFileContents("stdout-one-two-three-four-five-six.json");
assertEquals(expected, result.getStdout());
}
use of com.facebook.buck.testutil.integration.ProjectWorkspace.ProcessResult in project buck by facebook.
the class AuditTestsCommandIntegrationTest method testTestsWithMultipleTargetParametersPrintsTestsForAllTargets.
@Test
public void testTestsWithMultipleTargetParametersPrintsTestsForAllTargets() throws IOException {
ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "audit_tests", tmp);
workspace.setUp();
// Print all of the inputs to the rule.
ProcessResult result = workspace.runBuckCommand("audit", "tests", "//example:four", "//example:six");
result.assertSuccess();
assertEquals(workspace.getFileContents("stdout-four-six"), result.getStdout());
}
use of com.facebook.buck.testutil.integration.ProjectWorkspace.ProcessResult in project buck by facebook.
the class AuditTestsCommandIntegrationTest method testRunningWithNoParameterCausesBuildError.
@Test
public void testRunningWithNoParameterCausesBuildError() throws IOException {
ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "audit_tests", tmp);
workspace.setUp();
// Print all of the inputs to the rule.
ProcessResult result = workspace.runBuckCommand("audit", "tests");
result.assertFailure();
assertThat(result.getStderr(), containsString("Must specify at least one build target.\n"));
}
use of com.facebook.buck.testutil.integration.ProjectWorkspace.ProcessResult in project buck by facebook.
the class NumThreadsIntegrationTest method testCommandLineNumThreadsArgOverridesBuckConfig.
@Test
public void testCommandLineNumThreadsArgOverridesBuckConfig() throws IOException {
ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "num_threads", tmp);
workspace.setUp();
workspace.disableThreadLimitOverride();
ProcessResult buildResult1 = workspace.runBuckCommand("build", "//:noop", "--verbose", "10");
assertThat("Number of threads to use should be read from .buckconfig.", buildResult1.getStderr(), containsString("Creating a build with 7 threads.\n"));
ProcessResult buildResult2 = workspace.runBuckCommand("build", "//:noop", "--verbose", "10", "--num-threads", "27");
assertThat("Command-line arg should override value in .buckconfig.", buildResult2.getStderr(), containsString("Creating a build with 27 threads.\n"));
Path buckconfig = workspace.getPath(".buckconfig");
Files.delete(buckconfig);
int numThreads = Runtime.getRuntime().availableProcessors();
ProcessResult buildResult3 = workspace.runBuckCommand("build", "//:noop", "--verbose", "10");
assertThat("Once .buckconfig is deleted, the number of threads should be " + "equal to the number of processors.", buildResult3.getStderr(), containsString("Creating a build with " + numThreads + " threads.\n"));
}
Aggregations