Subject: Re: [boost] [test] [build] best practices for looking up data files from test executables
From: Raffi Enficiaud (raffi.enficiaud_at_[hidden])
Date: 2017-11-14 10:28:44
Le 13.11.17 à 22:17, Stefan Seefeld via Boost a écrit :
> On 13.11.2017 16:06, Steven Watanabe via Boost wrote:
>> On 11/13/2017 01:54 PM, Robert Ramey via Boost wrote:
>>> Hmm - I do this in serialization library. My believe is that the tests
>>> are run while the current directory is set to the test directory.
>> Boost.Build never changes the current directory.
>> If you run the tests from the test directory, then
>> this will work. If you run them from somewhere else
>> (say $BOOST_ROOT/status), then it won't.
> Ah, but the cwd surely differs depending on whether I run `.../b2` from
> the boost root directory, within the project root directory or the
> project test/ subdirectory, doesn't it ? How can I make the test
> executable find the data directory independently of where I call
> `.../b2` from ? I believe this is where a command-line argument would
> help, but accessing that from within the boost::test machinery seems
> tricky, to say the least.
For the boost.test part:
you can pass custom arguments after the -- on the command line.
> (I wouldn't mind not being able to run the tests from within the `test/`
> subdirectory, but I most definitely do want to run it from the project
> root dir, and others likely want to run it from the boost root, so there
> are at least two use-cases that require supporting.)
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk