• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2021-2022 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")
15
16module_output_path = "safwk/safwk"
17
18config("system_ability_config") {
19  visibility = [ ":*" ]
20  include_dirs = [
21    "//foundation/systemabilitymgr/safwk/services/safwk/include",
22    "//foundation/systemabilitymgr/safwk/interfaces/innerkits/safwk",
23  ]
24}
25
26config("system_ability_all_deps_config") {
27  include_dirs =
28      [ "//foundation/systemabilitymgr/safwk/interfaces/innerkits/safwk" ]
29}
30
31ohos_static_library("system_ability_fwk_tdd") {
32  sanitize = {
33    cfi = true
34    cfi_cross_dso = true
35    debug = false
36    cfi_no_nvcall = true
37    blocklist = "../../../../cfi_blocklist.txt"
38  }
39  sources = [
40    "//foundation/systemabilitymgr/safwk/services/safwk/src/api_cache_manager.cpp",
41    "//foundation/systemabilitymgr/safwk/services/safwk/src/local_ability_manager.cpp",
42    "//foundation/systemabilitymgr/safwk/services/safwk/src/local_ability_manager_dumper.cpp",
43    "//foundation/systemabilitymgr/safwk/services/safwk/src/local_ability_manager_stub.cpp",
44    "//foundation/systemabilitymgr/safwk/services/safwk/src/system_ability.cpp",
45    "//foundation/systemabilitymgr/safwk/services/safwk/src/system_ability_ondemand_reason.cpp",
46  ]
47
48  configs =
49      [ "//foundation/systemabilitymgr/safwk/test/resource:coverage_flags" ]
50
51  public_configs = [
52    ":system_ability_config",
53    ":system_ability_all_deps_config",
54  ]
55  if (is_standard_system) {
56    external_deps = [
57      "access_token:libaccesstoken_sdk",
58      "c_utils:utils",
59      "hilog:libhilog",
60      "hitrace:hitrace_meter",
61      "ipc:ipc_single",
62      "samgr:samgr_common",
63      "samgr:samgr_proxy",
64    ]
65  }
66
67  part_name = "safwk"
68  subsystem_name = "systemabilitymgr"
69}
70
71ohos_unittest("LocalAbilityManagerTest") {
72  module_out_path = module_output_path
73  resource_config_file =
74      "//foundation/systemabilitymgr/safwk/test/resource/ohos_test.xml"
75
76  include_dirs = [
77    "//foundation/systemabilitymgr/safwk/services/safwk/include",
78    "//foundation/systemabilitymgr/samgr/services/lsamgr/include",
79    "//foundation/systemabilitymgr/safwk/test/services/safwk/unittest/include",
80  ]
81
82  sources = [
83    "./local_ability_manager_dumper_test.cpp",
84    "./local_ability_manager_stub_test.cpp",
85    "./local_ability_manager_test.cpp",
86    "./mock_accesstoken_kit.cpp",
87    "./mock_sa_realize.cpp",
88    "./system_ability_ondemand_reason_test.cpp",
89    "//foundation/systemabilitymgr/samgr/services/dfx/source/hisysevent_adapter.cpp",
90  ]
91
92  configs =
93      [ "//foundation/systemabilitymgr/safwk/test/resource:coverage_flags" ]
94
95  deps = [
96    ":system_ability_fwk_tdd",
97    "//foundation/systemabilitymgr/safwk/test/mock/common/audio_ability:test_audio_ability",
98    "//foundation/systemabilitymgr/safwk/test/mock/common/connect_ability:test_connect_ability",
99    "//foundation/systemabilitymgr/safwk/test/mock/common/incomplete_ability:test_incomplete_ability",
100    "//foundation/systemabilitymgr/safwk/test/mock/common/ondemand_ability:test_ondemand_ability",
101    "//foundation/systemabilitymgr/safwk/test/mock/common/tt_ability:test_tt_ability",
102    "//foundation/systemabilitymgr/safwk/test/services/safwk/unittest/listen_ability:listen_test",
103  ]
104
105  if (target_cpu == "arm") {
106    cflags = [ "-DBINDER_IPC_32BIT" ]
107  }
108
109  external_deps = [
110    "access_token:libaccesstoken_sdk",
111    "access_token:libnativetoken",
112    "access_token:libtoken_setproc",
113    "c_utils:utils",
114    "googletest:gtest_main",
115    "hilog:libhilog",
116    "hisysevent:libhisysevent",
117    "ipc:ipc_core",
118    "samgr:samgr_common",
119    "samgr:samgr_proxy",
120  ]
121}
122
123ohos_unittest("SystemAbilityTest") {
124  sanitize = {
125    cfi = true
126    cfi_cross_dso = true
127    debug = false
128    cfi_no_nvcall = true
129    blocklist = "../../../../cfi_blocklist.txt"
130  }
131  module_out_path = module_output_path
132
133  resource_config_file =
134      "//foundation/systemabilitymgr/safwk/test/resource/ohos_test.xml"
135
136  include_dirs = [
137    "//foundation/systemabilitymgr/safwk/services/safwk/include",
138    "//foundation/systemabilitymgr/safwk/test/services/safwk/unittest/include",
139    "//foundation/systemabilitymgr/safwk/test/services/safwk/unittest/listen_ability/include",
140  ]
141
142  sources = [
143    "./mock_sa_realize.cpp",
144    "./sa_mock_permission.cpp",
145    "./system_ability_test.cpp",
146  ]
147
148  configs =
149      [ "//foundation/systemabilitymgr/safwk/test/resource:coverage_flags" ]
150
151  deps = [ ":system_ability_fwk_tdd" ]
152
153  if (target_cpu == "arm") {
154    cflags = [ "-DBINDER_IPC_32BIT" ]
155  }
156
157  external_deps = [
158    "access_token:libaccesstoken_sdk",
159    "access_token:libnativetoken_shared",
160    "access_token:libtokensetproc_shared",
161    "c_utils:utils",
162    "googletest:gtest_main",
163    "hilog:libhilog",
164    "ipc:ipc_core",
165    "samgr:samgr_common",
166  ]
167}
168
169ohos_unittest("CacheManagerTest") {
170  module_out_path = module_output_path
171
172  resource_config_file =
173      "//foundation/systemabilitymgr/safwk/test/resource/ohos_test.xml"
174
175  include_dirs = [
176    "//foundation/systemabilitymgr/safwk/services/safwk/include",
177    "//foundation/systemabilitymgr/safwk/test/services/safwk/unittest/include",
178    "//foundation/systemabilitymgr/safwk/test/services/safwk/unittest/listen_ability/include",
179    "//foundation/systemabilitymgr/safwk/test/mock/common/audio_ability/include",
180  ]
181
182  sources = [ "./api_cache_manager_test.cpp" ]
183
184  configs =
185      [ "//foundation/systemabilitymgr/safwk/test/resource:coverage_flags" ]
186
187  deps = [
188    ":system_ability_fwk_tdd",
189    "listen_ability:listen_test",
190    "test_sa_proxy_cache_ability:test_sa_proxy_cache",
191    "//foundation/systemabilitymgr/safwk/test/mock/common/audio_ability:test_audio_ability",
192  ]
193
194  if (target_cpu == "arm") {
195    cflags = [ "-DBINDER_IPC_32BIT" ]
196  }
197
198  external_deps = [
199    "access_token:libaccesstoken_sdk",
200    "access_token:libnativetoken_shared",
201    "access_token:libtokensetproc_shared",
202    "c_utils:utils",
203    "googletest:gtest_main",
204    "hilog:libhilog",
205    "ipc:ipc_core",
206    "samgr:samgr_common",
207  ]
208}
209
210ohos_unittest("ExpireLruCacheTest") {
211  module_out_path = module_output_path
212
213  resource_config_file =
214      "//foundation/systemabilitymgr/safwk/test/resource/ohos_test.xml"
215
216  include_dirs = [
217    "//foundation/systemabilitymgr/safwk/services/safwk/include",
218    "//foundation/systemabilitymgr/safwk/test/services/safwk/unittest/include",
219  ]
220
221  sources = [ "./expire_lru_cache_test.cpp" ]
222
223  configs =
224      [ "//foundation/systemabilitymgr/safwk/test/resource:coverage_flags" ]
225
226  deps = [
227    ":system_ability_fwk_tdd",
228    "listen_ability:listen_test",
229  ]
230
231  if (target_cpu == "arm") {
232    cflags = [ "-DBINDER_IPC_32BIT" ]
233  }
234
235  external_deps = [
236    "c_utils:utils",
237    "googletest:gtest_main",
238    "hilog:libhilog",
239    "ipc:ipc_core",
240  ]
241}
242
243ohos_unittest("SaProxyCacheTest") {
244  module_out_path = module_output_path
245
246  resource_config_file =
247      "//foundation/systemabilitymgr/safwk/test/resource/ohos_test.xml"
248
249  include_dirs = [
250    "//foundation/systemabilitymgr/safwk/services/safwk/include",
251    "//foundation/systemabilitymgr/safwk/test/services/safwk/unittest/include",
252    "//foundation/systemabilitymgr/safwk/test/services/safwk/unittest/test_sa_proxy_cache_ability/include",
253    "//foundation/systemabilitymgr/safwk/test/services/safwk/unittest/listen_ability/include",
254  ]
255
256  sources = [ "./sa_proxy_cache_test.cpp" ]
257
258  configs =
259      [ "//foundation/systemabilitymgr/safwk/test/resource:coverage_flags" ]
260
261  deps = [
262    ":system_ability_fwk_tdd",
263    "listen_ability:listen_test",
264    "test_sa_proxy_cache_ability:test_sa_proxy_cache",
265  ]
266
267  if (target_cpu == "arm") {
268    cflags = [ "-DBINDER_IPC_32BIT" ]
269  }
270
271  external_deps = [
272    "c_utils:utils",
273    "googletest:gmock_main",
274    "googletest:gtest_main",
275    "hilog:libhilog",
276    "ipc:ipc_core",
277  ]
278}
279
280group("unittest") {
281  testonly = true
282  deps = [
283    ":CacheManagerTest",
284    ":ExpireLruCacheTest",
285    ":LocalAbilityManagerTest",
286    ":SystemAbilityTest",
287  ]
288}
289