Boost logo

Boost-Build :

Subject: [Boost-build] Jamfiles for unit tests
From: Boris Schaeling (boris_at_[hidden])
Date: 2009-10-15 13:45:07


What are the recommendations to write Jamfiles for unit tests? I wonder as
I tried something like this first:

----------
import boost ;
import testing ;

boost.use-project ;
project : requirements <library>/boost//test ;
unit-test mytest : mytest.cpp ;
----------

The linker (MSVC) complains it can't find the library (eg.
libboost_test-vc90-mt-gd-1_39.lib). There seems to be something wrong with
the target /boost//test (it exists but wrong files are looked up).
Wondering how the unit tests of the Boost libraries work I found the
test-suite rule. I rewrote my Jamfile to:

----------
import boost ;
import testing ;

boost.use-project ;
project : requirements <library>/boost//filesystem ;
test-suite mytest : [ run mytest.cpp ] ;
----------

This works. I have to reference another Boost library (like
/boost//filesystem) but then the Boost.Test libraries are automatically
found and linked (not with toolsets though which don't support
auto-linking).

So what's the difference between unit-test and test-suite? Anything
recommended because the other is deprecated? And how do I refer to the
Boost.Test libraries (all the other targets like /boost//filesystem work)?

Boris


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