Skip to content
This repository has been archived by the owner on Feb 2, 2021. It is now read-only.

Commit

Permalink
show friendly error message if the TEST_HOST executable doesn't exist.
Browse files Browse the repository at this point in the history
  • Loading branch information
fpotter committed Aug 29, 2013
1 parent 5fb206a commit a8b5a90
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
12 changes: 12 additions & 0 deletions xctool/xctool-tests/OTestQueryTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,16 @@ - (void)testQueryFailsWhenDYLDRejectsBundle_iOS
assertThat(error, containsString(@"no suitable image found."));
}

- (void)testIOSAppTestQueryFailsWhenTestHostExecutableIsMissing
{
NSString *error = nil;
NSString *latestSDK = GetAvailableSDKsAndAliases()[@"iphonesimulator"];
NSArray *classes = OTestQueryTestCasesInIOSBundleWithTestHost(TEST_DATA @"otest-query-tests-ios-test-bundle/TestProject-LibraryTests.octest",
@"/path/to/executable/that/does/not/exist",
latestSDK,
&error);
assertThat(classes, equalTo(nil));
assertThat(error, containsString(@"The test host executable is missing: '/path/to/executable/that/does/not/exist'"));
}

@end
5 changes: 5 additions & 0 deletions xctool/xctool/OTestQuery.m
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@
{
NSCAssert([sdk hasPrefix:@"iphonesimulator"], @"Only iphonesimulator SDKs are supported.");

if (![[NSFileManager defaultManager] isExecutableFileAtPath:testHostExecutablePath]) {
*error = [NSString stringWithFormat:@"The test host executable is missing: '%@'", testHostExecutablePath];
return nil;
}

NSString *version = [sdk stringByReplacingOccurrencesOfString:@"iphonesimulator" withString:@""];
DTiPhoneSimulatorSystemRoot *systemRoot = [DTiPhoneSimulatorSystemRoot rootWithSDKVersion:version];
NSCAssert(systemRoot != nil, @"Cannot get systemRoot");
Expand Down

0 comments on commit a8b5a90

Please sign in to comment.