use of com.facebook.buck.step.TargetDevice in project buck by facebook.
the class TargetDeviceCommandLineOptionsTest method onlySettingTheSerialFlagAssumesTheTargetIsARealDevice.
@Test
public void onlySettingTheSerialFlagAssumesTheTargetIsARealDevice() {
TargetDeviceCommandLineOptions options = buildOptions("-s", "1234");
TargetDevice device = options.getTargetDeviceOptional().get();
assertFalse(device.isEmulator());
assertEquals("1234", device.getIdentifier().get());
}
use of com.facebook.buck.step.TargetDevice in project buck by facebook.
the class TargetDeviceCommandLineOptionsTest method shouldReturnAnEmulatorIfOnlyEmulatorFlagSet.
@Test
public void shouldReturnAnEmulatorIfOnlyEmulatorFlagSet() {
TargetDeviceCommandLineOptions options = buildOptions("-e");
TargetDevice device = options.getTargetDeviceOptional().get();
assertTrue(device.isEmulator());
assertFalse(device.getIdentifier().isPresent());
}
use of com.facebook.buck.step.TargetDevice in project buck by facebook.
the class TargetDeviceCommandLineOptionsTest method serialFlagOverridesEnvironment.
@Test
public void serialFlagOverridesEnvironment() {
TargetDeviceCommandLineOptions options = new TargetDeviceCommandLineOptions("1234");
TargetDevice device = options.getTargetDeviceOptional().get();
assertEquals("1234", device.getIdentifier().get());
try {
new CmdLineParser(options).parseArgument("-s", "5678");
} catch (CmdLineException e) {
fail("Unable to parse arguments");
}
device = options.getTargetDeviceOptional().get();
assertEquals("5678", device.getIdentifier().get());
}
use of com.facebook.buck.step.TargetDevice in project buck by facebook.
the class JavaTestRuleTest method shouldAddRealTargetDeviceToVmArgsIfPresent.
@Test
public void shouldAddRealTargetDeviceToVmArgsIfPresent() throws Exception {
ImmutableList<String> vmArgs = ImmutableList.of("--one");
JavaTest rule = newRule(vmArgs);
TargetDevice device = new TargetDevice(TargetDevice.Type.REAL_DEVICE, Optional.empty());
ImmutableList<String> amended = rule.amendVmArgs(vmArgs, createMock(SourcePathResolver.class), Optional.of(device));
ImmutableList<String> expected = ImmutableList.of("--one", "-Dbuck.device=device");
assertEquals(expected, amended);
}
use of com.facebook.buck.step.TargetDevice in project buck by facebook.
the class JavaTestRuleTest method shouldAddDeviceSerialIdToVmArgsIfPresent.
@Test
public void shouldAddDeviceSerialIdToVmArgsIfPresent() throws Exception {
ImmutableList<String> vmArgs = ImmutableList.of("--one");
JavaTest rule = newRule(vmArgs);
TargetDevice device = new TargetDevice(TargetDevice.Type.EMULATOR, Optional.of("123"));
List<String> amended = rule.amendVmArgs(vmArgs, createMock(SourcePathResolver.class), Optional.of(device));
List<String> expected = ImmutableList.of("--one", "-Dbuck.device=emulator", "-Dbuck.device.id=123");
assertEquals(expected, amended);
}
Aggregations