From 71daf9ef3f6ae3f564f9651b0fd0ba12c6723e47 Mon Sep 17 00:00:00 2001 From: fan-jingle Date: Mon, 25 Aug 2025 16:38:09 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E8=99=9A=E5=81=87?= =?UTF-8?q?=E6=96=AD=E8=A8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: fan-jingle --- .../app_spawn_cold_run_test.cpp | 28 ++++++++----------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/test/unittest/app_spawn_standard_test/app_spawn_cold_run_test.cpp b/test/unittest/app_spawn_standard_test/app_spawn_cold_run_test.cpp index ebc0e292..879123e8 100644 --- a/test/unittest/app_spawn_standard_test/app_spawn_cold_run_test.cpp +++ b/test/unittest/app_spawn_standard_test/app_spawn_cold_run_test.cpp @@ -140,16 +140,15 @@ HWTEST_F(AppSpawnColdRunTest, App_Spawn_Cold_Run_001, TestSize.Level0) // set cold start flags AppSpawnReqMsgSetAppFlag(reqHandle, APP_FLAGS_COLD_BOOT); - ret = -1; + int msgRet = -1; node->flags |= STUB_NEED_CHECK; node->arg = reinterpret_cast(HandleExecvStub); AppSpawnResult result = {}; - ret = AppSpawnClientSendMsg(clientHandle, reqHandle, &result); + msgRet = AppSpawnClientSendMsg(clientHandle, reqHandle, &result); APPSPAWN_LOGV("App_Spawn_Cold_Run_001 Kill pid %{public}d %{public}d", result.pid, result.result); - if (ret == 0 && result.pid > 0) { + if (msgRet == 0 && result.pid > 0) { kill(result.pid, SIGKILL); } - ret = 0; } while (0); AppSpawnClientDestroy(clientHandle); ASSERT_EQ(ret, 0); @@ -168,16 +167,15 @@ HWTEST_F(AppSpawnColdRunTest, App_Spawn_Cold_Run_002, TestSize.Level0) // set cold start flags AppSpawnReqMsgSetAppFlag(reqHandle, APP_FLAGS_COLD_BOOT); - ret = -1; + int msgRet = -1; node->flags |= STUB_NEED_CHECK; node->arg = reinterpret_cast(HandleExecvStub); AppSpawnResult result = {}; - ret = AppSpawnClientSendMsg(clientHandle, reqHandle, &result); + msgRet = AppSpawnClientSendMsg(clientHandle, reqHandle, &result); APPSPAWN_LOGV("App_Spawn_Cold_Run_002 Kill pid %{public}d %{public}d", result.pid, result.result); - if (ret == 0 && result.pid > 0) { + if (msgRet == 0 && result.pid > 0) { kill(result.pid, SIGKILL); } - ret = 0; } while (0); AppSpawnClientDestroy(clientHandle); node->flags &= ~STUB_NEED_CHECK; @@ -202,16 +200,15 @@ HWTEST_F(AppSpawnColdRunTest, App_Spawn_Cold_Run_003, TestSize.Level0) // set cold start flags AppSpawnReqMsgSetAppFlag(reqHandle, APP_FLAGS_COLD_BOOT); - ret = -1; + int msgRet = -1; node->flags |= STUB_NEED_CHECK; node->arg = reinterpret_cast(ExecvAbortStub); AppSpawnResult result = {}; - ret = AppSpawnClientSendMsg(clientHandle, reqHandle, &result); + msgRet = AppSpawnClientSendMsg(clientHandle, reqHandle, &result); APPSPAWN_LOGV("App_Spawn_Cold_Run_003 Kill pid %{public}d %{public}d", result.pid, result.result); - if (ret == 0 && result.pid > 0) { + if (msgRet == 0 && result.pid > 0) { kill(result.pid, SIGKILL); } - ret = 0; } while (0); AppSpawnClientDestroy(clientHandle); node->flags &= ~STUB_NEED_CHECK; @@ -235,16 +232,15 @@ HWTEST_F(AppSpawnColdRunTest, App_Spawn_Cold_Run_004, TestSize.Level0) // set cold start flags AppSpawnReqMsgSetAppFlag(reqHandle, APP_FLAGS_COLD_BOOT); - ret = -1; + int msgRet = -1; node->flags |= STUB_NEED_CHECK; node->arg = reinterpret_cast(ExecvTimeoutStub); AppSpawnResult result = {}; - ret = AppSpawnClientSendMsg(clientHandle, reqHandle, &result); + msgRet = AppSpawnClientSendMsg(clientHandle, reqHandle, &result); APPSPAWN_LOGV("App_Spawn_Cold_Run_004 Kill pid %{public}d %{public}d", result.pid, result.result); - if (ret == 0 && result.pid > 0) { + if (msgRet == 0 && result.pid > 0) { kill(result.pid, SIGKILL); } - ret = 0; } while (0); AppSpawnClientDestroy(clientHandle); node->flags &= ~STUB_NEED_CHECK; -- Gitee