Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c0fee617 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Replace sanitize.address with sanitize.hwaddress"

parents 8417d82d d2b38837
Loading
Loading
Loading
Loading
+6 −8
Original line number Diff line number Diff line
@@ -827,7 +827,10 @@ cc_test {
        ":BluetoothBtaaSources_host",
        ":BluetoothHalSources_hci_host",
        ":BluetoothOsSources_host",
        ":TestCommonLogMsg",
        ":TestCommonMainHandler",
        ":TestCommonMockFunctions",
        ":TestCommonStackConfig",
        ":TestMockBta",
        ":TestMockBtif",
        ":TestMockDevice",
@@ -895,14 +898,9 @@ cc_test {
        "libprotobuf-cpp-lite",
    ],
    sanitize: {
        address: true,
        all_undefined: true,
        cfi: true,
      hwaddress: true,
      integer_overflow: true,
      scs: true,
        diag: {
            undefined : true
        },
    },
}

+8 −69
Original line number Diff line number Diff line
@@ -60,77 +60,10 @@ tL2C_CB l2cb;

const hci_t* hci_layer_get_interface() { return nullptr; }

void LogMsg(uint32_t trace_set_mask, const char* fmt_str, ...) {}

const std::string kSmpOptions("mock smp options");
const std::string kBroadcastAudioConfigOptions(
    "mock broadcast audio config options");

bool get_trace_config_enabled(void) { return false; }
bool get_pts_avrcp_test(void) { return false; }
bool get_pts_secure_only_mode(void) { return false; }
bool get_pts_conn_updates_disabled(void) { return false; }
bool get_pts_crosskey_sdp_disable(void) { return false; }
const std::string* get_pts_smp_options(void) { return &kSmpOptions; }
int get_pts_smp_failure_case(void) { return 123; }
bool get_pts_force_eatt_for_notifications(void) { return false; }
bool get_pts_connect_eatt_unconditionally(void) { return false; }
bool get_pts_connect_eatt_before_encryption(void) { return false; }
bool get_pts_unencrypt_broadcast(void) { return false; }
bool get_pts_eatt_peripheral_collision_support(void) { return false; }
bool get_pts_use_eatt_for_all_services(void) { return false; }
bool get_pts_force_le_audio_multiple_contexts_metadata(void) { return false; }
bool get_pts_l2cap_ecoc_upper_tester(void) { return false; }
int get_pts_l2cap_ecoc_min_key_size(void) { return -1; }
int get_pts_l2cap_ecoc_initial_chan_cnt(void) { return -1; }
bool get_pts_l2cap_ecoc_connect_remaining(void) { return false; }
int get_pts_l2cap_ecoc_send_num_of_sdu(void) { return -1; }
bool get_pts_l2cap_ecoc_reconfigure(void) { return false; }
const std::string* get_pts_broadcast_audio_config_options(void) {
  return &kBroadcastAudioConfigOptions;
}
bool get_pts_le_audio_disable_ases_before_stopping(void) { return false; }
config_t* get_all(void) { return nullptr; }
const packet_fragmenter_t* packet_fragmenter_get_interface() { return nullptr; }

stack_config_t mock_stack_config{
    .get_trace_config_enabled = get_trace_config_enabled,
    .get_pts_avrcp_test = get_pts_avrcp_test,
    .get_pts_secure_only_mode = get_pts_secure_only_mode,
    .get_pts_conn_updates_disabled = get_pts_conn_updates_disabled,
    .get_pts_crosskey_sdp_disable = get_pts_crosskey_sdp_disable,
    .get_pts_smp_options = get_pts_smp_options,
    .get_pts_smp_failure_case = get_pts_smp_failure_case,
    .get_pts_force_eatt_for_notifications =
        get_pts_force_eatt_for_notifications,
    .get_pts_connect_eatt_unconditionally =
        get_pts_connect_eatt_unconditionally,
    .get_pts_connect_eatt_before_encryption =
        get_pts_connect_eatt_before_encryption,
    .get_pts_unencrypt_broadcast = get_pts_unencrypt_broadcast,
    .get_pts_eatt_peripheral_collision_support =
        get_pts_eatt_peripheral_collision_support,
    .get_pts_l2cap_ecoc_upper_tester = get_pts_l2cap_ecoc_upper_tester,
    .get_pts_l2cap_ecoc_min_key_size = get_pts_l2cap_ecoc_min_key_size,
    .get_pts_force_le_audio_multiple_contexts_metadata =
        get_pts_force_le_audio_multiple_contexts_metadata,
    .get_pts_l2cap_ecoc_initial_chan_cnt = get_pts_l2cap_ecoc_initial_chan_cnt,
    .get_pts_l2cap_ecoc_connect_remaining =
        get_pts_l2cap_ecoc_connect_remaining,
    .get_pts_l2cap_ecoc_send_num_of_sdu = get_pts_l2cap_ecoc_send_num_of_sdu,
    .get_pts_l2cap_ecoc_reconfigure = get_pts_l2cap_ecoc_reconfigure,
    .get_pts_broadcast_audio_config_options =
        get_pts_broadcast_audio_config_options,
    .get_pts_le_audio_disable_ases_before_stopping =
        get_pts_le_audio_disable_ases_before_stopping,
    .get_all = get_all,
};
const stack_config_t* stack_config_get_interface(void) {
  return &mock_stack_config;
}

std::map<std::string, int> mock_function_count_map;

namespace {

using testing::_;
@@ -160,8 +93,14 @@ class StackBtmTest : public Test {
class StackBtmWithInitFreeTest : public StackBtmTest {
 public:
 protected:
  void SetUp() override { btm_cb.Init(BTM_SEC_MODE_SC); }
  void TearDown() override { btm_cb.Free(); }
  void SetUp() override {
    StackBtmTest::SetUp();
    btm_cb.Init(BTM_SEC_MODE_SC);
  }
  void TearDown() override {
    btm_cb.Free();
    StackBtmTest::TearDown();
  }
};

TEST_F(StackBtmTest, GlobalLifecycle) {
+14 −0
Original line number Diff line number Diff line
@@ -354,6 +354,13 @@ filegroup {
  ],
}

filegroup {
  name: "TestMockStackEatt",
  srcs: [
      "mock/mock_stack_eatt*.cc",
  ],
}

filegroup {
  name: "TestMockStackGatt",
  srcs: [
@@ -438,6 +445,13 @@ filegroup {
  ],
}

filegroup {
  name: "TestCommonLogMsg",
  srcs: [
      "common/log_msg.cc",
  ],
}

filegroup {
  name: "TestMockBluetoothInterface",
  srcs: [
+19 −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 <cstdint>

extern "C" void LogMsg(uint32_t trace_set_mask, const char* fmt_str, ...) {}