use of com.facebook.buck.testutil.integration.ProjectWorkspace.ProcessResult in project buck by facebook.
the class RunCommandIntegrationTest method testRunCommandWithNonExistentTarget.
@Test
public void testRunCommandWithNonExistentTarget() throws IOException, InterruptedException {
ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "run-command", temporaryFolder);
workspace.setUp();
ProcessResult result = workspace.runBuckCommand("run", "//does/not/exist");
result.assertFailure();
assertThat(result.getStderr(), containsString("No build file at does/not/exist/BUCK when resolving target //does/not/exist:exist."));
}
use of com.facebook.buck.testutil.integration.ProjectWorkspace.ProcessResult in project buck by facebook.
the class RunCommandIntegrationTest method testRunCommandWithNoArguments.
@Test
public void testRunCommandWithNoArguments() throws IOException, InterruptedException {
ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "run-command", temporaryFolder);
workspace.setUp();
ProcessResult result = workspace.runBuckCommand("run");
result.assertFailure();
assertThat(result.getStderr(), containsString("buck run <target> <arg1> <arg2>..."));
assertThat(result.getStderr(), containsString("No target given to run"));
}
use of com.facebook.buck.testutil.integration.ProjectWorkspace.ProcessResult in project buck by facebook.
the class RunCommandIntegrationTest method testRunCommandFailure.
@Test
public void testRunCommandFailure() throws IOException {
ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "run-command-failure", temporaryFolder);
workspace.setUp();
ProcessResult result = workspace.runBuckCommand("run", "//cmd:command");
result.assertSpecialExitCode("buck run should propagate failure", 5);
}
use of com.facebook.buck.testutil.integration.ProjectWorkspace.ProcessResult in project buck by facebook.
the class InstallCommandIntegrationTest method appleBundleInstallsAndRunsInIphoneSimulatorWithDwarfDebugging.
@Test
public void appleBundleInstallsAndRunsInIphoneSimulatorWithDwarfDebugging() throws IOException, InterruptedException {
assumeThat(Platform.detect(), is(Platform.MACOS));
ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "apple_app_bundle", tmp);
workspace.setUp();
workspace.enableDirCache();
// build locally
ProcessResult result = workspace.runBuckCommand("install", "--config", "apple.default_debug_info_format_for_binaries=DWARF", "--config", "apple.default_debug_info_format_for_libraries=DWARF", "--config", "apple.default_debug_info_format_for_tests=DWARF", "-r", "//:DemoApp");
assumeFalse(result.getStderr().contains("no appropriate simulator found"));
result.assertSuccess();
// find port to connect lldb to
// "lldb -p 12345"
Pattern p = Pattern.compile("lldb -p \\d{1,6}");
Matcher matcher = p.matcher(result.getStderr());
assertThat(matcher.find(), equalTo(true));
String[] lldbCommand = matcher.group().split(" ");
ProcessExecutor executor = new DefaultProcessExecutor(new TestConsole());
// run lldb session
ProcessExecutor.Result lldbResult = executor.launchAndExecute(ProcessExecutorParams.builder().addCommand(lldbCommand).build(), ImmutableSet.of(), Optional.of("b application:didFinishLaunchingWithOptions:\nb\nexit\nY\n"), Optional.empty(), Optional.empty());
assertThat(lldbResult.getExitCode(), equalTo(0));
// check that lldb resolved breakpoint locations
String lldbOutput = lldbResult.getStdout().orElse("");
assertThat(lldbOutput, containsString("Current breakpoints:"));
assertThat(lldbOutput, containsString("name = 'application:didFinishLaunchingWithOptions:', " + "locations = 1, resolved = 1, hit count = 0"));
// clean buck out
workspace.runBuckCommand("clean");
// build again - get everything from cache now
result = workspace.runBuckCommand("install", "--config", "apple.default_debug_info_format_for_binaries=DWARF", "--config", "apple.default_debug_info_format_for_libraries=DWARF", "--config", "apple.default_debug_info_format_for_tests=DWARF", "-r", "//:DemoApp");
result.assertSuccess();
matcher = p.matcher(result.getStderr());
assertThat(matcher.find(), equalTo(true));
String[] lldbCommand2 = matcher.group().split(" ");
// run lldb session again - now on top of files fetched from cache
lldbResult = executor.launchAndExecute(ProcessExecutorParams.builder().addCommand(lldbCommand2).build(), ImmutableSet.of(), Optional.of("b application:didFinishLaunchingWithOptions:\nb\nexit\nY\n"), Optional.empty(), Optional.empty());
assertThat(lldbResult.getExitCode(), equalTo(0));
// check that lldb resolved breakpoint locations with files from cache
lldbOutput = lldbResult.getStdout().orElse("");
assertThat(lldbOutput, containsString("Current breakpoints:"));
assertThat(lldbOutput, containsString("name = 'application:didFinishLaunchingWithOptions:', " + "locations = 1, resolved = 1, hit count = 0"));
}
use of com.facebook.buck.testutil.integration.ProjectWorkspace.ProcessResult in project buck by facebook.
the class InstallCommandIntegrationTest method appleBundleInstallsInIphoneSimulator.
@Test
public void appleBundleInstallsInIphoneSimulator() throws IOException {
assumeThat(Platform.detect(), is(Platform.MACOS));
ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "apple_app_bundle", tmp);
workspace.setUp();
ProcessResult result = workspace.runBuckCommand("install", "//:DemoApp");
assumeFalse(result.getStderr().contains("no appropriate simulator found"));
result.assertSuccess();
// TODO(bhamiltoncx): If we make the install command output the UDID of the
// simulator, we could poke around in
// ~/Library/Developer/CoreSimulator/[UDID] to see if the bits were installed.
}
Aggregations