|
Boost Users : |
Subject: Re: [Boost-users] [Boost] [Test] [1.38] "can't use testing tools before framework is initialized"
From: Greg Christopher (gchristopher_at_[hidden])
Date: 2009-05-17 23:05:49
________________________________________
From: boost-users-bounces_at_[hidden] [boost-users-bounces_at_[hidden]] On Behalf Of Gennadiy Rozental [rogeeff_at_[hidden]]
Sent: Sunday, May 17, 2009 3:23 PM
To: boost-users_at_[hidden]
Subject: Re: [Boost-users] [Boost] [Test] [1.38] "can't use testing tools before framework is initialized"
Greg Christopher wrote:
> Hi,
> I am trying to integrate boost.test into an existing test program with its own framework. Therefore I'd like to use that program's main.
Simplest way to get this is to use dynamic variant of UTF.
> I am currently running into this runtime error when calling BOOST_WARN_MESSAGE(1, "string"). I have tried three different things to avoid this condition:
Where do you call it from? The error indicate exactly what the problem is.
Greg>This was called from a function that is called from WinMain in this application.
> 1) I declared a TEST_SUITE using the BOOST_AUTO_TEST_SUITE() and END() macros. Probably not what I want because I want my own main to keep control, but figured it would generate a main that would allow the initialization to happen.
This has nothing to do with main. You can use auto registration tools
and have your own main.
> 2) I called init_unit_test_suite( argc, argv ). Even though it was called, I am still getting this.
You are not supposed to call this function manually.
Sorry- I misread that document. If anything, I should implement it.
> 3) I defined a cpp_main(). This never got called. I was hoping that the existence of this symbol would cause initialization to happen elsewhere.
Wow, you adventurous. I recommend reading docs first.
Greg>For instance, this page?
http://www.boost.org/doc/libs/1_39_0/libs/test/doc/html/prg-exec-monitor.html
I didn't dream up cpp_main(); the docs lead me to believe it would be called by the framework. In the situation where it would be called, initialization would happen first- at least my understanding.
> My desired control flow is to have this test program in control and to use the BOOST logging tools. I am trying to slip in boost.test with a minimum of changes to this program. I have hooked its logging function to call boost logging facilities instead; just can't get past this problem.
1. Here is an example that defines main: http://tinyurl.com/qmve47. This
example does not use automated tools, but it might as well.
Greg> Thanks- looks like as long as I get the test framework to call us, we'll be ok.
-Greg
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