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

Commit f2fb1912 authored by Myles Watson's avatar Myles Watson Committed by Gerrit Code Review
Browse files

Merge "HCI: Dump the stopwatch log when events come after timeout" into main

parents 5aa1ec4b 7be7b599
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -188,6 +188,7 @@ struct HciLayer::impl {
        OpCodeText(op_code).c_str());
    if (waiting_command_ == OpCode::CONTROLLER_DEBUG_INFO && op_code != OpCode::CONTROLLER_DEBUG_INFO) {
      LOG_ERROR("Discarding event that came after timeout 0x%02hx (%s)", op_code, OpCodeText(op_code).c_str());
      common::StopWatch::DumpStopWatchLog();
      return;
    }
    ASSERT_LOG(
+21 −0
Original line number Diff line number Diff line
@@ -156,6 +156,27 @@ TEST_F(HciLayerDeathTest, abort_after_hci_restart_timeout) {
      "");
}

TEST_F(HciLayerDeathTest, discard_event_after_hci_timeout) {
  FailIfResetNotSent();
  FakeTimerAdvance(HciLayer::kHciTimeoutMs.count());

  auto sent_command = hal_->GetSentCommand();
  ASSERT_TRUE(sent_command.has_value());
  auto debug_info_view = ControllerDebugInfoView::Create(VendorCommandView::Create(*sent_command));
  ASSERT_TRUE(debug_info_view.IsValid());

  // This event should be discarded, not cause an abort.
  hal_->InjectEvent(ResetCompleteBuilder::Create(1, ErrorCode::SUCCESS));
  sync_handler();

  ASSERT_DEATH(
      {
        FakeTimerAdvance(HciLayer::kHciTimeoutRestartMs.count());
        sync_handler();
      },
      "");
}

TEST_F(HciLayerDeathTest, abort_on_root_inflammation_event) {
  FailIfResetNotSent();