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

Commit 58576764 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Make controller prop and default commands configurable in rootcanal" am: 54f850c3

Original change: https://android-review.googlesource.com/c/platform/system/bt/+/1629269

Change-Id: I35d19d73b3fbca4874c540d0ee64727ebdd62980
parents 5553ac0a 54f850c3
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -166,6 +166,7 @@ cc_binary_host {
        "libscriptedbeaconpayload-protos-lite",
        "libbt-rootcanal",
        "breakpad_client",
        "libgflags",
    ],
    sanitize: {
        address: true,
+5 −0
Original line number Diff line number Diff line
prebuilt_etc_host {
    name: "controller_properties.json",
    src: "controller_properties.json",
    sub_dir: "rootcanal/data",
}
 No newline at end of file
+12 −1
Original line number Diff line number Diff line
@@ -23,10 +23,17 @@
#include <backtrace/Backtrace.h>
#include <backtrace/backtrace_constants.h>

#include <gflags/gflags.h>

#include "os/log.h"

using ::android::bluetooth::root_canal::TestEnvironment;

DEFINE_string(controller_properties_file, "",
              "controller_properties.json file path");
DEFINE_string(default_commands_file, "",
              "commands file which root-canal runs it as default");

constexpr uint16_t kTestPort = 6401;
constexpr uint16_t kHciServerPort = 6402;
constexpr uint16_t kLinkServerPort = 6403;
@@ -74,6 +81,8 @@ int main(int argc, char** argv) {
                                       true, -1);
  eh.set_crash_handler(crash_callback);

  gflags::ParseCommandLineFlags(&argc, &argv, true);

  LOG_INFO("main");
  uint16_t test_port = kTestPort;
  uint16_t hci_server_port = kHciServerPort;
@@ -103,7 +112,9 @@ int main(int argc, char** argv) {
    }
  }

  TestEnvironment root_canal(test_port, hci_server_port, link_server_port);
  TestEnvironment root_canal(test_port, hci_server_port, link_server_port,
                             FLAGS_controller_properties_file,
                             FLAGS_default_commands_file);
  std::promise<void> barrier;
  std::future<void> barrier_future = barrier.get_future();
  root_canal.initialize(std::move(barrier));
+2 −0
Original line number Diff line number Diff line
@@ -159,6 +159,8 @@ void TestEnvironment::SetUpTestChannel() {
  test_channel_.SetTimerPeriod({"5"});
  test_channel_.StartTimer({});

  test_channel_.FromFile(default_commands_file_);

  if (socket_fd == -1) {
    LOG_ERROR("Test channel SetUp(%d) failed.", test_port_);
    return;
+11 −2
Original line number Diff line number Diff line
@@ -30,8 +30,16 @@ namespace root_canal {

class TestEnvironment {
 public:
  TestEnvironment(uint16_t test_port, uint16_t hci_server_port, uint16_t link_server_port)
      : test_port_(test_port), hci_server_port_(hci_server_port), link_server_port_(link_server_port) {}
  TestEnvironment(uint16_t test_port, uint16_t hci_server_port,
                  uint16_t link_server_port,
                  const std::string& controller_properties_file = "",
                  const std::string& default_commands_file = "")
      : test_port_(test_port),
        hci_server_port_(hci_server_port),
        link_server_port_(link_server_port),
        default_commands_file_(default_commands_file),
        controller_(std::make_shared<test_vendor_lib::DualModeController>(
            controller_properties_file)) {}

  void initialize(std::promise<void> barrier);

@@ -41,6 +49,7 @@ class TestEnvironment {
  uint16_t test_port_;
  uint16_t hci_server_port_;
  uint16_t link_server_port_;
  std::string default_commands_file_;
  std::promise<void> barrier_;

  test_vendor_lib::AsyncManager async_manager_;
Loading