Skip to content

Commit 61832b7

Browse files
Address review comment: remove temp file when done.
1 parent 0607ae9 commit 61832b7

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/darwin/Framework/CHIPTests/MTRXPCListenerSampleTests.m

+8-3
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,7 @@ - (void)readAttributeCacheWithController:(id _Nullable)controller
419419
static const uint16_t kTimeoutInSeconds = 3;
420420
static const uint64_t kDeviceId = 0x12344321;
421421
static NSString * kOnboardingPayload = @"MT:Y.K90SO527JA0648G00";
422+
static NSString * _Nullable sLogContentFilePath;
422423
static NSString * kSimpleLogContent = @"This is a simple log\n";
423424
static const uint16_t kLocalPort = 5541;
424425

@@ -516,14 +517,14 @@ + (void)setUp
516517
[super setUp];
517518

518519
__auto_type * uniqueName = [[NSUUID UUID] UUIDString];
519-
__auto_type * uniquePath = [NSTemporaryDirectory() stringByAppendingPathComponent:uniqueName];
520-
[[NSFileManager defaultManager] createFileAtPath:uniquePath
520+
sLogContentFilePath = [NSTemporaryDirectory() stringByAppendingPathComponent:uniqueName];
521+
[[NSFileManager defaultManager] createFileAtPath:sLogContentFilePath
521522
contents:[kSimpleLogContent dataUsingEncoding:NSUTF8StringEncoding]
522523
attributes:nil];
523524
BOOL started = [self startAppWithName:@"all-clusters"
524525
arguments:@[
525526
@"--end_user_support_log",
526-
uniquePath,
527+
sLogContentFilePath,
527528
]
528529
payload:kOnboardingPayload];
529530
XCTAssertTrue(started);
@@ -532,6 +533,10 @@ + (void)setUp
532533
+ (void)tearDown
533534
{
534535
// Global teardown, runs once
536+
if (sLogContentFilePath != nil) {
537+
[[NSFileManager defaultManager] removeItemAtPath:sLogContentFilePath error:nil];
538+
}
539+
535540
[self shutdownStack];
536541
[super tearDown];
537542
}

0 commit comments

Comments
 (0)