use of com.facebook.buck.testutil.integration.BuckBuildLog in project buck by facebook.
the class CxxLibraryIntegrationTest method preferredLinkageOverridesParentLinkStyle.
@Test
public void preferredLinkageOverridesParentLinkStyle() throws Exception {
ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "preferred_linkage", tmp);
workspace.setUp();
BuckBuildLog buildLog;
workspace.runBuckBuild("//:foo-prefer-shared#default").assertSuccess();
buildLog = workspace.getBuildLog();
buildLog.assertTargetBuiltLocally("//:always_static#default,static-pic");
buildLog.assertTargetBuiltLocally("//:always_shared#default,shared");
buildLog.assertTargetBuiltLocally("//:agnostic#default,shared");
buildLog.assertTargetBuiltLocally("//:foo-prefer-shared#default");
workspace.runBuckBuild("//:foo-prefer-static#default").assertSuccess();
buildLog = workspace.getBuildLog();
buildLog.assertTargetBuiltLocally("//:always_static#default,static");
buildLog.assertTargetHadMatchingRuleKey("//:always_shared#default,shared");
buildLog.assertTargetBuiltLocally("//:agnostic#default,static");
buildLog.assertTargetBuiltLocally("//:foo-prefer-static#default");
}
use of com.facebook.buck.testutil.integration.BuckBuildLog in project buck by facebook.
the class PrebuiltCxxLibraryIntegrationTest method prebuiltCxxLibraryFromGenrule.
@Test
public void prebuiltCxxLibraryFromGenrule() throws IOException {
assumeTrue(Platform.detect() != Platform.WINDOWS);
ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "prebuilt_cxx_from_genrule", tmp);
workspace.setUp();
workspace.enableDirCache();
final String binaryTargetString = "//core:binary";
final String staticBuildTargetString = "//test_lib:bar#static,default";
final String sharedBuildTargetString = "//test_lib:bar#shared,default";
workspace.runBuckBuild(binaryTargetString).assertSuccess();
// Clean everything
workspace.runBuckCommand("clean").assertSuccess();
// After a clean make sure that everything was in cache.
workspace.runBuckBuild(binaryTargetString).assertSuccess();
BuckBuildLog buildLog = workspace.getBuildLog();
buildLog.assertTargetWasFetchedFromCache(binaryTargetString);
// Make sure that the static library isn't cached but can still be built.
workspace.runBuckBuild(staticBuildTargetString).assertSuccess();
buildLog = workspace.getBuildLog();
buildLog.assertTargetBuiltLocally(staticBuildTargetString);
workspace.runBuckBuild(sharedBuildTargetString).assertSuccess();
workspace.runBuckBuild(binaryTargetString).assertSuccess();
buildLog = workspace.getBuildLog();
// Others will be MATCHING_RULE_KEY
for (BuildTarget buildTarget : buildLog.getAllTargets()) {
buildLog.assertNotTargetBuiltLocally(buildTarget.toString());
}
}
use of com.facebook.buck.testutil.integration.BuckBuildLog in project buck by facebook.
the class DBinaryIntegrationTest method cxx.
@Test
public void cxx() throws Exception {
Assumptions.assumeDCompilerUsable();
ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "cxx", tmp);
workspace.setUp();
workspace.runBuckBuild("-v", "10", "//:test").assertSuccess();
BuckBuildLog buildLog = workspace.getBuildLog();
buildLog.assertTargetBuiltLocally("//:test");
workspace.resetBuildLogFile();
ProcessExecutor.Result result = workspace.runCommand(workspace.resolve(BuildTargets.getGenPath(filesystem, BuildTargetFactory.newInstance("//:test").withFlavors(DBinaryDescription.BINARY_FLAVOR), "%s/test")).toString());
assertEquals(0, result.getExitCode());
assertEquals("1 + 1 = 2\n100 + 1 = 5\n", result.getStdout().get());
assertEquals("", result.getStderr().get());
}
use of com.facebook.buck.testutil.integration.BuckBuildLog in project buck by facebook.
the class PrecompiledHeaderIntegrationTest method touchingPchReferencedHeaderShouldNotCauseClangToRejectPch.
@Test
public void touchingPchReferencedHeaderShouldNotCauseClangToRejectPch() throws Exception {
assumeTrue(Platform.detect() != Platform.WINDOWS);
workspace.runBuckBuild("//:some_binary#default").assertSuccess();
workspace.resetBuildLogFile();
// Change this file (not in the pch) to trigger recompile.
workspace.writeContentsToPath("int lib_func() { return 0; }", "lib.c");
// Touch this file that contributes to the PCH without changing its contents.
workspace.writeContentsToPath(workspace.getFileContents("referenced_by_prefix_header_from_dependency.h"), "referenced_by_prefix_header_from_dependency.h");
workspace.runBuckBuild("//:some_binary#default").assertSuccess();
BuckBuildLog buildLog = workspace.getBuildLog();
buildLog.assertTargetHadMatchingRuleKey(findPchTarget().toString());
buildLog.assertTargetBuiltLocally("//:some_library#default,static");
}
use of com.facebook.buck.testutil.integration.BuckBuildLog in project buck by facebook.
the class PrecompiledHeaderIntegrationTest method changingPchReferencedHeaderFromSameTargetCausesLibraryToRecompile.
@Test
public void changingPchReferencedHeaderFromSameTargetCausesLibraryToRecompile() 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 3\n", "referenced_by_prefix_header.h");
workspace.runBuckBuild("//:some_binary#default").assertSuccess();
BuckBuildLog buildLog = workspace.getBuildLog();
buildLog.assertTargetBuiltLocally(findPchTarget().toString());
buildLog.assertTargetBuiltLocally("//:some_library#default,static");
}
Aggregations