Skip to content
Snippets Groups Projects
Commit d85d34e2 authored by Hui Peng's avatar Hui Peng
Browse files

Fix flakiness in net_test_btif_hh

The flakiness is caused by usage of fakeosi
and mock timer implementation. This change
replaces fakeosi and mock timer with real
implementation.

Bug: 311769946
Test: atest net_test_btif_hh
Change-Id: I81434dca67a34a4fc209abb551d5ab3f9842eadc
parent f3368822
No related branches found
No related tags found
No related merge requests found
......@@ -578,7 +578,6 @@ cc_test {
":TestCommonCoreInterface",
":TestCommonMainHandler",
":TestCommonMockFunctions",
":TestFakeOsi",
":TestMockAndroidHardware",
":TestMockBtaAg",
":TestMockBtaAr",
......@@ -601,7 +600,6 @@ cc_test {
":TestMockBtaVc",
":TestMockBtcore",
":TestMockBtu",
":TestMockCommon",
":TestMockFrameworks",
":TestMockHci",
":TestMockMainShim",
......@@ -636,6 +634,7 @@ cc_test {
"libbluetooth_crypto_toolbox",
"libbluetooth_gd",
"libbt-audio-hal-interface",
"libbt-common",
"libbt-platform-protos-lite",
"libbt-sbc-decoder",
"libbt-sbc-encoder",
......@@ -651,6 +650,8 @@ cc_test {
"libcom.android.sysprop.bluetooth.wrapped",
"libevent",
"libgmock",
"libosi",
"libprotobuf-cpp-lite",
"libstatslog_bt",
],
cflags: [
......
......@@ -153,27 +153,9 @@ bthh_callbacks_t bthh_callbacks = {
class BtifHhWithMockTest : public ::testing::Test {
protected:
void SetUp() override {
reset_mock_function_count_map();
test::mock::osi_allocator::osi_malloc.body = [](size_t size) {
return malloc(size);
};
test::mock::osi_allocator::osi_calloc.body = [](size_t size) {
return calloc(1UL, size);
};
test::mock::osi_allocator::osi_free.body = [](void* ptr) { free(ptr); };
test::mock::osi_allocator::osi_free_and_reset.body = [](void** ptr) {
free(*ptr);
*ptr = nullptr;
};
}
void SetUp() override { reset_mock_function_count_map(); }
void TearDown() override {
test::mock::osi_allocator::osi_malloc = {};
test::mock::osi_allocator::osi_calloc = {};
test::mock::osi_allocator::osi_free = {};
test::mock::osi_allocator::osi_free_and_reset = {};
}
void TearDown() override {}
};
class BtifHhWithHalCallbacksTest : public BtifHhWithMockTest {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment