From 1cb58a38251c1fc7f55167127b2e672d7a3fe5cd Mon Sep 17 00:00:00 2001 From: wenkaisong Date: Tue, 23 May 2023 22:08:08 +0800 Subject: [PATCH] fix: UT testcase issues Signed-off-by: wenkaisong --- .../inner_api/src/lite/device_security_level_proxy.c | 2 +- test/dslm_unit_test/dslm_test.cpp | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/interfaces/inner_api/src/lite/device_security_level_proxy.c b/interfaces/inner_api/src/lite/device_security_level_proxy.c index fb98416..473c758 100644 --- a/interfaces/inner_api/src/lite/device_security_level_proxy.c +++ b/interfaces/inner_api/src/lite/device_security_level_proxy.c @@ -31,7 +31,7 @@ static int DslmIpcCallback(IOwner owner, int code, IpcIo *reply) return ERR_INVALID_PARA; } - uint32_t cookie, result, level; + uint32_t result, level; struct DslmCallbackHolder *holder = (struct DslmCallbackHolder *)owner; ReadUint32(reply, &result); diff --git a/test/dslm_unit_test/dslm_test.cpp b/test/dslm_unit_test/dslm_test.cpp index babcec1..a6664ef 100644 --- a/test/dslm_unit_test/dslm_test.cpp +++ b/test/dslm_unit_test/dslm_test.cpp @@ -1519,12 +1519,16 @@ HWTEST_F(DslmTest, DestroyDslmCred_case1, TestSize.Level0) */ HWTEST_F(DslmTest, ReportHiEventAppInvoke_case1, TestSize.Level0) { - DslmDeviceInfo info; - (void)memset_s(&info, sizeof(DslmDeviceInfo), 0, sizeof(DslmDeviceInfo)); - info.lastRequestTime = 10U; + DslmDeviceInfo *info = (DslmDeviceInfo *)MALLOC(sizeof(DslmDeviceInfo)); + ASSERT_NE(nullptr, info); + (void)memset_s(info, sizeof(DslmDeviceInfo), 0, sizeof(DslmDeviceInfo)); + info->lastRequestTime = 10U; ReportHiEventInfoSync(nullptr); - ReportHiEventInfoSync(&info); + ReportHiEventInfoSync(info); ReportHiEventAppInvoke(nullptr); + EXPECT_NE(nullptr, info); + FREE(info); + info = nullptr; } /**