• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_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/mock_appmgr_service/include",
33    "${ability_runtime_test_path}/mock/mock_sa_call",
34    "${ability_runtime_test_path}/mock/services_appmgr_test/include",
35    "mock/include",
36  ]
37
38  sources = [
39    "${ability_runtime_services_path}/appmgr/src/ams_mgr_scheduler.cpp",
40    "${ability_runtime_test_path}/mock/services_appmgr_test/src/mock_bundle_manager.cpp",
41    "${ability_runtime_test_path}/mock/services_appmgr_test/src/mock_overlay_manager.cpp",
42    "mock/src/mock_my_flag.cpp",
43    "mock/src/mock_permission_verification.cpp",
44  ]
45
46  sources += [ "ams_mgr_scheduler_test.cpp" ]
47
48  cflags = []
49  configs = [ "${ability_runtime_services_path}/appmgr:appmgr_config" ]
50  if (target_cpu == "arm") {
51    cflags += [ "-DBINDER_IPC_32BIT" ]
52  }
53  deps = [
54    "${ability_runtime_innerkits_path}/app_manager:app_manager",
55    "${ability_runtime_native_path}/appkit:appkit_manager_helper",
56    "${ability_runtime_native_path}/appkit:appkit_native",
57    "${ability_runtime_path}/utils/server/startup:startup_util",
58    "${ability_runtime_services_path}/appmgr:libappms",
59    "${ability_runtime_services_path}/common:app_util",
60    "${ability_runtime_services_path}/common:perm_verification",
61    "${ability_runtime_services_path}/common:task_handler_wrap",
62  ]
63
64  external_deps = [
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    "hitrace:hitrace_meter",
79    "init:libbeget_proxy",
80    "init:libbegetutil",
81    "ipc:ipc_core",
82    "napi:ace_napi",
83    "safwk:system_ability_fwk",
84    "samgr:samgr_proxy",
85    "selinux_adapter:librestorecon",
86  ]
87
88  defines = [ "AMS_LOG_TAG = \"AppMgrService\"" ]
89
90  if (ability_command_for_test) {
91    defines += [ "ABILITY_COMMAND_FOR_TEST" ]
92  }
93
94  if (ability_runtime_graphics) {
95    defines += [ "SUPPORT_GRAPHICS" ]
96    deps += []
97    external_deps += [
98      "i18n:intl_util",
99      "window_manager:libwm",
100    ]
101  }
102  cflags_cc = []
103  if (os_dlp_part_enabled) {
104    cflags_cc += [ "-DWITH_DLP" ]
105  }
106}
107
108group("unittest") {
109  testonly = true
110  deps = [ ":ams_mgr_scheduler_test" ]
111}
112