Search in sources :

Example 46 with BuckBuildLog

use of com.facebook.buck.testutil.integration.BuckBuildLog in project buck by facebook.

the class RustBinaryIntegrationTest method simpleBinary.

@Test
public void simpleBinary() throws IOException, InterruptedException {
    ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "simple_binary", tmp);
    workspace.setUp();
    workspace.runBuckBuild("//:xyzzy").assertSuccess();
    BuckBuildLog buildLog = workspace.getBuildLog();
    buildLog.assertTargetBuiltLocally("//:xyzzy");
    workspace.resetBuildLogFile();
    ProcessExecutor.Result result = workspace.runCommand(workspace.resolve("buck-out/gen/xyzzy#binary,default/xyzzy").toString());
    assertThat(result.getExitCode(), Matchers.equalTo(0));
    assertThat(result.getStdout().get(), Matchers.containsString("Hello, world!"));
    assertThat(result.getStderr().get(), Matchers.blankString());
}
Also used : ProjectWorkspace(com.facebook.buck.testutil.integration.ProjectWorkspace) BuckBuildLog(com.facebook.buck.testutil.integration.BuckBuildLog) ProcessExecutor(com.facebook.buck.util.ProcessExecutor) Test(org.junit.Test)

Example 47 with BuckBuildLog

use of com.facebook.buck.testutil.integration.BuckBuildLog in project buck by facebook.

the class BuckBuildLogTest method testBuildLogParsing.

@Test
public void testBuildLogParsing() {
    ImmutableList<String> buildLogLines = ImmutableList.of("735 INFO  BuildRuleFinished(//example/base:one): " + "SUCCESS MISS BUILT_LOCALLY 489e1b85f804dc0f66545f2ce06f57ee85204747", "735 INFO  BuildRuleFinished(//example/base:two): " + "FAIL MISS MISSING 489e1b85f804dc0f66545f2ce06f57ee85204747", "735 INFO  BuildRuleFinished(//example/base:three): " + "SUCCESS MISS MATCHING_RULE_KEY 489e1b85f804dc0f66545f2ce06f57ee85204747");
    BuckBuildLog buildLog = BuckBuildLog.fromLogContents(Paths.get("/spoof"), buildLogLines);
    buildLog.assertTargetBuiltLocally("//example/base:one");
    buildLog.assertTargetFailed("//example/base:two");
    buildLog.assertTargetHadMatchingRuleKey("//example/base:three");
}
Also used : BuckBuildLog(com.facebook.buck.testutil.integration.BuckBuildLog) Test(org.junit.Test)

Example 48 with BuckBuildLog

use of com.facebook.buck.testutil.integration.BuckBuildLog in project buck by facebook.

the class DBinaryIntegrationTest method xyzzy.

@Test
public void xyzzy() throws Exception {
    Assumptions.assumeDCompilerUsable();
    ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "simple_binary", tmp);
    workspace.setUp();
    workspace.runBuckBuild("-v", "10", "//:xyzzy").assertSuccess();
    BuckBuildLog buildLog = workspace.getBuildLog();
    buildLog.assertTargetBuiltLocally("//:xyzzy");
    workspace.resetBuildLogFile();
    ProcessExecutor.Result result = workspace.runCommand(workspace.resolve(BuildTargets.getGenPath(filesystem, BuildTargetFactory.newInstance("//:xyzzy").withFlavors(DBinaryDescription.BINARY_FLAVOR), "%s/xyzzy")).toString());
    assertEquals(0, result.getExitCode());
    assertEquals("Nothing happens.\n", result.getStdout().get());
    assertEquals("", result.getStderr().get());
}
Also used : ProjectWorkspace(com.facebook.buck.testutil.integration.ProjectWorkspace) BuckBuildLog(com.facebook.buck.testutil.integration.BuckBuildLog) ProcessExecutor(com.facebook.buck.util.ProcessExecutor) Test(org.junit.Test)

Example 49 with BuckBuildLog

use of com.facebook.buck.testutil.integration.BuckBuildLog in project buck by facebook.

the class DLibraryIntegrationTest method compileAndRun.

