[test] Problem with BOOST_TEST_MESSAGE
In testing out a library with Boost.Test I want to inject informational messages that will appear in the output of the test results. When I use BOOST_TEST_MESSAGE with the correct logging level my message appears in the output if there is some sort of Boost.Test error during my tests. However if my unit test does not have a Boost.Test error my BOOST_TEST_MESSAGE does not appear. Needless to say I always want my BOOST_TEST_MESSAGE messages to always appear in the output. Is there a solution to this ?
On 5/12/2015 6:42 PM, Bjorn Reese wrote:
On 05/13/2015 12:00 AM, Edward Diener wrote:
BOOST_TEST_MESSAGE does not appear. Needless to say I always want my BOOST_TEST_MESSAGE messages to always appear in the output. Is there a solution to this ?
Add --log_level=message when you run the test.
You mean that if I add '--log_level=message' when the test is run my BOOST_TEST_MESSAGE message will always appear in the output, but if I set the environment variable: BOOST_TEST_LOG_LEVEL=message before running the test that my BOOST_TEST_MESSAGE message will only appear if there is an error in the unit test ? I thought the two ways are equivalent.
On 5/12/2015 6:42 PM, Bjorn Reese wrote:
On 05/13/2015 12:00 AM, Edward Diener wrote:
BOOST_TEST_MESSAGE does not appear. Needless to say I always want my BOOST_TEST_MESSAGE messages to always appear in the output. Is there a solution to this ?
Add --log_level=message when you run the test.
I tried that with the same result.
On 05/13/2015 02:39 AM, Edward Diener wrote:
On 5/12/2015 6:42 PM, Bjorn Reese wrote:
On 05/13/2015 12:00 AM, Edward Diener wrote:
BOOST_TEST_MESSAGE does not appear. Needless to say I always want my BOOST_TEST_MESSAGE messages to always appear in the output. Is there a solution to this ?
Add --log_level=message when you run the test.
I tried that with the same result.
Both this and the BOOST_TEST_LOG_LEVEL environment variable work fine here. I have attached a small test program; hopefully that will help you narrow down the problem. Btw, you can also set the log level at compile time: http://www.boost.org/libs/test/doc/html/utf/user-guide/test-output/log-ct-co...
On 5/13/2015 4:51 AM, Bjorn Reese wrote:
On 05/13/2015 02:39 AM, Edward Diener wrote:
On 5/12/2015 6:42 PM, Bjorn Reese wrote:
On 05/13/2015 12:00 AM, Edward Diener wrote:
BOOST_TEST_MESSAGE does not appear. Needless to say I always want my BOOST_TEST_MESSAGE messages to always appear in the output. Is there a solution to this ?
Add --log_level=message when you run the test.
I tried that with the same result.
Both this and the BOOST_TEST_LOG_LEVEL environment variable work fine here. I have attached a small test program; hopefully that will help you narrow down the problem.
I tried your program using the latest Boost.Test on the 'master' branch, and the result is the same for me. Perhaps this works for you with some previous release or perhaps this works for you with the 'develop' branch of Boost.Test.
Btw, you can also set the log level at compile time:
http://www.boost.org/libs/test/doc/html/utf/user-guide/test-output/log-ct-co...
Thanks, that helps.
On 5/13/2015 8:31 PM, Edward Diener wrote:
On 5/13/2015 4:51 AM, Bjorn Reese wrote:
On 05/13/2015 02:39 AM, Edward Diener wrote:
On 5/12/2015 6:42 PM, Bjorn Reese wrote:
On 05/13/2015 12:00 AM, Edward Diener wrote:
BOOST_TEST_MESSAGE does not appear. Needless to say I always want my BOOST_TEST_MESSAGE messages to always appear in the output. Is there a solution to this ?
Add --log_level=message when you run the test.
I tried that with the same result.
Both this and the BOOST_TEST_LOG_LEVEL environment variable work fine here. I have attached a small test program; hopefully that will help you narrow down the problem.
I tried your program using the latest Boost.Test on the 'master' branch, and the result is the same for me.
By this I meant that if their are no errors the BOOST_TEST_MESSAGE message never appears. By the "same for me" I meant that nothing has changed with your test from my original problem.
Perhaps this works for you with some previous release or perhaps this works for you with the 'develop' branch of Boost.Test.
Btw, you can also set the log level at compile time:
http://www.boost.org/libs/test/doc/html/utf/user-guide/test-output/log-ct-co...
Thanks, that helps.
On 05/14/2015 02:31 AM, Edward Diener wrote:
I tried your program using the latest Boost.Test on the 'master' branch, and the result is the same for me. Perhaps this works for you with some previous release or perhaps this works for you with the 'develop' branch of Boost.Test.
Yes, I tested it with the develop branch and the 1.55 release. I have not tried the master branch (or the 1.58 release.)
On 5/14/2015 2:35 AM, Bjorn Reese wrote:
On 05/14/2015 02:31 AM, Edward Diener wrote:
I tried your program using the latest Boost.Test on the 'master' branch, and the result is the same for me. Perhaps this works for you with some previous release or perhaps this works for you with the 'develop' branch of Boost.Test.
Yes, I tested it with the develop branch and the 1.55 release. I have not tried the master branch (or the 1.58 release.)
I tried the current 'develop' branch of Boost.Test and still got the result reported in my OP. I can live with it, since the vast majority of the times I only need to see the BOOST_TEST_MESSAGE output when a test fails. But there is clearly something different in our environments when your result is different than mine. I wish I knew what it was, but it is not so important that I cannnot use BOOST_TEST_MESSAGE to trace through my code when something is wrong.
Edward Diener
I tried the current 'develop' branch of Boost.Test and still got the result reported in my OP. I can live with it, since the vast majority of the times I only need to see the BOOST_TEST_MESSAGE output when a test fails
BOOST_TEST_MESSAGE has nothing to do whatsoever with assertions (failing or not). This is a feature of the log subsystem. Do you observe this with bjam? If yes, than this is expected. Gennadiy
On 5/14/2015 10:20 PM, Gennadiy Rozental wrote:
Edward Diener
writes: I tried the current 'develop' branch of Boost.Test and still got the result reported in my OP. I can live with it, since the vast majority of the times I only need to see the BOOST_TEST_MESSAGE output when a test fails
BOOST_TEST_MESSAGE has nothing to do whatsoever with assertions (failing or not). This is a feature of the log subsystem.
When did I say it has anything to do with assertions ?
Do you observe this with bjam?
Yes.
If yes, than this is expected.
Do you mean that if I use BOOST_TEST_MESSAGE in a test and there are no failures the BOOST_TEST_MESSAGE not appearing as bjam output, while if there is a test failure the BOOST_TEST_MESSAGE appearing as bjam output, is expected ? Why is that ?
AMDG On 05/14/2015 09:24 PM, Edward Diener wrote:
Do you mean that if I use BOOST_TEST_MESSAGE in a test and there are no failures the BOOST_TEST_MESSAGE not appearing as bjam output, while if there is a test failure the BOOST_TEST_MESSAGE appearing as bjam output, is expected ? Why is that ?
Boost.Build doesn't print the test output unless it fails or you pass --verbose-test. You'll find it in the file xxx.output. In Christ, Steven Watanabe
On 5/15/2015 12:45 AM, Steven Watanabe wrote:
AMDG
On 05/14/2015 09:24 PM, Edward Diener wrote:
Do you mean that if I use BOOST_TEST_MESSAGE in a test and there are no failures the BOOST_TEST_MESSAGE not appearing as bjam output, while if there is a test failure the BOOST_TEST_MESSAGE appearing as bjam output, is expected ? Why is that ?
Boost.Build doesn't print the test output unless it fails or you pass --verbose-test. You'll find it in the file xxx.output.+
Thanks for the explanation. I naively thought that all standard output showed up in the Boost Build results.
participants (4)
-
Bjorn Reese
-
Edward Diener
-
Gennadiy Rozental
-
Steven Watanabe