I have an app in Xcode, and also Unit Tests. I got the following error in console when I run my Unit Tests (Project -> Test).
malloc: *** error for object 0x600000490e50: Invalid pointer dequeued from free list
*** set a breakpoint in malloc_error_break to debug
I know there is memory management bug in my app, and I am trying to work on that. But the problem came:
I know how to run my app with instrument, which is opening instruments and select simulator then installed app. But I cannot find a way to run my Unit Test in instrument. I tried to add my Unit Test to the scheme, but it didn't seem to work.
Hope some one could help me with this. Please note that I am not asking help for how to solve this malloc error, instead, I just wanna figure out a way to run my Unit Test with the instrument tool. Then I can deal with the error myself.
Thanks in advance.
In "Test Navigator" right click on a test target, test class or test case. From the context menu select "Profile ...":
Related
I recently added a UI Testing target to our existing project (which already has an iOS app target and a couple of other testing targets). Everything is working as expected and UI tests run without problems, but if a test fails the errors are never displayed in the file they occur and the Test Report shows them at <unknown>:0 while the Issue Navigator shows them at <unknown>:
It does mark the correct test as failed, but doesn't shown an error inside the editor. I looked through the build settings but couldn't find anything out of the ordinary.
Naturally, this makes debugging the tests much more annoying and harder. The usual clean/derived data/xcode restart magic hasn't done anything.
Update: After investigating further, it turns out that this is NOT a problem for assertion failures, which show up correctly.
I was looking for smart way for always automatically run unit test before start archiving. The idea is that if I start all process (by clicking on archive button or by doing something else) unit test will start running. If unit test succeed, archive process will be started, otherwise not. I know it is nor difficult to do that with using Jenkins, etc. but I would like to have simple config/scheme in Xcode which will do the job.
Has anyone some experiences with that?
Select you scheme and go to edit scheme and select "Build".
Check mark Archive for Unit test case target as shown in below image.
Seems like it's just one setting called "Test after build" in Xcode. Someone posted a blog about it.
I am doing an Max OS X terminal project. After I am done with the implementation I wanted to try try unit test. So I created a test target and set the target to be the one that I want to test. I wrote some simple test cases but it tells the link error ""_OBJC_CLASS_$_SomeClassUnderTest", referenced from:
objc-class-ref in SomeTest.o"
I looked at link
so first of all, why the error happened? I mean apple's official document does not mention anything about bundle loader or whatsoever, why I have to do that? there is something wrong with my original config or something? the linking should go the executable file? or it should go to static library file? but where to find that for testing and how to reference that?
and now the issue about linking issue is gone. but I got test fail even if I do "XCTAssertTrue(1==1,"")"! and I do not see any issue generated saying tests not pass or pass, just after build succeed there is a message saying test failed? why is this so?
This is a bug in Xcode and is corrected in version 5.1 . When using the simulator, tests can sometimes show the message Test target [test name] encountered an error (Test process exited with code -1)
See Xcode release notes for official details:
enter link description here
I'm having many issues with unit testing in XCode 5 and want to verify if anybody else if having the same problems (and any possible solutions...) I'm using the Kiwi framework developing for ios7 and its a new project therefore is using XCUnit underneath. I'm on a 2011 macbook air on OSX 10.8
The first time I run a test on startup, it runs all tests, even if I only select one case/test class - it even runs all the disabled ones.
Upon adding new unit tests, there is ~1/3 chance that XCode crashes on running all tests.
Clicking on failed unit tests very rarely takes me to the failed unit tests. It acts as if the code has been deleted.
When unit tests have been fixed, errors are often left over both in the issue navigator and in the editor however test is now reporting to succeed.
Upon successful running of all unit tests Xcode often reports that Tests have failed however all show as successful in the navigator.
Unit tests quite regularly get 'stuck' and execute forever. Its then impossible to run/build anything else until have restarted xcode.
Anybody with a similar setup having the same issues? Any solutions? What a bloody mess.
It seems that Xcode 5.1 (DP) will solve your issues.
Yes I get similar problems, also using Kiwi. No idea if its Kiwi related, but certainly I experience crashes when running unit tests, perhaps about 1 in 5 runs, and more often if the program hits a breakpoint and I run the tests again with Cmd-U.
I haven't been using the 'test single' option, so can't comment there.
The errors left over problem appears to be generic to unit tests, not just Kiwi. If you delete the block that contains the left over error, wait a few secs for Xcode to recompile in the background and paste it back it, you'll get rid of it. Or exit and restart Xcode if you have a bunch of them.
It used to work fine but now I get this message when loading a certain scene and then the APP crashes.
2012-12-01 18:33:55.104 AppName[9561:707] cocos2d: CCSpriteFrameCache: Trying to use file 'art1-hd.png' as texture
I have no idea on where to start debugging this. Is there a way to get a more precise error message to understand why this happens?
Btw, I have changed my code signing identity to developer and XCode doesn't yet give me any trace of it on the console other than the plain message above. I checked as well the device logs on the Xcode-Organizer section but no trace.
I whish there was something like in Java + Eclipse, where I could get a precise STACKTRACE of where the crash happened.
Any suggestion on how to get a precise stacktrace (E.g. with function name generating the crash)?
PS: I have set strip debug symbols to "NO" in DEBUG, and to "YES" in Release, but I am builing on my own test iPod and hence I think it is automatically build for "Debug" (the section says build for running and testing which is confusing as the project settings allows only debug and release). But I think the problem is not here.. but in the issues above before the PS:
EDIT: If I look into the debug navigator I don't see any stacktrace of methods, as I want, but just threads.. I need to figure out how to use the global exceptions.
I have no idea on where to start debugging this.
You have the cocos2d source code. I would start there.
Search for "trying to use file" in CCSpriteFrameCache to understand what the cause of this message is (which I agree is confusing, why shouldn't you use that file?).
As for the stack trace, it's available as soon as you add a global exception breakpoint. If the breakpoint triggers in OpenAL code make sure to set it to catch only Objective-C exceptions.