use of com.facebook.buck.testutil.integration.BuckBuildLog in project buck by facebook.
the class OCamlIntegrationTest method testPrebuiltLibraryBytecodeOnly.
@Test
@Ignore("Redesign test so it does not depend on compiler/platform-specific binary artifacts.")
public void testPrebuiltLibraryBytecodeOnly() throws IOException {
ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "ocaml", tmp);
workspace.setUp();
BuildTarget target = BuildTargetFactory.newInstance(workspace.getDestPath(), "//ocaml_ext_bc:ocaml_ext");
BuildTarget binary = createOcamlLinkTarget(target);
BuildTarget bytecode = OcamlBuildRulesGenerator.addBytecodeFlavor(binary);
BuildTarget libplus = BuildTargetFactory.newInstance(workspace.getDestPath(), "//ocaml_ext_bc:plus");
ImmutableSet<BuildTarget> targets = ImmutableSet.of(target, bytecode, libplus);
workspace.runBuckCommand("build", target.toString()).assertSuccess();
BuckBuildLog buildLog = workspace.getBuildLog();
assertTrue(buildLog.getAllTargets().containsAll(targets));
assertFalse(buildLog.getAllTargets().contains(binary));
buildLog.assertTargetBuiltLocally(target.toString());
buildLog.assertTargetBuiltLocally(bytecode.toString());
}
use of com.facebook.buck.testutil.integration.BuckBuildLog in project buck by facebook.
the class OCamlIntegrationTest method testConfigWarningsFlags.
@Test
public void testConfigWarningsFlags() throws IOException {
ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "config_warnings_flags", tmp);
workspace.setUp();
BuildTarget target = BuildTargetFactory.newInstance(workspace.getDestPath(), "//:unused_var");
BuildTarget binary = createOcamlLinkTarget(target);
ImmutableSet<BuildTarget> targets = ImmutableSet.of(target, binary);
workspace.runBuckCommand("build", target.toString()).assertFailure();
BuckBuildLog buildLog = workspace.getBuildLog();
assertTrue(buildLog.getAllTargets().containsAll(targets));
buildLog.assertTargetCanceled(target.toString());
buildLog.assertTargetCanceled(binary.toString());
workspace.resetBuildLogFile();
workspace.replaceFileContents(".buckconfig", "warnings_flags=+a", "");
workspace.runBuckCommand("build", target.toString()).assertSuccess();
buildLog = workspace.getBuildLog();
buildLog.assertTargetBuiltLocally(target.toString());
buildLog.assertTargetBuiltLocally(binary.toString());
}
use of com.facebook.buck.testutil.integration.BuckBuildLog in project buck by facebook.
the class OCamlIntegrationTest method testConfigInteropIncludes.
@Test
public void testConfigInteropIncludes() throws IOException, InterruptedException {
ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "config_interop_includes", tmp);
workspace.setUp();
Path ocamlc = new ExecutableFinder(Platform.detect()).getExecutable(Paths.get("ocamlc"), ImmutableMap.copyOf(System.getenv()));
ProcessExecutor.Result result = workspace.runCommand(ocamlc.toString(), "-where");
assertEquals(0, result.getExitCode());
String stdlibPath = result.getStdout().get();
BuildTarget target = BuildTargetFactory.newInstance(workspace.getDestPath(), "//:test");
BuildTarget binary = createOcamlLinkTarget(target);
ImmutableSet<BuildTarget> targets = ImmutableSet.of(target, binary);
// Points somewhere with no stdlib in it, so fails to find Pervasives
workspace.runBuckCommand("build", target.toString()).assertFailure();
BuckBuildLog buildLog = workspace.getBuildLog();
assertThat(buildLog.getAllTargets(), Matchers.hasItems(targets.toArray(new BuildTarget[0])));
buildLog.assertTargetCanceled(target.toString());
buildLog.assertTargetCanceled(binary.toString());
workspace.resetBuildLogFile();
// Point to the real stdlib (from `ocamlc -where`)
workspace.replaceFileContents(".buckconfig", "interop.includes=lib", "interop.includes=" + stdlibPath);
workspace.runBuckCommand("build", target.toString()).assertSuccess();
buildLog = workspace.getBuildLog();
buildLog.assertTargetBuiltLocally(target.toString());
buildLog.assertTargetBuiltLocally(binary.toString());
workspace.resetBuildLogFile();
// Remove the config, should default to a valid place
workspace.replaceFileContents(".buckconfig", "interop.includes=" + stdlibPath, "");
workspace.runBuckCommand("build", target.toString()).assertSuccess();
buildLog = workspace.getBuildLog();
buildLog.assertTargetBuiltLocally(target.toString());
buildLog.assertTargetBuiltLocally(binary.toString());
}
use of com.facebook.buck.testutil.integration.BuckBuildLog in project buck by facebook.
the class OCamlIntegrationTest method testCppLibraryDependency.
@Test
public void testCppLibraryDependency() throws IOException {
ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "ocaml", tmp);
workspace.setUp();
BuildTarget target = BuildTargetFactory.newInstance(workspace.getDestPath(), "//clib:clib");
BuildTarget binary = createOcamlLinkTarget(target);
BuildTarget libplus = BuildTargetFactory.newInstance(workspace.getDestPath(), "//clib:plus");
BuildTarget libplusStatic = createStaticLibraryBuildTarget(libplus);
BuildTarget cclib = BuildTargetFactory.newInstance(workspace.getDestPath(), "//clib:cc");
CxxPlatform cxxPlatform = CxxPlatformUtils.build(new CxxBuckConfig(FakeBuckConfig.builder().build()));
CxxSourceRuleFactory cxxSourceRuleFactory = CxxSourceRuleFactoryHelper.of(workspace.getDestPath(), cclib, cxxPlatform);
BuildTarget cclibbin = CxxDescriptionEnhancer.createStaticLibraryBuildTarget(cclib, cxxPlatform.getFlavor(), CxxSourceRuleFactory.PicType.PDC);
String sourceName = "cc/cc.cpp";
BuildTarget ccObj = cxxSourceRuleFactory.createCompileBuildTarget(sourceName);
BuildTarget headerSymlinkTreeTarget = CxxDescriptionEnhancer.createHeaderSymlinkTreeTarget(cclib, HeaderVisibility.PRIVATE, cxxPlatform.getFlavor());
BuildTarget exportedHeaderSymlinkTreeTarget = CxxDescriptionEnhancer.createHeaderSymlinkTreeTarget(cclib, HeaderVisibility.PUBLIC, CxxPlatformUtils.getHeaderModeForDefaultPlatform(tmp.getRoot()).getFlavor());
workspace.runBuckCommand("build", target.toString()).assertSuccess();
BuckBuildLog buildLog = workspace.getBuildLog();
buildLog.assertTargetBuiltLocally(binary.toString());
buildLog.assertTargetBuiltLocally(libplusStatic.toString());
buildLog.assertTargetBuiltLocally(cclibbin.toString());
buildLog.assertTargetBuiltLocally(ccObj.toString());
buildLog.assertTargetBuiltLocally(headerSymlinkTreeTarget.toString());
buildLog.assertTargetBuiltLocally(exportedHeaderSymlinkTreeTarget.toString());
workspace.resetBuildLogFile();
workspace.runBuckCommand("build", target.toString()).assertSuccess();
buildLog = workspace.getBuildLog();
buildLog.assertTargetHadMatchingRuleKey(binary.toString());
buildLog.assertTargetHadMatchingRuleKey(target.toString());
workspace.resetBuildLogFile();
workspace.replaceFileContents("clib/cc/cc.cpp", "Hi there", "hi there");
workspace.runBuckCommand("build", target.toString()).assertSuccess();
buildLog = workspace.getBuildLog();
buildLog.assertTargetBuiltLocally(binary.toString());
buildLog.assertTargetBuiltLocally(libplusStatic.toString());
buildLog.assertTargetBuiltLocally(cclibbin.toString());
buildLog.assertTargetBuiltLocally(ccObj.toString());
}
use of com.facebook.buck.testutil.integration.BuckBuildLog in project buck by facebook.
the class RustBinaryIntegrationTest method simpleBinaryWarnings.
@Test
public void simpleBinaryWarnings() throws IOException, InterruptedException {
ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "simple_binary", tmp);
workspace.setUp();
assertThat(workspace.runBuckBuild("//:xyzzy").assertSuccess().getStderr(), Matchers.allOf(Matchers.containsString("warning: constant item is never used: `foo`, #[warn(dead_code)] on by default"), Matchers.containsString("warning: constant `foo` should have an upper case name such as `FOO`,")));
BuckBuildLog buildLog = workspace.getBuildLog();
buildLog.assertTargetBuiltLocally("//:xyzzy");
workspace.resetBuildLogFile();
}
Aggregations