From: Francis Dupont Date: Fri, 14 Feb 2025 22:30:06 +0000 (+0100) Subject: [#3729] Finished agent tests X-Git-Tag: Kea-2.7.7~226 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=5198ace9ab447013467e3b024dbcd5098ccf814a;p=thirdparty%2Fkea.git [#3729] Finished agent tests --- diff --git a/src/bin/agent/meson.build b/src/bin/agent/meson.build index f198f8b50d..cc3a942f02 100644 --- a/src/bin/agent/meson.build +++ b/src/bin/agent/meson.build @@ -23,3 +23,4 @@ executable( install_dir: 'sbin', link_with: [agent_lib] + LIBS_BUILT_SO_FAR, ) +subdir('tests') diff --git a/src/bin/agent/tests/ca_process_tests.sh.in b/src/bin/agent/tests/ca_process_tests.sh.in old mode 100644 new mode 100755 diff --git a/src/bin/agent/tests/meson-test_basic_auth_libraries.h.in b/src/bin/agent/tests/meson-test_basic_auth_libraries.h.in new file mode 100644 index 0000000000..c6f3a6720e --- /dev/null +++ b/src/bin/agent/tests/meson-test_basic_auth_libraries.h.in @@ -0,0 +1,24 @@ +// Copyright (C) 2020 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 AGENT_TEST_BASIC_AUTH_LIBRARIES_H +#define AGENT_TEST_BASIC_AUTH_LIBRARIES_H + +#include + +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 HTTP authentication as a callout library. +static const char* BASIC_AUTH_LIBRARY = "@abs_builddir@/libbasicauth.so"; + +} // anonymous namespace + +#endif // TEST_BASIC_AUTH_LIBRARIES_H diff --git a/src/bin/agent/tests/meson-test_callout_libraries.h.in b/src/bin/agent/tests/meson-test_callout_libraries.h.in new file mode 100644 index 0000000000..f73532ed2b --- /dev/null +++ b/src/bin/agent/tests/meson-test_callout_libraries.h.in @@ -0,0 +1,24 @@ +// Copyright (C) 2017-2020 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 AGENT_TEST_CALLOUT_LIBRARIES_H +#define AGENT_TEST_CALLOUT_LIBRARIES_H + +#include + +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 // TEST_LIBRARIES_H diff --git a/src/bin/agent/tests/meson.build b/src/bin/agent/tests/meson.build index ac95e5d73f..1149ca2af9 100644 --- a/src/bin/agent/tests/meson.build +++ b/src/bin/agent/tests/meson.build @@ -3,10 +3,46 @@ if not gtest.found() endif current_build_dir = meson.current_build_dir() +kea_agent_tests_data = configuration_data() +kea_agent_tests_data.set('abs_top_builddir', TOP_BUILD_DIR) +kea_agent_tests_data.set('abs_top_srcdir', TOP_SOURCE_DIR) +kea_agent_tests_data.set('abs_builddir', current_build_dir) +ca_process_tests = configure_file( + input: 'ca_process_tests.sh.in', + output: 'ca_process_tests.sh', + configuration: kea_agent_tests_data, +) +test( + 'ca_process_tests.sh', + ca_process_tests, + workdir: current_build_dir, + is_parallel: false, + priority: -1, +) +configure_file( + input: 'meson-test_basic_auth_libraries.h.in', + output: 'test_basic_auth_libraries.h', + configuration: kea_agent_tests_data, +) +configure_file( + input: 'meson-test_callout_libraries.h.in', + output: 'test_callout_libraries.h', + configuration: kea_agent_tests_data, +) +configure_file( + input: 'test_data_files_config.h.in', + output: 'test_data_files_config.h', + configuration: kea_agent_tests_data, +) +current_source_dir = meson.current_source_dir() +kea_agent_tests_libs = [ + kea_process_testutils_lib, + kea_testutils_lib, + kea_asiolink_testutils_lib, +] kea_agent_tests = executable( 'kea-agent-tests', - 'basic_auth_library.cc', 'ca_cfg_mgr_unittests.cc', 'ca_command_mgr_unittests.cc', 'ca_controller_unittests.cc', @@ -14,17 +50,33 @@ kea_agent_tests = executable( 'ca_response_creator_factory_unittests.cc', 'ca_response_creator_unittests.cc', 'ca_unittests.cc', - 'callout_library.cc', 'get_config_unittest.cc', 'parser_unittests.cc', cpp_args: [ + f'-DTEST_DATA_BUILDDIR="@current_build_dir@"', f'-DCFG_EXAMPLES="@TOP_SOURCE_DIR@/doc/examples/agent"', f'-DSYNTAX_FILE="@current_source_dir@/../agent_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: [agent_lib] + LIBS_BUILT_SO_FAR, + link_with: [agent_lib] + kea_agent_tests_libs + LIBS_BUILT_SO_FAR, ) test('kea-agent-tests', kea_agent_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( + 'basicauth', + 'basic_auth_library.cc', + include_directories: [include_directories('.')] + INCLUDES, + link_with: LIBS_BUILT_SO_FAR, + build_rpath: '/nowhere', + name_suffix: 'so', +)