From: Francis Dupont Date: Thu, 6 Feb 2025 00:31:30 +0000 (+0100) Subject: [#3729] Finished lib tests X-Git-Tag: Kea-2.7.7~259 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=49a24f43afe3b035ce5b469ea07ef106973ecd23;p=thirdparty%2Fkea.git [#3729] Finished lib tests --- diff --git a/src/lib/dhcpsrv/tests/meson-test_libraries.h.in b/src/lib/dhcpsrv/tests/meson-test_libraries.h.in new file mode 100644 index 0000000000..53254037ee --- /dev/null +++ b/src/lib/dhcpsrv/tests/meson-test_libraries.h.in @@ -0,0 +1,35 @@ +// Copyright (C) 2013-2016 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 TEST_LIBRARIES_H +#define TEST_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 +// shared library. + +// Library with load/unload functions creating marker files to check their +// operation. +static const char* CALLOUT_LIBRARY_1 = "@abs_builddir@/libco1.so"; +static const char* CALLOUT_LIBRARY_2 = "@abs_builddir@/libco2.so"; + +// This library will try to get the following parameters: +// - svalue (and will expect its value to be "string value") +// - ivalue (and will expect its value to be 42) +// - bvalue (and will expect its value to be true) +static const char* CALLOUT_PARAMS_LIBRARY = "@abs_builddir@/libco3.so"; + +// Name of a library which is not present. +static const char* NOT_PRESENT_LIBRARY = "@abs_builddir@/libnothere.so"; + +} // anonymous namespace + + +#endif // TEST_LIBRARIES_H diff --git a/src/lib/dhcpsrv/tests/meson.build b/src/lib/dhcpsrv/tests/meson.build index dc17f5b2d9..d09f2d7197 100644 --- a/src/lib/dhcpsrv/tests/meson.build +++ b/src/lib/dhcpsrv/tests/meson.build @@ -14,6 +14,13 @@ configure_file( output: 'test_kea_lfc_env.sh', copy: true, ) +kea_dhcpsrv_conf_data = configuration_data() +kea_dhcpsrv_conf_data.set('abs_builddir', meson.current_build_dir()) +configure_file( + input: 'meson-test_libraries.h.in', + output: 'test_libraries.h', + configuration: kea_dhcpsrv_conf_data, +) kea_dhcpsrv_tests = executable( 'kea-dhcpsrv-tests', 'alloc_engine4_unittest.cc', @@ -46,7 +53,7 @@ kea_dhcpsrv_tests = executable( 'd2_client_unittest.cc', 'd2_udp_unittest.cc', 'dhcp4o6_ipc_unittest.cc', - # 'dhcp_parsers_unittest.cc', + 'dhcp_parsers_unittest.cc', 'dhcp_queue_control_parser_unittest.cc', 'duid_config_parser_unittest.cc', 'expiration_config_parser_unittest.cc', @@ -104,3 +111,28 @@ test( protocol: 'gtest', is_parallel: false, ) + +shared_library( + 'co1', + 'callout_library.cc', + include_directories: [include_directories('.')] + INCLUDES, + link_with: LIBS_BUILT_SO_FAR, + build_rpath: '/nowhere', + name_suffix: 'so', +) +shared_library( + 'co2', + 'callout_library.cc', + include_directories: [include_directories('.')] + INCLUDES, + link_with: LIBS_BUILT_SO_FAR, + build_rpath: '/nowhere', + name_suffix: 'so', +) +shared_library( + 'co3', + 'callout_params_library.cc', + include_directories: [include_directories('.')] + INCLUDES, + link_with: LIBS_BUILT_SO_FAR, + build_rpath: '/nowhere', + name_suffix: 'so', +) diff --git a/src/lib/hooks/tests/meson-test_libraries.h.in b/src/lib/hooks/tests/meson-test_libraries.h.in new file mode 100644 index 0000000000..141d7afd28 --- /dev/null +++ b/src/lib/hooks/tests/meson-test_libraries.h.in @@ -0,0 +1,61 @@ +// Copyright (C) 2013-2018 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 TEST_LIBRARIES_H +#define TEST_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 library with context_create and three "standard" callouts. +static const char* BASIC_CALLOUT_LIBRARY = "@abs_builddir@/libbcl.so"; + +// Library with context_create and three "standard" callouts, as well as +// load() and unload() functions. +static const char* FULL_CALLOUT_LIBRARY = "@abs_builddir@/libfcl.so"; + +// Library where the all framework functions throw an exception +static const char* FRAMEWORK_EXCEPTION_LIBRARY = "@abs_builddir@/libfxl.so"; + +// Library where the version() function returns an incorrect result. +static const char* INCORRECT_VERSION_LIBRARY = "@abs_builddir@/libivl.so"; + +// Library where some of the callout registration is done with the load() +// function. +static const char* LOAD_CALLOUT_LIBRARY = "@abs_builddir@/liblcl.so"; + +// Library where the load() function returns an error. +static const char* LOAD_ERROR_CALLOUT_LIBRARY = + "@abs_builddir@/liblecl.so"; + +// Name of a library which is not present. +static const char* NOT_PRESENT_LIBRARY = "@abs_builddir@/libnothere.so"; + +// Library that does not include a version function. +static const char* NO_VERSION_LIBRARY = "@abs_builddir@/libnvl.so"; + +// Library where there is an unload() function. +static const char* UNLOAD_CALLOUT_LIBRARY = "@abs_builddir@/libucl.so"; + +// Library where parameters are checked. +static const char* CALLOUT_PARAMS_LIBRARY = "@abs_builddir@/libpcl.so"; + +// Library which tests objects parking. +// Used only by hooks_manager_unittest.cc. +#ifdef TEST_ASYNC_CALLOUT +static const char* ASYNC_CALLOUT_LIBRARY = "@abs_builddir@/libacl.so"; +#endif + +} // anonymous namespace + + +#endif // TEST_LIBRARIES_H diff --git a/src/lib/hooks/tests/meson.build b/src/lib/hooks/tests/meson.build index 988a1bb35f..f05c2575b2 100644 --- a/src/lib/hooks/tests/meson.build +++ b/src/lib/hooks/tests/meson.build @@ -9,9 +9,9 @@ kea_hooks_tests = executable( 'callout_handle_unittest.cc', 'callout_manager_unittest.cc', 'handles_unittest.cc', - # 'hooks_manager_unittest.cc', - # 'library_manager_collection_unittest.cc', - # 'library_manager_unittest.cc', + 'hooks_manager_unittest.cc', + 'library_manager_collection_unittest.cc', + 'library_manager_unittest.cc', 'parking_lots_unittest.cc', 'run_unittests.cc', 'server_hooks_unittest.cc', @@ -20,3 +20,97 @@ kea_hooks_tests = executable( link_with: [kea_util_unittests_lib] + LIBS_BUILT_SO_FAR, ) test('kea_hooks_tests', kea_hooks_tests, protocol: 'gtest') + +kea_hooks_conf_data = configuration_data() +kea_hooks_conf_data.set('abs_builddir', meson.current_build_dir()) +configure_file( + input: 'marker_file.h.in', + output: 'marker_file.h', + configuration: kea_hooks_conf_data, +) +configure_file( + input: 'meson-test_libraries.h.in', + output: 'test_libraries.h', + configuration: kea_hooks_conf_data, +) + +shared_library( + 'nvl', + 'no_version_library.cc', + include_directories: [include_directories('.')] + INCLUDES, + link_with: LIBS_BUILT_SO_FAR, + build_rpath: '/nowhere', + name_suffix: 'so', +) +shared_library( + 'ivl', + 'incorrect_version_library.cc', + include_directories: [include_directories('.')] + INCLUDES, + link_with: LIBS_BUILT_SO_FAR, + build_rpath: '/nowhere', + name_suffix: 'so', +) +shared_library( + 'fxl', + 'framework_exception_library.cc', + include_directories: [include_directories('.')] + INCLUDES, + link_with: LIBS_BUILT_SO_FAR, + build_rpath: '/nowhere', + name_suffix: 'so', +) +shared_library( + 'bcl', + 'basic_callout_library.cc', + include_directories: [include_directories('.')] + INCLUDES, + link_with: LIBS_BUILT_SO_FAR, + build_rpath: '/nowhere', + name_suffix: 'so', +) +shared_library( + 'lcl', + 'load_callout_library.cc', + include_directories: [include_directories('.')] + INCLUDES, + link_with: LIBS_BUILT_SO_FAR, + build_rpath: '/nowhere', + name_suffix: 'so', +) +shared_library( + 'lecl', + 'load_error_callout_library.cc', + include_directories: [include_directories('.')] + INCLUDES, + link_with: LIBS_BUILT_SO_FAR, + build_rpath: '/nowhere', + name_suffix: 'so', +) +shared_library( + 'ucl', + 'unload_callout_library.cc', + include_directories: [include_directories('.')] + INCLUDES, + link_with: LIBS_BUILT_SO_FAR, + build_rpath: '/nowhere', + name_suffix: 'so', +) +shared_library( + 'fcl', + 'full_callout_library.cc', + include_directories: [include_directories('.')] + INCLUDES, + link_with: LIBS_BUILT_SO_FAR, + build_rpath: '/nowhere', + name_suffix: 'so', +) +shared_library( + 'pcl', + 'callout_params_library.cc', + include_directories: [include_directories('.')] + INCLUDES, + link_with: LIBS_BUILT_SO_FAR, + build_rpath: '/nowhere', + name_suffix: 'so', +) +shared_library( + 'acl', + 'async_callout_library.cc', + include_directories: [include_directories('.')] + INCLUDES, + link_with: LIBS_BUILT_SO_FAR, + build_rpath: '/nowhere', + name_suffix: 'so', +)