Loading system/stack/Android.bp +69 −0 Original line number Diff line number Diff line Loading @@ -1073,3 +1073,72 @@ cc_test { }, }, } cc_test { name: "net_test_stack_l2cap", test_suites: ["device-tests"], host_supported: true, defaults: ["fluoride_defaults"], local_include_dirs: [ "include", "test/common", ], include_dirs: [ "packages/modules/Bluetooth/system", "packages/modules/Bluetooth/system/gd", "packages/modules/Bluetooth/system/utils/include", ], generated_headers: [ "BluetoothGeneratedDumpsysDataSchema_h", "BluetoothGeneratedPackets_h", ], srcs: [ ":OsiCompatSources", ":TestCommonMainHandler", ":TestCommonMockFunctions", ":TestCommonStackConfig", ":TestMockBta", ":TestMockBtif", ":TestMockHci", ":TestMockLegacyHciCommands", ":TestMockMainShim", ":TestMockStackAcl", ":TestMockStackBtm", ":TestMockStackCryptotoolbox", ":TestMockStackHcic", ":TestMockStackSdp", ":TestMockStackSmp", "l2cap/l2c_api.cc", "l2cap/l2c_ble.cc", "l2cap/l2c_csm.cc", "l2cap/l2c_fcr.cc", "l2cap/l2c_link.cc", "l2cap/l2c_main.cc", "l2cap/l2c_utils.cc", "test/stack_l2cap_test.cc", ], static_libs: [ "libbt-common", "libbt-protos-lite", "libbtdevice", "libgmock", "liblog", "libosi", ], shared_libs: [ "libbinder_ndk", "libcrypto", "libflatbuffers-cpp", "libprotobuf-cpp-lite", ], sanitize: { address: true, all_undefined: true, cfi: true, integer_overflow: true, scs: true, diag: { undefined : true }, }, } system/stack/test/stack_l2cap_test.cc 0 → 100644 +47 −0 Original line number Diff line number Diff line /* * Copyright 2022 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <gtest/gtest.h> #include "common/init_flags.h" #include "internal_include/bt_trace.h" #include "stack/btm/btm_int_types.h" #include "stack/include/l2cap_hci_link_interface.h" #include "stack/l2cap/l2c_int.h" #include "types/raw_address.h" tBTM_CB btm_cb; extern tL2C_CB l2cb; // Global trace level referred in the code under test uint8_t appl_trace_level = BT_TRACE_LEVEL_VERBOSE; extern "C" void LogMsg(uint32_t trace_set_mask, const char* fmt_str, ...) {} const char* test_flags[] = { "INIT_logging_debug_enabled_for_all=true", nullptr, }; class StackL2capTest : public ::testing::Test { protected: void SetUp() override { bluetooth::common::InitFlags::Load(test_flags); l2cb = {}; // TODO Use proper init/free APIs } void TearDown() override {} }; Loading
system/stack/Android.bp +69 −0 Original line number Diff line number Diff line Loading @@ -1073,3 +1073,72 @@ cc_test { }, }, } cc_test { name: "net_test_stack_l2cap", test_suites: ["device-tests"], host_supported: true, defaults: ["fluoride_defaults"], local_include_dirs: [ "include", "test/common", ], include_dirs: [ "packages/modules/Bluetooth/system", "packages/modules/Bluetooth/system/gd", "packages/modules/Bluetooth/system/utils/include", ], generated_headers: [ "BluetoothGeneratedDumpsysDataSchema_h", "BluetoothGeneratedPackets_h", ], srcs: [ ":OsiCompatSources", ":TestCommonMainHandler", ":TestCommonMockFunctions", ":TestCommonStackConfig", ":TestMockBta", ":TestMockBtif", ":TestMockHci", ":TestMockLegacyHciCommands", ":TestMockMainShim", ":TestMockStackAcl", ":TestMockStackBtm", ":TestMockStackCryptotoolbox", ":TestMockStackHcic", ":TestMockStackSdp", ":TestMockStackSmp", "l2cap/l2c_api.cc", "l2cap/l2c_ble.cc", "l2cap/l2c_csm.cc", "l2cap/l2c_fcr.cc", "l2cap/l2c_link.cc", "l2cap/l2c_main.cc", "l2cap/l2c_utils.cc", "test/stack_l2cap_test.cc", ], static_libs: [ "libbt-common", "libbt-protos-lite", "libbtdevice", "libgmock", "liblog", "libosi", ], shared_libs: [ "libbinder_ndk", "libcrypto", "libflatbuffers-cpp", "libprotobuf-cpp-lite", ], sanitize: { address: true, all_undefined: true, cfi: true, integer_overflow: true, scs: true, diag: { undefined : true }, }, }
system/stack/test/stack_l2cap_test.cc 0 → 100644 +47 −0 Original line number Diff line number Diff line /* * Copyright 2022 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <gtest/gtest.h> #include "common/init_flags.h" #include "internal_include/bt_trace.h" #include "stack/btm/btm_int_types.h" #include "stack/include/l2cap_hci_link_interface.h" #include "stack/l2cap/l2c_int.h" #include "types/raw_address.h" tBTM_CB btm_cb; extern tL2C_CB l2cb; // Global trace level referred in the code under test uint8_t appl_trace_level = BT_TRACE_LEVEL_VERBOSE; extern "C" void LogMsg(uint32_t trace_set_mask, const char* fmt_str, ...) {} const char* test_flags[] = { "INIT_logging_debug_enabled_for_all=true", nullptr, }; class StackL2capTest : public ::testing::Test { protected: void SetUp() override { bluetooth::common::InitFlags::Load(test_flags); l2cb = {}; // TODO Use proper init/free APIs } void TearDown() override {} };