Skip to content

Commit

Permalink
Re-enable the leak detection in MTRTestCase, now that the test leaks …
Browse files Browse the repository at this point in the history
…are fixed. (#33277)
  • Loading branch information
bzbarsky-apple authored May 3, 2024
1 parent f0ba374 commit 98c10ee
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/darwin/Framework/CHIPTests/MTRPerControllerStorageTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -353,8 +357,6 @@ - (nullable MTRDeviceController *)startControllerWithRootKeys:(MTRTestKeys *)roo

- (void)test001_BasicControllerStartup
{
self.detectLeaks = YES;

__auto_type * factory = [MTRDeviceControllerFactory sharedInstance];
XCTAssertNotNil(factory);

Expand Down Expand Up @@ -403,8 +405,6 @@ - (void)test001_BasicControllerStartup

- (void)test002_TryStartingTwoControllersWithSameNodeID
{
self.detectLeaks = YES;

__auto_type * rootKeys = [[MTRTestKeys alloc] init];
XCTAssertNotNil(rootKeys);

Expand Down
2 changes: 0 additions & 2 deletions src/darwin/Framework/CHIPTests/TestHelpers/MTRTestCase.mm
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,13 @@ @implementation MTRTestCase
*/
- (void)tearDown
{
#if 0
#if defined(ENABLE_LEAK_DETECTION) && ENABLE_LEAK_DETECTION
if (_detectLeaks) {
int pid = getpid();
__auto_type * cmd = [NSString stringWithFormat:@"leaks %d", pid];
int ret = system(cmd.UTF8String);
XCTAssertEqual(ret, 0, "LEAKS DETECTED");
}
#endif
#endif

[super tearDown];
Expand Down

0 comments on commit 98c10ee

Please sign in to comment.