| 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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 NSData* data = [NSPropertyListSerialization | 251 NSData* data = [NSPropertyListSerialization |
| 252 dataFromPropertyList:xctestrun | 252 dataFromPropertyList:xctestrun |
| 253 format:NSPropertyListXMLFormat_v1_0 | 253 format:NSPropertyListXMLFormat_v1_0 |
| 254 errorDescription:&error]; | 254 errorDescription:&error]; |
| 255 [data writeToFile:tempFilePath atomically:YES]; | 255 [data writeToFile:tempFilePath atomically:YES]; |
| 256 XCRunTask* task = [[[XCRunTask alloc] initWithArguments:@[ | 256 XCRunTask* task = [[[XCRunTask alloc] initWithArguments:@[ |
| 257 @"xcodebuild", @"-xctestrun", tempFilePath, @"-destination", | 257 @"xcodebuild", @"-xctestrun", tempFilePath, @"-destination", |
| 258 [@"platform=iOS Simulator,id=" stringByAppendingString:udid], | 258 [@"platform=iOS Simulator,id=" stringByAppendingString:udid], |
| 259 @"test-without-building" | 259 @"test-without-building" |
| 260 ]] autorelease]; | 260 ]] autorelease]; |
| 261 |
| 262 // The following stderr messages are meaningless on iossim when not running |
| 263 // xctests and can be safely stripped. |
| 264 if (!xctest_path) { |
| 265 NSPipe* stderr_pipe = [NSPipe pipe]; |
| 266 stderr_pipe.fileHandleForReading.readabilityHandler = |
| 267 ^(NSFileHandle* handle) { |
| 268 NSString* log = [[[NSString alloc] initWithData:handle.availableData |
| 269 encoding:NSUTF8StringEncoding] |
| 270 autorelease]; |
| 271 if ([log containsString:@"IDETestOperationsObserverErrorDomain"] || |
| 272 [log containsString:@"** TEST EXECUTE FAILED **"]) { |
| 273 return; |
| 274 } |
| 275 printf("%s", [log UTF8String]); |
| 276 }; |
| 277 [task setStandardError:stderr_pipe]; |
| 278 } |
| 261 [task run]; | 279 [task run]; |
| 262 } | 280 } |
| 263 | 281 |
| 264 int main(int argc, char* const argv[]) { | 282 int main(int argc, char* const argv[]) { |
| 265 NSString* app_path = nil; | 283 NSString* app_path = nil; |
| 266 NSString* xctest_path = nil; | 284 NSString* xctest_path = nil; |
| 267 NSString* cmd_args = nil; | 285 NSString* cmd_args = nil; |
| 268 NSString* device_name = @"iPhone 6s"; | 286 NSString* device_name = @"iPhone 6s"; |
| 269 bool wants_wipe = false; | 287 bool wants_wipe = false; |
| 270 bool wants_print_home = false; | 288 bool wants_print_home = false; |
| (...skipping 965 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1236 } | 1254 } |
| 1237 | 1255 |
| 1238 // Note that this code is only executed if the simulator fails to start | 1256 // Note that this code is only executed if the simulator fails to start |
| 1239 // because once the main run loop is started, only the delegate calling | 1257 // because once the main run loop is started, only the delegate calling |
| 1240 // exit() will end the program. | 1258 // exit() will end the program. |
| 1241 [pool drain]; | 1259 [pool drain]; |
| 1242 return kExitFailure; | 1260 return kExitFailure; |
| 1243 } | 1261 } |
| 1244 | 1262 |
| 1245 #endif | 1263 #endif |
| OLD | NEW |