| # Copyright 2017 The Fuchsia Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| import("//build/bazel/bazel_fuchsia_test_package.gni") |
| import("//build/fuzz.gni") |
| import("//build_overrides/pigweed.gni") |
| import("$dir_pw_fuzzer/fuzzer.gni") |
| import("$dir_pw_unit_test/test.gni") |
| |
| dir_public_l2cap = "../public/pw_bluetooth_sapphire/internal/host/l2cap" |
| |
| # Basic target with protocol definitions and no logic, suitable for test |
| # emulation. |
| pw_source_set("definitions") { |
| public = [ |
| "$dir_public_l2cap/frame_headers.h", |
| "$dir_public_l2cap/l2cap_defs.h", |
| ] |
| |
| public_deps = [ |
| "//src/connectivity/bluetooth/core/bt-host/hci-spec", |
| "//src/connectivity/bluetooth/core/bt-host/sm:definitions", |
| ] |
| } |
| |
| pw_source_set("l2cap") { |
| public = [ |
| "$dir_public_l2cap/a2dp_offload_manager.h", |
| "$dir_public_l2cap/basic_mode_rx_engine.h", |
| "$dir_public_l2cap/basic_mode_tx_engine.h", |
| "$dir_public_l2cap/bredr_command_handler.h", |
| "$dir_public_l2cap/bredr_dynamic_channel.h", |
| "$dir_public_l2cap/bredr_signaling_channel.h", |
| "$dir_public_l2cap/channel.h", |
| "$dir_public_l2cap/channel_configuration.h", |
| "$dir_public_l2cap/channel_manager.h", |
| "$dir_public_l2cap/command_handler.h", |
| "$dir_public_l2cap/credit_based_flow_control_rx_engine.h", |
| "$dir_public_l2cap/credit_based_flow_control_tx_engine.h", |
| "$dir_public_l2cap/dynamic_channel.h", |
| "$dir_public_l2cap/dynamic_channel_registry.h", |
| "$dir_public_l2cap/enhanced_retransmission_mode_engines.h", |
| "$dir_public_l2cap/enhanced_retransmission_mode_rx_engine.h", |
| "$dir_public_l2cap/enhanced_retransmission_mode_tx_engine.h", |
| "$dir_public_l2cap/fcs.h", |
| "$dir_public_l2cap/fragmenter.h", |
| "$dir_public_l2cap/le_signaling_channel.h", |
| "$dir_public_l2cap/logical_link.h", |
| "$dir_public_l2cap/low_energy_command_handler.h", |
| "$dir_public_l2cap/pdu.h", |
| "$dir_public_l2cap/recombiner.h", |
| "$dir_public_l2cap/rx_engine.h", |
| "$dir_public_l2cap/scoped_channel.h", |
| "$dir_public_l2cap/signaling_channel.h", |
| "$dir_public_l2cap/tx_engine.h", |
| "$dir_public_l2cap/types.h", |
| ] |
| |
| sources = [ |
| "a2dp_offload_manager.cc", |
| "basic_mode_rx_engine.cc", |
| "basic_mode_tx_engine.cc", |
| "bredr_command_handler.cc", |
| "bredr_dynamic_channel.cc", |
| "bredr_signaling_channel.cc", |
| "channel.cc", |
| "channel_configuration.cc", |
| "channel_manager.cc", |
| "command_handler.cc", |
| "credit_based_flow_control_rx_engine.cc", |
| "credit_based_flow_control_tx_engine.cc", |
| "dynamic_channel.cc", |
| "dynamic_channel_registry.cc", |
| "enhanced_retransmission_mode_engines.cc", |
| "enhanced_retransmission_mode_rx_engine.cc", |
| "enhanced_retransmission_mode_tx_engine.cc", |
| "fcs.cc", |
| "fragmenter.cc", |
| "le_signaling_channel.cc", |
| "logical_link.cc", |
| "low_energy_command_handler.cc", |
| "pdu.cc", |
| "recombiner.cc", |
| "scoped_channel.cc", |
| "signaling_channel.cc", |
| "types.cc", |
| ] |
| |
| public_deps = [ |
| ":definitions", |
| "$dir_pw_string", |
| "$dir_pw_third_party/fuchsia:fit", |
| "//src/connectivity/bluetooth/core/bt-host:config", |
| "//src/connectivity/bluetooth/core/bt-host/hci", |
| "//src/connectivity/bluetooth/core/bt-host/transport", |
| ] |
| |
| deps = [ "$dir_pw_bluetooth:emboss_l2cap_frames" ] |
| } |
| |
| # Separate from :testing to avoid a dependency cycle. |
| pw_source_set("channel_manager_mock_controller_test_fixture") { |
| testonly = true |
| |
| testonly = pw_unit_test_TESTONLY |
| |
| public = |
| [ "$dir_public_l2cap/channel_manager_mock_controller_test_fixture.h" ] |
| |
| public_deps = [ |
| ":l2cap", |
| ":testing", |
| "//src/connectivity/bluetooth/core/bt-host/hci", |
| "//src/connectivity/bluetooth/core/bt-host/testing", |
| ] |
| } |
| |
| pw_source_set("testing") { |
| testonly = true |
| |
| testonly = pw_unit_test_TESTONLY |
| |
| public = [ |
| "$dir_public_l2cap/fake_channel.h", |
| "$dir_public_l2cap/fake_channel_test.h", |
| "$dir_public_l2cap/fake_l2cap.h", |
| "$dir_public_l2cap/fake_signaling_channel.h", |
| "$dir_public_l2cap/mock_channel_test.h", |
| "$dir_public_l2cap/test_packets.h", |
| ] |
| |
| sources = [ |
| "fake_channel.cc", |
| "fake_channel_test.cc", |
| "fake_l2cap.cc", |
| "fake_signaling_channel.cc", |
| "mock_channel_test.cc", |
| "test_packets.cc", |
| ] |
| |
| public_deps = [ |
| ":l2cap", |
| "$dir_pw_async:fake_dispatcher_fixture", |
| "$dir_pw_async:heap_dispatcher", |
| "$dir_pw_bluetooth", |
| "$dir_pw_unit_test", |
| "//src/connectivity/bluetooth/core/bt-host/common", |
| "//src/connectivity/bluetooth/core/bt-host/hci", |
| "//src/connectivity/bluetooth/core/bt-host/testing:test_helpers", |
| ] |
| } |
| |
| pw_test("tests") { |
| sources = [ |
| "a2dp_offload_manager_test.cc", |
| "basic_mode_rx_engine_test.cc", |
| "basic_mode_tx_engine_test.cc", |
| "bredr_command_handler_test.cc", |
| "bredr_dynamic_channel_test.cc", |
| "bredr_signaling_channel_test.cc", |
| "channel_configuration_test.cc", |
| "channel_manager_test.cc", |
| "channel_test.cc", |
| "command_handler_test.cc", |
| "credit_based_flow_control_rx_engine_test.cc", |
| "credit_based_flow_control_tx_engine_test.cc", |
| "dynamic_channel_registry_test.cc", |
| "enhanced_retransmission_mode_engines_test.cc", |
| "enhanced_retransmission_mode_rx_engine_test.cc", |
| "enhanced_retransmission_mode_tx_engine_test.cc", |
| "fcs_test.cc", |
| "fragmenter_test.cc", |
| "frame_headers_test.cc", |
| "le_signaling_channel_test.cc", |
| "logical_link_test.cc", |
| "low_energy_command_handler_test.cc", |
| "pdu_test.cc", |
| "recombiner_test.cc", |
| "scoped_channel_test.cc", |
| "signaling_channel_test.cc", |
| "types_test.cc", |
| ] |
| |
| deps = [ |
| ":channel_manager_mock_controller_test_fixture", |
| ":l2cap", |
| ":testing", |
| "$dir_pw_async:fake_dispatcher_fixture", |
| "//src/connectivity/bluetooth/core/bt-host/hci", |
| "//src/connectivity/bluetooth/core/bt-host/hci:testing", |
| "//src/connectivity/bluetooth/core/bt-host/testing", |
| "//src/connectivity/bluetooth/core/bt-host/transport:testing", |
| ] |
| |
| test_main = "//src/connectivity/bluetooth/core/bt-host/testing:gtest_main" |
| } |
| |
| fuchsia_library_fuzzer("basic_mode_rx_engine_fuzzer") { |
| sources = [ "basic_mode_rx_engine_fuzztest.cc" ] |
| deps = [ |
| ":l2cap", |
| ":testing", |
| "//src/connectivity/bluetooth/core/bt-host/testing:fuzztest_driver", |
| ] |
| } |
| |
| pw_fuzzer("pw_basic_mode_rx_engine_fuzzer") { |
| sources = [ "basic_mode_rx_engine_fuzztest.cc" ] |
| deps = [ |
| ":l2cap", |
| ":testing", |
| ] |
| } |
| |
| fuchsia_library_fuzzer("enhanced_retransmission_mode_engines_fuzzer") { |
| sources = [ "enhanced_retransmission_mode_engines_fuzztest.cc" ] |
| deps = [ |
| ":l2cap", |
| ":testing", |
| "//src/connectivity/bluetooth/core/bt-host/testing:fuzztest_driver", |
| ] |
| } |
| |
| pw_fuzzer("pw_enhanced_retransmission_mode_engines_fuzzer") { |
| sources = [ "enhanced_retransmission_mode_engines_fuzztest.cc" ] |
| deps = [ |
| ":l2cap", |
| ":testing", |
| ] |
| } |
| |
| fuchsia_library_fuzzer("bredr_dynamic_channel_registry_fuzzer") { |
| sources = [ "bredr_dynamic_channel_registry_fuzztest.cc" ] |
| deps = [ |
| ":l2cap", |
| ":testing", |
| "$dir_pw_random:fuzzer_generator", |
| "//src/connectivity/bluetooth/core/bt-host/testing:fuzztest_driver", |
| ] |
| } |
| |
| pw_fuzzer("pw_bredr_dynamic_channel_registry_fuzzer") { |
| sources = [ "bredr_dynamic_channel_registry_fuzztest.cc" ] |
| deps = [ |
| ":l2cap", |
| ":testing", |
| "$dir_pw_random:fuzzer_generator", |
| ] |
| } |
| |
| fuchsia_library_fuzzer("channel_configuration_fuzzer") { |
| sources = [ "channel_configuration_fuzztest.cc" ] |
| deps = [ |
| ":l2cap", |
| ":testing", |
| "//src/connectivity/bluetooth/core/bt-host/testing:fuzztest_driver", |
| ] |
| } |
| |
| pw_fuzzer("pw_channel_configuration_fuzzer") { |
| sources = [ "channel_configuration_fuzztest.cc" ] |
| deps = [ |
| ":l2cap", |
| ":testing", |
| ] |
| } |
| |
| fuchsia_library_fuzzer("common_handler_fuzzer") { |
| sources = [ "common_handler_fuzztest.cc" ] |
| deps = [ |
| ":l2cap", |
| ":testing", |
| "//src/connectivity/bluetooth/core/bt-host/testing:fuzztest_driver", |
| ] |
| } |
| |
| pw_fuzzer("pw_common_handler_fuzzer") { |
| sources = [ "common_handler_fuzztest.cc" ] |
| deps = [ |
| ":l2cap", |
| ":testing", |
| ] |
| } |
| |
| fuchsia_library_fuzzer("l2cap_fuzzer") { |
| sources = [ "l2cap_fuzztest.cc" ] |
| deps = [ |
| ":l2cap", |
| "$dir_pw_random:fuzzer_generator", |
| "//src/connectivity/bluetooth/core/bt-host/testing", |
| "//src/connectivity/bluetooth/core/bt-host/testing:controller_test_double_base", |
| "//src/connectivity/bluetooth/core/bt-host/testing:fuzztest_driver", |
| ] |
| } |
| |
| pw_fuzzer("pw_l2cap_fuzzer") { |
| sources = [ "l2cap_fuzztest.cc" ] |
| deps = [ |
| ":l2cap", |
| "$dir_pw_random:fuzzer_generator", |
| "//src/connectivity/bluetooth/core/bt-host/testing", |
| "//src/connectivity/bluetooth/core/bt-host/testing:controller_test_double_base", |
| ] |
| } |
| |
| pw_test_group("tests_and_fuzzers") { |
| tests = [ |
| ":tests", |
| ":pw_basic_mode_rx_engine_fuzzer_test", |
| ":pw_enhanced_retransmission_mode_engines_fuzzer_test", |
| ":pw_bredr_dynamic_channel_registry_fuzzer_test", |
| ":pw_channel_configuration_fuzzer_test", |
| ":pw_common_handler_fuzzer_test", |
| ":pw_l2cap_fuzzer_test", |
| ] |
| } |
| |
| bazel_fuchsia_test_package("test_pkg") { |
| test_package_name = "l2cap_tests" |
| test_component_names = [ "l2cap_test_autogen_cml" ] |
| } |