Boost logo

Boost Users :

From: Kim Barrett (kab_at_[hidden])
Date: 2005-08-19 23:01:27


At 8:25 PM -0400 8/19/05, Gennadiy Rozental wrote:
> > In 1.33, the descriptive text is printed to std::cerr
>
> I think you are mistaken. Log entries by default should appear in std::cout.

Oh drat! The test case in question is announcing failure via an
assert(). That's where the unwanted output to std::cerr is coming
from. Sorry for the bogus report.

> > Now, I never really liked redirecting stderr to a file in order to
> > capture the report. What if something in the test program were to
> > write to stderr? (Which is exactly what is happening now.) I see that
> > there is now (in 1.33) a mechanism for setting the stream used by the
> > report generator (boost:unit_test::results_reporter::set_stream()).
> > But after spending the last couple of days pouring over the
> > documentation and sources for Boost.Test, I have no idea where I
> > would put a call to that function that doesn't involve patching the
> > Boost.Test sources. There doesn't seem to be a place to insert such
> > user code, at least not that I can find. Have I overlooked something,
> > or is this really a hole in the present design / implementation?
>
> There several thing you could do:
>
> 1. Check your redirection. Log should appear in std::cout. While report
> should appear in std::cerr
> 2. You could set a --log_level=nothing (witch is a good idea for automated
> test runners anyway) and no log entries will appear

My test runner allows the log level to be specified. When running it
by hand (rather than from a chron job or the like), it can be helpful
to see the log information go by on the screen, both from a progress
reporting point of view, and also for immediate error context.

> 3. You could redirect log and/or report streams. Put configure testcase as a
> first one in a module:
>
> BOOST_AUTO_TEST_CASE( configure )
> {
> boost::unit_test::results_reporter::set_stream( report );
> boost::unit_test::unit_test_log::set_stream( log );
> }

Eew! What if somebody decides to use the new random order feature of
the test framework? I guess this is a usable workaround for now, but
I really think there needs to be some capability to insert user code
into the process in a more controlled fashion.


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