Boost logo

Boost-Build :

Subject: Re: [Boost-build] compile or run tests
From: Vladimir Prus (ghost_at_[hidden])
Date: 2010-04-13 15:51:04


Paulo Márcio Figueiredo Alves wrote:
> Hi everyone,
>
> I'm trying to find a way to either compile my tests or, if the user
> pass --run, run them. But I've been unsuccessful until now. Here is what
> I tried:
>
> jamfile.jam:
>
> test-suite unittest_run : [ run $(files) : $(args) : : :
> unittest_myproject ] ;
> test-suite unittest_compile : [ compile $(files) : : unittest_myproject ] ;

This defines two different metatargets named 'unittest_myproject' -- one is 'run'
and another 'compile'. Since there's nothing to make one of them preferred to
another in some cases, you get ambiguity...

> error: No best alternative for myproject/unittest_myproject
> next alternative: required properties: (empty)
> matched
> next alternative: required properties: (empty)
> matched

.. as reported here.

>
>
> I tried this too:
>
> jamfile.jam:
> local method = compile ;
> if --run in $(ARGV)

This actually won't read ARGV, because ARGV is defined in the global
module, and each Jamfile is a separate module. I suggest you use

        import option ;
        local run = [ option.get run : : true ] ;

instead

> {
> method = run ;
> }
> test-suite unittest : [ testing.make-test $(method) : $(files)
> /gt/$(PROJ_NAME) : $(requirements) : unittest_$(PROJ_NAME) ] ;
> explicit unittest ;
>
> project-root.jam:
> build-project myproject//unittest ;

This should work. What is the exact and complete error you get?

- 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