Boost logo

Boost-Build :

Subject: Re: [Boost-build] adding tests conditional on compiler's C++11 support
From: Edward Diener (eldiener_at_[hidden])
Date: 2016-11-10 20:50:54


On 11/10/2016 11:56 AM, Robert Ramey wrote:
> On 9/28/16 12:18 PM, Steven Watanabe wrote:
>> AMDG
>>
>> On 09/28/2016 12:34 PM, Stefan Seefeld wrote:
>>>
>>> what is the boost.build way to add a set of tests to my (Boost.Python)
>>> test suite only if the given compiler supports C++11 ? To break that
>>> down into two questions:
>>>
>>> * Is there a Boost.Build flag I can check for that indicates whether the
>>> current compiler supports C++11 ?
>>>
>>> * How can I conditionalize the adding of tests to my test suite based on
>>> that flag ?
>>>
>>
>> Try using config.requires:
>> http://www.boost.org/libs/config/doc/html/boost_config/build_config.html
>
> This is what I do and it seems to work - mostly. In particular I have
> one test test_forward_list which exposes the following problem:
>
> My test/jamfile.v2 includes
>
> [ test-bsl-run_files test_forward_list : A : : [ requires
> cxx11_hdr_forward_list ] ] # BOOST_NO_CXX11_HDR_FORWARD_LIST
> [ test-bsl-run_files test_forward_list_ptrs : A : : [ requires
> cxx11_hdr_forward_list ] ] # BOOST_NO_CXX11_HDR_FORWARD_LIST
>

Did you add:

import path-to-config-lib/checks/config : requires ;

at the top of your test/jamfile.v2 where the usually correct path would be:

import ../../config/checks/config : requires ;

>
> the test_forward list contains
> #ifdef BOOST_NO_CXX11_HDR_FORWARD_LIST
> #error "cannot run this test
> #endif
>
> One particular case illustrates the problem. See the test matrix
> http://www.boost.org/development/tests/develop/developer/serialization.html
> the test columns Sandia-darwin-c++11 and Sandia-darwin. Also of
> interest is the adjacent column timber-macOS. All tests are shown being
> run with compiler version 4.2.1. (I'll leave aside the question as what
> difference the clang part of the compiler name means.
>
> One column shows test_forward... failing with the above test. It gets
> the value of BOOST_NO_CXX11_HDR_FORWARD_LIST from the config file. While
> the bjam processor gets the "requires" from ...? It seems they are not
> getting these from the same source and that they are getting different
> values. In particular it looks like Jam is testing for the existence of
> <forward_list> which my program is checking config.hpp and that these
> are out of sync.
>
> I don't know what to do about other than suppress the check. I think
> it's a mistake somewhere but I can't see where it is.
>
> Robert Ramey
>
>>
>> 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