Re: Target setup for unit testing (using cppunit)
Re: Target setup for unit testing (using cppunit)
- Subject: Re: Target setup for unit testing (using cppunit)
- From: Stefan van den Oord <email@hidden>
- Date: Mon, 28 Nov 2005 10:49:00 +0100
Hi guys,
Thank you all very much for your help! With your combined hints I was
finally able to figure it out. When I needed to take care of the last
step, namely loading the test bundle into memory from my source code
(I hadn't realized the need before)
(<http://developer.apple.com/documentation/CoreFoundation/Conceptual/CFBundles/Tasks/loading.html>
describes how to do it), I realized that this was a very Mac-specific
way of doing it, whereas I want to be able to run my unit tests on
Linux and other platforms as well.
Therefore, I decided to take this direction:
- I created a new dynamic library target that contains only the test
code and has the linker flag "-undefined dynamic_lookup". I don't know
if that works on Linux; if not I will use "-undefined suppress" there.
The -undefined is to get rid of the linker errors; the BUNDLE_LOADER
trick you guys mentioned doesn't work for normal dynamic libraries.
(Question: is there an equivalent to BUNDLE_LOADER for dynamic
libraries?)
- I just linked my application to the test lib by using the linker
flag "-lTestLib".
- I added a new command line option to my application that runs the unit tests
- I added a custom shell script phase to my application target, which
sets DYLD_LIBRARY_PATH to $BUILD_PRODUCTS_DIR and then call my
application with the --test option.
- I added the test lib to the list of targets my application target depends on
Hurray, my tests are run automatically after every build now!
By the way, this way of doing it by just linking to a dynamic library
seems simpler than using a bundle. What is the difference, why would
you want to use a bundle for this?
Anyway, thanks again for your help!
Best regards,
Stefan
_______________________________________________
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