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

Commit 0bdc30f2 authored by David Duarte's avatar David Duarte Committed by Gerrit Code Review
Browse files

Merge changes I54165045,Ic197f4d5,Ic3add8e1,I7d5f2d5a,I82287ec6, ...

* changes:
  Add all unit and device tests to TEST_MAPPING
  FrameworkBluetoothTests: Set an accessible test-filter-dir
  GD: Use gtest ASSERT in SetCommandFuture
  GD: Skip LeImplTest that fail with NumberCachedCommands() != 3
  GD: Skip test failing due to broken LogCapture
  GD: Skip LeAddressManagerWithSingleClientTest tests that assert
  GD: Skip HciLayerTest that assert or block indefinitely
  Make bluetooth_flatbuffer_bundler_test host only
parents d06b2766 2b0844ab
Loading
Loading
Loading
Loading
+155 −32
Original line number Diff line number Diff line
{
  "postsubmit" : [
  "presubmit": [
    // android_test targets
    {
      "name" : "bluetooth_test_common"
      "name": "CtsBluetoothTestCases"
    },
    {
      "name" : "bluetoothtbd_test"
      "name": "BluetoothInstrumentationTests"
    },
    {
      "name": "GoogleBluetoothInstrumentationTests"
    },
    {
      "name": "FrameworkBluetoothTests"
    },
    {
      "name": "ServiceBluetoothTests"
    },
    // device only tests
    // Broken
    //{
    //  "name": "bluetooth-test-audio-hal-interface"
    //},
    {
      "name": "net_test_audio_a2dp_hw"
    },
    {
      "name" : "net_test_avrcp"
      "name": "net_test_audio_hearing_aid_hw"
    },
    {
      "name" : "net_test_btcore"
      "name": "net_test_bluetooth"
    },
    {
      "name": "net_test_bta"
    },
    {
      "name": "net_test_btif"
    },
    {
      "name" : "net_test_btif_profile_queue"
      "name": "net_test_btif_hf_client_service"
    },
    {
      "name" : "net_test_btpackets"
      "name": "net_test_btif_profile_queue"
    },
    {
      "name": "net_test_device"
    },
    {
      "name" : "net_test_eatt"
      "name": "net_test_gatt_conn_multiplexing"
    },
    {
      "name": "net_test_hci"
    },
    {
      "name" : "net_test_performance"
      "name": "net_test_hf_client_add_record"
    },
    {
      "name": "net_test_stack"
@@ -45,22 +63,57 @@
    {
      "name": "net_test_stack_multi_adv"
    },
    // go/a-unit-tests tests (unit_test: true)
    // Thoses test run on the host in the CI automatically.
    // Run the one that are available on the device on the
    // device as well
    {
      "name" : "net_test_stack_rfcomm"
      "name": "bluetooth_csis_test"
    },
    {
      "name" : "net_test_stack_smp"
      "name": "bluetooth_flatbuffer_tests"
    },
    {
      "name" : "net_test_types"
    }
  ],
  "presubmit" : [
      "name": "bluetooth_groups_test"
    },
    {
      "name" : "net_test_hf_client_add_record"
      "name": "bluetooth_has_test"
    },
    {
      "name" : "net_test_btif_hf_client_service"
      "name": "bluetooth_hh_test"
    },
    {
      "name": "bluetooth_le_audio_client_test"
    },
    {
      "name": "bluetooth_le_audio_test"
    },
    {
      "name": "bluetooth_packet_parser_test"
    },
    {
      "name": "bluetooth_test_broadcaster"
    },
    {
      "name": "bluetooth_test_broadcaster_state_machine"
    },
    {
      "name": "bluetooth_test_common"
    },
    {
      "name": "bluetooth_test_gd_unit"
    },
    {
      "name": "bluetooth_test_sdp"
    },
    {
      "name": "bluetooth_vc_test"
    },
    {
      "name": "bluetoothtbd_test"
    },
    {
      "name": "bt_host_test_bta"
    },
    {
      "name": "libaptx_enc_tests"
@@ -68,23 +121,93 @@
    {
      "name": "libaptxhd_enc_tests"
    },
    {
      "name": "net_test_avrcp"
    },
    {
      "name": "net_test_btcore"
    },
    {
      "name": "net_test_btif_config_cache"
    },
    {
      "name": "net_test_btif_hh"
    },
    {
      "name": "net_test_btif_rc"
    },
    {
      "name": "net_test_btif_stack"
    },
    {
      "name": "net_test_btm_iso"
    },
    {
      "name": "net_test_btpackets"
    },
    {
      "name": "net_test_eatt"
    },
    {
      "name": "net_test_hci_fragmenter_native"
    },
    {
      "name": "net_test_hci_native"
    },
    {
      "name": "net_test_main_shim"
    },
    {
      "name": "net_test_osi"
    },
    {
      "name": "net_test_performance"
    },
    {
      "name": "net_test_stack_a2dp_native"
    },
    {
      "name": "net_test_stack_acl"
    },
    {
      "name": "net_test_stack_avdtp"
    },
    {
      "name": "net_test_stack_btm"
    },
    {
      "name" : "CtsBluetoothTestCases"
      "name": "net_test_stack_btu"
    },
    {
      "name" : "BluetoothInstrumentationTests"
      "name": "net_test_stack_gatt"
    },
    {
      "name" : "GoogleBluetoothInstrumentationTests"
      "name": "net_test_stack_gatt_native"
    },
    {
      "name" : "FrameworkBluetoothTests"
      "name": "net_test_stack_gatt_sr_hash_native"
    },
    {
      "name" : "ServiceBluetoothTests"
      "name": "net_test_stack_hci"
    },
    {
      "name": "net_test_stack_hid"
    },
    {
      "name": "net_test_stack_l2cap"
    },
    // b/255042467
    //{
    //  "name": "net_test_stack_rfcomm"
    //},
    {
      "name": "net_test_stack_sdp"
    },
    {
      "name": "net_test_stack_smp"
    },
    {
      "name": "net_test_types"
    }
  ]
}
+4 −0
Original line number Diff line number Diff line
@@ -28,6 +28,10 @@

    <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
        <option name="package" value="com.android.framework.bluetooth.tests" />
        <!-- include and exclude filters go into /data/local/tmp/ajur/ by default
             However it's prohibited for access by system uid packages.
             So instead we use the app cache folder for filter -->
        <option name="test-filter-dir" value="/data/data/com.android.bluetooth/cache" />
        <option name="hidden-api-checks" value="false"/>
        <option name="runner" value="androidx.test.runner.AndroidJUnitRunner"/>
    </test>
+10 −5
Original line number Diff line number Diff line
@@ -62,7 +62,8 @@ TEST_F(LogCaptureTest, no_output) {
  ASSERT_TRUE(log_capture->Size() == 0);
}

TEST_F(LogCaptureTest, truncate) {
// b/260917913
TEST_F(LogCaptureTest, DISABLED_truncate) {
  std::unique_ptr<LogCapture> log_capture = std::make_unique<LogCapture>();

  CalibrateOneLine(kLogError);
@@ -76,7 +77,8 @@ TEST_F(LogCaptureTest, truncate) {
  ASSERT_EQ(size, log_capture->Size());
}

TEST_F(LogCaptureTest, log_size) {
// b/260917913
TEST_F(LogCaptureTest, DISABLED_log_size) {
  std::unique_ptr<LogCapture> log_capture = std::make_unique<LogCapture>();

  CalibrateOneLine(kEmptyLine);
@@ -101,7 +103,8 @@ TEST_F(LogCaptureTest, log_size) {
  ASSERT_TRUE(log_capture->Rewind()->Find(kLogInfo));
}

TEST_F(LogCaptureTest, typical) {
// b/260917913
TEST_F(LogCaptureTest, DISABLED_typical) {
  bluetooth::common::InitFlags::Load(nullptr);
  std::unique_ptr<LogCapture> log_capture = std::make_unique<LogCapture>();

@@ -118,7 +121,8 @@ TEST_F(LogCaptureTest, typical) {
  ASSERT_FALSE(log_capture->Rewind()->Find(kLogVerbose));
}

TEST_F(LogCaptureTest, with_logging_debug_enabled_for_all) {
// b/260917913
TEST_F(LogCaptureTest, DISABLED_with_logging_debug_enabled_for_all) {
  bluetooth::common::InitFlags::Load(test_flags);
  std::unique_ptr<LogCapture> log_capture = std::make_unique<LogCapture>();

@@ -136,7 +140,8 @@ TEST_F(LogCaptureTest, with_logging_debug_enabled_for_all) {
  bluetooth::common::InitFlags::Load(nullptr);
}

TEST_F(LogCaptureTest, wait_until_log_contains) {
// b/260917913
TEST_F(LogCaptureTest, DISABLED_wait_until_log_contains) {
  bluetooth::common::InitFlags::Load(test_flags);
  std::unique_ptr<LogCapture> log_capture = std::make_unique<LogCapture>();

+1 −2
Original line number Diff line number Diff line
@@ -69,9 +69,8 @@ cc_binary_host {
    ],
}

cc_test {
cc_test_host {
    name: "bluetooth_flatbuffer_bundler_test",
    host_supported: true,
    srcs: [
        ":BluetoothFlatbufferBundlerTestSources",
    ],
+42 −26
Original line number Diff line number Diff line
@@ -298,7 +298,7 @@ class TestHciLayer : public HciLayer {
  }

  void SetCommandFuture() {
    ASSERT_LOG(command_promise_ == nullptr, "Promises, Promises, ... Only one at a time.");
    ASSERT_EQ(command_promise_, nullptr) << "Promises, Promises, ... Only one at a time.";
    command_promise_ = std::make_unique<std::promise<void>>();
    command_future_ = std::make_unique<std::future<void>>(command_promise_->get_future());
  }
@@ -457,7 +457,7 @@ class LeImplTest : public ::testing::Test {

  void set_random_device_address_policy() {
    // Set address policy
    hci_layer_->SetCommandFuture();
    ASSERT_NO_FATAL_FAILURE(hci_layer_->SetCommandFuture());
    hci::Address address;
    Address::FromString("D0:05:04:03:02:01", address);
    hci::AddressWithType address_with_type(address, hci::AddressType::RANDOM_DEVICE_ADDRESS);
@@ -659,11 +659,11 @@ TEST_F(LeImplTest, connection_complete_with_periperal_role) {
  set_random_device_address_policy();

  // Create connection
  hci_layer_->SetCommandFuture();
  ASSERT_NO_FATAL_FAILURE(hci_layer_->SetCommandFuture());
  le_impl_->create_le_connection(
      {{0x21, 0x22, 0x23, 0x24, 0x25, 0x26}, AddressType::PUBLIC_DEVICE_ADDRESS}, true, false);
  hci_layer_->GetCommand(OpCode::LE_ADD_DEVICE_TO_FILTER_ACCEPT_LIST);
  hci_layer_->SetCommandFuture();
  ASSERT_NO_FATAL_FAILURE(hci_layer_->SetCommandFuture());
  hci_layer_->CommandCompleteCallback(LeAddDeviceToFilterAcceptListCompleteBuilder::Create(0x01, ErrorCode::SUCCESS));
  hci_layer_->GetCommand(OpCode::LE_CREATE_CONNECTION);
  hci_layer_->CommandStatusCallback(LeCreateConnectionStatusBuilder::Create(ErrorCode::SUCCESS, 0x01));
@@ -698,11 +698,11 @@ TEST_F(LeImplTest, enhanced_connection_complete_with_periperal_role) {

  controller_->AddSupported(OpCode::LE_EXTENDED_CREATE_CONNECTION);
  // Create connection
  hci_layer_->SetCommandFuture();
  ASSERT_NO_FATAL_FAILURE(hci_layer_->SetCommandFuture());
  le_impl_->create_le_connection(
      {{0x21, 0x22, 0x23, 0x24, 0x25, 0x26}, AddressType::PUBLIC_DEVICE_ADDRESS}, true, false);
  hci_layer_->GetCommand(OpCode::LE_ADD_DEVICE_TO_FILTER_ACCEPT_LIST);
  hci_layer_->SetCommandFuture();
  ASSERT_NO_FATAL_FAILURE(hci_layer_->SetCommandFuture());
  hci_layer_->CommandCompleteCallback(LeAddDeviceToFilterAcceptListCompleteBuilder::Create(0x01, ErrorCode::SUCCESS));
  hci_layer_->GetCommand(OpCode::LE_EXTENDED_CREATE_CONNECTION);
  hci_layer_->CommandStatusCallback(LeExtendedCreateConnectionStatusBuilder::Create(ErrorCode::SUCCESS, 0x01));
@@ -741,10 +741,10 @@ TEST_F(LeImplTest, connection_complete_with_central_role) {
  Address::FromString("D0:05:04:03:02:01", remote_address);
  hci::AddressWithType address_with_type(remote_address, hci::AddressType::PUBLIC_DEVICE_ADDRESS);
  // Create connection
  hci_layer_->SetCommandFuture();
  ASSERT_NO_FATAL_FAILURE(hci_layer_->SetCommandFuture());
  le_impl_->create_le_connection(address_with_type, true, false);
  hci_layer_->GetCommand(OpCode::LE_ADD_DEVICE_TO_FILTER_ACCEPT_LIST);
  hci_layer_->SetCommandFuture();
  ASSERT_NO_FATAL_FAILURE(hci_layer_->SetCommandFuture());
  hci_layer_->CommandCompleteCallback(LeAddDeviceToFilterAcceptListCompleteBuilder::Create(0x01, ErrorCode::SUCCESS));
  hci_layer_->GetCommand(OpCode::LE_CREATE_CONNECTION);
  hci_layer_->CommandStatusCallback(LeCreateConnectionStatusBuilder::Create(ErrorCode::SUCCESS, 0x01));
@@ -779,10 +779,10 @@ TEST_F(LeImplTest, enhanced_connection_complete_with_central_role) {
  Address::FromString("D0:05:04:03:02:01", remote_address);
  hci::AddressWithType address_with_type(remote_address, hci::AddressType::PUBLIC_DEVICE_ADDRESS);
  // Create connection
  hci_layer_->SetCommandFuture();
  ASSERT_NO_FATAL_FAILURE(hci_layer_->SetCommandFuture());
  le_impl_->create_le_connection(address_with_type, true, false);
  hci_layer_->GetCommand(OpCode::LE_ADD_DEVICE_TO_FILTER_ACCEPT_LIST);
  hci_layer_->SetCommandFuture();
  ASSERT_NO_FATAL_FAILURE(hci_layer_->SetCommandFuture());
  hci_layer_->CommandCompleteCallback(LeAddDeviceToFilterAcceptListCompleteBuilder::Create(0x01, ErrorCode::SUCCESS));
  hci_layer_->GetCommand(OpCode::LE_EXTENDED_CREATE_CONNECTION);
  hci_layer_->CommandStatusCallback(LeExtendedCreateConnectionStatusBuilder::Create(ErrorCode::SUCCESS, 0x01));
@@ -811,7 +811,8 @@ TEST_F(LeImplTest, enhanced_connection_complete_with_central_role) {
  ASSERT_EQ(ConnectabilityState::DISARMED, le_impl_->connectability_state_);
}

TEST_F(LeImplTest, register_with_address_manager__AddressPolicyNotSet) {
// b/260917913
TEST_F(LeImplTest, DISABLED_register_with_address_manager__AddressPolicyNotSet) {
  auto log_capture = std::make_unique<LogCapture>();

  std::promise<void> promise;
@@ -863,7 +864,8 @@ TEST_F(LeImplTest, register_with_address_manager__AddressPolicyNotSet) {
      std::move(log_capture)));
}

TEST_F(LeImplTest, disarm_connectability_DISARMED) {
// b/260917913
TEST_F(LeImplTest, DISABLED_disarm_connectability_DISARMED) {
  std::unique_ptr<LogCapture> log_capture = std::make_unique<LogCapture>();

  le_impl_->connectability_state_ = ConnectabilityState::DISARMED;
@@ -876,7 +878,8 @@ TEST_F(LeImplTest, disarm_connectability_DISARMED) {
  ASSERT_TRUE(log_capture->Rewind()->Find("in unexpected state:ConnectabilityState::DISARMED"));
}

TEST_F(LeImplTest, disarm_connectability_DISARMED_extended) {
// b/260917913
TEST_F(LeImplTest, DISABLED_disarm_connectability_DISARMED_extended) {
  std::unique_ptr<LogCapture> log_capture = std::make_unique<LogCapture>();

  le_impl_->connectability_state_ = ConnectabilityState::DISARMED;
@@ -890,7 +893,8 @@ TEST_F(LeImplTest, disarm_connectability_DISARMED_extended) {
  ASSERT_TRUE(log_capture->Rewind()->Find("in unexpected state:ConnectabilityState::DISARMED"));
}

TEST_F(LeImplTest, disarm_connectability_ARMING) {
// b/260917913
TEST_F(LeImplTest, DISABLED_disarm_connectability_ARMING) {
  std::unique_ptr<LogCapture> log_capture = std::make_unique<LogCapture>();

  le_impl_->connectability_state_ = ConnectabilityState::ARMING;
@@ -902,7 +906,8 @@ TEST_F(LeImplTest, disarm_connectability_ARMING) {
  ASSERT_TRUE(log_capture->Rewind()->Find("Le connection state machine armed state"));
}

TEST_F(LeImplTest, disarm_connectability_ARMING_extended) {
// b/260917913
TEST_F(LeImplTest, DISABLED_disarm_connectability_ARMING_extended) {
  std::unique_ptr<LogCapture> log_capture = std::make_unique<LogCapture>();

  le_impl_->connectability_state_ = ConnectabilityState::ARMING;
@@ -916,7 +921,8 @@ TEST_F(LeImplTest, disarm_connectability_ARMING_extended) {
  ASSERT_TRUE(log_capture->Rewind()->Find("Le connection state machine armed state"));
}

TEST_F(LeImplTest, disarm_connectability_ARMED) {
// b/260917913
TEST_F(LeImplTest, DISABLED_disarm_connectability_ARMED) {
  std::unique_ptr<LogCapture> log_capture = std::make_unique<LogCapture>();

  le_impl_->connectability_state_ = ConnectabilityState::ARMED;
@@ -929,7 +935,8 @@ TEST_F(LeImplTest, disarm_connectability_ARMED) {
  ASSERT_TRUE(log_capture->Rewind()->Find("Disarming LE connection state machine with create connection"));
}

TEST_F(LeImplTest, disarm_connectability_ARMED_extended) {
// b/260917913
TEST_F(LeImplTest, DISABLED_disarm_connectability_ARMED_extended) {
  std::unique_ptr<LogCapture> log_capture = std::make_unique<LogCapture>();

  le_impl_->connectability_state_ = ConnectabilityState::ARMED;
@@ -943,7 +950,8 @@ TEST_F(LeImplTest, disarm_connectability_ARMED_extended) {
  ASSERT_TRUE(log_capture->Rewind()->Find("Disarming LE connection state machine with create connection"));
}

TEST_F(LeImplTest, disarm_connectability_DISARMING) {
// b/260917913
TEST_F(LeImplTest, DISABLED_disarm_connectability_DISARMING) {
  std::unique_ptr<LogCapture> log_capture = std::make_unique<LogCapture>();

  le_impl_->connectability_state_ = ConnectabilityState::DISARMING;
@@ -956,7 +964,8 @@ TEST_F(LeImplTest, disarm_connectability_DISARMING) {
  ASSERT_TRUE(log_capture->Rewind()->Find("in unexpected state:ConnectabilityState::DISARMING"));
}

TEST_F(LeImplTest, disarm_connectability_DISARMING_extended) {
// b/260917913
TEST_F(LeImplTest, DISABLED_disarm_connectability_DISARMING_extended) {
  std::unique_ptr<LogCapture> log_capture = std::make_unique<LogCapture>();

  le_impl_->connectability_state_ = ConnectabilityState::DISARMING;
@@ -970,7 +979,8 @@ TEST_F(LeImplTest, disarm_connectability_DISARMING_extended) {
  ASSERT_TRUE(log_capture->Rewind()->Find("in unexpected state:ConnectabilityState::DISARMING"));
}

TEST_F(LeImplTest, register_with_address_manager__AddressPolicyPublicAddress) {
// b/260917913
TEST_F(LeImplTest, DISABLED_register_with_address_manager__AddressPolicyPublicAddress) {
  std::unique_ptr<LogCapture> log_capture = std::make_unique<LogCapture>();

  set_privacy_policy_for_initiator_address(fixed_address_, LeAddressManager::AddressPolicy::USE_PUBLIC_ADDRESS);
@@ -991,7 +1001,8 @@ TEST_F(LeImplTest, register_with_address_manager__AddressPolicyPublicAddress) {
  ASSERT_TRUE(log_capture->Rewind()->Find("Client unregistered"));
}

TEST_F(LeImplTest, register_with_address_manager__AddressPolicyStaticAddress) {
// b/260917913
TEST_F(LeImplTest, DISABLED_register_with_address_manager__AddressPolicyStaticAddress) {
  std::unique_ptr<LogCapture> log_capture = std::make_unique<LogCapture>();

  set_privacy_policy_for_initiator_address(fixed_address_, LeAddressManager::AddressPolicy::USE_STATIC_ADDRESS);
@@ -1012,7 +1023,8 @@ TEST_F(LeImplTest, register_with_address_manager__AddressPolicyStaticAddress) {
  ASSERT_TRUE(log_capture->Rewind()->Find("Client unregistered"));
}

TEST_F(LeImplTest, register_with_address_manager__AddressPolicyNonResolvableAddress) {
// b/260917913
TEST_F(LeImplTest, DISABLED_register_with_address_manager__AddressPolicyNonResolvableAddress) {
  std::unique_ptr<LogCapture> log_capture = std::make_unique<LogCapture>();

  set_privacy_policy_for_initiator_address(fixed_address_, LeAddressManager::AddressPolicy::USE_NON_RESOLVABLE_ADDRESS);
@@ -1033,7 +1045,8 @@ TEST_F(LeImplTest, register_with_address_manager__AddressPolicyNonResolvableAddr
  ASSERT_TRUE(log_capture->Rewind()->Find("Client unregistered"));
}

TEST_F(LeImplTest, register_with_address_manager__AddressPolicyResolvableAddress) {
// b/260917913
TEST_F(LeImplTest, DISABLED_register_with_address_manager__AddressPolicyResolvableAddress) {
  std::unique_ptr<LogCapture> log_capture = std::make_unique<LogCapture>();

  set_privacy_policy_for_initiator_address(fixed_address_, LeAddressManager::AddressPolicy::USE_RESOLVABLE_ADDRESS);
@@ -1054,7 +1067,8 @@ TEST_F(LeImplTest, register_with_address_manager__AddressPolicyResolvableAddress
  ASSERT_TRUE(log_capture->Rewind()->Find("Client unregistered"));
}

TEST_F(LeImplTest, add_device_to_resolving_list) {
// b/260920739
TEST_F(LeImplTest, DISABLED_add_device_to_resolving_list) {
  // Some kind of privacy policy must be set for LeAddressManager to operate properly
  set_privacy_policy_for_initiator_address(fixed_address_, LeAddressManager::AddressPolicy::USE_PUBLIC_ADDRESS);
  // Let LeAddressManager::resume_registered_clients execute
@@ -1388,7 +1402,8 @@ TEST_F(LeImplWithConnectionTest, on_le_event__REMOTE_CONNECTION_PARAMETER_REQUES
  ASSERT_EQ(kTimeout, view.GetTimeout());
}

TEST_F(LeImplRegisteredWithAddressManagerTest, clear_resolving_list) {
// b/260920739
TEST_F(LeImplRegisteredWithAddressManagerTest, DISABLED_clear_resolving_list) {
  le_impl_->clear_resolving_list();
  ASSERT_EQ(3UL, le_impl_->le_address_manager_->NumberCachedCommands());

@@ -1463,7 +1478,8 @@ TEST_F(LeImplTest, on_create_connection_timeout) {
  ASSERT_TRUE(le_impl_->create_connection_timeout_alarms_.empty());
}

TEST_F(LeImplTest, on_common_le_connection_complete__NoPriorConnection) {
// b/260917913
TEST_F(LeImplTest, DISABLED_on_common_le_connection_complete__NoPriorConnection) {
  auto log_capture = std::make_unique<LogCapture>();
  le_impl_->on_common_le_connection_complete(remote_public_address_with_type_);
  ASSERT_TRUE(le_impl_->connecting_le_.empty());
Loading