|  | # 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/fuzzing/fuzzer.gni") | 
|  | import("//src/connectivity/bluetooth/core/bt-host/build/bt_gtest_package.gni") | 
|  |  | 
|  | # Basic target with protocol definitions and no logic, suitable for test | 
|  | # emulation. | 
|  | source_set("definitions") { | 
|  | sources = [ | 
|  | "frame_headers.h", | 
|  | "l2cap_defs.h", | 
|  | ] | 
|  |  | 
|  | public_deps = [ | 
|  | "//src/connectivity/bluetooth/core/bt-host/hci:definitions", | 
|  | "//src/connectivity/bluetooth/core/bt-host/sm:definitions", | 
|  | ] | 
|  | } | 
|  |  | 
|  | static_library("l2cap") { | 
|  | sources = [ | 
|  | "basic_mode_rx_engine.cc", | 
|  | "basic_mode_rx_engine.h", | 
|  | "basic_mode_tx_engine.cc", | 
|  | "basic_mode_tx_engine.h", | 
|  | "bredr_command_handler.cc", | 
|  | "bredr_command_handler.h", | 
|  | "bredr_dynamic_channel.cc", | 
|  | "bredr_dynamic_channel.h", | 
|  | "bredr_signaling_channel.cc", | 
|  | "bredr_signaling_channel.h", | 
|  | "channel.cc", | 
|  | "channel.h", | 
|  | "channel_configuration.cc", | 
|  | "channel_configuration.h", | 
|  | "channel_manager.cc", | 
|  | "channel_manager.h", | 
|  | "command_handler.cc", | 
|  | "command_handler.h", | 
|  | "dynamic_channel.cc", | 
|  | "dynamic_channel.h", | 
|  | "dynamic_channel_registry.cc", | 
|  | "dynamic_channel_registry.h", | 
|  | "enhanced_retransmission_mode_engines.cc", | 
|  | "enhanced_retransmission_mode_engines.h", | 
|  | "enhanced_retransmission_mode_rx_engine.cc", | 
|  | "enhanced_retransmission_mode_rx_engine.h", | 
|  | "enhanced_retransmission_mode_tx_engine.cc", | 
|  | "enhanced_retransmission_mode_tx_engine.h", | 
|  | "fcs.cc", | 
|  | "fcs.h", | 
|  | "fragmenter.cc", | 
|  | "fragmenter.h", | 
|  | "l2cap.cc", | 
|  | "l2cap.h", | 
|  | "le_signaling_channel.cc", | 
|  | "le_signaling_channel.h", | 
|  | "logical_link.cc", | 
|  | "logical_link.h", | 
|  | "low_energy_command_handler.cc", | 
|  | "low_energy_command_handler.h", | 
|  | "pdu.cc", | 
|  | "pdu.h", | 
|  | "recombiner.cc", | 
|  | "recombiner.h", | 
|  | "rx_engine.h", | 
|  | "scoped_channel.cc", | 
|  | "scoped_channel.h", | 
|  | "signaling_channel.cc", | 
|  | "signaling_channel.h", | 
|  | "tx_engine.h", | 
|  | "types.h", | 
|  | ] | 
|  |  | 
|  | public_deps = [ | 
|  | ":definitions", | 
|  | "//src/connectivity/bluetooth/core/bt-host/hci", | 
|  | "//src/lib/fxl", | 
|  | "//zircon/public/lib/fit", | 
|  | "//zircon/system/ulib/inspect", | 
|  | ] | 
|  | } | 
|  |  | 
|  | source_set("testing") { | 
|  | testonly = true | 
|  |  | 
|  | sources = [ | 
|  | "fake_channel.cc", | 
|  | "fake_channel.h", | 
|  | "fake_channel_test.cc", | 
|  | "fake_channel_test.h", | 
|  | "fake_l2cap.cc", | 
|  | "fake_l2cap.h", | 
|  | "fake_signaling_channel.cc", | 
|  | "fake_signaling_channel.h", | 
|  | "test_packets.cc", | 
|  | "test_packets.h", | 
|  | ] | 
|  |  | 
|  | public_deps = [ | 
|  | ":l2cap", | 
|  | "//garnet/public/lib/gtest", | 
|  | "//src/connectivity/bluetooth/core/bt-host/common", | 
|  | "//src/connectivity/bluetooth/core/bt-host/hci", | 
|  | "//src/lib/fxl", | 
|  | "//third_party/googletest:gtest", | 
|  | ] | 
|  | } | 
|  |  | 
|  | source_set("tests") { | 
|  | testonly = true | 
|  |  | 
|  | sources = [ | 
|  | "basic_mode_rx_engine_unittest.cc", | 
|  | "basic_mode_tx_engine_unittest.cc", | 
|  | "bredr_command_handler_unittest.cc", | 
|  | "bredr_dynamic_channel_unittest.cc", | 
|  | "bredr_signaling_channel_unittest.cc", | 
|  | "channel_configuration_unittest.cc", | 
|  | "channel_manager_unittest.cc", | 
|  | "channel_unittest.cc", | 
|  | "command_handler_unittest.cc", | 
|  | "dynamic_channel_registry_unittest.cc", | 
|  | "enhanced_retransmission_mode_engines_unittest.cc", | 
|  | "enhanced_retransmission_mode_rx_engine_unittest.cc", | 
|  | "enhanced_retransmission_mode_tx_engine_unittest.cc", | 
|  | "fcs_unittest.cc", | 
|  | "fragmenter_unittest.cc", | 
|  | "frame_headers_unittest.cc", | 
|  | "l2cap_unittest.cc", | 
|  | "le_signaling_channel_unittest.cc", | 
|  | "logical_link_unittest.cc", | 
|  | "low_energy_command_handler_unittest.cc", | 
|  | "pdu_unittest.cc", | 
|  | "recombiner_unittest.cc", | 
|  | "scoped_channel_unittest.cc", | 
|  | "signaling_channel_unittest.cc", | 
|  | ] | 
|  |  | 
|  | deps = [ | 
|  | ":l2cap", | 
|  | ":testing", | 
|  | "//garnet/public/lib/gtest", | 
|  | "//sdk/lib/inspect/testing/cpp", | 
|  | "//src/connectivity/bluetooth/core/bt-host/hci", | 
|  | "//src/connectivity/bluetooth/core/bt-host/socket", | 
|  | "//src/connectivity/bluetooth/core/bt-host/testing", | 
|  | "//third_party/googletest:gmock", | 
|  | "//third_party/googletest:gtest", | 
|  | ] | 
|  | } | 
|  |  | 
|  | bt_gtest_package("bt-host-l2cap-tests") { | 
|  | with_death_tests = true | 
|  | deps = [ ":tests" ] | 
|  | } | 
|  |  | 
|  | 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", | 
|  | ] | 
|  | } | 
|  |  | 
|  | 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", | 
|  | ] | 
|  | } | 
|  |  | 
|  | fuzzer("bredr_dynamic_channel_registry_fuzzer") { | 
|  | sources = [ "bredr_dynamic_channel_registry_fuzztest.cc" ] | 
|  | deps = [ | 
|  | ":l2cap", | 
|  | ":testing", | 
|  | "//src/connectivity/bluetooth/core/bt-host/testing:fuzztest_driver", | 
|  | ] | 
|  | } | 
|  |  | 
|  | fuzzer("channel_configuration_fuzzer") { | 
|  | sources = [ "channel_configuration_fuzztest.cc" ] | 
|  | deps = [ | 
|  | ":l2cap", | 
|  | ":testing", | 
|  | "//src/connectivity/bluetooth/core/bt-host/testing:fuzztest_driver", | 
|  | ] | 
|  | } | 
|  |  | 
|  | fuzzer("common_handler_fuzzer") { | 
|  | sources = [ "common_handler_fuzztest.cc" ] | 
|  | deps = [ | 
|  | ":l2cap", | 
|  | ":testing", | 
|  | "//src/connectivity/bluetooth/core/bt-host/testing:fuzztest_driver", | 
|  | ] | 
|  | } | 
|  |  | 
|  | fuzzer("l2cap_fuzzer") { | 
|  | sources = [ "l2cap_fuzztest.cc" ] | 
|  | deps = [ | 
|  | ":l2cap", | 
|  | "//src/connectivity/bluetooth/core/bt-host/testing", | 
|  | "//src/connectivity/bluetooth/core/bt-host/testing:fuzztest_driver", | 
|  | ] | 
|  | } |