OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 #import <Foundation/Foundation.h> | 4 #import <Foundation/Foundation.h> |
5 #if defined(__MAC_10_12) && __MAC_OS_X_VERSION_MAX_ALLOWED >= __MAC_10_12 | 5 #if defined(__MAC_10_12) && __MAC_OS_X_VERSION_MAX_ALLOWED >= __MAC_10_12 |
6 #include <getopt.h> | 6 #include <getopt.h> |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 namespace { | 9 namespace { |
10 | 10 |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 } | 277 } |
278 } | 278 } |
279 printf("%s", [log UTF8String]); | 279 printf("%s", [log UTF8String]); |
280 }; | 280 }; |
281 [task setStandardError:stderr_pipe]; | 281 [task setStandardError:stderr_pipe]; |
282 } | 282 } |
283 [task run]; | 283 [task run]; |
284 } | 284 } |
285 | 285 |
286 int main(int argc, char* const argv[]) { | 286 int main(int argc, char* const argv[]) { |
| 287 // When the last running simulator is from Xcode 7, an Xcode 8 run will yeild |
| 288 // a failure to "unload a stale CoreSimulatorService job" message. Sending a |
| 289 // hidden simctl to do something simple (list devices) helpfully works around |
| 290 // this issue. |
| 291 XCRunTask* workaround_task = [[[XCRunTask alloc] |
| 292 initWithArguments:@[ @"simctl", @"list", @"-j" ]] autorelease]; |
| 293 [workaround_task setStandardOutput:nil]; |
| 294 [workaround_task setStandardError:nil]; |
| 295 [workaround_task run]; |
| 296 |
287 NSString* app_path = nil; | 297 NSString* app_path = nil; |
288 NSString* xctest_path = nil; | 298 NSString* xctest_path = nil; |
289 NSString* cmd_args = nil; | 299 NSString* cmd_args = nil; |
290 NSString* device_name = @"iPhone 6s"; | 300 NSString* device_name = @"iPhone 6s"; |
291 bool wants_wipe = false; | 301 bool wants_wipe = false; |
292 bool wants_print_home = false; | 302 bool wants_print_home = false; |
293 NSDictionary* simctl_list = GetSimulatorList(); | 303 NSDictionary* simctl_list = GetSimulatorList(); |
294 float sdk = 0; | 304 float sdk = 0; |
295 for (NSDictionary* runtime in Runtimes(simctl_list)) { | 305 for (NSDictionary* runtime in Runtimes(simctl_list)) { |
296 sdk = fmax(sdk, [runtime[@"version"] floatValue]); | 306 sdk = fmax(sdk, [runtime[@"version"] floatValue]); |
(...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1258 } | 1268 } |
1259 | 1269 |
1260 // Note that this code is only executed if the simulator fails to start | 1270 // Note that this code is only executed if the simulator fails to start |
1261 // because once the main run loop is started, only the delegate calling | 1271 // because once the main run loop is started, only the delegate calling |
1262 // exit() will end the program. | 1272 // exit() will end the program. |
1263 [pool drain]; | 1273 [pool drain]; |
1264 return kExitFailure; | 1274 return kExitFailure; |
1265 } | 1275 } |
1266 | 1276 |
1267 #endif | 1277 #endif |
OLD | NEW |