Re-enable the leak detection in MTRTestCase, now that the test leaks are fixed. (#33277)
diff --git a/src/darwin/Framework/CHIPTests/MTRPerControllerStorageTests.m b/src/darwin/Framework/CHIPTests/MTRPerControllerStorageTests.m
index 19f114f..06968b0 100644
--- a/src/darwin/Framework/CHIPTests/MTRPerControllerStorageTests.m
+++ b/src/darwin/Framework/CHIPTests/MTRPerControllerStorageTests.m
@@ -187,6 +187,10 @@
- (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 @@
- (void)test001_BasicControllerStartup
{
- self.detectLeaks = YES;
-
__auto_type * factory = [MTRDeviceControllerFactory sharedInstance];
XCTAssertNotNil(factory);
@@ -403,8 +405,6 @@
- (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 b4cf92b..1dd1fea 100644
--- a/src/darwin/Framework/CHIPTests/TestHelpers/MTRTestCase.mm
+++ b/src/darwin/Framework/CHIPTests/TestHelpers/MTRTestCase.mm
@@ -27,7 +27,6 @@
*/
- (void)tearDown
{
-#if 0
#if defined(ENABLE_LEAK_DETECTION) && ENABLE_LEAK_DETECTION
if (_detectLeaks) {
int pid = getpid();
@@ -36,7 +35,6 @@
XCTAssertEqual(ret, 0, "LEAKS DETECTED");
}
#endif
-#endif
[super tearDown];
}