mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-23 13:45:04 +02:00
test-runner: Replace initialization by global fixture
This is required to even be able to build tests static for Windows.
This commit is contained in:
parent
7d189b58f8
commit
1be285c530
@ -17,29 +17,30 @@
|
|||||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
|
#define BOOST_TEST_MAIN
|
||||||
|
|
||||||
#include "icinga/icingaapplication.hpp"
|
#include "icinga/icingaapplication.hpp"
|
||||||
#include "base/application.hpp"
|
#include "base/application.hpp"
|
||||||
#include <BoostTestTargetConfig.h>
|
#include <BoostTestTargetConfig.h>
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
static bool init_unit_test()
|
struct TestIcingaApplication
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
|
||||||
{
|
{
|
||||||
|
TestIcingaApplication()
|
||||||
|
{
|
||||||
Application::InitializeBase();
|
Application::InitializeBase();
|
||||||
|
|
||||||
IcingaApplication::Ptr appInst;
|
IcingaApplication::Ptr appInst;
|
||||||
|
|
||||||
appInst = new IcingaApplication();
|
appInst = new IcingaApplication();
|
||||||
static_pointer_cast<ConfigObject>(appInst)->OnConfigLoaded();
|
static_pointer_cast<ConfigObject>(appInst)->OnConfigLoaded();
|
||||||
|
}
|
||||||
|
|
||||||
int rc = boost::unit_test::unit_test_main(&init_unit_test, argc, argv);
|
~TestIcingaApplication()
|
||||||
|
{
|
||||||
|
IcingaApplication::GetInstance().reset();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
appInst.reset();
|
BOOST_GLOBAL_FIXTURE(TestIcingaApplication);
|
||||||
|
|
||||||
Application::Exit(rc);
|
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user