zantoku / google-toolbox-for-mac

Automatically exported from code.google.com/p/google-toolbox-for-mac
Apache License 2.0
0 stars 0 forks source link

leaks is not being run for iPhone Simulator Tests #56

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
Setup GTM testing for iPhone with test code that leaks. See attached project.

What is the expected output? What do you see instead?
Expected Leaks to detect the leak. But saw this instead:

dyld: Symbol not found: _CFXMLNodeGetInfoPtr
  Referenced from: /System/Library/Frameworks/Security.framework/Versions/A/Security
  Expected in: /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
 in /System/Library/Frameworks/Security.framework/Versions/A/Security

What version of the product are you using? On what operating system?

XCode 3.2.3 with iPhone OS 4

Please provide any additional information below.

RunIPhoneUnitTest.sh sets DYLD_ROOT_PATH to the iPhoneSimulator4.0.sdk SDKROOT. 
It affects all processes running. The iPhoneSimulator4.0.sdk's CoreFoundation 
does not contain CFXML library functions, hence the crash in leaks because it 
couldn't link properly. It failed silently however.

Solution: to set DYLD_ROOT_PATH to empty before calling leaks, and fail 
immediately if leaks failed to run. Patch:

diff -r GoogleToolboxForMac.orig/UnitTesting/GTMSenTestCase.m 
GoogleToolboxForMac.patched/UnitTesting/GTMSenTestCase.m
439,440c439,441
<     = [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`;"
>        @"if [ $? -ne 0 ]; then exit 1; fi; "
>        @"echo $LeakOut | /usr/bin/sed -e 's/Leak: /Leaks:0: warning: Leak /'",

Attached TestRunIPhoneUnitTest.zip is a project that demonstrates this issue. 
Run this in XCode 3.2.3 . There are two GoogleToolboxForMac.* directories, 
symlink them to GoogleToolboxForMac to see before and after.

Original issue reported on code.google.com by nigelc...@google.com on 10 Aug 2010 at 1:03

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by thoma...@gmail.com on 11 Aug 2010 at 11:45