1# Copyright (c) 2021-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/appmgr" 18 19ohos_unittest("ams_mgr_scheduler_second_test") { 20 sanitize = { 21 cfi = true 22 cfi_cross_dso = true 23 debug = false 24 blocklist = "../../cfi_blocklist.txt" 25 } 26 branch_protector_ret = "pac_ret" 27 module_out_path = module_output_path 28 cflags_cc = [] 29 include_dirs = [ 30 "${ability_runtime_path}/interfaces/kits/native/appkit/ability_bundle_manager_helper", 31 "${ability_runtime_services_path}/appmgr/include", 32 "${ability_runtime_test_path}/mock/common/include", 33 "${ability_runtime_test_path}/mock/mock_appmgr_service/include", 34 "${ability_runtime_test_path}/mock/mock_sa_call", 35 "${ability_runtime_test_path}/mock/services_appmgr_test/include", 36 "${ability_runtime_test_path}/mock/task_handler_wrap_mock/include", 37 "mock/include", 38 ] 39 40 sources = [ 41 "${ability_runtime_services_path}/appmgr/src/ams_mgr_scheduler.cpp", 42 "${ability_runtime_test_path}/mock/common/src/mock_native_token.cpp", 43 "${ability_runtime_test_path}/mock/services_appmgr_test/src/mock_bundle_manager.cpp", 44 "${ability_runtime_test_path}/mock/services_appmgr_test/src/mock_overlay_manager.cpp", 45 "mock/src/mock_ipc_skeleton.cpp", 46 "mock/src/mock_my_flag.cpp", 47 "mock/src/mock_permission_verification.cpp", 48 ] 49 50 sources += [ "ams_mgr_scheduler_second_test.cpp" ] 51 52 cflags = [] 53 configs = [ "${ability_runtime_services_path}/appmgr:appmgr_config" ] 54 if (target_cpu == "arm") { 55 cflags += [ "-DBINDER_IPC_32BIT" ] 56 } 57 deps = [ 58 "${ability_runtime_innerkits_path}/app_manager:app_manager", 59 "${ability_runtime_native_path}/appkit:appkit_manager_helper", 60 "${ability_runtime_native_path}/appkit:appkit_native", 61 "${ability_runtime_path}/utils/server/startup:startup_util", 62 "${ability_runtime_services_path}/appmgr:libappms", 63 "${ability_runtime_services_path}/common:app_util", 64 "${ability_runtime_services_path}/common:perm_verification", 65 "${ability_runtime_services_path}/common:task_handler_wrap", 66 ] 67 68 external_deps = [ 69 "access_token:libaccesstoken_sdk", 70 "access_token:libnativetoken", 71 "access_token:libtoken_setproc", 72 "appspawn:appspawn_client", 73 "bundle_framework:appexecfwk_base", 74 "bundle_framework:appexecfwk_core", 75 "cJSON:cjson", 76 "c_utils:utils", 77 "ffrt:libffrt", 78 "googletest:gmock_main", 79 "googletest:gtest_main", 80 "hilog:libhilog", 81 "hisysevent:libhisysevent", 82 "hitrace:hitrace_meter", 83 "init:libbeget_proxy", 84 "init:libbegetutil", 85 "ipc:ipc_core", 86 "napi:ace_napi", 87 "safwk:system_ability_fwk", 88 "samgr:samgr_proxy", 89 "selinux_adapter:librestorecon", 90 ] 91 92 defines = [ "AMS_LOG_TAG = \"AppMgrService\"" ] 93 94 if (ability_command_for_test) { 95 defines += [ "ABILITY_COMMAND_FOR_TEST" ] 96 } 97 98 if (ability_runtime_graphics) { 99 defines += [ "SUPPORT_GRAPHICS" ] 100 deps += [] 101 external_deps += [ 102 "i18n:intl_util", 103 "window_manager:libwm", 104 ] 105 } 106 cflags_cc = [] 107 if (os_dlp_part_enabled) { 108 cflags_cc += [ "-DWITH_DLP" ] 109 } 110} 111 112group("unittest") { 113 testonly = true 114 deps = [ ":ams_mgr_scheduler_second_test" ] 115} 116