diff --git a/src/lib/config/meson.build b/src/lib/config/meson.build index 5387ee25a5..ec99f408a8 100644 --- a/src/lib/config/meson.build +++ b/src/lib/config/meson.build @@ -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', diff --git a/src/lib/config/tests/meson.build b/src/lib/config/tests/meson.build new file mode 100644 index 0000000000..ceea94c3df --- /dev/null +++ b/src/lib/config/tests/meson.build @@ -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') diff --git a/src/lib/dhcp/meson.build b/src/lib/dhcp/meson.build index e74be1a7ae..6e7b64d6b8 100644 --- a/src/lib/dhcp/meson.build +++ b/src/lib/dhcp/meson.build @@ -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', diff --git a/src/lib/dhcp/tests/meson.build b/src/lib/dhcp/tests/meson.build new file mode 100644 index 0000000000..98c01eba02 --- /dev/null +++ b/src/lib/dhcp/tests/meson.build @@ -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') diff --git a/src/lib/dhcp/testutils/meson.build b/src/lib/dhcp/testutils/meson.build new file mode 100644 index 0000000000..c203f9ce41 --- /dev/null +++ b/src/lib/dhcp/testutils/meson.build @@ -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, +) diff --git a/src/lib/hooks/meson.build b/src/lib/hooks/meson.build index ff51d8dad9..3b1d0026aa 100644 --- a/src/lib/hooks/meson.build +++ b/src/lib/hooks/meson.build @@ -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', diff --git a/src/lib/hooks/tests/meson.build b/src/lib/hooks/tests/meson.build new file mode 100644 index 0000000000..988a1bb35f --- /dev/null +++ b/src/lib/hooks/tests/meson.build @@ -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') diff --git a/src/lib/http/meson.build b/src/lib/http/meson.build index b829068b18..601ac37362 100644 --- a/src/lib/http/meson.build +++ b/src/lib/http/meson.build @@ -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', diff --git a/src/lib/http/tests/meson.build b/src/lib/http/tests/meson.build new file mode 100644 index 0000000000..c583a7fe7d --- /dev/null +++ b/src/lib/http/tests/meson.build @@ -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) diff --git a/src/lib/tcp/meson.build b/src/lib/tcp/meson.build index d466f3c476..d4c10b3410 100644 --- a/src/lib/tcp/meson.build +++ b/src/lib/tcp/meson.build @@ -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', diff --git a/src/lib/tcp/tests/meson.build b/src/lib/tcp/tests/meson.build new file mode 100644 index 0000000000..0557205f44 --- /dev/null +++ b/src/lib/tcp/tests/meson.build @@ -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)