1# Copyright (c) 2022-2024 Huawei Device Co., Ltd. 2# Licensed under the Apache License, Version 2.0 (the "License"); 3# you may not use this file except in compliance with the License. 4# You may obtain a copy of the License at 5# 6# http://www.apache.org/licenses/LICENSE-2.0 7# 8# Unless required by applicable law or agreed to in writing, software 9# distributed under the License is distributed on an "AS IS" BASIS, 10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11# See the License for the specific language governing permissions and 12# limitations under the License. 13 14import("//build/test.gni") 15import("//foundation/ability/ability_runtime/ability_runtime.gni") 16 17module_output_path = "ability_runtime/ability_runtime/appmgrservice" 18 19mock_sources = [ "${ability_runtime_test_path}/mock/services_appmgr_test/src/mock_bundle_manager.cpp" ] 20 21ohos_unittest("AmsMgrKillProcessTest") { 22 module_out_path = module_output_path 23 sanitize = { 24 cfi = true 25 cfi_cross_dso = true 26 debug = false 27 blocklist = "../../cfi_blocklist.txt" 28 } 29 branch_protector_ret = "pac_ret" 30 31 include_dirs = [ 32 "${ability_runtime_path}/interfaces/kits/native/appkit/ability_bundle_manager_helper", 33 "${ability_runtime_test_path}/mock/common/include", 34 "${ability_runtime_test_path}/mock/mock_sa_call", 35 "${ability_runtime_test_path}/mock/services_appmgr_test/include", 36 ] 37 38 sources = [ 39 "${ability_runtime_test_path}/mock/common/src/mock_native_token.cpp", 40 "ams_mgr_kill_process_test.cpp", 41 ] 42 sources += mock_sources 43 44 configs = [ 45 "${ability_runtime_native_path}/ability/native:ability_config", 46 "${ability_runtime_services_path}/appmgr:appmgr_config", 47 ] 48 49 cflags = [] 50 if (target_cpu == "arm") { 51 cflags += [ "-DBINDER_IPC_32BIT" ] 52 } 53 54 deps = [ 55 "${ability_runtime_innerkits_path}/app_manager:app_manager", 56 "${ability_runtime_native_path}/ability/native:abilitykit_native", 57 "${ability_runtime_native_path}/appkit:appkit_manager_helper", 58 "${ability_runtime_services_path}/appmgr:libappms", 59 "${ability_runtime_services_path}/common:perm_verification", 60 "${ability_runtime_services_path}/common:task_handler_wrap", 61 ] 62 63 external_deps = [ 64 "ability_base:want", 65 "access_token:libaccesstoken_sdk", 66 "access_token:libnativetoken", 67 "access_token:libtoken_setproc", 68 "appspawn:appspawn_client", 69 "bundle_framework:appexecfwk_base", 70 "bundle_framework:appexecfwk_core", 71 "cJSON:cjson", 72 "c_utils:utils", 73 "ffrt:libffrt", 74 "googletest:gmock_main", 75 "googletest:gtest_main", 76 "hilog:libhilog", 77 "hisysevent:libhisysevent", 78 "ipc:ipc_core", 79 "napi:ace_napi", 80 "safwk:system_ability_fwk", 81 "samgr:samgr_proxy", 82 "selinux_adapter:librestorecon", 83 ] 84 if (ability_runtime_child_process) { 85 defines = [ "SUPPORT_CHILD_PROCESS" ] 86 } 87} 88 89group("unittest") { 90 testonly = true 91 92 deps = [ ":AmsMgrKillProcessTest" ] 93} 94