aboutsummaryrefslogtreecommitdiff
path: root/UnitTesting
diff options
context:
space:
mode:
authorGravatar gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3>2010-08-10 17:31:35 +0000
committerGravatar gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3>2010-08-10 17:31:35 +0000
commit55f2aea8ee69c3b29a0c47c8f90e8d3d1cdac844 (patch)
tree971aa91dddc4feb0da43564b3f7af6336ae3c4d7 /UnitTesting
parenteb679833e71ba911ad40837247ed31fb8c96b50f (diff)
[Author: nigelchoi]
Fixed invocation of leaks by iPhone Simulator builds. Fail build jobs properly if leaks invocation failed. (http://code.google.com/p/google-toolbox-for-mac/issues/detail?id=56) R=dmaclach,thomasvl APPROVED=thomasvl
Diffstat (limited to 'UnitTesting')
-rw-r--r--UnitTesting/GTMSenTestCase.m14
1 files changed, 11 insertions, 3 deletions
diff --git a/UnitTesting/GTMSenTestCase.m b/UnitTesting/GTMSenTestCase.m
index 99eacef..2a644d0 100644
--- a/UnitTesting/GTMSenTestCase.m
+++ b/UnitTesting/GTMSenTestCase.m
@@ -435,13 +435,21 @@ static void _GTMRunLeaks(void) {
[exclusions appendFormat:@"-exclude \"%@\" ", exclusion];
}
}
+ // Clearing out DYLD_ROOT_PATH because iPhone Simulator framework libraries
+ // are different from regular OS X libraries and leaks will fail to run
+ // because of missing symbols. Also capturing the output of leaks and then
+ // pipe rather than a direct pipe, because otherwise if leaks failed,
+ // the system() call will still be successful. Bug:
+ // http://code.google.com/p/google-toolbox-for-mac/issues/detail?id=56
NSString *string
- = [NSString stringWithFormat:@"/usr/bin/leaks %@%d"
- @"| /usr/bin/sed -e 's/Leak: /Leaks:0: warning: Leak /'",
+ = [NSString stringWithFormat:
+ @"LeakOut=`DYLD_ROOT_PATH='' /usr/bin/leaks %@%d` &&"
+ @"echo \"$LeakOut\"|/usr/bin/sed -e 's/Leak: /Leaks:0: warning: Leak /'",
exclusions, getpid()];
int ret = system([string UTF8String]);
if (ret) {
- fprintf(stderr, "%s:%d: Error: Unable to run leaks. 'system' returned: %d",
+ fprintf(stderr,
+ "%s:%d: Error: Unable to run leaks. 'system' returned: %d\n",
__FILE__, __LINE__, ret);
fflush(stderr);
}