Boost logo

Boost-Build :

Subject: Re: [Boost-build] several small question
From: George Georgiev (george.georgiev.sf_at_[hidden])
Date: 2012-03-23 16:14:43


Hi,

If I have this rule called from different projects:

rule performance_test ( name : libraries * : properties * )
{
    unit-test $(name)-performance_test
      :
        [ glob *-gtest.cpp ]
        [ glob *-performance-gtest.cpp ]

        $(libraries)
        prebuilt_gtest
      :
        <testing.arg>--gtest_output=xml:$(TOP)/../intermediate/performance-reports/$(name).xml
        <testing.arg>--gtest_filter=*.PERFORMANCE*
        <variant>release:<testing.arg>--gtest_repeat=10
        $(properties)
      ;

    explicit $(name)-performance_test ;
}

in the jamfiles I have
alias performance_test
  :
   projectA//projectA-performance_test
  ;

then in the root I have

alias performance_test
  :
   projectA//projectA-performance_test
   projectB//projectB-performance_test
  ;
explicit performance_test ;

This seems to work ok even with a little bit extra work for maintaining this:

I have two more things to do if you can help me with:
1. How to distinguish from compile and execute of the tests.
I would like to be able to say: b2 ... performance_test which will
mean they to be compiled and run, and also
performance_test_compile_only which obviously will mean they to be
only compiled, but not executed.

2. How I can ensure working directory from which the tests will be
executed. Right now it is the current folder from where I am calling
b2. My performance test load external data (files) and it will be
easier to write them if they are always executed from the same place
if I am building from the root or a sub directory.

Thanks,
George

On Tue, Mar 20, 2012 at 10:21 PM, George Georgiev
<george.georgiev.sf_at_[hidden]> wrote:
> Thank you Volodya,
>
>
> On Tue, Mar 20, 2012 at 10:05 PM, Vladimir Prus <ghost_at_[hidden]> wrote:
>>
>> George,
>>
>>
>>
>> On 21/03/12 06:52, George Georgiev wrote:
>>>
>>> Hi,
>>>
>>> I have a few questions that I can not find in the documentation.
>>>
>>> 1. How to list all available targets, say b2 list
>>
>>
>> There is no such way presently.
>>
>>
>>> 2. How to create a custom group of targets, say unit-test,
>>> integration-test and performance-test. When I create a test project I
>>> want to make something like:
>>>
>>> DEPENDS unit-tests : testa ;
>>>
>>> then when I run b2 .... unit-tests it to compile and execute all unit
>>> tests, etc with integration-test and performance-test
>>
>>
>> You need to use the 'alias' metatarget. E.g.
>>
>>        alias unit-tests : testa testb ;
>>
>> Note that metatarget names are local to Jamfile, so
>>
>>        b2 unit-tests
>>
>> from a different directory will not find it, unless that one directory
>> also has a metatarget called 'unit-tests'.
>>
>>
>>>
>>> 3. May I prioritize targets (group of targets). I have relatively big
>>> project - usually I build with -q. Unfortunately if I break a test
>>> even for a very low level library its test could be executed after
>>> most of the dependent projects are already compiled and linked - which
>>> is pointless. I would like to set the unit-tests targets to be with
>>> priority.
>>> Note I do not want to make fake dependencies to accomplish this. Fake
>>> dependencies may result in building things that I do not care about if
>>> I specify a single target.
>>
>>
>> I don't think there's a way to do this. By default, targets are built in
>> the reverse order of modification time -- that is, most recently modified
>> sources are built first (see make0sort in make.c).
>>
>>
>>> 4. How to dump a whole object with all the data it has. echo $(object)
>>> outputs just its name.
>>
>>
>> There's no way, each object has to implement printing by itself.
>>
>>
>>> 5. How to make force only targets. I would like my integration-test
>>> and performance-test to be compiled and executed only if I specify
>>> this explicitly. Can I make if I run the build without target
>>> arguments some of the targets to be omitted.
>>
>>
>> Does 'explicit' (explained in docs) help here?
>
> Yes, it is. I missed this one.
>
>>
>> HTH,
>> Volodya
>> _______________________________________________
>> Unsubscribe & other changes:
>> http://lists.boost.org/mailman/listinfo.cgi/boost-build


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