@Test
public void compileAndRun() throws Exception {
    Assumptions.assumeDCompilerUsable();
    ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "library", tmp);
    workspace.setUp();
    workspace.runBuckBuild("-v", "10", "//:greet").assertSuccess();
    BuckBuildLog buildLog = workspace.getBuildLog();
    buildLog.assertTargetBuiltLocally("//:greet");
    buildLog.assertTargetBuiltLocally("//:greeting");
    workspace.resetBuildLogFile();
    ProcessExecutor.Result result = workspace.runCommand(workspace.resolve(BuildTargets.getGenPath(new FakeProjectFilesystem(), BuildTargetFactory.newInstance("//:greet").withFlavors(DBinaryDescription.BINARY_FLAVOR), "%s/greet")).toString());
    assertEquals(0, result.getExitCode());
    assertEquals("Hello, world!\n", result.getStdout().get());
    assertEquals("", result.getStderr().get());
}
Also used : ProjectWorkspace(com.facebook.buck.testutil.integration.ProjectWorkspace) BuckBuildLog(com.facebook.buck.testutil.integration.BuckBuildLog) FakeProjectFilesystem(com.facebook.buck.testutil.FakeProjectFilesystem) ProcessExecutor(com.facebook.buck.util.ProcessExecutor) Test(org.junit.Test)

Example 50 with BuckBuildLog

use of com.facebook.buck.testutil.integration.BuckBuildLog in project buck by facebook.

the class PrecompiledHeaderIntegrationTest method changingPchReferencedHeaderFromDependencyCausesLibraryToRecompile.

@Test
public void changingPchReferencedHeaderFromDependencyCausesLibraryToRecompile() throws Exception {
    assumeTrue(Platform.detect() != Platform.WINDOWS);
    workspace.runBuckBuild("//:some_binary#default").assertSuccess();
    workspace.resetBuildLogFile();
    workspace.writeContentsToPath("#pragma once\n#define REFERENCED_BY_PREFIX_HEADER_FROM_DEPENDENCY 3\n", "referenced_by_prefix_header_from_dependency.h");
    workspace.runBuckBuild("//:some_binary#default").assertSuccess();
    BuckBuildLog buildLog = workspace.getBuildLog();
    buildLog.assertTargetBuiltLocally(findPchTarget().toString());
    buildLog.assertTargetBuiltLocally("//:some_library#default,static");
}
Also used : BuckBuildLog(com.facebook.buck.testutil.integration.BuckBuildLog) Test(org.junit.Test)

Aggregations

BuckBuildLog (com.facebook.buck.testutil.integration.BuckBuildLog)88 Test (org.junit.Test)88 ProjectWorkspace (com.facebook.buck.testutil.integration.ProjectWorkspace)53 BuildTarget (com.facebook.buck.model.BuildTarget)32 OcamlRuleBuilder.createStaticLibraryBuildTarget (com.facebook.buck.ocaml.OcamlRuleBuilder.createStaticLibraryBuildTarget)10 ProcessExecutor (com.facebook.buck.util.ProcessExecutor)9 Path (java.nio.file.Path)8 ProjectFilesystem (com.facebook.buck.io.ProjectFilesystem)7 ExecutableFinder (com.facebook.buck.io.ExecutableFinder)2 Sha1HashCode (com.facebook.buck.util.sha1.Sha1HashCode)2 ImmutableList (com.google.common.collect.ImmutableList)2 ImmutableSet (com.google.common.collect.ImmutableSet)2 ImmutableSortedSet (com.google.common.collect.ImmutableSortedSet)2 NSString (com.dd.plist.NSString)1 AssumeAndroidPlatform (com.facebook.buck.android.AssumeAndroidPlatform)1 ArtifactCache (com.facebook.buck.artifact_cache.ArtifactCache)1 FakeBuckConfig (com.facebook.buck.cli.FakeBuckConfig)1 CxxBuckConfig (com.facebook.buck.cxx.CxxBuckConfig)1 CxxFlavorSanitizer.sanitize (com.facebook.buck.cxx.CxxFlavorSanitizer.sanitize)1 CxxPlatform (com.facebook.buck.cxx.CxxPlatform)1