--- /dev/null
+// 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/.
+
+#ifndef D2_TEST_CALLOUT_LIBRARIES_H
+#define D2_TEST_CALLOUT_LIBRARIES_H
+
+#include <config.h>
+
+namespace {
+
+// Names of the libraries used in these tests. These libraries are built using
+// libtool, so we need to look in the hidden ".libs" directory to locate the
+// .so file. Note that we access the .so file - libtool creates this as a
+// like to the real shared library.
+
+// Basic callout library with context_create and three "standard" callouts.
+static const char* CALLOUT_LIBRARY = "@abs_builddir@/libcallout.so";
+
+} // anonymous namespace
+
+#endif // D2_TEST_CALLOUT_LIBRARIES_H
--- /dev/null
+// 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/.
+
+#ifndef D2_TEST_CONFIGURED_LIBRARIES_H
+#define D2_TEST_CONFIGURED_LIBRARIES_H
+
+#include <config.h>
+
+namespace {
+
+// Names of the libraries used in these tests. These libraries are built using
+// libtool, so we need to look in the hidden ".libs" directory to locate the
+// .so file. Note that we access the .so file - libtool creates this as a
+// like to the real shared library.
+
+// Configured library with d2_srv_configured testing: if there is a toplevel
+// user context with an error entry the returned status is DROP with the
+// content of the error entry.
+static const char* CONFIGURED_LIBRARY = "@abs_builddir@/libconfigured.so";
+
+} // anonymous namespace
+
+#endif // D2_TEST_CONFIGURED_LIBRARIES_H
endif
current_build_dir = meson.current_build_dir()
+kea_d2_tests_data = configuration_data()
+kea_d2_tests_data.set('abs_top_builddir', TOP_BUILD_DIR)
+kea_d2_tests_data.set('abs_top_srcdir', TOP_SOURCE_DIR)
+kea_d2_tests_data.set('abs_builddir', current_build_dir)
+d2_process_tests = configure_file(
+ input: 'd2_process_tests.sh.in',
+ output: 'd2_process_tests.sh',
+ configuration: kea_d2_tests_data,
+)
+test(
+ 'd2_process_tests.sh',
+ d2_process_tests,
+ workdir: current_build_dir,
+ is_parallel: false,
+ priority: -1,
+)
+configure_file(
+ input: 'meson-test_callout_libraries.h.in',
+ output: 'test_callout_libraries.h',
+ configuration: kea_d2_tests_data,
+)
+configure_file(
+ input: 'test_data_files_config.h.in',
+ output: 'test_data_files_config.h',
+ configuration: kea_d2_tests_data,
+)
+configure_file(
+ input: 'meson-test_configured_libraries.h.in',
+ output: 'test_configured_libraries.h',
+ configuration: kea_d2_tests_data,
+)
+current_source_dir = meson.current_source_dir()
+kea_d2_tests_libs = [
+ kea_d2srv_testutils_lib,
+ kea_process_testutils_lib,
+ kea_testutils_lib,
+ kea_asiolink_testutils_lib,
+]
kea_d2_tests = executable(
'kea-d2-tests',
- 'check_exists_add.cc',
- 'check_exists_remove.cc',
- 'd2_controller.cc',
- 'd2_lexer.cc',
- 'd2_parser.cc',
- 'd2_process.cc',
- 'd2_queue_mgr.cc',
- 'd2_update_mgr.cc',
- 'main.cc',
- 'nc_add.cc',
- 'nc_remove.cc',
- 'parser_context.cc',
- 'simple_add.cc',
- 'simple_add_without_dhcid.cc',
- 'simple_remove.cc',
- 'simple_remove_without_dhcid.cc',
+ 'check_exists_add_unittests.cc',
+ 'check_exists_remove_unittests.cc',
+ 'd2_cfg_mgr_unittests.cc',
+ 'd2_command_unittest.cc',
+ 'd2_controller_unittests.cc',
+ 'd2_http_command_unittest.cc',
+ 'd2_process_unittests.cc',
+ 'd2_queue_mgr_unittests.cc',
+ 'd2_simple_parser_unittest.cc',
+ 'd2_unittests.cc',
+ 'd2_update_mgr_unittests.cc',
+ 'get_config_unittest.cc',
+ 'nc_add_unittests.cc',
+ 'nc_remove_unittests.cc',
+ 'parser_unittest.cc',
+ 'simple_add_unittests.cc',
+ 'simple_add_without_dhcid_unittests.cc',
+ 'simple_remove_unittests.cc',
+ 'simple_remove_without_dhcid_unittests.cc',
cpp_args: [
+ f'-DTEST_DATA_BUILDDIR="@current_build_dir@"',
f'-DCFG_EXAMPLES="@TOP_SOURCE_DIR@/doc/examples/ddns"',
f'-DSYNTAX_FILE="@current_source_dir@/../d2_parser.yy"',
f'-DTEST_CA_DIR="@TEST_CA_DIR@"',
- f'-DTEST_DATA_BUILDDIR="@current_build_dir@"',
],
dependencies: [gtest],
include_directories: [include_directories('.')] + INCLUDES,
- link_with: [d2_lib] + LIBS_BUILT_SO_FAR,
+ link_with: [d2_lib] + kea_d2_tests_libs + LIBS_BUILT_SO_FAR,
)
test('kea-d2-tests', kea_d2_tests, protocol: 'gtest')
+
+shared_library(
+ 'callout',
+ 'callout_library.cc',
+ include_directories: [include_directories('.')] + INCLUDES,
+ link_with: LIBS_BUILT_SO_FAR,
+ build_rpath: '/nowhere',
+ name_suffix: 'so',
+)
+shared_library(
+ 'configured',
+ 'configured_library.cc',
+ include_directories: [include_directories('.')] + INCLUDES,
+ link_with: LIBS_BUILT_SO_FAR,
+ build_rpath: '/nowhere',
+ name_suffix: 'so',
+)