diff --git a/standard/appspawn_service.c b/standard/appspawn_service.c index 001ddcbf27acccac44048752d7159d004e3ed1b2..01f16d0ae2ba06a18f7ec923407378353d0a8fc8 100644 --- a/standard/appspawn_service.c +++ b/standard/appspawn_service.c @@ -1075,19 +1075,14 @@ static void ProcessChildResponse(const WatcherHandle taskHandle, int fd, uint32_ AppSpawningCtx *property = (AppSpawningCtx *)context; property->forkCtx.watcherHandle = NULL; // delete watcher LE_RemoveWatcher(LE_GetDefaultLoop(), (WatcherHandle)taskHandle); - - if (ProcessChildFdCheck(fd, property) != 0) { - return; - } + APPSPAWN_CHECK_ONLY_EXPER(ProcessChildFdCheck(fd, property) == 0, return); // success bool isDebuggable = CheckAppMsgFlagsSet(property, APP_FLAGS_DEBUGGABLE); uint32_t appIndex = 0; if (CheckAppMsgFlagsSet(property, APP_FLAGS_CLONE_ENABLE)) { AppSpawnMsgBundleInfo *bundleInfo = (AppSpawnMsgBundleInfo *)GetAppProperty(property, TLV_BUNDLE_INFO); - if (bundleInfo != NULL) { - appIndex = bundleInfo->bundleIndex; - } + APPSPAWN_CHECK_ONLY_EXPER(bundleInfo == NULL, appIndex = bundleInfo->bundleIndex); } AppSpawnedProcess *appInfo = AddSpawnedProcess(property->pid, GetBundleName(property), appIndex, isDebuggable); if (appInfo) { diff --git a/test/unittest/app_spawn_standard_test/app_spawn_common_test.cpp b/test/unittest/app_spawn_standard_test/app_spawn_common_test.cpp index e10b6d13d547a442a32be7b4a86108b7be4fc8e5..17b5d029fe53f83a94a01e92596c35063761a973 100644 --- a/test/unittest/app_spawn_standard_test/app_spawn_common_test.cpp +++ b/test/unittest/app_spawn_standard_test/app_spawn_common_test.cpp @@ -632,7 +632,6 @@ HWTEST_F(AppSpawnCommonTest, App_Spawn_Common_029, TestSize.Level0) DeleteAppSpawnNamespace(appSpawnNamespace); DeleteAppSpawnMgr(mgr); EXPECT_EQ(appSpawnNamespace == nullptr, 1); - } HWTEST_F(AppSpawnCommonTest, App_Spawn_Common_030, TestSize.Level0) diff --git a/test/unittest/app_spawn_standard_test/app_spawn_sandbox_new_mount_test.cpp b/test/unittest/app_spawn_standard_test/app_spawn_sandbox_new_mount_test.cpp index df738bd67853c40c303f898923c147e8b8562e4b..66da4cde02cb56208b14d0a444cb0ffb32ae75ca 100644 --- a/test/unittest/app_spawn_standard_test/app_spawn_sandbox_new_mount_test.cpp +++ b/test/unittest/app_spawn_standard_test/app_spawn_sandbox_new_mount_test.cpp @@ -283,6 +283,18 @@ HWTEST_F(AppSpawnSandboxCoverageTest, App_Spawn_Sandbox_MountAllGroup, TestSize. cJSON_Delete(config1); free(context->rootPath); context->rootPath = NULL; +} + +HWTEST_F(AppSpawnSandboxCoverageTest, App_Spawn_Sandbox_MountAllGroup_001, TestSize.Level0) +{ + AppSpawningCtx *spawningCtx = TestCreateAppSpawningCtx(); + SandboxContext *context = TestGetSandboxContext(spawningCtx, 0); + ASSERT_EQ(context != nullptr, 1); + AppSpawnSandboxCfg *sandbox = CreateAppSpawnSandbox(EXT_DATA_APP_SANDBOX); + ASSERT_EQ(sandbox != nullptr, 1); + LoadAppSandboxConfig(sandbox, EXT_DATA_APP_SANDBOX); + free(context->rootPath); + context->rootPath = NULL; const char testDataGroupStr2[] = R"([ { @@ -324,7 +336,7 @@ HWTEST_F(AppSpawnSandboxCoverageTest, App_Spawn_Sandbox_MountAllGroup, TestSize. } } -HWTEST_F(AppSpawnSandboxCoverageTest, App_Spawn_Sandbox_MountAllGroup_001, TestSize.Level0) +HWTEST_F(AppSpawnSandboxCoverageTest, App_Spawn_Sandbox_MountAllGroup_002, TestSize.Level0) { AppSpawningCtx *spawningCtx = TestCreateAppSpawningCtx(); SandboxContext *context = TestGetSandboxContext(spawningCtx, 0); @@ -350,7 +362,7 @@ HWTEST_F(AppSpawnSandboxCoverageTest, App_Spawn_Sandbox_MountAllGroup_001, TestS } } -HWTEST_F(AppSpawnSandboxCoverageTest, App_Spawn_Sandbox_MountAllGroup_002, TestSize.Level0) +HWTEST_F(AppSpawnSandboxCoverageTest, App_Spawn_Sandbox_MountAllGroup_003, TestSize.Level0) { AppSpawningCtx *spawningCtx = TestCreateAppSpawningCtx(); SandboxContext *context = TestGetSandboxContext(spawningCtx, 0);