| 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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 | 261 |
| 262 // The following stderr messages are meaningless on iossim when not running | |
| 263 // xctests and can be safely stripped. | |
| 264 if (!xctest_path) { | 262 if (!xctest_path) { |
| 263 // The following stderr messages are meaningless on iossim when not running |
| 264 // xctests and can be safely stripped. |
| 265 NSArray* ignore_strings = @[ |
| 266 @"IDETestOperationsObserverErrorDomain", @"** TEST EXECUTE FAILED **" |
| 267 ]; |
| 265 NSPipe* stderr_pipe = [NSPipe pipe]; | 268 NSPipe* stderr_pipe = [NSPipe pipe]; |
| 266 stderr_pipe.fileHandleForReading.readabilityHandler = | 269 stderr_pipe.fileHandleForReading.readabilityHandler = |
| 267 ^(NSFileHandle* handle) { | 270 ^(NSFileHandle* handle) { |
| 268 NSString* log = [[[NSString alloc] initWithData:handle.availableData | 271 NSString* log = [[[NSString alloc] initWithData:handle.availableData |
| 269 encoding:NSUTF8StringEncoding] | 272 encoding:NSUTF8StringEncoding] |
| 270 autorelease]; | 273 autorelease]; |
| 271 if ([log containsString:@"IDETestOperationsObserverErrorDomain"] || | 274 for (NSString* ignore_string in ignore_strings) { |
| 272 [log containsString:@"** TEST EXECUTE FAILED **"]) { | 275 if ([log rangeOfString:ignore_string].location != NSNotFound) { |
| 273 return; | 276 return; |
| 277 } |
| 274 } | 278 } |
| 275 printf("%s", [log UTF8String]); | 279 printf("%s", [log UTF8String]); |
| 276 }; | 280 }; |
| 277 [task setStandardError:stderr_pipe]; | 281 [task setStandardError:stderr_pipe]; |
| 278 } | 282 } |
| 279 [task run]; | 283 [task run]; |
| 280 } | 284 } |
| 281 | 285 |
| 282 int main(int argc, char* const argv[]) { | 286 int main(int argc, char* const argv[]) { |
| 283 NSString* app_path = nil; | 287 NSString* app_path = nil; |
| (...skipping 970 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1254 } | 1258 } |
| 1255 | 1259 |
| 1256 // Note that this code is only executed if the simulator fails to start | 1260 // Note that this code is only executed if the simulator fails to start |
| 1257 // because once the main run loop is started, only the delegate calling | 1261 // because once the main run loop is started, only the delegate calling |
| 1258 // exit() will end the program. | 1262 // exit() will end the program. |
| 1259 [pool drain]; | 1263 [pool drain]; |
| 1260 return kExitFailure; | 1264 return kExitFailure; |
| 1261 } | 1265 } |
| 1262 | 1266 |
| 1263 #endif | 1267 #endif |
| OLD | NEW |