Skip to content

Commit

Permalink
Fix Darwin tests in newer Xcode versions. (#33456)
Browse files Browse the repository at this point in the history
We no longer seem to get a useful PWD when running tests, so stop using it.
  • Loading branch information
bzbarsky-apple authored May 14, 2024
1 parent c7f7984 commit 517d5cb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/darwin/Framework/CHIPTests/MTROTAProviderTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -722,11 +722,11 @@ + (void)shutdownStack
*/
- (NSString *)absolutePathFor:(NSString *)matterRootRelativePath
{
// Find the right absolute path to our file. PWD should
// point to our src/darwin/Framework.
NSString * pwd = [[NSProcessInfo processInfo] environment][@"PWD"];
// Start with the absolute path to our file, then remove the suffix that
// comes after the path to the Matter SDK root.
NSString * pathToTest = [NSString stringWithUTF8String:__FILE__];
NSMutableArray * pathComponents = [[NSMutableArray alloc] init];
[pathComponents addObject:[pwd substringToIndex:(pwd.length - @"src/darwin/Framework".length)]];
[pathComponents addObject:[pathToTest substringToIndex:(pathToTest.length - @"src/darwin/Framework/CHIPTests/MTROTAProviderTests.m".length)]];
[pathComponents addObjectsFromArray:[matterRootRelativePath pathComponents]];
return [NSString pathWithComponents:pathComponents];
}
Expand Down

0 comments on commit 517d5cb

Please sign in to comment.