Boost logo

Boost-Build :

Subject: Re: [Boost-build] help with v2 build system
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2008-12-02 20:55:49


AMDG

Jonathan Brannan wrote:
> I'm working to upgrade our boost and our current buildsystem/Jamrules.
>
> I'm stuck trying to figure out how to do one of our test coverage
> rules. In simple terms we do this:
>
> before all tests arerun, execute an action (initialize)
> before each test, execute an action specific to that test (zero out)
> after each test is run, execute another action specific to that test
> (gather stats from that output stats)
> after all tests are run, execute an action (generate html)
>
> I also want to assure that in the testcov build mode, unit tests are
> always run regardless of changes.
>
> I have figured out how to create a new variant of testcov and set the
> proper cxxflags/cflags/ldflags, but I can't figure out the new
> dependency/generation/type chaining.

Does the attached Jamfile work?

In Christ,
Steven Watanabe

import notfile ;

actions init
{
    echo initializing... >$(<)
}

make initialize : : @init ;

all-tests = ;

actions generate-xml
{
   echo Creating xml from $(>) >$(<)
}

variant testcov : debug ;

actions do-nothing
{
}

alias rebuild-in-testcov ;
notfile rebuild-in-testcov : @do-nothing : : <variant>testcov ;
explicit rebuild-in-testcov ;

rule run-test ( sources + : args * : input-files * :
                requirements * : target-name ? :
                default-build * )
{
    requirements += <dependency>rebuild-in-testcov ;
    local test = [ run $(sources) : $(args) : $(input-files) :
                   $(requirements) : $(target-name) :
                   $(default-build) ] ;
    local test-name = [ $(test).name ] ;
    make $(test-name).xml : $(test) : @generate-xml ;
    all-tests += $(test-name).xml ;
}

run-test a.cpp ;
run-test b.cpp ;

actions generate-html
{
    echo Generating html from $(>) >$(<)
}

make all-tests.html : $(all-tests) : @generate-html ;





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