Skip to content

Commit 8162b20

Browse files
Fix Darwin tests in newer Xcode versions.
We no longer seem to get a useful PWD when running tests, so stop using it.
1 parent b653e8e commit 8162b20

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/darwin/Framework/CHIPTests/MTROTAProviderTests.m

+4-4
Original file line numberDiff line numberDiff line change
@@ -722,11 +722,11 @@ + (void)shutdownStack
722722
*/
723723
- (NSString *)absolutePathFor:(NSString *)matterRootRelativePath
724724
{
725-
// Find the right absolute path to our file. PWD should
726-
// point to our src/darwin/Framework.
727-
NSString * pwd = [[NSProcessInfo processInfo] environment][@"PWD"];
725+
// Start with the absolute path to our file, then remove the suffix that
726+
// comes after the path to the Matter SDK root.
727+
NSString * pathToTest = [NSString stringWithUTF8String:__FILE__];
728728
NSMutableArray * pathComponents = [[NSMutableArray alloc] init];
729-
[pathComponents addObject:[pwd substringToIndex:(pwd.length - @"src/darwin/Framework".length)]];
729+
[pathComponents addObject:[pathToTest substringToIndex:(pathToTest.length - @"src/darwin/Framework/CHIPTests/MTROTAProviderTests.m".length)]];
730730
[pathComponents addObjectsFromArray:[matterRootRelativePath pathComponents]];
731731
return [NSString pathWithComponents:pathComponents];
732732
}

0 commit comments

Comments
 (0)