Boost logo

Boost Users :

From: Gennadiy Rozental (rogeeff_at_[hidden])
Date: 2007-08-14 23:42:23


"Alexander Schmolck" <a.schmolck_at_[hidden]> wrote in message
news:yfsbqda2ocf.fsf_at_gmx.net...
> "Gennadiy Rozental" <rogeeff_at_[hidden]> writes:
>>> I haven't figured out how to set things up so that I can compile
>>> individual
>>> tests to .o files and then either simply build a complete regression
>>> suite
>>> executable from them or an executable from just one (or a few) of these
>>> tests; because I don't know how to use the autoregistration facilities
>>> without ending up with multiple main()s.
> [...]
>> Define BOOST_TEST_MODULE only in single file of your multi-file test
>> module.
>
> Thanks for the help. I guess that means that I'm going to setup things so
> that
> I have a single run_tests.cpp that just looks like so:
>
> #define BOOST_TEST_MODULE test_everything
> #include <boost/test/unit_test.hpp>

Yes. You can do this.

> and only vary the make target; i.e. what I link against it (just a
> single/few
> test-file(s) during development or the complete regression suite). Does
> this
> sound sensible?

Yes it's reasonable.

> Another option might be to always build the complete regression test and
> then
> pass a string/regexp on the commandline to specify what suite/testcase(s)
> to
> run, but as far as I can tell that isn't yet supported out of the box, and
> would likely require more work than above approach, right?

Yes. It's available already in my local copy. Once I am finished with docs
I'll try to commit it into source control (I have to setuo this one as well)

> Also, from reading the docs I get the impression that it isn't (easily)
> possible to span tests suites over multiple files, unless one forgoes the
> convenience of BOOST_AUTO_TEST_CASE/SUITE -- e.g.. I can't just use
>
> //file1.cpp
> BOOST_AUTO_TEST_SUITE(foo_suite)
> [...]
> BOOST_AUTO_TEST_SUITE_END()
>
> //file2.cpp
> BOOST_AUTO_TEST_SUITE(foo_suite)
> [...]
> BOOST_AUTO_TEST_SUITE_END()
>
> to automagically either add more tests to foo_suite or create it if it
> hasn't
> been previously defined?

It's been requested recently and I implemented this as well in my local
copy. Keep an eyes open for commit ;)

Gennadiy


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net