Boost logo

Boost-Build :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2008-03-27 02:35:10


Alex Khassapov wrote:

> Vladimir Prus <ghost <at> cs.msu.su> writes:
>
>>
>> Khassapov, Alex wrote:
>>
>> > Hi,
>> >
>> >
>> >
>> > I wonder if there's a rule I could use to run unit tets which don't
>> > require source, i.e. simply execute python scripts?
>>
>> No. unit-test assumes that the sources is either EXE, or something
>> convertible to EXE. Making unit-test run whatever is passed to it
>> will mess up the current behaviour.
>>
>> However, to get what you want you can:
>>
>> 1. Just use the 'make' rule.
>> 2. Use the following:
>>
>> import type ;
>> import generators ;
>>
>> type.register UNIT_TEST_RAW : UNIT_TEST ;
>> generators.register-standard testing.unit-test : : UNIT_TEST_RAW ;
>>
>> unit-test-raw something : script.py ;
>>
>> (This presently assumes that "." directory is in PATH)
>>
>> Does this help?
>>
>> - Volodya
>>
>> _______________________________________________
>> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost-build
>>
>>
>
> Thanks Volodya,
>
> I'll try it.
>
> I was actually thinking of using RUN_OUTPUT type from testing.jam to copy "run"
> behavior without compiling, so the output format would be the same - when test
> passes we get **passed** message.
>
> I'm just struggling to understand the flow, i.e. how and in which
> order ‘.run’, ‘.output’ and ‘.test’ files are created?
>
> Any thoughts on this?

Uhm, it's all in the source.

        generators.register-standard testing.expect-success : RUN_OUTPUT : RUN ;
        generators.register-standard testing.capture-output : EXE : RUN_OUTPUT ;

So, when you have:

        run .... ;

Boost.Build tries to build RUN type, and to do that, it has to build RUN_OUTPUT
first. The RUN_OUTPUT has extension .run. If you look at the testing.capture-output
rules and action you'll see that it always produces file with extension .output,
and then, only if program exited successfully, copies that to .run. The RUN type
has extension of .test, it is produces by expect-success rule, if the .run
is successfully produced. .test has no interesting content.

The reason there's both .run and .output is to avoid rerunning program
if it succeeded, and to retain the output for debugging if it failed.

To use RUN, you'd have to create new type, and register new generator similar to
what I've done, only using:

   generators.register-standard testing.capture-output : EXE : RUN_OUTPUT ;

as basis.

- Volodya

        

        


Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk