Boost logo

Boost-Build :

Subject: Re: [Boost-build] unit-test rule with different launcher
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2013-09-29 19:47:49


AMDG

On 09/29/2013 04:24 AM, lepere renaud wrote:
> I am using boost unit-test framework and bbv2. I would like to launch
> the same test executable twice with different arguments/launcher (mostly
> --log_format=XML and a thin python script to generate a report).
>
> My jamfile is something like this
>
> alias utf : /boost//unit_test_framework/<link>shared ;
>
> unit-test run_test : runner.cpp mytest.cpp .//utf ;
> unit-test report_test : runner.cpp mytest.cpp .//utf :
> <testing.launcher>pylauncher ;
>
> But when i launch bjam this leads to an error
>
> error: Duplicate name of actual target: <p...>runner.o
> error: created from ./run_test
> ..
> error: created from ./report_test
> error: added properties: <testing.launcher>pylauncher
>
> Why the testing.launcher property have an influence on how i build the
> exectuable ?
>

Boost.Build doesn't have a way to identify which
features are relevant to each actual target.

> The only workaround i found was to create an obj target for all the .cpp
> obj runner : runner.cpp ;
> obj test_angle : test_angle.cpp ;
> and then :
> unit-test run_test : .//runner .//test_angle .//utf ;
> unit-test report_test : .//runner .//test_angle .//utf :
>
> Is there a more elegant / better way to do it ?
>

You could build the executable separately, instead
of building the object files separately:

exe run_test.exe : runner.cpp test_angle.cpp utf ;
unit-test run_test : run_test.exe ;

In Christ,
Steven Watanabe


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