From a84a5c1bb28711d3dc1b7a7df84934aeeee8f79c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E6=98=8C=E5=8F=8B?= Date: Wed, 28 Feb 2024 09:47:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DOpenHarmony-4.1-Release?= =?UTF-8?q?=E5=88=86=E6=94=AF=E4=BB=A3=E7=A0=81=E5=91=8A=E8=AD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 马昌友 --- .../wlan/lnn_wifiservice_monitor.cpp | 2 +- .../ipc/include/lnn_bus_center_ipc.h | 2 +- .../ipc/small/src/lnn_bus_center_ipc.c | 2 +- .../heartbeat/src/lnn_heartbeat_ctrl.c | 1 - .../lane_manager/src/lnn_lane_reliability.c | 16 +++++++------- .../lane_manager/src/lnn_trans_lane.c | 2 +- .../lnn/net_builder/src/lnn_network_info.c | 2 +- .../net_ledger/common/src/lnn_huks_utils.c | 12 +++++----- .../src/lnn_distributed_net_ledger.c | 4 ++-- .../unittest/auth_other_test.cpp | 4 ++-- .../lane/trans_lane/lnn_trans_lane_test.cpp | 22 ------------------- .../lnn/lane_link/lnn_lane_link_test.cpp | 8 +++---- .../include/lnn_net_builder_deps_mock.h | 3 ++- .../src/lnn_net_builder_mock_test.cpp | 7 ------ .../mock_common/src/lnn_hichain_mock.cpp | 10 +++++---- .../bus_center_decision_center_test.cpp | 5 ++--- .../bus_center/test/heartbeat/hb_fsm_test.cpp | 6 ++--- .../test/heartbeat/hb_medium_mgr_test.cpp | 4 ---- .../bus_center/publish_refresh_lnn_demo.c | 2 -- .../shiftlnngear_fuzzer.cpp | 1 + 20 files changed, 41 insertions(+), 74 deletions(-) diff --git a/adapter/common/bus_center/wlan/lnn_wifiservice_monitor.cpp b/adapter/common/bus_center/wlan/lnn_wifiservice_monitor.cpp index e1306f9d7..88ec7766b 100644 --- a/adapter/common/bus_center/wlan/lnn_wifiservice_monitor.cpp +++ b/adapter/common/bus_center/wlan/lnn_wifiservice_monitor.cpp @@ -39,7 +39,7 @@ namespace EventFwk { class WifiServiceMonitor : public CommonEventSubscriber { public: explicit WifiServiceMonitor(const CommonEventSubscribeInfo &subscriberInfo); - virtual ~WifiServiceMonitor(){} + virtual ~WifiServiceMonitor() {} virtual void OnReceiveEvent(const CommonEventData &data); }; diff --git a/core/bus_center/ipc/include/lnn_bus_center_ipc.h b/core/bus_center/ipc/include/lnn_bus_center_ipc.h index a258592e7..1264cf3cd 100644 --- a/core/bus_center/ipc/include/lnn_bus_center_ipc.h +++ b/core/bus_center/ipc/include/lnn_bus_center_ipc.h @@ -25,7 +25,7 @@ extern "C" { #endif -int32_t LnnIpcInit (void); +int32_t LnnIpcInit(void); int32_t LnnIpcServerJoin(const char *pkgName, int32_t callingPid, void *addr, uint32_t addrTypeLen); int32_t LnnIpcServerLeave(const char *pkgName, int32_t callingPid, const char *networkId); int32_t LnnIpcGetAllOnlineNodeInfo(const char *pkgName, void **info, uint32_t infoTypeLen, int *infoNum); diff --git a/core/bus_center/ipc/small/src/lnn_bus_center_ipc.c b/core/bus_center/ipc/small/src/lnn_bus_center_ipc.c index 50890f1e6..3110d4011 100644 --- a/core/bus_center/ipc/small/src/lnn_bus_center_ipc.c +++ b/core/bus_center/ipc/small/src/lnn_bus_center_ipc.c @@ -51,7 +51,7 @@ typedef struct { static LNNRequestInfo g_lnnRequestInfo; -int32_t LnnIpcInit (void) +int32_t LnnIpcInit(void) { g_lnnRequestInfo.joinLNNRequestInfo = NULL; g_lnnRequestInfo.leaveLNNRequestInfo = NULL; diff --git a/core/bus_center/lnn/lane_hub/heartbeat/src/lnn_heartbeat_ctrl.c b/core/bus_center/lnn/lane_hub/heartbeat/src/lnn_heartbeat_ctrl.c index ba57a2f91..7ac83eeee 100644 --- a/core/bus_center/lnn/lane_hub/heartbeat/src/lnn_heartbeat_ctrl.c +++ b/core/bus_center/lnn/lane_hub/heartbeat/src/lnn_heartbeat_ctrl.c @@ -477,7 +477,6 @@ static void HbDifferentAccountEventHandler(const LnnEventBasicInfo *info) } const LnnMonitorHbStateChangedEvent *event = (const LnnMonitorHbStateChangedEvent *)info; SoftBusDifferentAccountState difAccountState = (SoftBusDifferentAccountState)event->status; - // g_hbConditionState.accountState == difAccountState; if (difAccountState == LNN_EVENT_DIF_ACCOUNT_DEV_CHANGED) { HbConditionChanged(false); } diff --git a/core/bus_center/lnn/lane_hub/lane_manager/src/lnn_lane_reliability.c b/core/bus_center/lnn/lane_hub/lane_manager/src/lnn_lane_reliability.c index 520246bb6..d5c44ce28 100644 --- a/core/bus_center/lnn/lane_hub/lane_manager/src/lnn_lane_reliability.c +++ b/core/bus_center/lnn/lane_hub/lane_manager/src/lnn_lane_reliability.c @@ -66,9 +66,9 @@ static int32_t GetSameLaneDetectInfo(LaneDetectInfo *infoItem) case LANE_WLAN_2P4G: case LANE_WLAN_5G: if ((strncmp(infoItem->linkInfo.wlanDetect.wlanInfo.connInfo.addr, - item->linkInfo.wlanDetect.wlanInfo.connInfo.addr, MAX_SOCKET_ADDR_LEN) == 0) && - (infoItem->linkInfo.wlanDetect.wlanInfo.connInfo.port == - item->linkInfo.wlanDetect.wlanInfo.connInfo.port)) { + item->linkInfo.wlanDetect.wlanInfo.connInfo.addr, MAX_SOCKET_ADDR_LEN) == 0) && + (infoItem->linkInfo.wlanDetect.wlanInfo.connInfo.port == + item->linkInfo.wlanDetect.wlanInfo.connInfo.port)) { infoItem->linkInfo.wlanDetect.wlanFd = item->linkInfo.wlanDetect.wlanFd; infoItem->laneDetectId = item->laneDetectId; ListTailInsert(&g_laneDetectList.list, &infoItem->node); @@ -78,7 +78,7 @@ static int32_t GetSameLaneDetectInfo(LaneDetectInfo *infoItem) break; case LANE_BR: if ((strncmp(infoItem->linkInfo.brDetect.brInfo.brMac, - item->linkInfo.brDetect.brInfo.brMac, BT_MAC_LEN) == 0)) { + item->linkInfo.brDetect.brInfo.brMac, BT_MAC_LEN) == 0)) { infoItem->linkInfo.brDetect.brReqId = item->linkInfo.brDetect.brReqId; infoItem->laneDetectId = item->laneDetectId; ListTailInsert(&g_laneDetectList.list, &infoItem->node); @@ -106,7 +106,7 @@ static int32_t ClientConnectTcp(LaneDetectInfo *infoItem) } }; if (strncpy_s(option.socketOption.addr, MAX_SOCKET_ADDR_LEN, - infoItem->linkInfo.wlanDetect.wlanInfo.connInfo.addr, MAX_SOCKET_ADDR_LEN) != EOK) { + infoItem->linkInfo.wlanDetect.wlanInfo.connInfo.addr, MAX_SOCKET_ADDR_LEN) != EOK) { return SOFTBUS_MEM_ERR; } int32_t fd = ConnOpenClientSocket(&option, BIND_ADDR_ALL, true); @@ -142,7 +142,7 @@ static int32_t GetLaneDetectInfoByWlanFd(uint32_t fd, LaneDetectInfo *infoItem) LIST_FOR_EACH_ENTRY_SAFE(item, next, &g_laneDetectList.list, LaneDetectInfo, node) { if (item->linkInfo.wlanDetect.wlanFd == fd) { if (memcpy_s(infoItem, sizeof(LaneDetectInfo), item, - sizeof(LaneDetectInfo)) != EOK) { + sizeof(LaneDetectInfo)) != EOK) { SoftBusMutexUnlock(&g_laneDetectList.lock); return SOFTBUS_MEM_ERR; } @@ -191,7 +191,7 @@ static int32_t WlanDetectReliability(uint32_t lnnReqId, const LaneLinkInfo *lane return SOFTBUS_MEM_ERR; } if (memcpy_s(&(infoItem->linkInfo.wlanDetect.wlanInfo), sizeof(WlanLinkInfo), - &(laneInfo->linkInfo.wlan), sizeof(WlanLinkInfo)) != EOK) { + &(laneInfo->linkInfo.wlan), sizeof(WlanLinkInfo)) != EOK) { SoftBusFree(infoItem); return SOFTBUS_MEM_ERR; } @@ -279,7 +279,7 @@ static int32_t NotifyWlanDetectResult(LaneDetectInfo *requestItem, bool isSendSu (void)memset_s(&laneInfo, sizeof(LaneLinkInfo), 0, sizeof(LaneLinkInfo)); laneInfo.type = item->type; if (memcpy_s(&(laneInfo.linkInfo.wlan), sizeof(WlanLinkInfo), - &(item->linkInfo.wlanDetect.wlanInfo), sizeof(WlanLinkInfo)) != EOK) { + &(item->linkInfo.wlanDetect.wlanInfo), sizeof(WlanLinkInfo)) != EOK) { LNN_LOGE(LNN_LANE, "memcpy linkinfo failed, lnnReqId=%{public}u", item->lnnReqId); ListDelete(&item->node); SoftBusFree(item); diff --git a/core/bus_center/lnn/lane_hub/lane_manager/src/lnn_trans_lane.c b/core/bus_center/lnn/lane_hub/lane_manager/src/lnn_trans_lane.c index 416e91ad5..cc6c4e265 100644 --- a/core/bus_center/lnn/lane_hub/lane_manager/src/lnn_trans_lane.c +++ b/core/bus_center/lnn/lane_hub/lane_manager/src/lnn_trans_lane.c @@ -321,7 +321,7 @@ static int32_t AllocLane(uint32_t laneId, const LaneRequestOption *request, cons } recommendLinkList->linkTypeNum = 0; if (SelectExpectLanesByQos((const char *)transRequest->networkId, &selectParam, - recommendLinkList) != SOFTBUS_OK) { + recommendLinkList) != SOFTBUS_OK) { SoftBusFree(recommendLinkList); LNN_LOGE(LNN_LANE, "selectExpectLanesByQos fail, laneId=%{public}u", laneId); return SOFTBUS_ERR; diff --git a/core/bus_center/lnn/net_builder/src/lnn_network_info.c b/core/bus_center/lnn/net_builder/src/lnn_network_info.c index 8f667305e..b8379447a 100644 --- a/core/bus_center/lnn/net_builder/src/lnn_network_info.c +++ b/core/bus_center/lnn/net_builder/src/lnn_network_info.c @@ -53,7 +53,7 @@ static uint32_t ConvertMsgToCapability(uint32_t *capability, const uint8_t *msg, return SOFTBUS_ERR; } for (uint32_t i = 0; i < BITLEN; i++) { - *capability = *capability | (*(msg + i) << BITS*i); + *capability = *capability | (*(msg + i) << (BITS * i)); } return SOFTBUS_OK; } diff --git a/core/bus_center/lnn/net_ledger/common/src/lnn_huks_utils.c b/core/bus_center/lnn/net_ledger/common/src/lnn_huks_utils.c index bc5df5e1f..f7bd70e19 100644 --- a/core/bus_center/lnn/net_ledger/common/src/lnn_huks_utils.c +++ b/core/bus_center/lnn/net_ledger/common/src/lnn_huks_utils.c @@ -285,18 +285,18 @@ int32_t LnnEncryptDataByHuks(const struct HksBlob *keyAlias, const struct HksBlo struct HksBlob cipherText = {inData->size, cipher}; if (UpdateLoopFinishByHuks(&handleEncrypt, g_encryptParamSet, inData, &cipherText) != SOFTBUS_OK) { LNN_LOGE(LNN_LEDGER, "huks encrypt data update and finish fail"); - (void)memset_s(cipher, sizeof(cipher), 0x0, sizeof(cipher)); + (void)memset_s(cipher, inData->size, 0x0, inData->size); SoftBusFree(cipher); return SOFTBUS_ERR; } outData->size = cipherText.size; if (memcpy_s(outData->data, cipherText.size, cipherText.data, cipherText.size) != EOK) { LNN_LOGE(LNN_LEDGER, "huks memcpy_s encrypt data fail"); - (void)memset_s(cipher, sizeof(cipher), 0x0, sizeof(cipher)); + (void)memset_s(cipher, inData->size, 0x0, inData->size); SoftBusFree(cipher); return SOFTBUS_MEM_ERR; } - (void)memset_s(cipher, sizeof(cipher), 0x0, sizeof(cipher)); + (void)memset_s(cipher, inData->size, 0x0, inData->size); SoftBusFree(cipher); return SOFTBUS_OK; } @@ -323,18 +323,18 @@ int32_t LnnDecryptDataByHuks(const struct HksBlob *keyAlias, const struct HksBlo struct HksBlob plainText = {inData->size, plain}; if (UpdateLoopFinishByHuks(&handleDecrypt, g_decryptParamSet, inData, &plainText) != SOFTBUS_OK) { LNN_LOGE(LNN_LEDGER, "huks decrypt data update and finish fail"); - (void)memset_s(plain, sizeof(plain), 0x0, sizeof(plain)); + (void)memset_s(plain, inData->size, 0x0, inData->size); SoftBusFree(plain); return SOFTBUS_ERR; } outData->size = plainText.size; if (memcpy_s(outData->data, plainText.size, plainText.data, plainText.size) != EOK) { LNN_LOGE(LNN_LEDGER, "huks memcpy_s decrypt data fail"); - (void)memset_s(plain, sizeof(plain), 0x0, sizeof(plain)); + (void)memset_s(plain, inData->size, 0x0, inData->size); SoftBusFree(plain); return SOFTBUS_MEM_ERR; } - (void)memset_s(plain, sizeof(plain), 0x0, sizeof(plain)); + (void)memset_s(plain, inData->size, 0x0, inData->size); SoftBusFree(plain); return SOFTBUS_OK; } diff --git a/core/bus_center/lnn/net_ledger/distributed_ledger/src/lnn_distributed_net_ledger.c b/core/bus_center/lnn/net_ledger/distributed_ledger/src/lnn_distributed_net_ledger.c index d0d31901c..9789eb702 100644 --- a/core/bus_center/lnn/net_ledger/distributed_ledger/src/lnn_distributed_net_ledger.c +++ b/core/bus_center/lnn/net_ledger/distributed_ledger/src/lnn_distributed_net_ledger.c @@ -1321,7 +1321,7 @@ static void MergeLnnInfo(const NodeInfo *oldInfo, NodeInfo *info) } if (oldInfo->authChannelId[i][AUTH_AS_CLIENT_SIDE] != 0 || oldInfo->authChannelId[i][AUTH_AS_SERVER_SIDE] != 0 || info->authChannelId[i][AUTH_AS_CLIENT_SIDE] != 0 || - info->authChannelId[i][AUTH_AS_SERVER_SIDE] != 0 ) { + info->authChannelId[i][AUTH_AS_SERVER_SIDE] != 0) { LNN_LOGD(LNN_LEDGER, "Merge authChannelId. authChannelId:%{public}d|%{public}d->%{public}d|%{public}d, addrType=%{public}d", oldInfo->authChannelId[i][AUTH_AS_CLIENT_SIDE], oldInfo->authChannelId[i][AUTH_AS_SERVER_SIDE], @@ -1618,7 +1618,7 @@ static void BleDirectlyOnlineProc(NodeInfo *info) LNN_LOGE(LNN_LEDGER, "strcpy_s networkId fail"); return; } - if(LnnSaveRemoteDeviceInfo(&deviceInfo) != SOFTBUS_OK) { + if (LnnSaveRemoteDeviceInfo(&deviceInfo) != SOFTBUS_OK) { LNN_LOGE(LNN_LEDGER, "save remote devInfo fail"); return; } diff --git a/tests/core/authentication/unittest/auth_other_test.cpp b/tests/core/authentication/unittest/auth_other_test.cpp index cd7f2e9fc..d10787c7e 100644 --- a/tests/core/authentication/unittest/auth_other_test.cpp +++ b/tests/core/authentication/unittest/auth_other_test.cpp @@ -835,7 +835,7 @@ HWTEST_F(AuthOtherTest, FSM_MSG_TYPE_TO_STR_TEST_001, TestSize.Level1) EXPECT_EQ(ret, str); type = FSM_MSG_RECV_DEVICE_ID; ret = FsmMsgTypeToStr(type); - const char *str1= "RECV_DEVICE_ID"; + const char *str1 = "RECV_DEVICE_ID"; EXPECT_EQ(ret, str1); } @@ -915,7 +915,7 @@ HWTEST_F(AuthOtherTest, AUTH_DEVICE_GET_PREFER_CONN_INFO_TEST_001, TestSize.Leve ret = AuthDeviceGetPreferConnInfo(NULL, connInfo); connInfo->type = AUTH_LINK_TYPE_BLE; EXPECT_TRUE(ret == SOFTBUS_INVALID_PARAM); - SoftBusFree(connInfo); + SoftBusFree(connInfo); } /* diff --git a/tests/core/bus_center/lnn/lane/trans_lane/lnn_trans_lane_test.cpp b/tests/core/bus_center/lnn/lane/trans_lane/lnn_trans_lane_test.cpp index 352ade85a..3a5159253 100644 --- a/tests/core/bus_center/lnn/lane/trans_lane/lnn_trans_lane_test.cpp +++ b/tests/core/bus_center/lnn/lane/trans_lane/lnn_trans_lane_test.cpp @@ -105,28 +105,6 @@ HWTEST_F(LNNTransLaneMockTest, LNN_TRANS_LANE_002, TestSize.Level1) EXPECT_CALL(laneMock, SelectLane).WillOnce(Return(SOFTBUS_OK)); int32_t ret = transObj->AllocLane(laneId, (const LaneRequestOption *)&request, nullptr); EXPECT_TRUE(ret != SOFTBUS_OK); - /* - auto laneSelect = [](LaneLinkType **list, uint32_t *num) { - uint32_t laneNum = 2; // means two phy-channels are available - *list = (LaneLinkType *)SoftBusMalloc(sizeof(LaneLinkType) * laneNum); - EXPECT_TRUE(*list != nullptr); - (*list)[0] = LANE_P2P; - (*list)[1] = LANE_WLAN_5G; - *num = laneNum; - }; - auto linkFail = [](const LaneLinkCb *cb) { cb->OnLaneLinkFail(1, SOFTBUS_ERR); }; - EXPECT_CALL(laneMock, SelectLane) - .WillOnce(DoAll(WithArgs<2, 3>(laneSelect), Return(SOFTBUS_OK))); - EXPECT_CALL(laneMock, BuildLink) - .WillRepeatedly(DoAll(WithArg<2>(linkFail), Return(SOFTBUS_OK))); - ILaneListener listener = { - .OnLaneRequestSuccess = LaneRequestSuccess, - .OnLaneRequestFail = LaneRequestFail, - .OnLaneStateChange = LaneStateChange, - }; - ret = transObj->AllocLane(laneId, (const LaneRequestOption *)&request, &listener); - EXPECT_EQ(ret, SOFTBUS_OK); - */ std::this_thread::sleep_for(std::chrono::milliseconds(200)); // delay 200ms for looper completion. transObj->Deinit(); } diff --git a/tests/core/bus_center/lnn/lane_link/lnn_lane_link_test.cpp b/tests/core/bus_center/lnn/lane_link/lnn_lane_link_test.cpp index 75c844044..ba8d267c4 100644 --- a/tests/core/bus_center/lnn/lane_link/lnn_lane_link_test.cpp +++ b/tests/core/bus_center/lnn/lane_link/lnn_lane_link_test.cpp @@ -146,7 +146,7 @@ HWTEST_F(LNNLaneLinkTest, LNN_LANE_LINK_002, TestSize.Level1) uint64_t remote = 1 << 14; LinkRequest *request = (LinkRequest *)SoftBusCalloc(sizeof(LinkRequest)); if (request == NULL) { - return; + return; } request->pid = 1024; @@ -203,7 +203,7 @@ HWTEST_F(LNNLaneLinkTest, LNN_LANE_LINK_003, TestSize.Level1) uint32_t laneLinkReqId = 1; LinkRequest *request = (LinkRequest *)SoftBusCalloc(sizeof(LinkRequest)); if (request == NULL) { - return; + return; } request->pid = 1024; request->networkDelegate = false; @@ -246,7 +246,7 @@ HWTEST_F(LNNLaneLinkTest, LNN_LANE_LINK_004, TestSize.Level1) { LinkRequest *request = (LinkRequest *)SoftBusCalloc(sizeof(LinkRequest)); if (request == NULL) { - return; + return; } request->pid = 1024; @@ -314,7 +314,7 @@ HWTEST_F(LNNLaneLinkTest, LNN_LANE_LINK_006, TestSize.Level1) }; LinkRequest *request = (LinkRequest *)SoftBusCalloc(sizeof(LinkRequest)); if (request == NULL) { - return; + return; } request->pid = 1024; diff --git a/tests/core/bus_center/lnn/net_builder/include/lnn_net_builder_deps_mock.h b/tests/core/bus_center/lnn/net_builder/include/lnn_net_builder_deps_mock.h index ea697144b..afa9fdfd8 100644 --- a/tests/core/bus_center/lnn/net_builder/include/lnn_net_builder_deps_mock.h +++ b/tests/core/bus_center/lnn/net_builder/include/lnn_net_builder_deps_mock.h @@ -265,7 +265,8 @@ public: MOCK_METHOD1(LnnSendJoinRequestToConnFsm, int32_t (LnnConnectionFsm *)); MOCK_METHOD3(LnnNotifyJoinResult, void (ConnectionAddr *, const char *, int32_t)); MOCK_METHOD1(LnnDestroyConnectionFsm, void (LnnConnectionFsm *)); - MOCK_METHOD3(LnnCreateConnectionFsm, LnnConnectionFsm * (const ConnectionAddr *target, const char *pkgName, bool isNeedConnect)); + MOCK_METHOD3(LnnCreateConnectionFsm, LnnConnectionFsm * (const ConnectionAddr *target, + const char *pkgName, bool isNeedConnect)); MOCK_METHOD1(LnnStartConnectionFsm, int32_t (LnnConnectionFsm *)); MOCK_METHOD3(LnnNotifyMasterNodeChanged, void (bool, const char*, int32_t)); MOCK_METHOD0(LnnInitFastOffline, int32_t ()); diff --git a/tests/core/bus_center/lnn/net_builder/src/lnn_net_builder_mock_test.cpp b/tests/core/bus_center/lnn/net_builder/src/lnn_net_builder_mock_test.cpp index fe1d832c2..9b2af892e 100644 --- a/tests/core/bus_center/lnn/net_builder/src/lnn_net_builder_mock_test.cpp +++ b/tests/core/bus_center/lnn/net_builder/src/lnn_net_builder_mock_test.cpp @@ -288,15 +288,9 @@ HWTEST_F(LNNNetBuilderMockTest, GET_CURRENT_CONNECT_TYPE_TEST_001, TestSize.Leve */ HWTEST_F(LNNNetBuilderMockTest, PROCESS_LEAVE_SPECIFIC_TEST_001, TestSize.Level1) { - // EXPECT_TRUE(LnnInitBusCenterEvent() == SOFTBUS_OK); - // EXPECT_TRUE(LnnInitNetBuilder() == SOFTBUS_OK); - // void *para = reinterpret_cast(SoftBusMalloc(sizeof(SpecificLeaveMsgPara))); NiceMock NetBuilderMock; EXPECT_CALL(NetBuilderMock, LnnSendLeaveRequestToConnFsm(_)).WillRepeatedly(Return(SOFTBUS_OK)); EXPECT_TRUE(ProcessLeaveSpecific(nullptr) == SOFTBUS_INVALID_PARAM); - // EXPECT_TRUE(ProcessLeaveSpecific(para) == SOFTBUS_OK); - // LnnDeinitNetBuilder(); - // LnnDeinitBusCenterEvent(); } /* @@ -355,7 +349,6 @@ HWTEST_F(LNNNetBuilderMockTest, PROCESS_NODE_STATE_CHANGED_TEST_001, TestSize.Le NiceMock NetBuilderMock; EXPECT_CALL(NetBuilderMock, SoftbusGetConfig(_, _, _)).WillRepeatedly(Return(SOFTBUS_OK)); EXPECT_TRUE(ProcessNodeStateChanged(nullptr) == SOFTBUS_INVALID_PARAM); - // EXPECT_TRUE(LnnInitNetBuilder() == SOFTBUS_OK); EXPECT_TRUE(ProcessNodeStateChanged(para) == SOFTBUS_ERR); } diff --git a/tests/core/bus_center/mock_common/src/lnn_hichain_mock.cpp b/tests/core/bus_center/mock_common/src/lnn_hichain_mock.cpp index 4d33b47a2..75f479ddc 100644 --- a/tests/core/bus_center/mock_common/src/lnn_hichain_mock.cpp +++ b/tests/core/bus_center/mock_common/src/lnn_hichain_mock.cpp @@ -27,6 +27,8 @@ namespace OHOS { const int32_t GRUOP_NUM1 = 10; const int32_t GRUOP_NUM2 = 12; const int32_t GRUOP_NUM3 = 100; +const int32_t GROUP_TYPE_POINT_TO_POINT = 256; +const int32_t GROUP_VISIBILITY_INVALID = 26; char jsonChar = 'A'; bool flage = false; bool is_return_device_num = false; @@ -183,8 +185,8 @@ int32_t LnnHichainInterfaceMock::getRelatedGroups1( if (!JSON_AddStringToObject(obj, "groupName", "mygroup<256>E469") || !JSON_AddStringToObject(obj, "groupId", "1D77EBFF0349B27EED57014DD7B2449A") || !JSON_AddStringToObject(obj, "groupOwner", "com.hhhs.secueity") || - !JSON_AddInt32ToObject(obj, "groupType", 256) || - !JSON_AddInt32ToObject(obj, "groupVisibility", 26)) { + !JSON_AddInt32ToObject(obj, "groupType", GROUP_TYPE_POINT_TO_POINT) || + !JSON_AddInt32ToObject(obj, "groupVisibility", GROUP_VISIBILITY_INVALID)) { JSON_Delete(obj); return SOFTBUS_ERR; } @@ -196,7 +198,7 @@ int32_t LnnHichainInterfaceMock::getRelatedGroups1( return SOFTBUS_OK; } int32_t LnnHichainInterfaceMock::getTrustedDevices( - int32_t osAccountId, const char *appId, const char *groupId, char **returnDevInfoVec, uint32_t *deviceNum) + int32_t osAccountId, const char *appId, const char *groupId, char **returnDevInfoVec, uint32_t *deviceNum) { (void)osAccountId; (void)appId; @@ -223,7 +225,7 @@ int32_t LnnHichainInterfaceMock::getTrustedDevices( } int32_t LnnHichainInterfaceMock::getTrustedDevices1( - int32_t osAccountId, const char *appId, const char *groupId, char **returnDevInfoVec, uint32_t *deviceNum) + int32_t osAccountId, const char *appId, const char *groupId, char **returnDevInfoVec, uint32_t *deviceNum) { (void)osAccountId; (void)appId; diff --git a/tests/core/bus_center/service/unittest/bus_center_decision_center_test.cpp b/tests/core/bus_center/service/unittest/bus_center_decision_center_test.cpp index 837b3bda5..2d75eef5f 100644 --- a/tests/core/bus_center/service/unittest/bus_center_decision_center_test.cpp +++ b/tests/core/bus_center/service/unittest/bus_center_decision_center_test.cpp @@ -20,7 +20,6 @@ #include "bus_center_decision_center.h" #include "message_handler.h" #include "softbus_conn_interface.h" -#include #include "bus_center_manager.h" #include "lnn_distributed_net_ledger.h" #include "lnn_net_builder.h" @@ -66,9 +65,9 @@ HWTEST_F(BusCenterDecisionTest, BusCenterDecisionTest001, TestSize.Level0) ConnectOption option; memset_s(&option, sizeof(ConnectOption), 0, sizeof(ConnectOption)); option.type = CONNECT_BR; - LnnDCReportConnectException(&option,1); + LnnDCReportConnectException(&option, 1); option.type = CONNECT_P2P; - LnnDCReportConnectException(&option,1); + LnnDCReportConnectException(&option, 1); } } \ No newline at end of file diff --git a/tests/core/bus_center/test/heartbeat/hb_fsm_test.cpp b/tests/core/bus_center/test/heartbeat/hb_fsm_test.cpp index cff217f74..d6362774e 100644 --- a/tests/core/bus_center/test/heartbeat/hb_fsm_test.cpp +++ b/tests/core/bus_center/test/heartbeat/hb_fsm_test.cpp @@ -394,7 +394,9 @@ HWTEST_F(HeartBeatFSMTest, ProcessLostHeartbeatTest_01, TestSize.Level1) int32_t ret = ProcessLostHeartbeat(nullptr, CONNECTION_ADDR_BLE, false); EXPECT_TRUE(ret == SOFTBUS_INVALID_PARAM); EXPECT_CALL(distriLedgerMock, LnnGetOnlineStateById).WillOnce(Return(false)).WillRepeatedly(Return(true)); - EXPECT_CALL(lnnNetLedgerMock, LnnGetRemoteNodeInfoById).WillOnce(Return(SOFTBUS_ERR)).WillRepeatedly(Return(SOFTBUS_OK)); + EXPECT_CALL(lnnNetLedgerMock, LnnGetRemoteNodeInfoById) + .WillOnce(Return(SOFTBUS_ERR)) + .WillRepeatedly(Return(SOFTBUS_OK)); ret = ProcessLostHeartbeat(TEST_NETWORK_ID, CONNECTION_ADDR_BLE, false); EXPECT_TRUE(ret == SOFTBUS_OK); ret = ProcessLostHeartbeat(TEST_NETWORK_ID, CONNECTION_ADDR_BR, false); @@ -538,8 +540,6 @@ HWTEST_F(HeartBeatFSMTest, LnnPostNextSendOnceMsgToHbFsmTest_01, TestSize.Level1 EXPECT_TRUE(ret == SOFTBUS_ERR); ret = LnnPostSendEndMsgToHbFsm(nullptr, custData, TEST_TIME1); EXPECT_TRUE(ret == SOFTBUS_INVALID_PARAM); - // ret = LnnPostSendEndMsgToHbFsm(hbFsm, custData, TEST_TIME1); - // EXPECT_TRUE(ret == SOFTBUS_OK); ret = LnnPostStartMsgToHbFsm(nullptr, TEST_TIME1); EXPECT_TRUE(ret == SOFTBUS_INVALID_PARAM); ret = LnnPostStopMsgToHbFsm(nullptr, HEARTBEAT_TYPE_BLE_V1); diff --git a/tests/core/bus_center/test/heartbeat/hb_medium_mgr_test.cpp b/tests/core/bus_center/test/heartbeat/hb_medium_mgr_test.cpp index 7ac414d5f..6e6eee0d3 100644 --- a/tests/core/bus_center/test/heartbeat/hb_medium_mgr_test.cpp +++ b/tests/core/bus_center/test/heartbeat/hb_medium_mgr_test.cpp @@ -216,10 +216,6 @@ HWTEST_F(HeartBeatMediumTest, GetOnlineNodeByRecvInfoTest_01, TestSize.Level1) EXPECT_CALL(ledgerMock, LnnHasDiscoveryType).WillRepeatedly(Return(SOFTBUS_ERR)); ret = HbGetOnlineNodeByRecvInfo(udidHash, CONNECTION_ADDR_BR, &nodeInfo, &hbResp); EXPECT_TRUE(ret == SOFTBUS_ERR); - // ret = HbGetOnlineNodeByRecvInfo(TEST_UDID_HASH, CONNECTION_ADDR_BR, &nodeInfo, &hbResp); - // EXPECT_TRUE(ret == SOFTBUS_OK); - // ret = HbGetOnlineNodeByRecvInfo(TEST_UDID_HASH, CONNECTION_ADDR_WLAN, &nodeInfo, &hbResp); - // EXPECT_TRUE(ret == SOFTBUS_OK); } /* diff --git a/tests/sdk/bus_center/demo/bus_center/publish_refresh_lnn_demo.c b/tests/sdk/bus_center/demo/bus_center/publish_refresh_lnn_demo.c index 830af0d90..28e4c6d69 100644 --- a/tests/sdk/bus_center/demo/bus_center/publish_refresh_lnn_demo.c +++ b/tests/sdk/bus_center/demo/bus_center/publish_refresh_lnn_demo.c @@ -82,7 +82,6 @@ static IRefreshCallback g_refreshCB = { .OnDiscoverResult = OnDiscoverResultTest }; -// Device A: int main(void) { const char *pkgNameA = "pkgNameA.demo"; @@ -113,7 +112,6 @@ int main(void) return ret; } -// Device B: int main(void) { const char *pkgNameB = "pkgNameB.demo"; diff --git a/tests/sdk/bus_center/fuzztest/shiftlnngear_fuzzer/shiftlnngear_fuzzer.cpp b/tests/sdk/bus_center/fuzztest/shiftlnngear_fuzzer/shiftlnngear_fuzzer.cpp index 889c26c37..863cdcd92 100644 --- a/tests/sdk/bus_center/fuzztest/shiftlnngear_fuzzer/shiftlnngear_fuzzer.cpp +++ b/tests/sdk/bus_center/fuzztest/shiftlnngear_fuzzer/shiftlnngear_fuzzer.cpp @@ -83,6 +83,7 @@ namespace OHOS { ShiftLNNGear(TEST_PKG_NAME1, callerId, networkId, &g_mode); if (callerId != nullptr) { free(callerId); + callerId = nullptr; } return true; }