@@ -73,17 +73,28 @@ - (void)tearDown
73
73
int pid = getpid ();
74
74
__auto_type * cmd = [NSString stringWithFormat: @" leaks %d " , pid];
75
75
int ret = system (cmd.UTF8String );
76
- if (WIFEXITED (ret)) {
77
- // leaks ran to completion.
78
- XCTAssertEqual (WEXITSTATUS (ret), 0 , " LEAKS DETECTED" );
79
- } else {
80
- // leaks failed to actually run to completion (e.g. crashed or ran
81
- // into some other sort of failure trying to do its work). Ideally
82
- // we would fail our tests in that case, but this seems to be
83
- // happening a fair amount, and randomly, on the ARM GitHub runners.
76
+ if (WIFSIGNALED (ret)) {
77
+ XCTFail (@" leaks unexpectedly stopped by signal %d " , WTERMSIG (ret));
78
+ }
79
+ XCTAssertTrue (WIFEXITED (ret), " leaks did not run to completion" );
80
+ // The exit status is 0 if no leaks detected, 1 if leaks were detected,
81
+ // something else on error.
82
+ if (WEXITSTATUS (ret) == 1 ) {
83
+ XCTFail (@" LEAKS DETECTED" );
84
+ } else if (WEXITSTATUS (ret) != 0 ) {
85
+ // leaks failed to actually run correctly. Ideally we would fail
86
+ // our tests in that case, but this seems to be happening a fair
87
+ // amount, and randomly, on the ARM GitHub runners, with errors
88
+ // like:
89
+ //
90
+ // *** getStackLoggingSharedMemoryAddressFromTask: couldn't find ___mach_stack_logging_shared_memory_address in target task
91
+ // *** task_malloc_get_all_zones: error 1 reading num_zones at 0
92
+ // *** task_malloc_get_all_zones: error 1 reading num_zones at 0
93
+ // *** task_malloc_get_all_zones: error 1 reading num_zones at 0
94
+ // [fatal] unable to instantiate a memory scanner.
95
+ //
84
96
// Just log and ignore for now.
85
- XCTAssertFalse (WIFSTOPPED (ret), " Not expecting a stopped leaks" );
86
- NSLog (@" Stopped by signal %d " , WTERMSIG(ret));
97
+ NSLog (@" leaks failed to run, exit status: %d " , WEXITSTATUS(ret));
87
98
}
88
99
}
89
100
#endif
0 commit comments