Boost logo

Boost-Build :

Subject: Re: [Boost-build] Jamfiles for unit tests
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2009-10-15 13:55:20


AMDG

Boris Schaeling wrote:
> 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).

Try adding <define>BOOST_ALL_NO_LIB to the project requirements.

> 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)?

You don't need test-suite. The preferred way to write tests is

run mytest.cpp ;

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