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

Commit 2853521c authored by David Duarte's avatar David Duarte Committed by Gerrit Code Review
Browse files

Merge "RootCanal: Move into tools/"

parents cae822ad 18c8bb01
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -70,16 +70,16 @@ COVERAGE_TESTS = [
        ],
    },
    {
        "test_name": "test-vendor_test_host",
        "test_name": "rootcanal_test_host",
        "covered_files": [
            "packages/modules/Bluetooth/system/vendor_libs/test_vendor_lib/include",
            "packages/modules/Bluetooth/system/vendor_libs/test_vendor_lib/src",
            "packages/modules/Bluetooth/tools/rootcanal/include",
            "packages/modules/Bluetooth/tools/rootcanal/src",
        ],
    },
    {
        "test_name": "rootcanal-packets_test_host",
        "covered_files": [
            "packages/modules/Bluetooth/system/vendor_libs/test_vendor_lib/packets",
            "packages/modules/Bluetooth/tools/rootcanal/packets",
        ],
    },
    {
+5 −6
Original line number Diff line number Diff line
@@ -33,9 +33,9 @@ namespace V1_1 {
namespace sim {

using android::hardware::hidl_vec;
using test_vendor_lib::AsyncTaskId;
using test_vendor_lib::DualModeController;
using test_vendor_lib::TaskCallback;
using rootcanal::AsyncTaskId;
using rootcanal::DualModeController;
using rootcanal::TaskCallback;

namespace {

@@ -177,9 +177,8 @@ Return<void> BluetoothHci::initialize_impl(
  // Add the controller as a device in the model.
  size_t controller_index = test_model_.Add(controller_);
  size_t low_energy_phy_index =
      test_model_.AddPhy(test_vendor_lib::Phy::Type::LOW_ENERGY);
  size_t classic_phy_index =
      test_model_.AddPhy(test_vendor_lib::Phy::Type::BR_EDR);
      test_model_.AddPhy(rootcanal::Phy::Type::LOW_ENERGY);
  size_t classic_phy_index = test_model_.AddPhy(rootcanal::Phy::Type::BR_EDR);
  test_model_.AddDeviceToPhy(controller_index, low_energy_phy_index);
  test_model_.AddDeviceToPhy(controller_index, classic_phy_index);
  test_model_.SetTimerPeriod(std::chrono::milliseconds(10));
+15 −16
Original line number Diff line number Diff line
@@ -84,7 +84,7 @@ class BluetoothHci : public IBluetoothHci {
  std::shared_ptr<AsyncDataChannelServer> hci_socket_server_;
  std::shared_ptr<AsyncDataChannelServer> link_socket_server_;
  std::shared_ptr<AsyncDataChannelConnector> connector_;
  test_vendor_lib::AsyncManager async_manager_;
  rootcanal::AsyncManager async_manager_;

  void SetUpTestChannel();
  void SetUpHciServer(ConnectCallback on_connect);
@@ -92,40 +92,39 @@ class BluetoothHci : public IBluetoothHci {
  std::shared_ptr<AsyncDataChannel> ConnectToRemoteServer(
      const std::string& server, int port);

  std::shared_ptr<test_vendor_lib::DualModeController> controller_;
  std::shared_ptr<rootcanal::DualModeController> controller_;

  test_vendor_lib::TestChannelTransport test_channel_transport_;
  test_vendor_lib::TestChannelTransport remote_hci_transport_;
  test_vendor_lib::TestChannelTransport remote_link_layer_transport_;
  rootcanal::TestChannelTransport test_channel_transport_;
  rootcanal::TestChannelTransport remote_hci_transport_;
  rootcanal::TestChannelTransport remote_link_layer_transport_;

  test_vendor_lib::AsyncUserId user_id_ = async_manager_.GetNextUserId();
  test_vendor_lib::TestModel test_model_{
  rootcanal::AsyncUserId user_id_ = async_manager_.GetNextUserId();
  rootcanal::TestModel test_model_{
      [this]() { return async_manager_.GetNextUserId(); },
      [this](test_vendor_lib::AsyncUserId user_id,
             std::chrono::milliseconds delay,
             const test_vendor_lib::TaskCallback& task) {
      [this](rootcanal::AsyncUserId user_id, std::chrono::milliseconds delay,
             const rootcanal::TaskCallback& task) {
        return async_manager_.ExecAsync(user_id, delay, task);
      },

      [this](test_vendor_lib::AsyncUserId user_id,
             std::chrono::milliseconds delay, std::chrono::milliseconds period,
             const test_vendor_lib::TaskCallback& task) {
      [this](rootcanal::AsyncUserId user_id, std::chrono::milliseconds delay,
             std::chrono::milliseconds period,
             const rootcanal::TaskCallback& task) {
        return async_manager_.ExecAsyncPeriodically(user_id, delay, period,
                                                    task);
      },

      [this](test_vendor_lib::AsyncUserId user) {
      [this](rootcanal::AsyncUserId user) {
        async_manager_.CancelAsyncTasksFromUser(user);
      },

      [this](test_vendor_lib::AsyncTaskId task) {
      [this](rootcanal::AsyncTaskId task) {
        async_manager_.CancelAsyncTask(task);
      },

      [this](const std::string& server, int port) {
        return ConnectToRemoteServer(server, port);
      }};
  test_vendor_lib::TestCommandHandler test_channel_{test_model_};
  rootcanal::TestCommandHandler test_channel_{test_model_};
};

extern "C" IBluetoothHci* HIDL_FETCH_IBluetoothHci(const char* name);
+0 −1
Original line number Diff line number Diff line
@@ -8,6 +8,5 @@ package {
}

subdirs = [
    "test_vendor_lib",
    "linux",
]
+6 −2
Original line number Diff line number Diff line
@@ -6,6 +6,10 @@ package {
    // to get the below license kinds:
    //   SPDX-license-identifier-Apache-2.0
    default_applicable_licenses: ["system_bt_license"],
    default_visibility: [
        "//device:__subpackages__",
        "//packages/modules/Bluetooth:__subpackages__",
    ],
}

cc_library_static {
@@ -101,7 +105,7 @@ cc_library_static {

// test-vendor unit tests for host
cc_test_host {
    name: "test-vendor_test_host",
    name: "rootcanal_test_host",
    defaults: [
        "clang_file_coverage",
        "clang_coverage_bin",
@@ -207,7 +211,7 @@ genrule {
    tools: [
        "bluetooth_packetgen",
    ],
    cmd: "$(location bluetooth_packetgen) --root_namespace=model --include=packages/modules/Bluetooth/system/vendor_libs/test_vendor_lib --out=$(genDir) $(in)",
    cmd: "$(location bluetooth_packetgen) --root_namespace=model --include=packages/modules/Bluetooth/tools/rootcanal --out=$(genDir) $(in)",
    srcs: [
        "packets/link_layer_packets.pdl",
    ],
Loading