2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-30 05:27:55 +00:00

[#3729] Added unit tests (1)

This commit is contained in:
Francis Dupont 2025-02-05 01:53:04 +01:00 committed by Andrei Pavel
parent 237a8b3b6d
commit 57b1451e01
No known key found for this signature in database
GPG Key ID: D4E804481939CB21
11 changed files with 193 additions and 0 deletions

View File

@ -20,6 +20,7 @@ kea_config_lib = library(
link_with: LIBS_BUILT_SO_FAR,
)
LIBS_BUILT_SO_FAR = [kea_config_lib] + LIBS_BUILT_SO_FAR
subdir('tests')
kea_config_headers = [
'base_command_mgr.h',
'client_connection.h',

View File

@ -0,0 +1,29 @@
if not gtest.found()
subdir_done()
endif
CURRENT_BUILD_DIR = meson.current_build_dir()
libs_testutils = [kea_testutils_lib, kea_asiolink_testutils_lib]
kea_config_tests = executable(
'kea-config-tests',
'client_connection_unittests.cc',
'cmd_http_listener_unittests.cc',
'cmd_response_creator_factory_unittests.cc',
'cmd_response_creator_unittests.cc',
'command_mgr_unittests.cc',
'http_command_config_unittests.cc',
'http_command_mgr_unittests.cc',
'http_command_response_creator_factory_unittests.cc',
'http_command_response_creator_unittests.cc',
'run_unittests.cc',
'unix_command_config_unittests.cc',
'unix_command_mgr_unittests.cc',
dependencies: [gtest],
cpp_args: [
f'-DTEST_DATA_BUILDDIR="@CURRENT_BUILD_DIR@"',
f'-DTEST_CA_DIR="@TEST_CA_DIR@"',
],
include_directories: [include_directories('.')] + INCLUDES,
link_with: [kea_util_unittests_lib] + libs_testutils + LIBS_BUILT_SO_FAR,
)
test('kea_config_tests', kea_config_tests, protocol: 'gtest')

View File

@ -61,6 +61,8 @@ kea_dhcp_lib = library(
link_with: LIBS_BUILT_SO_FAR,
)
LIBS_BUILT_SO_FAR = [kea_dhcp_lib] + LIBS_BUILT_SO_FAR
subdir('testutils')
subdir('tests')
kea_dhcp_headers = [
'classify.h',
'dhcp4.h',

View File

@ -0,0 +1,70 @@
if not gtest.found()
subdir_done()
endif
if SYSTEM == 'linux'
pkt_filter_xpf_unittest_cc = 'pkt_filter_lpf_unittest.cc'
elif SYSTEM == 'freebsd' or SYSTEM == 'netbsd' or SYSTEM == 'openbsd' or SYSTEM == 'darwin'
pkt_filter_xpf_unittest_cc = 'pkt_filter_bpf_unittest.cc'
else
error(f'Build failed: Unsupported system "@SYSTEM@".')
endif
CURRENT_BUILD_DIR = meson.current_build_dir()
CURRENT_SOURCE_DIR = meson.current_source_dir()
libs_testutils = [kea_dhcp_testutils_lib, kea_testutils_lib]
kea_dhcp_tests = executable(
'kea-dhcp-tests',
'classify_unittest.cc',
'duid_factory_unittest.cc',
'duid_unittest.cc',
'hwaddr_unittest.cc',
# 'iface_mgr_unittest.cc',
'libdhcp++_unittest.cc',
'opaque_data_tuple_unittest.cc',
'option4_addrlst_unittest.cc',
'option4_client_fqdn_unittest.cc',
'option4_dnr_unittest.cc',
'option6_addrlst_unittest.cc',
'option6_auth_unittest.cc',
'option6_client_fqdn_unittest.cc',
'option6_dnr_unittest.cc',
'option6_ia_unittest.cc',
'option6_iaaddr_unittest.cc',
'option6_iaprefix_unittest.cc',
'option6_pdexclude_unittest.cc',
'option6_status_code_unittest.cc',
'option_classless_static_route_unittest.cc',
'option_copy_unittest.cc',
'option_custom_unittest.cc',
'option_data_types_unittest.cc',
'option_definition_unittest.cc',
'option_int_array_unittest.cc',
'option_int_unittest.cc',
'option_opaque_data_tuples_unittest.cc',
'option_space_unittest.cc',
'option_string_unittest.cc',
'option_unittest.cc',
'option_vendor_class_unittest.cc',
'option_vendor_unittest.cc',
'packet_queue4_unittest.cc',
'packet_queue6_unittest.cc',
'packet_queue_mgr4_unittest.cc',
'packet_queue_mgr6_unittest.cc',
'pkt4_unittest.cc',
'pkt4o6_unittest.cc',
'pkt6_unittest.cc',
'pkt_filter6_test_utils.cc',
'pkt_filter_inet6_unittest.cc',
'pkt_filter_inet_unittest.cc',
'pkt_filter_test_utils.cc',
'pkt_filter_unittest.cc',
'protocol_util_unittest.cc',
'run_unittests.cc',
pkt_filter_xpf_unittest_cc,
dependencies: [gtest, crypto],
cpp_args: [f'-DTEST_DATA_BUILDDIR="@CURRENT_BUILD_DIR@"'],
include_directories: [include_directories('.')] + INCLUDES,
link_with: [kea_util_unittests_lib] + libs_testutils + LIBS_BUILT_SO_FAR,
)
test('kea_dhcp_tests', kea_dhcp_tests, protocol: 'gtest')

View File

@ -0,0 +1,14 @@
if not gtest.found()
subdir_done()
endif
kea_dhcp_testutils_lib = static_library(
'kea-dhcp-testutils',
'iface_mgr_test_config.cc',
'pkt_captures4.cc',
'pkt_captures6.cc',
'pkt_filter6_test_stub.cc',
'pkt_filter_test_stub.cc',
include_directories: [include_directories('.')] + INCLUDES,
link_with: LIBS_BUILT_SO_FAR,
)

View File

@ -21,6 +21,7 @@ kea_hooks_lib = library(
link_with: LIBS_BUILT_SO_FAR,
)
LIBS_BUILT_SO_FAR = [kea_hooks_lib] + LIBS_BUILT_SO_FAR
subdir('tests')
kea_hooks_headers = [
'callout_handle.h',
'callout_handle_associate.h',

View File

@ -0,0 +1,22 @@
if not gtest.found()
subdir_done()
endif
# Generate marker_file.h test_libraries.h
kea_hooks_tests = executable(
'kea-hooks-tests',
'callout_handle_associate_unittest.cc',
'callout_handle_unittest.cc',
'callout_manager_unittest.cc',
'handles_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',
dependencies: [gtest],
include_directories: [include_directories('.')] + INCLUDES,
link_with: [kea_util_unittests_lib] + LIBS_BUILT_SO_FAR,
)
test('kea_hooks_tests', kea_hooks_tests, protocol: 'gtest')

View File

@ -32,6 +32,7 @@ kea_http_lib = library(
link_with: LIBS_BUILT_SO_FAR,
)
LIBS_BUILT_SO_FAR = [kea_http_lib] + LIBS_BUILT_SO_FAR
subdir('tests')
kea_http_headers = [
'auth_config.h',
'auth_log.h',

View File

@ -0,0 +1,37 @@
if not gtest.found()
subdir_done()
endif
CURRENT_SOURCE_DIR = meson.current_source_dir()
libs_testutils = [kea_testutils_lib, kea_asiolink_testutils_lib]
kea_http_tests = executable(
'kea-http-tests',
'basic_auth_config_unittests.cc',
'basic_auth_unittests.cc',
'cfg_http_header_unittests.cc',
'client_mt_unittests.cc',
'connection_pool_unittests.cc',
'date_time_unittests.cc',
'http_client_unittests.cc',
'http_header_unittests.cc',
'http_server_unittests.cc',
'post_request_json_unittests.cc',
'request_parser_unittests.cc',
'request_unittests.cc',
'response_creator_unittests.cc',
'response_json_unittests.cc',
'response_parser_unittests.cc',
'response_unittests.cc',
'run_unittests.cc',
'tls_client_unittests.cc',
'tls_server_unittests.cc',
'url_unittests.cc',
cpp_args: [
f'-DTEST_CA_DIR="@TEST_CA_DIR@"',
f'-DDATA_DIR="@CURRENT_SOURCE_DIR@/testdata"',
],
dependencies: [gtest],
include_directories: [include_directories('.')] + INCLUDES,
link_with: [kea_util_unittests_lib] + libs_testutils + LIBS_BUILT_SO_FAR,
)
test('kea_http_tests', kea_http_tests, protocol: 'gtest', is_parallel: false)

View File

@ -14,6 +14,7 @@ kea_tcp_lib = library(
link_with: LIBS_BUILT_SO_FAR,
)
LIBS_BUILT_SO_FAR = [kea_tcp_lib] + LIBS_BUILT_SO_FAR
subdir('tests')
kea_tcp_headers = [
'mt_tcp_listener_mgr.h',
'tcp_connection.h',

View File

@ -0,0 +1,15 @@
if not gtest.found()
subdir_done()
endif
kea_tcp_tests = executable(
'kea-tcp-tests',
'mt_tcp_listener_mgr_unittests.cc',
'run_unittests.cc',
'tcp_listener_unittests.cc',
cpp_args: [f'-DTEST_CA_DIR="@TEST_CA_DIR@"'],
dependencies: [gtest],
include_directories: [include_directories('.')] + INCLUDES,
link_with: [kea_util_unittests_lib, kea_asiolink_testutils_lib] + LIBS_BUILT_SO_FAR,
)
test('kea_tcp_tests', kea_tcp_tests, protocol: 'gtest', is_parallel: false)