Search in sources :

Example 76 with ProcessResult

use of com.facebook.buck.testutil.integration.ProjectWorkspace.ProcessResult in project buck by facebook.

the class ProjectIntegrationTest method testBuckProjectDryRun.

@Test
public void testBuckProjectDryRun() throws IOException {
    ProcessResult result = runBuckProjectWithoutVerification("project1", "--deprecated-ij-generation", "--dry-run", "-v", "5");
    ImmutableSortedSet<String> expectedResult = ImmutableSortedSet.of("//:project_config", "//:root_module", "//libs:generated", "//libs:generated_jar", "//libs:generated_source_jar", "//libs:guava", "//libs:jsr305", "//libs:junit", "//modules/dep1:dep1", "//modules/dep1:project_config", "//modules/dep1:test", "//modules/tip:project_config", "//modules/tip:test", "//modules/tip:tip");
    ImmutableSortedSet<String> actualResult = ImmutableSortedSet.copyOf(Splitter.on('\n').omitEmptyStrings().split(result.getStdout()));
    assertEquals("`buck project --dry-run` should print the list of targets that would be included.", expectedResult, actualResult);
}
Also used : ProcessResult(com.facebook.buck.testutil.integration.ProjectWorkspace.ProcessResult) Matchers.containsString(org.hamcrest.Matchers.containsString) Test(org.junit.Test)

Example 77 with ProcessResult

use of com.facebook.buck.testutil.integration.ProjectWorkspace.ProcessResult in project buck by facebook.

the class ProjectIntegrationTest method testVersion2BuckProjectWithUnusedLibraries.

@Test
public void testVersion2BuckProjectWithUnusedLibraries() throws IOException {
    ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "experimental_project_with_unused_libraries", temporaryFolder);
    workspace.setUp();
    ProcessResult result = workspace.runBuckCommand("project");
    result.assertSuccess("buck project should exit cleanly");
    assertFalse(workspace.resolve(".idea/libraries/library_libs_jsr305.xml").toFile().exists());
}
Also used : ProjectWorkspace(com.facebook.buck.testutil.integration.ProjectWorkspace) ProcessResult(com.facebook.buck.testutil.integration.ProjectWorkspace.ProcessResult) Test(org.junit.Test)

Example 78 with ProcessResult

use of com.facebook.buck.testutil.integration.ProjectWorkspace.ProcessResult in project buck by facebook.

the class PythonSrcZipIntegrationTest method testDependingOnSrcZipWorks.

@Test
public void testDependingOnSrcZipWorks() throws IOException {
    // This test should pass.
    ProcessResult result1 = workspace.runBuckCommand("test", "//:test");
    result1.assertSuccess();
}
Also used : ProcessResult(com.facebook.buck.testutil.integration.ProjectWorkspace.ProcessResult) Test(org.junit.Test)

Example 79 with ProcessResult

use of com.facebook.buck.testutil.integration.ProjectWorkspace.ProcessResult in project buck by facebook.

the class PythonTestIntegrationTest method testPythonTest.

@Test
public void testPythonTest() throws IOException {
    // This test should pass.
    ProcessResult result1 = workspace.runBuckCommand("test", "//:test-success");
    result1.assertSuccess();
    workspace.resetBuildLogFile();
    ProcessResult runResult1 = workspace.runBuckCommand("run", "//:test-success");
    runResult1.assertSuccess("python test binary should exit 0 on success");
    // This test should fail.
    ProcessResult result2 = workspace.runBuckCommand("test", "//:test-failure");
    result2.assertTestFailure();
    assertThat("`buck test` should fail because test_that_fails() failed.", result2.getStderr(), containsString("test_that_fails"));
    ProcessResult runResult2 = workspace.runBuckCommand("run", "//:test-failure");
    runResult2.assertExitCode("python test binary should exit with expected error code on failure", PythonRunTestsStep.TEST_FAILURES_EXIT_CODE);
}
Also used : ProcessResult(com.facebook.buck.testutil.integration.ProjectWorkspace.ProcessResult) Test(org.junit.Test)

Example 80 with ProcessResult

use of com.facebook.buck.testutil.integration.ProjectWorkspace.ProcessResult in project buck by facebook.

the class PythonTestIntegrationTest method testPythonSkippedResult.

@Test
public void testPythonSkippedResult() throws IOException, InterruptedException {
    assumePythonVersionIsAtLeast("2.7", "unittest skip support was added in Python-2.7");
    ProcessResult result = workspace.runBuckCommand("test", "//:test-skip").assertSuccess();
    assertThat(result.getStderr(), containsString("1 Skipped"));
}
Also used : ProcessResult(com.facebook.buck.testutil.integration.ProjectWorkspace.ProcessResult) Test(org.junit.Test)

Aggregations

ProcessResult (com.facebook.buck.testutil.integration.ProjectWorkspace.ProcessResult)175 Test (org.junit.Test)174 ProjectWorkspace (com.facebook.buck.testutil.integration.ProjectWorkspace)127 Path (java.nio.file.Path)21 Matchers.containsString (org.hamcrest.Matchers.containsString)20 BuildTarget (com.facebook.buck.model.BuildTarget)17 JsonNode (com.fasterxml.jackson.databind.JsonNode)8 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)8 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)6 TestContext (com.facebook.buck.testutil.integration.TestContext)4 ProjectFilesystem (com.facebook.buck.io.ProjectFilesystem)3 ZipInspector (com.facebook.buck.testutil.integration.ZipInspector)3 ZipFile (java.util.zip.ZipFile)3 FakeProjectFilesystem (com.facebook.buck.testutil.FakeProjectFilesystem)2 DelegatingInputStream (com.facebook.buck.testutil.integration.DelegatingInputStream)2 CapturingPrintStream (com.facebook.buck.util.CapturingPrintStream)2 File (java.io.File)2 Charset (java.nio.charset.Charset)2 FileTime (java.nio.file.attribute.FileTime)2 ArtifactCache (com.facebook.buck.artifact_cache.ArtifactCache)1