|
Boost Users : |
Subject: Re: [Boost-users] testing command-line interface using Boost.Test
From: Olaf Meeuwissen (olaf.meeuwissen_at_[hidden])
Date: 2011-10-04 01:24:09
Gennadiy Rozental <rogeeff_at_[hidden]> writes:
> Olaf Meeuwissen <olaf.meeuwissen <at> avasys.jp> writes:
>
>> > 2) You can use boost::unit_test::unit_test_monitor singleton
>> > to manipulate these
>> > options at runtime. You'll have set and revert these values in fixture
>>
>> I tried this but without any effect. Either alternative below in the
>> fixture's constructor yields the same result.
>
> Yes. Fixture is part of test case and it's too late. You can probable switch it
> in "fake" test case placed before those which require catch_system_error=false
Tried that but that doesn't do the trick either. Of course, even if it
worked, it would completely screw unit test statistics and it's so ugly
that I be ashamed of publishing the code ;-)
Also tried with a test suite shared fixture but no such luck that way
either. Besides test suite shared fixtures are supplanted by the
fixture of any BOOST_FIXTURE_TEST_CASEs in that suite.
# I tried with regular auto-test cases too and made sure the suite's
# fixture took effect.
My guess is that the execution_monitor gets a go at the system error
before the unit_test_monitor gets a chance and I would really have to
modify the former's p_catch_system_error attribute to make it work.
Unfortunately, execution_monitor is not a singleton and there does not
seem to be a way to access it from something that is (like framework,
for example).
Thanks for the help so far. I'm still open to suggestions but it looks
like I'll be going with two test runners, each with their own main so
that can set BOOST_TEST_CATCH_SYSTEM_ERRORS before unit_test_main().
Sincerely,
-- Olaf Meeuwissen, LPIC-2 FLOSS Engineer -- AVASYS CORPORATION FSF Associate Member #1962 Help support software freedom http://www.fsf.org/jf?referrer=1962
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