]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#3729] Finished agent tests
authorFrancis Dupont <fdupont@isc.org>
Fri, 14 Feb 2025 22:30:06 +0000 (23:30 +0100)
committerAndrei Pavel <andrei@isc.org>
Mon, 17 Feb 2025 13:34:48 +0000 (15:34 +0200)
src/bin/agent/meson.build
src/bin/agent/tests/ca_process_tests.sh.in [changed mode: 0644->0755]
src/bin/agent/tests/meson-test_basic_auth_libraries.h.in [new file with mode: 0644]
src/bin/agent/tests/meson-test_callout_libraries.h.in [new file with mode: 0644]
src/bin/agent/tests/meson.build

index f198f8b50d30db5ccc5babe0b8743ffdee2dddd8..cc3a942f02d7400ae9b2536fe04acd3925669072 100644 (file)
@@ -23,3 +23,4 @@ executable(
     install_dir: 'sbin',
     link_with: [agent_lib] + LIBS_BUILT_SO_FAR,
 )
+subdir('tests')
old mode 100644 (file)
new mode 100755 (executable)
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 (file)
index 0000000..c6f3a67
--- /dev/null
@@ -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 <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 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 (file)
index 0000000..f73532e
--- /dev/null
@@ -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 <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 // TEST_LIBRARIES_H
index ac95e5d73f0216b468791d705bce7229324176bc..1149ca2af93a2014bba0040ede6d8fd78cb6e81b 100644 (file)
@@ -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',
+)