diff --git a/src/darwin/Framework/CHIPTests/MTRPerControllerStorageTests.m b/src/darwin/Framework/CHIPTests/MTRPerControllerStorageTests.m index 19f114f7877d23..06968b00292ef4 100644 --- a/src/darwin/Framework/CHIPTests/MTRPerControllerStorageTests.m +++ b/src/darwin/Framework/CHIPTests/MTRPerControllerStorageTests.m @@ -187,6 +187,10 @@ @implementation MTRPerControllerStorageTests { - (void)setUp { + // Set detectLeaks true first, in case our superclass wants to do something + // in setUp when it's set. + self.detectLeaks = YES; + // Per-test setup, runs before each test. [super setUp]; [self setContinueAfterFailure:NO]; @@ -353,8 +357,6 @@ - (nullable MTRDeviceController *)startControllerWithRootKeys:(MTRTestKeys *)roo - (void)test001_BasicControllerStartup { - self.detectLeaks = YES; - __auto_type * factory = [MTRDeviceControllerFactory sharedInstance]; XCTAssertNotNil(factory); @@ -403,8 +405,6 @@ - (void)test001_BasicControllerStartup - (void)test002_TryStartingTwoControllersWithSameNodeID { - self.detectLeaks = YES; - __auto_type * rootKeys = [[MTRTestKeys alloc] init]; XCTAssertNotNil(rootKeys); diff --git a/src/darwin/Framework/CHIPTests/TestHelpers/MTRTestCase.mm b/src/darwin/Framework/CHIPTests/TestHelpers/MTRTestCase.mm index b4cf92b1ee3322..1dd1fea675b46c 100644 --- a/src/darwin/Framework/CHIPTests/TestHelpers/MTRTestCase.mm +++ b/src/darwin/Framework/CHIPTests/TestHelpers/MTRTestCase.mm @@ -27,7 +27,6 @@ @implementation MTRTestCase */ - (void)tearDown { -#if 0 #if defined(ENABLE_LEAK_DETECTION) && ENABLE_LEAK_DETECTION if (_detectLeaks) { int pid = getpid(); @@ -35,7 +34,6 @@ - (void)tearDown int ret = system(cmd.UTF8String); XCTAssertEqual(ret, 0, "LEAKS DETECTED"); } -#endif #endif [super tearDown];