Boost logo

Boost :

From: Rene Rivera (grafik.list_at_[hidden])
Date: 2004-10-07 21:01:41


Robert Ramey wrote:

> Now - out of curiosity, most of the rule are of the form:
>
> rule test-bsl-run_polymorphic_archive ( test-name : sources * )
>
> which suggests to me that I could just use:
>
> test-suite serialization :
> [ test-bsl-run_files test_level_class_info_load
> test_level_class_info_save ]
>
> Which would make ...load dependant on ...save. Or this is this answered by
> the following:

Not sure it answers it, as I'm not sure I understand your question...

>>That last DEPENDS makes the directory for the part 2 depend on the
>>completion of part 1. You may ask why the directory and not the test
>>itself? Strangely it's because to properly chain the tests you need to
>>make the earliest step of the second test depend on the latest part of
>>the next test. And directories are the only sure thing that you can know
>>a test needs first.

...But the what you changed it to:

DEPENDS test_class_info_load_xml_warchive :
test_class_info_save_xml_warchive ;

Doesn't work. When I run those tests now the load runs before the save.
So let me try and explain why.

When I do the testing I run "bjam ... test". The "test" target is a
fake/symbolic target that depends on all the individual tests (the
*.test) files/targets. Also the "test_class_info_load_xml_warchive" etc.
targets are fake targets that depend on the corresponding *.test target.
Hence by running "bjam ... test" I skip all the nice extra dependency
information you put in :-( It looks like so:

test_*_load_*archive --> *.test
   \--> test_*_save_*archive --> *.test
test --> *.test -> *.run -> *.exe, *.obj, etc -> *.test directory ...

And all but the fake and directory targets really look like this, which
is what the run rule returns:

<@boost!libs!serialization!test\test_array_xml_archive.test\cw\debug\runtime-link-static\threading-multi>test_array_xml_archive.test

Confused yet?

So the next obvious ;-) idea is to use the *.test targets as dependencies:

DEPENDS <variant-path-here>test_class_info_load_xml_warchive.test :
<variant-path-here>test_class_info_save_xml_warchive.test ;

Unfortunately that doesn't work because that doesn't prevent the
<->*.run targets from executing in whatever order, and those are the
ones that actually run the executables. Hence theoretically you could
make the <->*.run targets depend on each other, and it would work... But
the problem is that getting at those targets, that is getting the long
name with the variant info in it, is hard, because it changes depending
on the type of test you do. They are not all required to by *.run,
although they are for your tests.

The solution I suggested before does the dependency:

<directory>test_*_load_*.test --> <->test_*_save_*.test

Which make that last line of the DAG above:

test --> *.test -> *.run -> *.exe, *.obj, etc -> *_load_*.test directory
-> *_save_*.test

Make sense?

PS. If you are sure you are only going to have run tests. You could do
things like:

local test-part-2 = [ test-bsl-run_files test_class_info_load ] ;
local test-part-1 = [ test-bsl-run_files test_class_info_save ] ;
DEPENDS $(test-part-2:S=.run) : $(test-part-1:S=.run) ;

-- 
-- Grafik - Don't Assume Anything
-- Redshift Software, Inc. - http://redshift-software.com
-- rrivera/acm.org - grafik/redshift-software.com - 102708583/icq

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk