Re: otest -- only useful for bundles?
Re: otest -- only useful for bundles?
- Subject: Re: otest -- only useful for bundles?
- From: James Bucanek <email@hidden>
- Date: Tue, 22 Nov 2005 09:40:52 -0700
Chris Hanson wrote on Monday, November 21, 2005:
>On Nov 6, 2005, at 4:49 PM, James Bucanek wrote:
>> - When testing a framework or dynamic library, only the code for
>> the tests are compiled into the unit test bundle. The otest is
>> executed to load both the unit test bundle and the framework to be
>> tested and execute the tests.
>
>This is just slightly incorrect. When otest is used to run the tests
>in a dependent unit test bundle, it loads just the unit test bundle
>exactly as it does with an independent unit test bundle. Because the
>dependent unit test bundle links against the framework or dynamic
>library it contains tests for, it is loaded as a prerequisite for the
>unit test bundle automatically. There's no involvement by otest in
>this; it's all handled by the dynamic loading machinery. (All of
>this applies to CPlusTestRig as well.)
<and>
>> When configuring a dependent unit test to test a framework or
>> dynamic library, how should the target be configured? How does
>> otest know which frameworks and libraries are being tested?
>
>As I described above, neither otest nor CPlusTestRig has this
>knowledge, nor do they have any need for it. It's handled
>automatically by the dynamic loader, since a dependent test bundle is
>linked against the target framework or library.
So to answer the framework/library question: A dependent unit test bundle that tests a framework or library should be configured exactly as one would configure any client or application that used that library. (i.e. add the library to the target, include the correct headers, etc.)
>> - When testing an application, the code for the tests are compiled
>> into the unit test bundle. When it come times to execute the tests,
>> special DYLD_... environment variables are set so that the dynamic
>> linker links the target executable to special unit test frameworks
>> and the unit test bundle (which contains the actual tests). When
>> the application begins executing, the "injected" bundle/framework
>> intercepts the application's execution, runs the tests, and exits.
>
>Again, just slightly incorrect. Special DYLD_ environment variables
>are used to cause an additional framework to be loaded into the
>application when executed. When that framework is loaded, it looks
>for the specified test bundle. The test bundle (or the test
>framework it links against) intercepts the application's execution,
>runs the tests, and exits.
OK -- and for my personal edification -- the sequence is this:
1) Application is loaded.
2) DYLD_ environment variables cause a special testing framework to be loaded in addition to the normal dynamic libraries the application was linked to.
3) When initialized, the testing framework looks for, and loads, the test bundle into memory as well.
4) Application and test bundle are both initialized (dynamically linked, static initializers run, etc.)
5) Initialization of the test bundle is used to intercept the application's normal execution.
6) The test bundle then runs all tests and exits.
James
--
James Bucanek
_______________________________________________
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