From ec8e9daf42c5cfe4541b48248bc989abcbb706d4 Mon Sep 17 00:00:00 2001 From: Razvan Becheriu Date: Thu, 28 Jan 2021 16:32:15 +0200 Subject: [PATCH] [#899] added missing files --- .../dhcp/run_script/libloadtests/Makefile.am | 48 +++++++++++++++++++ .../dhcp/run_script/run_script_messages.cc | 23 +++++++++ .../dhcp/run_script/run_script_messages.h | 12 +++++ src/hooks/dhcp/run_script/tests/Makefile.am | 48 +++++++++++++++++++ src/hooks/dhcp/run_script/version.cc | 17 +++++++ 5 files changed, 148 insertions(+) create mode 100644 src/hooks/dhcp/run_script/libloadtests/Makefile.am create mode 100644 src/hooks/dhcp/run_script/run_script_messages.cc create mode 100644 src/hooks/dhcp/run_script/run_script_messages.h create mode 100644 src/hooks/dhcp/run_script/tests/Makefile.am create mode 100644 src/hooks/dhcp/run_script/version.cc diff --git a/src/hooks/dhcp/run_script/libloadtests/Makefile.am b/src/hooks/dhcp/run_script/libloadtests/Makefile.am new file mode 100644 index 0000000000..a5bed4c98e --- /dev/null +++ b/src/hooks/dhcp/run_script/libloadtests/Makefile.am @@ -0,0 +1,48 @@ +SUBDIRS = . + +AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib +AM_CPPFLAGS += -I$(top_builddir)/src/hooks/dhcp/run_script -I$(top_srcdir)/src/hooks/dhcp/run_script +AM_CPPFLAGS += $(BOOST_INCLUDES) +AM_CPPFLAGS += -DLIBRUN_SCRIPT_SO=\"$(abs_top_builddir)/src/hooks/dhcp/run_script/.libs/libdhcp_run_script.so\" +AM_CPPFLAGS += -DINSTALL_PROG=\"$(abs_top_srcdir)/install-sh\" + +AM_CXXFLAGS = $(KEA_CXXFLAGS) + +if USE_STATIC_LINK +AM_LDFLAGS = -static +endif + +# Unit test data files need to get installed. +EXTRA_DIST = + +CLEANFILES = *.gcno *.gcda + +# TESTS_ENVIRONMENT = $(LIBTOOL) --mode=execute $(VALGRIND_COMMAND) +LOG_COMPILER = $(LIBTOOL) +AM_LOG_FLAGS = --mode=execute + +TESTS = +if HAVE_GTEST +TESTS += run_script_unittests + +run_script_unittests_SOURCES = run_unittests.cc +run_script_unittests_SOURCES += load_unload_unittests.cc +run_script_unittests_SOURCES += close_unittests.cc + +run_script_unittests_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES) $(LOG4CPLUS_INCLUDES) + +run_script_unittests_LDFLAGS = $(AM_LDFLAGS) $(CRYPTO_LDFLAGS) $(GTEST_LDFLAGS) + +run_script_unittests_CXXFLAGS = $(AM_CXXFLAGS) + +run_script_unittests_LDADD = $(top_builddir)/src/lib/hooks/libkea-hooks.la +run_script_unittests_LDADD += $(top_builddir)/src/lib/cc/libkea-cc.la +run_script_unittests_LDADD += $(top_builddir)/src/lib/log/libkea-log.la +run_script_unittests_LDADD += $(top_builddir)/src/lib/util/libkea-util.la +run_script_unittests_LDADD += $(top_builddir)/src/lib/exceptions/libkea-exceptions.la +run_script_unittests_LDADD += $(LOG4CPLUS_LIBS) +run_script_unittests_LDADD += $(CRYPTO_LIBS) +run_script_unittests_LDADD += $(BOOST_LIBS) +run_script_unittests_LDADD += $(GTEST_LDADD) +endif +noinst_PROGRAMS = $(TESTS) diff --git a/src/hooks/dhcp/run_script/run_script_messages.cc b/src/hooks/dhcp/run_script/run_script_messages.cc new file mode 100644 index 0000000000..ca9934216b --- /dev/null +++ b/src/hooks/dhcp/run_script/run_script_messages.cc @@ -0,0 +1,23 @@ +// File created from ../../../../src/hooks/dhcp/run_script/run_script_messages.mes + +#include +#include +#include + +extern const isc::log::MessageID RUN_SCRIPT_LOAD = "RUN_SCRIPT_LOAD"; +extern const isc::log::MessageID RUN_SCRIPT_LOAD_ERROR = "RUN_SCRIPT_LOAD_ERROR"; +extern const isc::log::MessageID RUN_SCRIPT_UNLOAD = "RUN_SCRIPT_UNLOAD"; + +namespace { + +const char* values[] = { + "RUN_SCRIPT_LOAD", "Run Script hooks library has been loaded", + "RUN_SCRIPT_LOAD_ERROR", "Run Script hooks library failed: %1", + "RUN_SCRIPT_UNLOAD", "Run Script hooks library has been unloaded", + NULL +}; + +const isc::log::MessageInitializer initializer(values); + +} // Anonymous namespace + diff --git a/src/hooks/dhcp/run_script/run_script_messages.h b/src/hooks/dhcp/run_script/run_script_messages.h new file mode 100644 index 0000000000..a70c8ca9cd --- /dev/null +++ b/src/hooks/dhcp/run_script/run_script_messages.h @@ -0,0 +1,12 @@ +// File created from ../../../../src/hooks/dhcp/run_script/run_script_messages.mes + +#ifndef RUN_SCRIPT_MESSAGES_H +#define RUN_SCRIPT_MESSAGES_H + +#include + +extern const isc::log::MessageID RUN_SCRIPT_LOAD; +extern const isc::log::MessageID RUN_SCRIPT_LOAD_ERROR; +extern const isc::log::MessageID RUN_SCRIPT_UNLOAD; + +#endif // RUN_SCRIPT_MESSAGES_H diff --git a/src/hooks/dhcp/run_script/tests/Makefile.am b/src/hooks/dhcp/run_script/tests/Makefile.am new file mode 100644 index 0000000000..28ea6e7bb5 --- /dev/null +++ b/src/hooks/dhcp/run_script/tests/Makefile.am @@ -0,0 +1,48 @@ +SUBDIRS = . + +AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib +AM_CPPFLAGS += -I$(top_builddir)/src/hooks/dhcp/run_script -I$(top_srcdir)/src/hooks/dhcp/run_script +AM_CPPFLAGS += $(BOOST_INCLUDES) +AM_CPPFLAGS += -DRUN_SCRIPT_LIB_SO=\"$(abs_top_builddir)/src/hooks/dhcp/run_script/.libs/libdhcp_run_script.so\" +AM_CPPFLAGS += -DINSTALL_PROG=\"$(abs_top_srcdir)/install-sh\" + +AM_CXXFLAGS = $(KEA_CXXFLAGS) + +if USE_STATIC_LINK +AM_LDFLAGS = -static +endif + +# Unit test data files need to get installed. +EXTRA_DIST = + +CLEANFILES = *.gcno *.gcda + +# TESTS_ENVIRONMENT = $(LIBTOOL) --mode=execute $(VALGRIND_COMMAND) +LOG_COMPILER = $(LIBTOOL) +AM_LOG_FLAGS = --mode=execute + +TESTS = +if HAVE_GTEST +TESTS += run_script_unittests + +run_script_unittests_SOURCES = run_unittests.cc +run_script_unittests_SOURCES += run_script_unittests.cc + +run_script_unittests_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES) $(LOG4CPLUS_INCLUDES) + +run_script_unittests_LDFLAGS = $(AM_LDFLAGS) $(CRYPTO_LDFLAGS) $(GTEST_LDFLAGS) + +run_script_unittests_CXXFLAGS = $(AM_CXXFLAGS) + +run_script_unittests_LDADD = $(top_builddir)/src/hooks/dhcp/run_script/librun_script.la +run_script_unittests_LDADD += $(top_builddir)/src/lib/hooks/libkea-hooks.la +run_script_unittests_LDADD += $(top_builddir)/src/lib/cc/libkea-cc.la +run_script_unittests_LDADD += $(top_builddir)/src/lib/log/libkea-log.la +run_script_unittests_LDADD += $(top_builddir)/src/lib/util/libkea-util.la +run_script_unittests_LDADD += $(top_builddir)/src/lib/exceptions/libkea-exceptions.la +run_script_unittests_LDADD += $(LOG4CPLUS_LIBS) +run_script_unittests_LDADD += $(CRYPTO_LIBS) +run_script_unittests_LDADD += $(BOOST_LIBS) +run_script_unittests_LDADD += $(GTEST_LDADD) +endif +noinst_PROGRAMS = $(TESTS) diff --git a/src/hooks/dhcp/run_script/version.cc b/src/hooks/dhcp/run_script/version.cc new file mode 100644 index 0000000000..a5b8d8c3f5 --- /dev/null +++ b/src/hooks/dhcp/run_script/version.cc @@ -0,0 +1,17 @@ +// Copyright (C) 2021 Internet Systems Consortium, Inc. ("ISC") +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include +#include + +extern "C" { + +/// @brief returns Kea hooks version. +int version() { + return (KEA_HOOKS_VERSION); +} + +}