Boost logo

Boost :

Subject: [boost] [test] [build] best practices for looking up data files from test executables
From: Stefan Seefeld (stefan_at_[hidden])
Date: 2017-11-13 20:31:32


Hi there,

I'm trying to write a test that needs to access a data file. As I'm
surely not the first wanting to use external data in my tests, I wonder
whether there are established "best practices" or idioms when using
Boost.Build and Boost.Test.

My first attempt was to compute the relative path using the test
source's `__FILE__`, until I realized the path was invalid due to the
build logic moving executables before running them. Then I considered
using a command-line option to point at the data directory, but that
seems quite involved when using boost::test (and BOOST_TEST_MODULE)...

Any suggestions for how to approach this ?

Thanks,

Stefan

-- 
      ...ich hab' noch einen Koffer in Berlin...
    

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk