[Pkg-nagios-changes] [pkg-icinga2] 04/04: Backport patch from HEAD to fix unit tests
Alexander Wirt
formorer at debian.org
Sun Sep 11 18:33:43 UTC 2016
This is an automated email from the git hooks/post-receive script.
formorer pushed a commit to branch master
in repository pkg-icinga2.
commit 467d47dc8ad02016fb81634f6bf10da11eba033e
Author: Alexander Wirt <formorer at debian.org>
Date: Fri Sep 9 12:56:03 2016 +0200
Backport patch from HEAD to fix unit tests
---
debian/patches/50_fix_unit_tests | 513 +++++++++++++++++++++++++++++++++++++++
debian/patches/series | 1 +
2 files changed, 514 insertions(+)
diff --git a/debian/patches/50_fix_unit_tests b/debian/patches/50_fix_unit_tests
new file mode 100644
index 0000000..c1cdd41
--- /dev/null
+++ b/debian/patches/50_fix_unit_tests
@@ -0,0 +1,513 @@
+commit 1dc4ab367e56c0ae69831f1737386bf51797c052
+Author: Gunnar Beutner <gunnar at beutner.name>
+Date: Wed Sep 7 08:20:51 2016 +0200
+
+ Fix: Unit tests randomly crash after the tests have completed
+
+ fixes #12610
+
+diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
+index 918fe5b..e577d03 100644
+--- a/test/CMakeLists.txt
++++ b/test/CMakeLists.txt
+@@ -15,6 +15,8 @@
+ # along with this program; if not, write to the Free Software Foundation
+ # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+
++set(Boost_USE_STATIC_LIBS OFF)
++
+ include(BoostTestTargets)
+
+ set(base_test_SOURCES
+@@ -31,7 +33,7 @@ if(ICINGA2_UNITY_BUILD)
+ endif()
+
+ add_boost_test(base
+- SOURCES base-test.cpp ${base_test_SOURCES}
++ SOURCES test-runner.cpp ${base_test_SOURCES}
+ LIBRARIES base config icinga
+ TESTS base_array/construct
+ base_array/getset
+@@ -123,7 +125,7 @@ if(ICINGA2_WITH_LIVESTATUS)
+ endif()
+
+ add_boost_test(livestatus
+- SOURCES livestatus-test.cpp ${livestatus_test_SOURCES}
++ SOURCES test-runner.cpp livestatus-fixture.cpp ${livestatus_test_SOURCES}
+ LIBRARIES base config icinga livestatus
+ DEPENDENCIES methods
+ TESTS livestatus/hosts livestatus/services
+diff --git a/test/base-array.cpp b/test/base-array.cpp
+index 61b2043..a748b3e 100644
+--- a/test/base-array.cpp
++++ b/test/base-array.cpp
+@@ -20,7 +20,7 @@
+ #include "base/array.hpp"
+ #include "base/objectlock.hpp"
+ #include "base/json.hpp"
+-#include <boost/test/unit_test.hpp>
++#include <BoostTestTargetConfig.h>
+
+ using namespace icinga;
+
+diff --git a/test/base-convert.cpp b/test/base-convert.cpp
+index 16e84da..0c330da 100644
+--- a/test/base-convert.cpp
++++ b/test/base-convert.cpp
+@@ -19,7 +19,7 @@
+
+ #include "base/convert.hpp"
+ #include "base/object.hpp"
+-#include <boost/test/unit_test.hpp>
++#include <BoostTestTargetConfig.h>
+ #include <iostream>
+
+ using namespace icinga;
+diff --git a/test/base-dictionary.cpp b/test/base-dictionary.cpp
+index bd336b4..903d9c1 100644
+--- a/test/base-dictionary.cpp
++++ b/test/base-dictionary.cpp
+@@ -20,7 +20,7 @@
+ #include "base/dictionary.hpp"
+ #include "base/objectlock.hpp"
+ #include "base/json.hpp"
+-#include <boost/test/unit_test.hpp>
++#include <BoostTestTargetConfig.h>
+ #include <boost/tuple/tuple.hpp>
+
+ using namespace icinga;
+diff --git a/test/base-fifo.cpp b/test/base-fifo.cpp
+index 06385f1..51b7391 100644
+--- a/test/base-fifo.cpp
++++ b/test/base-fifo.cpp
+@@ -19,7 +19,7 @@
+
+ #include "base/fifo.hpp"
+ #include "base/objectlock.hpp"
+-#include <boost/test/unit_test.hpp>
++#include <BoostTestTargetConfig.h>
+
+ using namespace icinga;
+
+diff --git a/test/base-json.cpp b/test/base-json.cpp
+index 3bb7015..bbe89c7 100644
+--- a/test/base-json.cpp
++++ b/test/base-json.cpp
+@@ -21,7 +21,7 @@
+ #include "base/dictionary.hpp"
+ #include "base/objectlock.hpp"
+ #include "base/json.hpp"
+-#include <boost/test/unit_test.hpp>
++#include <BoostTestTargetConfig.h>
+ #include <boost/tuple/tuple.hpp>
+
+ using namespace icinga;
+diff --git a/test/base-match.cpp b/test/base-match.cpp
+index c150e57..0b00f63 100644
+--- a/test/base-match.cpp
++++ b/test/base-match.cpp
+@@ -18,7 +18,7 @@
+ ******************************************************************************/
+
+ #include "base/utility.hpp"
+-#include <boost/test/unit_test.hpp>
++#include <BoostTestTargetConfig.h>
+
+ using namespace icinga;
+
+diff --git a/test/base-netstring.cpp b/test/base-netstring.cpp
+index 2e4d0ad..9c29229 100644
+--- a/test/base-netstring.cpp
++++ b/test/base-netstring.cpp
+@@ -19,7 +19,7 @@
+
+ #include "base/netstring.hpp"
+ #include "base/fifo.hpp"
+-#include <boost/test/unit_test.hpp>
++#include <BoostTestTargetConfig.h>
+
+ using namespace icinga;
+
+diff --git a/test/base-object.cpp b/test/base-object.cpp
+index 5fac6f7..004aa9e 100644
+--- a/test/base-object.cpp
++++ b/test/base-object.cpp
+@@ -19,7 +19,7 @@
+
+ #include "base/object.hpp"
+ #include "base/value.hpp"
+-#include <boost/test/unit_test.hpp>
++#include <BoostTestTargetConfig.h>
+
+ using namespace icinga;
+
+diff --git a/test/base-serialize.cpp b/test/base-serialize.cpp
+index 4373b2e..7f5669c 100644
+--- a/test/base-serialize.cpp
++++ b/test/base-serialize.cpp
+@@ -23,7 +23,7 @@
+ #include "base/serializer.hpp"
+ #include "base/array.hpp"
+ #include "base/dictionary.hpp"
+-#include <boost/test/unit_test.hpp>
++#include <BoostTestTargetConfig.h>
+ #include <boost/tuple/tuple.hpp>
+
+ using namespace icinga;
+diff --git a/test/base-shellescape.cpp b/test/base-shellescape.cpp
+index c6317db..6f89cd3 100644
+--- a/test/base-shellescape.cpp
++++ b/test/base-shellescape.cpp
+@@ -18,7 +18,7 @@
+ ******************************************************************************/
+
+ #include "base/utility.hpp"
+-#include <boost/test/unit_test.hpp>
++#include <BoostTestTargetConfig.h>
+ #include <iostream>
+
+ using namespace icinga;
+diff --git a/test/base-stacktrace.cpp b/test/base-stacktrace.cpp
+index 745338c..2fceecd 100644
+--- a/test/base-stacktrace.cpp
++++ b/test/base-stacktrace.cpp
+@@ -18,7 +18,7 @@
+ ******************************************************************************/
+
+ #include "base/stacktrace.hpp"
+-#include <boost/test/unit_test.hpp>
++#include <BoostTestTargetConfig.h>
+
+ using namespace icinga;
+
+diff --git a/test/base-stream.cpp b/test/base-stream.cpp
+index c093b06..dfe3909 100644
+--- a/test/base-stream.cpp
++++ b/test/base-stream.cpp
+@@ -19,7 +19,7 @@
+
+ #include "base/stdiostream.hpp"
+ #include "base/string.hpp"
+-#include <boost/test/unit_test.hpp>
++#include <BoostTestTargetConfig.h>
+ #include <sstream>
+
+ using namespace icinga;
+diff --git a/test/base-string.cpp b/test/base-string.cpp
+index f61a938..841f787 100644
+--- a/test/base-string.cpp
++++ b/test/base-string.cpp
+@@ -18,7 +18,7 @@
+ ******************************************************************************/
+
+ #include "base/string.hpp"
+-#include <boost/test/unit_test.hpp>
++#include <BoostTestTargetConfig.h>
+
+ using namespace icinga;
+
+diff --git a/test/base-test.cpp b/test/base-test.cpp
+deleted file mode 100644
+index 0ed1d89..0000000
+--- a/test/base-test.cpp
++++ /dev/null
+@@ -1,48 +0,0 @@
+-/******************************************************************************
+- * Icinga 2 *
+- * Copyright (C) 2012-2016 Icinga Development Team (https://www.icinga.org/) *
+- * *
+- * This program is free software; you can redistribute it and/or *
+- * modify it under the terms of the GNU General Public License *
+- * as published by the Free Software Foundation; either version 2 *
+- * of the License, or (at your option) any later version. *
+- * *
+- * This program is distributed in the hope that it will be useful, *
+- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+- * GNU General Public License for more details. *
+- * *
+- * You should have received a copy of the GNU General Public License *
+- * along with this program; if not, write to the Free Software Foundation *
+- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
+- ******************************************************************************/
+-
+-#define BOOST_TEST_MAIN
+-#define BOOST_TEST_MODULE icinga2_test
+-
+-#include "icinga/icingaapplication.hpp"
+-#include "base/application.hpp"
+-#include "base/timer.hpp"
+-#include <BoostTestTargetConfig.h>
+-
+-using namespace icinga;
+-
+-struct InitLibBase
+-{
+- IcingaApplication::Ptr appInst;
+-
+- InitLibBase(void)
+- {
+- Application::InitializeBase();
+-
+- appInst = new IcingaApplication();
+- static_pointer_cast<ConfigObject>(appInst)->OnConfigLoaded();
+- }
+-
+- ~InitLibBase(void)
+- {
+- Application::UninitializeBase();
+- }
+-};
+-
+-BOOST_GLOBAL_FIXTURE(InitLibBase);
+diff --git a/test/base-timer.cpp b/test/base-timer.cpp
+index 14a39b8..cd4404f 100644
+--- a/test/base-timer.cpp
++++ b/test/base-timer.cpp
+@@ -20,7 +20,7 @@
+ #include "base/timer.hpp"
+ #include "base/utility.hpp"
+ #include "base/application.hpp"
+-#include <boost/test/unit_test.hpp>
++#include <BoostTestTargetConfig.h>
+
+ using namespace icinga;
+
+diff --git a/test/base-type.cpp b/test/base-type.cpp
+index 0c726f4..0b83f9a 100644
+--- a/test/base-type.cpp
++++ b/test/base-type.cpp
+@@ -22,7 +22,7 @@
+ #include "base/objectlock.hpp"
+ #include "base/application.hpp"
+ #include "base/type.hpp"
+-#include <boost/test/unit_test.hpp>
++#include <BoostTestTargetConfig.h>
+ #include <boost/tuple/tuple.hpp>
+
+ using namespace icinga;
+diff --git a/test/base-value.cpp b/test/base-value.cpp
+index a8170d1..f79f5f8 100644
+--- a/test/base-value.cpp
++++ b/test/base-value.cpp
+@@ -18,7 +18,7 @@
+ ******************************************************************************/
+
+ #include "base/value.hpp"
+-#include <boost/test/unit_test.hpp>
++#include <BoostTestTargetConfig.h>
+
+ using namespace icinga;
+
+diff --git a/test/config-ops.cpp b/test/config-ops.cpp
+index ffa813b..77a384c 100644
+--- a/test/config-ops.cpp
++++ b/test/config-ops.cpp
+@@ -19,7 +19,7 @@
+
+ #include "config/configcompiler.hpp"
+ #include "base/exception.hpp"
+-#include <boost/test/unit_test.hpp>
++#include <BoostTestTargetConfig.h>
+
+ using namespace icinga;
+
+diff --git a/test/icinga-checkresult.cpp b/test/icinga-checkresult.cpp
+index 5241d43..703602d 100644
+--- a/test/icinga-checkresult.cpp
++++ b/test/icinga-checkresult.cpp
+@@ -18,7 +18,7 @@
+ ******************************************************************************/
+
+ #include "icinga/host.hpp"
+-#include <boost/test/unit_test.hpp>
++#include <BoostTestTargetConfig.h>
+
+ using namespace icinga;
+
+diff --git a/test/icinga-macros.cpp b/test/icinga-macros.cpp
+index ef15cfb..43f8f79 100644
+--- a/test/icinga-macros.cpp
++++ b/test/icinga-macros.cpp
+@@ -18,7 +18,7 @@
+ ******************************************************************************/
+
+ #include "icinga/macroprocessor.hpp"
+-#include <boost/test/unit_test.hpp>
++#include <BoostTestTargetConfig.h>
+
+ using namespace icinga;
+
+diff --git a/test/icinga-perfdata.cpp b/test/icinga-perfdata.cpp
+index 7372159..4ca535e 100644
+--- a/test/icinga-perfdata.cpp
++++ b/test/icinga-perfdata.cpp
+@@ -19,7 +19,7 @@
+
+ #include "icinga/perfdatavalue.hpp"
+ #include "icinga/pluginutility.hpp"
+-#include <boost/test/unit_test.hpp>
++#include <BoostTestTargetConfig.h>
+
+ using namespace icinga;
+
+diff --git a/test/livestatus-test.cpp b/test/livestatus-fixture.cpp
+similarity index 85%
+rename from test/livestatus-test.cpp
+rename to test/livestatus-fixture.cpp
+index 18aa932..e034188 100644
+--- a/test/livestatus-test.cpp
++++ b/test/livestatus-fixture.cpp
+@@ -17,14 +17,10 @@
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ******************************************************************************/
+
+-#define BOOST_TEST_MAIN
+-#define BOOST_TEST_MODULE icinga2_test
+-
+ #include "config/configcompiler.hpp"
+ #include "config/configitem.hpp"
+ #include "base/application.hpp"
+ #include "base/loader.hpp"
+-#include <fstream>
+ #include <BoostTestTargetConfig.h>
+
+ using namespace icinga;
+@@ -33,22 +29,11 @@ struct LivestatusFixture
+ {
+ LivestatusFixture(void)
+ {
+- BOOST_TEST_MESSAGE("setup global config fixture");
+-
+- Application::InitializeBase();
+-
+- BOOST_TEST_MESSAGE( "Preparing config objects...");
++ BOOST_TEST_MESSAGE("Preparing config objects...");
+
+ ConfigItem::RunWithActivationContext(new Function("CreateTestObjects", WrapFunction(CreateTestObjects)));
+ }
+
+- ~LivestatusFixture(void)
+- {
+- BOOST_TEST_MESSAGE("cleanup global config fixture");
+-
+- Application::UninitializeBase();
+- }
+-
+ static void CreateTestObjects(void)
+ {
+ String config = R"CONFIG(
+@@ -78,5 +63,4 @@ apply Service "livestatus" {
+ }
+ };
+
+-BOOST_GLOBAL_FIXTURE(LivestatusFixture);
+-
++BOOST_GLOBAL_FIXTURE(LivestatusFixture);
+\ No newline at end of file
+diff --git a/test/livestatus.cpp b/test/livestatus.cpp
+index a065bf1..e6fb37e 100644
+--- a/test/livestatus.cpp
++++ b/test/livestatus.cpp
+@@ -21,7 +21,7 @@
+ #include "base/application.hpp"
+ #include "base/stdiostream.hpp"
+ #include "base/json.hpp"
+-#include <boost/test/unit_test.hpp>
++#include <BoostTestTargetConfig.h>
+
+ using namespace icinga;
+
+diff --git a/test/remote-base64.cpp b/test/remote-base64.cpp
+index b0c78cc..3dd0143 100644
+--- a/test/remote-base64.cpp
++++ b/test/remote-base64.cpp
+@@ -18,7 +18,7 @@
+ ******************************************************************************/
+
+ #include "remote/base64.hpp"
+-#include <boost/test/unit_test.hpp>
++#include <BoostTestTargetConfig.h>
+
+ using namespace icinga;
+
+diff --git a/test/remote-url.cpp b/test/remote-url.cpp
+index 7ba9640..b8d7c5f 100644
+--- a/test/remote-url.cpp
++++ b/test/remote-url.cpp
+@@ -19,7 +19,7 @@
+
+ #include "base/array.hpp"
+ #include "remote/url.hpp"
+-#include <boost/test/unit_test.hpp>
++#include <BoostTestTargetConfig.h>
+ #include <boost/assign/list_of.hpp>
+
+ using namespace icinga;
+diff --git a/test/test-runner.cpp b/test/test-runner.cpp
+new file mode 100644
+index 0000000..3cc7bc8
+--- /dev/null
++++ b/test/test-runner.cpp
+@@ -0,0 +1,45 @@
++/******************************************************************************
++* Icinga 2 *
++* Copyright (C) 2012-2016 Icinga Development Team (https://www.icinga.org/) *
++* *
++* This program is free software; you can redistribute it and/or *
++* modify it under the terms of the GNU General Public License *
++* as published by the Free Software Foundation; either version 2 *
++* of the License, or (at your option) any later version. *
++* *
++* This program is distributed in the hope that it will be useful, *
++* but WITHOUT ANY WARRANTY; without even the implied warranty of *
++* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
++* GNU General Public License for more details. *
++* *
++* You should have received a copy of the GNU General Public License *
++* along with this program; if not, write to the Free Software Foundation *
++* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
++******************************************************************************/
++
++#include "icinga/icingaapplication.hpp"
++#include "base/application.hpp"
++#include <BoostTestTargetConfig.h>
++
++using namespace icinga;
++
++static bool init_unit_test(void)
++{
++ return true;
++}
++
++int main(int argc, char *argv[])
++{
++ Application::InitializeBase();
++
++ IcingaApplication::Ptr appInst;
++
++ appInst = new IcingaApplication();
++ static_pointer_cast<ConfigObject>(appInst)->OnConfigLoaded();
++
++ int rc = boost::unit_test::unit_test_main(&init_unit_test, argc, argv);
++
++ appInst.reset();
++
++ Application::Exit(rc);
++}
+\ No newline at end of file
+diff --git a/third-party/cmake/BoostTestTargets.cmake b/third-party/cmake/BoostTestTargets.cmake
+index e2f664e..8c26324 100644
+--- a/third-party/cmake/BoostTestTargets.cmake
++++ b/third-party/cmake/BoostTestTargets.cmake
+@@ -78,9 +78,7 @@ if(Boost_FOUND AND NOT "${Boost_VERSION}0" LESS "1034000")
+ if(Boost_USE_STATIC_LIBS)
+ set(_boostConfig "BoostTestTargetsStatic.h")
+ else()
+- if(NOT APPLE)
+- set(_boostConfig "BoostTestTargetsDynamic.h")
+- endif()
++ set(_boostConfig "BoostTestTargetsDynamic.h")
+ endif()
+ endif()
+ get_filename_component(_moddir ${CMAKE_CURRENT_LIST_FILE} PATH)
diff --git a/debian/patches/series b/debian/patches/series
index e1c16fd..d833ec1 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
21_config_changes
+50_fix_unit_tests
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-nagios/pkg-icinga2.git
More information about the Pkg-nagios-changes
mailing list