Re: Run iOS unit tests from instruments w/o Xcode
Re: Run iOS unit tests from instruments w/o Xcode
- Subject: Re: Run iOS unit tests from instruments w/o Xcode
- From: email@hidden
- Date: Wed, 23 Apr 2014 15:14:24 -0700
I tried that, both by sleeping and simply breaking in applicationDidFinishLaunching, but the test run finishes with a huge number of test classes still in memory. With the break point I could attach instruments to the running process, but that feels like a hack.
As best I can tell there is a static array that holds a list of all the test classes in a given run / suite. This array never appears to deallocate and as a result of some sloppy tearDown implementations we’re leaving a lot of junk in memory.
After the test run nearly all of my test classes are stuck in memory with an allocation history like so:
# Event Type ∆ RefCt RefCt Timestamp Responsible Library Responsible Caller
0 Malloc +1 1 00:04.401.385 XCTest +[XCTestCase testCaseWithInvocation:]
1 Autorelease 00:04.401.389 XCTest +[XCTestSuite testSuiteForTestCaseClass:]
2 Retain +1 2 00:04.401.394 XCTest +[XCTestSuite testSuiteForTestCaseClass:]
3 Retain +1 3 00:04.401.463 XCTest -[XCTestSuite addTest:]
4 Retain +1 4 00:04.444.943 XCTest -[XCTestSuite(XCTestProbeExtensions) removeTestsWithNames:]
5 Release -1 3 00:04.464.960 XCTest +[XCTestProbe specifiedTestSuite]
6 Release -1 2 00:04.513.404 XCTest +[XCTestProbe specifiedTestSuite]
7 Release -1 1 00:04.513.405 XCTest +[XCTestProbe specifiedTestSuite]
8 Retain +1 2 00:04.529.744 XCTest +[XCTestRun testRunWithTest:]
9 Retain +1 3 00:04.539.649 WealthfrontTests -[OCMockRecorder andCall:onObject:]
10 Release -1 2 00:04.542.602 WealthfrontTests -[OCMockRecorder dealloc]
11 Release -1 1 00:04.925.520 XCTest -[XCTestSuiteRun dealloc]
Cheers.
Nick
On Apr 23, 2014, at 8:33 AM, Joar Wingfors <email@hidden> wrote:
> Hi Nick,
>
> Here's something to try:
>
> - Add a sleep() to your test
> - Run the test from Xcode
> - While still sleeping, attach with Instruments
>
> Would that work in your case?
>
> Joar
>
>
> On 22 apr 2014, at 23:34, email@hidden wrote:
>
>> Is this possible?
>>
>> It seems like I should be able to set the appropriate DYLD / XCInjectBundle environment variables and run it without Xcode.
>>
>> Reason I ask is I’m trying to track down high memory usage during our test run. We’re running out of memory on iPod touches trying to run the tests.
>>
>> Thanks.
>>
>> Nick
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Xcode-users mailing list (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>>
>> This email sent to email@hidden
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden