Unverified Commit 5abe2d33 authored by Jenn Magder's avatar Jenn Magder Committed by GitHub

Allow hyphens in iOS UDIDs (#62225)

parent 50b7940b
...@@ -334,8 +334,9 @@ class XCDevice { ...@@ -334,8 +334,9 @@ class XCDevice {
} }
// Attach: d83d5bc53967baa0ee18626ba87b6254b2ab5418 // Attach: d83d5bc53967baa0ee18626ba87b6254b2ab5418
// Attach: 00008027-00192736010F802E
// Detach: d83d5bc53967baa0ee18626ba87b6254b2ab5418 // Detach: d83d5bc53967baa0ee18626ba87b6254b2ab5418
final RegExp _observationIdentifierPattern = RegExp(r'^(\w*): (\w*)$'); final RegExp _observationIdentifierPattern = RegExp(r'^(\w*): ([\w-]*)$');
Future<void> _startObservingTetheredIOSDevices() async { Future<void> _startObservingTetheredIOSDevices() async {
try { try {
...@@ -367,6 +368,7 @@ class XCDevice { ...@@ -367,6 +368,7 @@ class XCDevice {
// //
// Listening for all devices, on both interfaces. // Listening for all devices, on both interfaces.
// Attach: d83d5bc53967baa0ee18626ba87b6254b2ab5418 // Attach: d83d5bc53967baa0ee18626ba87b6254b2ab5418
// Attach: 00008027-00192736010F802E
// Detach: d83d5bc53967baa0ee18626ba87b6254b2ab5418 // Detach: d83d5bc53967baa0ee18626ba87b6254b2ab5418
// Attach: d83d5bc53967baa0ee18626ba87b6254b2ab5418 // Attach: d83d5bc53967baa0ee18626ba87b6254b2ab5418
final RegExpMatch match = _observationIdentifierPattern.firstMatch(line); final RegExpMatch match = _observationIdentifierPattern.firstMatch(line);
......
...@@ -356,8 +356,8 @@ void main() { ...@@ -356,8 +356,8 @@ void main() {
); );
device2 = IOSDevice( device2 = IOSDevice(
'43ad2fda7991b34fe1acbda82f9e2fd3d6ddc9f7', '00008027-00192736010F802E',
name: 'iPhone 6s', name: 'iPad Pro',
sdkVersion: '13.3', sdkVersion: '13.3',
cpuArchitecture: DarwinArch.arm64, cpuArchitecture: DarwinArch.arm64,
iProxy: IProxy.test(logger: logger, processManager: FakeProcessManager.any()), iProxy: IProxy.test(logger: logger, processManager: FakeProcessManager.any()),
......
...@@ -400,29 +400,37 @@ void main() { ...@@ -400,29 +400,37 @@ void main() {
'observe', 'observe',
'--both', '--both',
], stdout: 'Attach: d83d5bc53967baa0ee18626ba87b6254b2ab5418\n' ], stdout: 'Attach: d83d5bc53967baa0ee18626ba87b6254b2ab5418\n'
'Detach: d83d5bc53967baa0ee18626ba87b6254b2ab5418', 'Attach: 00008027-00192736010F802E\n'
'Detach: d83d5bc53967baa0ee18626ba87b6254b2ab5418',
stderr: 'Some error', stderr: 'Some error',
)); ));
final Completer<void> attach = Completer<void>(); final Completer<void> attach1 = Completer<void>();
final Completer<void> detach = Completer<void>(); final Completer<void> attach2 = Completer<void>();
final Completer<void> detach1 = Completer<void>();
// Attach: d83d5bc53967baa0ee18626ba87b6254b2ab5418 // Attach: d83d5bc53967baa0ee18626ba87b6254b2ab5418
// Attach: 00008027-00192736010F802E
// Detach: d83d5bc53967baa0ee18626ba87b6254b2ab5418 // Detach: d83d5bc53967baa0ee18626ba87b6254b2ab5418
xcdevice.observedDeviceEvents().listen((Map<XCDeviceEvent, String> event) { xcdevice.observedDeviceEvents().listen((Map<XCDeviceEvent, String> event) {
expect(event.length, 1); expect(event.length, 1);
if (event.containsKey(XCDeviceEvent.attach)) { if (event.containsKey(XCDeviceEvent.attach)) {
expect(event[XCDeviceEvent.attach], 'd83d5bc53967baa0ee18626ba87b6254b2ab5418'); if (event[XCDeviceEvent.attach] == 'd83d5bc53967baa0ee18626ba87b6254b2ab5418') {
attach.complete(); attach1.complete();
} else
if (event[XCDeviceEvent.attach] == '00008027-00192736010F802E') {
attach2.complete();
}
} else if (event.containsKey(XCDeviceEvent.detach)) { } else if (event.containsKey(XCDeviceEvent.detach)) {
expect(event[XCDeviceEvent.detach], 'd83d5bc53967baa0ee18626ba87b6254b2ab5418'); expect(event[XCDeviceEvent.detach], 'd83d5bc53967baa0ee18626ba87b6254b2ab5418');
detach.complete(); detach1.complete();
} else { } else {
fail('Unexpected event'); fail('Unexpected event');
} }
}); });
await attach.future; await attach1.future;
await detach.future; await attach2.future;
await detach1.future;
expect(logger.traceText, contains('xcdevice observe error: Some error')); expect(logger.traceText, contains('xcdevice observe error: Some error'));
}); });
}); });
...@@ -463,7 +471,7 @@ void main() { ...@@ -463,7 +471,7 @@ void main() {
"available" : true, "available" : true,
"platform" : "com.apple.platform.iphoneos", "platform" : "com.apple.platform.iphoneos",
"modelCode" : "iPhone8,1", "modelCode" : "iPhone8,1",
"identifier" : "d83d5bc53967baa0ee18626ba87b6254b2ab5418", "identifier" : "00008027-00192736010F802E",
"architecture" : "arm64", "architecture" : "arm64",
"modelName" : "iPhone 6s", "modelName" : "iPhone 6s",
"name" : "An iPhone (Space Gray)" "name" : "An iPhone (Space Gray)"
...@@ -542,7 +550,7 @@ void main() { ...@@ -542,7 +550,7 @@ void main() {
)); ));
final List<IOSDevice> devices = await xcdevice.getAvailableIOSDevices(); final List<IOSDevice> devices = await xcdevice.getAvailableIOSDevices();
expect(devices, hasLength(3)); expect(devices, hasLength(3));
expect(devices[0].id, 'd83d5bc53967baa0ee18626ba87b6254b2ab5418'); expect(devices[0].id, '00008027-00192736010F802E');
expect(devices[0].name, 'An iPhone (Space Gray)'); expect(devices[0].name, 'An iPhone (Space Gray)');
expect(await devices[0].sdkNameAndVersion, 'iOS 13.3'); expect(await devices[0].sdkNameAndVersion, 'iOS 13.3');
expect(devices[0].cpuArchitecture, DarwinArch.arm64); expect(devices[0].cpuArchitecture, DarwinArch.arm64);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment