【应用热启】修复外部导致的TDD崩溃问题

Signed-off-by: huzeshan <huzeshan@huawei.com>
This commit is contained in:
huzeshan 2024-09-07 12:05:50 +08:00
parent 5dd77e0341
commit ad7e8b7e41
2 changed files with 19 additions and 17 deletions

View File

@ -21,12 +21,16 @@ ohos_unittest("cache_process_manager_test") {
cfi = true
cfi_cross_dso = true
debug = false
blocklist = "../../cfi_blocklist.txt"
}
branch_protector_ret = "pac_ret"
module_out_path = module_output_path
cflags_cc = []
include_dirs = [
"${ability_runtime_innerkits_path}/ability_manager/include/",
"${ability_runtime_services_path}/appmgr/include/",
"${ability_runtime_test_path}/mock/common/include",
"${ability_runtime_test_path}/mock/mock_appmgr_service/include",
"${ability_runtime_test_path}/mock/mock_sa_call",
"${ability_runtime_test_path}/mock/services_appmgr_test/include",
]
sources = [
@ -34,47 +38,40 @@ ohos_unittest("cache_process_manager_test") {
"cache_process_manager_test.cpp",
]
configs = [ "${ability_runtime_test_path}/unittest:appmgr_test_config" ]
cflags = []
configs = [ "${ability_runtime_services_path}/appmgr:appmgr_config" ]
deps = [
"${ability_runtime_innerkits_path}/app_manager:app_manager",
"${ability_runtime_innerkits_path}/deps_wrapper:ability_deps_wrapper",
"${ability_runtime_innerkits_path}/uri_permission:uri_permission_mgr",
"${ability_runtime_native_path}/appkit:appkit_native",
"${ability_runtime_path}/utils/server/startup:startup_util",
"${ability_runtime_services_path}/appmgr:libappms",
"${ability_runtime_services_path}/common:app_util",
"${ability_runtime_services_path}/common:event_report",
"${ability_runtime_services_path}/common:perm_verification",
"${ability_runtime_services_path}/common:task_handler_wrap",
"${windowmanager_path}/utils:libwmutil_static",
"//third_party/googletest:gmock_main",
"//third_party/googletest:gtest_main",
]
external_deps = [
"ability_base:base",
"ability_base:configuration",
"ability_base:want",
"ability_runtime:app_manager",
"access_token:libaccesstoken_sdk",
"access_token:libnativetoken",
"access_token:libtoken_setproc",
"appspawn:appspawn_client",
"bundle_framework:appexecfwk_base",
"bundle_framework:appexecfwk_core",
"c_utils:utils",
"common_event_service:cesfwk_innerkits",
"ffrt:libffrt",
"hicollie:libhicollie",
"hilog:libhilog",
"hisysevent:libhisysevent",
"hitrace:hitrace_meter",
"init:libbeget_proxy",
"init:libbegetutil",
"ipc:ipc_core",
"kv_store:distributeddata_mgr",
"memory_utils:libmeminfo",
"napi:ace_napi",
"safwk:system_ability_fwk",
"samgr:samgr_proxy",
"window_manager:libwm",
"window_manager:libwsutils",
]
defines = [ "AMS_LOG_TAG = \"AppMgrService\"" ]

View File

@ -85,6 +85,7 @@ HWTEST_F(CacheProcessManagerTest, CacheProcessManager_QueryEnableProcessCache_01
auto cacheProcMgr = std::make_shared<CacheProcessManager>();
EXPECT_NE(cacheProcMgr, nullptr);
cacheProcMgr->maxProcCacheNum_ = 0;
cacheProcMgr->resourceCacheProcessEnable_ = false;
EXPECT_EQ(cacheProcMgr->QueryEnableProcessCache(), false);
}
@ -98,6 +99,7 @@ HWTEST_F(CacheProcessManagerTest, CacheProcessManager_QueryEnableProcessCache_02
auto cacheProcMgr = std::make_shared<CacheProcessManager>();
EXPECT_NE(cacheProcMgr, nullptr);
cacheProcMgr->maxProcCacheNum_ = 100;
cacheProcMgr->resourceCacheProcessEnable_ = false;
EXPECT_EQ(cacheProcMgr->QueryEnableProcessCache(), true);
}
@ -131,6 +133,8 @@ HWTEST_F(CacheProcessManagerTest, CacheProcessManager_PenddingCacheProcess_0100,
appRecord->SetKeepAliveEnableState(true);
appRecord->SetSingleton(true);
appRecord->SetEmptyKeepAliveAppState(true);
appRecord->SetKeepAliveBundle(true);
appRecord->SetMainProcess(true);
EXPECT_EQ(cacheProcMgr->PenddingCacheProcess(appRecord), false);
// nullptr not allowed
std::shared_ptr<AppRunningRecord> appRecord2 = nullptr;
@ -338,6 +342,7 @@ HWTEST_F(CacheProcessManagerTest, CacheProcessManager_IsAppShouldCache_0100, Tes
// Not enable
cacheProcMgr->maxProcCacheNum_ = 0;
cacheProcMgr->resourceCacheProcessEnable_ = false;
EXPECT_EQ(cacheProcMgr->IsAppShouldCache(nullptr), false);
// Cached app