Skip to content

Commit 76fdf2c

Browse files
Re-enable the leak detection in MTRTestCase, now that the test leaks are fixed.
1 parent 66bc46e commit 76fdf2c

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

src/darwin/Framework/CHIPTests/MTRPerControllerStorageTests.m

+4-4
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,10 @@ @implementation MTRPerControllerStorageTests {
187187

188188
- (void)setUp
189189
{
190+
// Set detectLeaks true first, in case our superclass wants to do something
191+
// in setUp when it's set.
192+
self.detectLeaks = YES;
193+
190194
// Per-test setup, runs before each test.
191195
[super setUp];
192196
[self setContinueAfterFailure:NO];
@@ -353,8 +357,6 @@ - (nullable MTRDeviceController *)startControllerWithRootKeys:(MTRTestKeys *)roo
353357

354358
- (void)test001_BasicControllerStartup
355359
{
356-
self.detectLeaks = YES;
357-
358360
__auto_type * factory = [MTRDeviceControllerFactory sharedInstance];
359361
XCTAssertNotNil(factory);
360362

@@ -403,8 +405,6 @@ - (void)test001_BasicControllerStartup
403405

404406
- (void)test002_TryStartingTwoControllersWithSameNodeID
405407
{
406-
self.detectLeaks = YES;
407-
408408
__auto_type * rootKeys = [[MTRTestKeys alloc] init];
409409
XCTAssertNotNil(rootKeys);
410410

src/darwin/Framework/CHIPTests/TestHelpers/MTRTestCase.mm

-2
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,13 @@ @implementation MTRTestCase
2727
*/
2828
- (void)tearDown
2929
{
30-
#if 0
3130
#if defined(ENABLE_LEAK_DETECTION) && ENABLE_LEAK_DETECTION
3231
if (_detectLeaks) {
3332
int pid = getpid();
3433
__auto_type * cmd = [NSString stringWithFormat:@"leaks %d", pid];
3534
int ret = system(cmd.UTF8String);
3635
XCTAssertEqual(ret, 0, "LEAKS DETECTED");
3736
}
38-
#endif
3937
#endif
4038

4139
[super tearDown];

0 commit comments

Comments
 (0)