if(WIN32)
set(Boost_USE_STATIC_LIBS ON)
add_definitions(-DBOOST_ALL_NO_LIB)
- add_definitions(/bigobj)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /bigobj")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj")
endif()
if(NOT DEFINED LOGROTATE_HAS_SU)
add_custom_target(choco-pkg ALL
COMMAND choco pack
COMMAND ${CMAKE_COMMAND} -E rename ${CMAKE_CURRENT_BINARY_DIR}/icinga2.${SPEC_VERSION}.nupkg ${CMAKE_CURRENT_BINARY_DIR}/icinga2.nupkg
- DEPENDS icinga2.nuspec ${CMAKE_CURRENT_BINARY_DIR}/chocolateyInstall.ps1 chocolateyUninstall.ps1
+ DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/icinga2.nuspec ${CMAKE_CURRENT_BINARY_DIR}/chocolateyInstall.ps1 chocolateyUninstall.ps1
)
endif()
static ConsoleType l_ConsoleType = Console_Dumb;
-INITIALIZE_ONCE([]() {
+static void InitializeConsole(void)
+{
l_ConsoleType = Console_Dumb;
#ifndef _WIN32
#else /* _WIN32 */
l_ConsoleType = Console_Windows;
#endif /* _WIN32 */
-})
+}
+
+INITIALIZE_ONCE(InitializeConsole);
ConsoleColorTag::ConsoleColorTag(int color, ConsoleType consoleType)
: m_Color(color), m_ConsoleType(consoleType)
#include "base/i2-base.hpp"
#include "base/value.hpp"
#include <vector>
+#include <boost/function_types/function_arity.hpp>
#include <type_traits>
using namespace std::placeholders;
public:
template <typename FuncType>
auto operator () (FuncType f, const std::vector<Value>& args)
- -> decltype(call(f, args, BuildIndices<boost::function_traits<typename boost::remove_pointer<FuncType>::type>::arity>{}))
+ -> decltype(call(f, args, BuildIndices<boost::function_types::function_arity<typename boost::remove_pointer<FuncType>::type>::value>{}))
{
- return call(f, args, BuildIndices<boost::function_traits<typename boost::remove_pointer<FuncType>::type>::arity>{});
+ return call(f, args, BuildIndices<boost::function_types::function_arity<typename boost::remove_pointer<FuncType>::type>::value>{});
}
};
EnableIf<std::is_same<decltype(unpack_caller()(FuncType(), std::vector<Value>())), void>::value>* = 0)
{
return [function](const std::vector<Value>& arguments) {
- constexpr int arity = boost::function_traits<typename boost::remove_pointer<FuncType>::type>::arity;
+ constexpr int arity = boost::function_types::function_arity<typename boost::remove_pointer<FuncType>::type>::value;
if (arguments.size() < arity)
BOOST_THROW_EXCEPTION(std::invalid_argument("Too few arguments for function."));
EnableIf<!std::is_same<decltype(unpack_caller()(FuncType(), std::vector<Value>())), void>::value>* = 0)
{
return [function](const std::vector<Value>& arguments) {
- constexpr int arity = boost::function_traits<typename boost::remove_pointer<FuncType>::type>::arity;
+ constexpr int arity = boost::function_types::function_arity<typename boost::remove_pointer<FuncType>::type>::value;
if (arity > 0) {
if (arguments.size() < arity)
icinga-checkable-flapping.cpp
)
+if(ICINGA2_UNITY_BUILD)
+ mkunity_target(icinga_checkable test icinga_checkable_test_SOURCES)
+endif()
+
add_boost_test(icinga_checkable
- SOURCES icinga-checkable-test.cpp ${icinga_checkable_test_SOURCES}
+ SOURCES test-runner.cpp icinga-checkable-test.cpp ${icinga_checkable_test_SOURCES}
LIBRARIES base config icinga cli
TESTS icinga_checkable_flapping/host_not_flapping
icinga_checkable_flapping/host_flapping
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
******************************************************************************/
-#include <boost/test/unit_test.hpp>
-#include <bitset>
#include "icinga/host.hpp"
+#include <bitset>
#include <iostream>
+#include <BoostTestTargetConfig.h>
using namespace icinga;
int oldestIndex = (obj->GetFlappingBuffer() & 0xFF00000) >> 20;
std::cout << "Flapping: " << obj->IsFlapping() << "\nHT: " << obj->GetFlappingThresholdHigh() << " LT: " << obj->GetFlappingThresholdLow()
- << "\nOur value: " << obj->GetFlappingCurrent() << "\nPtr: " << oldestIndex << " Buf: " << stateChangeBuf << '\n';
+ << "\nOur value: " << obj->GetFlappingCurrent() << "\nPtr: " << oldestIndex << " Buf: " << stateChangeBuf.to_ulong() << '\n';
}
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
******************************************************************************/
-#define BOOST_TEST_MAIN
-#define BOOST_TEST_MODULE icinga2_test
-
#include "cli/daemonutility.hpp"
#include "base/application.hpp"
#include "base/loader.hpp"
BOOST_TEST_MESSAGE("setup running Icinga 2 core");
Application::InitializeBase();
-
- /* start the Icinga application and load the configuration */
- Application::DeclareSysconfDir("etc");
- Application::DeclareLocalStateDir("var");
-
- ActivationScope ascope;
-
- Loader::LoadExtensionLibrary("icinga");
- Loader::LoadExtensionLibrary("methods"); //loaded by ITL
-
- std::vector<std::string> configs;
- std::vector<ConfigItem::Ptr> newItems;
-
- DaemonUtility::LoadConfigFiles(configs, newItems, "icinga2.debug", "icinga2.vars");
-
- /* ignore config errors */
- WorkQueue upq;
- ConfigItem::ActivateItems(upq, newItems);
}
~IcingaCheckableFixture(void)