use of com.facebook.buck.testutil.integration.ProjectWorkspace in project buck by facebook.
the class AppleLibraryIntegrationTest method testAppleLibraryBuildsSomething.
@Test
public void testAppleLibraryBuildsSomething() throws IOException {
assumeTrue(Platform.detect() == Platform.MACOS);
ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "apple_library_builds_something", tmp);
workspace.setUp();
ProjectFilesystem filesystem = new ProjectFilesystem(workspace.getDestPath());
BuildTarget target = BuildTargetFactory.newInstance("//Libraries/TestLibrary:TestLibrary#static,default");
ProjectWorkspace.ProcessResult result = workspace.runBuckCommand("build", target.getFullyQualifiedName());
result.assertSuccess();
assertTrue(Files.exists(workspace.getPath(BuildTargets.getGenPath(filesystem, target, "%s"))));
}
use of com.facebook.buck.testutil.integration.ProjectWorkspace in project buck by facebook.
the class AppleLibraryIntegrationTest method testBuildEmptySourceAppleLibrary.
@Test
public void testBuildEmptySourceAppleLibrary() throws Exception {
assumeTrue(Platform.detect() == Platform.MACOS);
ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "empty_source_targets", tmp);
workspace.setUp();
BuildTarget target = workspace.newBuildTarget("//:real-none#iphonesimulator-x86_64").withAppendedFlavors(CxxDescriptionEnhancer.SHARED_FLAVOR);
ProjectWorkspace.ProcessResult result = workspace.runBuckCommand("build", target.getFullyQualifiedName());
result.assertSuccess();
ProjectFilesystem filesystem = new ProjectFilesystem(workspace.getDestPath());
Path binaryOutput = workspace.getPath(BuildTargets.getGenPath(filesystem, target, "%s/libreal-none.dylib"));
assertThat(Files.exists(binaryOutput), is(true));
}
use of com.facebook.buck.testutil.integration.ProjectWorkspace in project buck by facebook.
the class AppleTestIntegrationTest method exitCodeIsCorrectOnAppTestFailure.
@Test(timeout = 180000)
public void exitCodeIsCorrectOnAppTestFailure() throws IOException {
assumeTrue(Platform.detect() == Platform.MACOS);
ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "apple_test_with_host_app_failure", tmp);
workspace.setUp();
workspace.copyRecursively(TestDataHelper.getTestDataDirectory(this).resolve("fbxctest"), Paths.get("fbxctest"));
workspace.addBuckConfigLocalOption("apple", "xctool_path", "fbxctest/bin/fbxctest");
ProjectWorkspace.ProcessResult result = workspace.runBuckCommand("test", "--config", "apple.xctool_path=fbxctest/bin/fbxctest", "//:AppTest");
result.assertSpecialExitCode("test should fail", 42);
assertThat(result.getStderr(), containsString("0 Passed 0 Skipped 1 Failed AppTest"));
assertThat(result.getStderr(), matchesPattern("(?s).*FAILURE AppTest -\\[AppTest testMagicValueShouldFail\\]:.*AppTest\\.m:13.*"));
}
use of com.facebook.buck.testutil.integration.ProjectWorkspace in project buck by facebook.
the class AppleTestIntegrationTest method testWithHostAppWithDsym.
@Test(timeout = 180000)
public void testWithHostAppWithDsym() throws IOException, InterruptedException {
assumeTrue(Platform.detect() == Platform.MACOS);
ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "apple_test_with_host_app", tmp);
workspace.setUp();
workspace.copyRecursively(TestDataHelper.getTestDataDirectory(this).resolve("fbxctest"), Paths.get("fbxctest"));
workspace.addBuckConfigLocalOption("apple", "xctool_path", "fbxctest/bin/fbxctest");
ProjectWorkspace.ProcessResult result = workspace.runBuckCommand("test", "//:AppTest", "--config", "cxx.cflags=-g", "--config", "apple.default_debug_info_format_for_binaries=DWARF_AND_DSYM", "--config", "apple.default_debug_info_format_for_libraries=DWARF_AND_DSYM", "--config", "apple.default_debug_info_format_for_tests=DWARF_AND_DSYM");
result.assertSuccess();
assertThat(result.getStderr(), containsString("1 Passed 0 Skipped 0 Failed AppTest"));
Path appTestDsym = tmp.getRoot().resolve(filesystem.getBuckPaths().getGenDir()).resolve("AppTest#apple-test-bundle,dwarf-and-dsym,no-include-frameworks,no-linkermap").resolve("AppTest.xctest.dSYM");
AppleDsymTestUtil.checkDsymFileHasDebugSymbol("-[AppTest testMagicValue]", workspace, appTestDsym);
Path hostAppDsym = tmp.getRoot().resolve(filesystem.getBuckPaths().getGenDir()).resolve("TestHostApp#dwarf-and-dsym,no-include-frameworks").resolve("TestHostApp.app.dSYM");
AppleDsymTestUtil.checkDsymFileHasDebugSymbol("-[TestHostApp magicValue]", workspace, hostAppDsym);
}
use of com.facebook.buck.testutil.integration.ProjectWorkspace in project buck by facebook.
the class AppleTestIntegrationTest method appleTestWithoutTestHostMultiarchShouldHaveMultiarchDsym.
@Test
public void appleTestWithoutTestHostMultiarchShouldHaveMultiarchDsym() throws Exception {
assumeTrue(Platform.detect() == Platform.MACOS);
ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "apple_test_xctest", tmp);
workspace.setUp();
workspace.copyRecursively(TestDataHelper.getTestDataDirectory(this).resolve("fbxctest"), Paths.get("fbxctest"));
BuildTarget target = BuildTargetFactory.newInstance("//:foo#iphonesimulator-i386,iphonesimulator-x86_64");
ProjectWorkspace.ProcessResult result = workspace.runBuckCommand("build", "--config", "cxx.cflags=-g", "--config", "apple.xctool_path=fbxctest/bin/fbxctest", "--config", "apple.default_debug_info_format_for_binaries=DWARF_AND_DSYM", "--config", "apple.default_debug_info_format_for_libraries=DWARF_AND_DSYM", "--config", "apple.default_debug_info_format_for_tests=DWARF_AND_DSYM", target.getFullyQualifiedName());
result.assertSuccess();
BuildTarget libraryTarget = target.withAppendedFlavors(AppleTestDescription.LIBRARY_FLAVOR, CxxDescriptionEnhancer.MACH_O_BUNDLE_FLAVOR);
Path output = workspace.getDestPath().resolve(BuildTargets.getGenPath(filesystem, libraryTarget.withAppendedFlavors(AppleDsym.RULE_FLAVOR), "%s.dSYM")).resolve("Contents/Resources/DWARF/" + libraryTarget.getShortName());
ProcessExecutor.Result lipoVerifyResult = workspace.runCommand("lipo", output.toString(), "-verify_arch", "i386", "x86_64");
assertEquals(lipoVerifyResult.getStderr().orElse(""), 0, lipoVerifyResult.getExitCode());
AppleDsymTestUtil.checkDsymFileHasDebugSymbolForConcreteArchitectures("-[FooXCTest testTwoPlusTwoEqualsFour]", workspace, output, Optional.of(ImmutableList.of("i386", "x86_64")));
}
Aggregations