Boost logo

Boost Users :

Subject: Re: [Boost-users] testing command-line interface using Boost.Test
From: Olaf Meeuwissen (olaf.meeuwissen_at_[hidden])
Date: 2011-10-03 02:02:06

Gennadiy Rozental <rogeeff_at_[hidden]> writes:

> Olaf Meeuwissen <olaf.meeuwissen <at>> writes:
>> Gennadiy Rozental <rogeeff <at>> writes:
>> > Olaf Meeuwissen <olaf.meeuwissen <at>> writes:
>> >> My only problem now is that I have no clue how to get at or where to
>> >> look for the execution_monitor instance that I would need to change.
>> >
>> > You do not need execution_monitor instance. Yo ucan spacify runtime parameter
>> > using either environment variable or CLA --catch_system_error=no
>> True, but I would like to do this only for those tests that need it.
>> That is, only for those tests that use the test fixture that provides
>> the my_system() functionality. So if I have
> 1) I'd personally split this module in two and run one with and another without
> catch_system_errors

I have considered that as well, but it seems a bit awkward to split
tests into two modules just because some of them for success and some of
them for failure. That said, even if I were to split them into two
modules, I'd still want a programmatic interface that allows me to set
this in the C++ sources. I'm using automake's `check` infra-structure
and specifying command-line arguments or environment variables on a per
module basis is a pain.

> 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.

  boost::unit_test::unit_test_monitor.p_catch_system_errors.set (true);
  boost::unit_test::unit_test_monitor.p_catch_system_errors.set (false);

The results I'm getting for tests for the coreutils `false` and `true`
utilities look like:

  Running 2 test cases...
  Entering test suite "src::core"
  Entering test case "test_false"
  Running: false
  unknown location(0): fatal error in "test_false": child has exited; pid: 12822; uid: 1000; exit value: 1
  process.hh(117): last checkpoint: Running: false
  Leaving test case "test_false"
  Entering test case "test_true"
  Running: true info: check run ("true", 0) passed
  Leaving test case "test_true"
  Leaving test suite "src::core"

Looks like something is catching and acting upon system errors before
unit_test_monitor gets a chance to do so. I think this happens in
execution_monitor::catch_signals() but am not sure.

Any hints would be appreciated. FTR, still using the Debian package for

Thanks in advance,

Olaf Meeuwissen, LPIC-2           FLOSS Engineer -- AVASYS CORPORATION
FSF Associate Member #1962               Help support software freedom

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at