1eace7efcSopenharmony_ci# Copyright (c) 2022 Huawei Device Co., Ltd.
2eace7efcSopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
3eace7efcSopenharmony_ci# you may not use this file except in compliance with the License.
4eace7efcSopenharmony_ci# You may obtain a copy of the License at
5eace7efcSopenharmony_ci#
6eace7efcSopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
7eace7efcSopenharmony_ci#
8eace7efcSopenharmony_ci# Unless required by applicable law or agreed to in writing, software
9eace7efcSopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
10eace7efcSopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11eace7efcSopenharmony_ci# See the License for the specific language governing permissions and
12eace7efcSopenharmony_ci# limitations under the License.
13eace7efcSopenharmony_ci
14eace7efcSopenharmony_ciimport("//build/test.gni")
15eace7efcSopenharmony_ciimport("//foundation/ability/ability_runtime/ability_runtime.gni")
16eace7efcSopenharmony_ci
17eace7efcSopenharmony_cimodule_output_path = "ability_runtime/abilitymgr"
18eace7efcSopenharmony_ci
19eace7efcSopenharmony_ciconfig("coverage_flags") {
20eace7efcSopenharmony_ci  cflags = [ "--coverage" ]
21eace7efcSopenharmony_ci  ldflags = [ "--coverage" ]
22eace7efcSopenharmony_ci}
23eace7efcSopenharmony_ci
24eace7efcSopenharmony_ciohos_unittest("quickfix_callback_test") {
25eace7efcSopenharmony_ci  module_out_path = module_output_path
26eace7efcSopenharmony_ci
27eace7efcSopenharmony_ci  include_dirs = [
28eace7efcSopenharmony_ci    "${ability_runtime_native_path}/runtime",
29eace7efcSopenharmony_ci    "${ability_runtime_native_path}/runtime/utils/include",
30eace7efcSopenharmony_ci  ]
31eace7efcSopenharmony_ci
32eace7efcSopenharmony_ci  sources = [ "js_quickfix_callback_test.cpp" ]
33eace7efcSopenharmony_ci
34eace7efcSopenharmony_ci  configs = [ "${ability_runtime_services_path}/abilitymgr:abilityms_config" ]
35eace7efcSopenharmony_ci  deps = []
36eace7efcSopenharmony_ci
37eace7efcSopenharmony_ci  external_deps = [
38eace7efcSopenharmony_ci    "ability_runtime:runtime",
39eace7efcSopenharmony_ci    "c_utils:utils",
40eace7efcSopenharmony_ci  ]
41eace7efcSopenharmony_ci}
42eace7efcSopenharmony_ci
43eace7efcSopenharmony_ciohos_unittest("runtime_test") {
44eace7efcSopenharmony_ci  module_out_path = module_output_path
45eace7efcSopenharmony_ci
46eace7efcSopenharmony_ci  include_dirs = [
47eace7efcSopenharmony_ci    "${ability_runtime_native_path}/runtime",
48eace7efcSopenharmony_ci    "${ability_runtime_native_path}/runtime/utils/include",
49eace7efcSopenharmony_ci    "${ability_base_kits_path}/extractortool/include",
50eace7efcSopenharmony_ci    "//third_party/zlib/contrib/minizip",
51eace7efcSopenharmony_ci    "//third_party/zlib",
52eace7efcSopenharmony_ci  ]
53eace7efcSopenharmony_ci
54eace7efcSopenharmony_ci  sources = [
55eace7efcSopenharmony_ci    # add mock file
56eace7efcSopenharmony_ci    "js_module_reader_test.cpp",
57eace7efcSopenharmony_ci  ]
58eace7efcSopenharmony_ci
59eace7efcSopenharmony_ci  configs = [ "${ability_runtime_services_path}/abilitymgr:abilityms_config" ]
60eace7efcSopenharmony_ci  deps = []
61eace7efcSopenharmony_ci
62eace7efcSopenharmony_ci  external_deps = [
63eace7efcSopenharmony_ci    "ability_base:extractortool",
64eace7efcSopenharmony_ci    "ability_runtime:runtime",
65eace7efcSopenharmony_ci    "c_utils:utils",
66eace7efcSopenharmony_ci  ]
67eace7efcSopenharmony_ci}
68eace7efcSopenharmony_ci
69eace7efcSopenharmony_ciohos_unittest("js_runtime_test") {
70eace7efcSopenharmony_ci  module_out_path = module_output_path
71eace7efcSopenharmony_ci  sanitize = {
72eace7efcSopenharmony_ci    cfi = true
73eace7efcSopenharmony_ci    cfi_cross_dso = true
74eace7efcSopenharmony_ci    debug = false
75eace7efcSopenharmony_ci    blocklist = "../../cfi_blocklist.txt"
76eace7efcSopenharmony_ci  }
77eace7efcSopenharmony_ci  branch_protector_ret = "pac_ret"
78eace7efcSopenharmony_ci
79eace7efcSopenharmony_ci  include_dirs = [
80eace7efcSopenharmony_ci    "${ability_runtime_native_path}/runtime",
81eace7efcSopenharmony_ci    "${ability_runtime_native_path}/runtime/utils/include",
82eace7efcSopenharmony_ci    "//third_party/zlib/contrib/minizip",
83eace7efcSopenharmony_ci    "//third_party/zlib",
84eace7efcSopenharmony_ci  ]
85eace7efcSopenharmony_ci
86eace7efcSopenharmony_ci  sources = [
87eace7efcSopenharmony_ci    # add mock file
88eace7efcSopenharmony_ci    "js_runtime_test.cpp",
89eace7efcSopenharmony_ci    "mock_jsnapi.cpp",
90eace7efcSopenharmony_ci  ]
91eace7efcSopenharmony_ci
92eace7efcSopenharmony_ci  configs = [ "${ability_runtime_services_path}/abilitymgr:abilityms_config" ]
93eace7efcSopenharmony_ci  deps = [
94eace7efcSopenharmony_ci    "//third_party/googletest:gmock_main",
95eace7efcSopenharmony_ci    "//third_party/googletest:gtest_main",
96eace7efcSopenharmony_ci  ]
97eace7efcSopenharmony_ci
98eace7efcSopenharmony_ci  external_deps = [
99eace7efcSopenharmony_ci    "ability_runtime:js_environment",
100eace7efcSopenharmony_ci    "ability_runtime:runtime",
101eace7efcSopenharmony_ci    "bundle_framework:appexecfwk_core",
102eace7efcSopenharmony_ci    "c_utils:utils",
103eace7efcSopenharmony_ci    "ets_runtime:libark_jsruntime",
104eace7efcSopenharmony_ci    "eventhandler:libeventhandler",
105eace7efcSopenharmony_ci    "ffrt:libffrt",
106eace7efcSopenharmony_ci    "hilog:libhilog",
107eace7efcSopenharmony_ci    "ipc:ipc_core",
108eace7efcSopenharmony_ci    "napi:ace_napi",
109eace7efcSopenharmony_ci  ]
110eace7efcSopenharmony_ci}
111eace7efcSopenharmony_ci
112eace7efcSopenharmony_ciohos_unittest("js_runtime_first_test") {
113eace7efcSopenharmony_ci  module_out_path = module_output_path
114eace7efcSopenharmony_ci  sanitize = {
115eace7efcSopenharmony_ci    cfi = true
116eace7efcSopenharmony_ci    cfi_cross_dso = true
117eace7efcSopenharmony_ci    debug = false
118eace7efcSopenharmony_ci    blocklist = "../../cfi_blocklist.txt"
119eace7efcSopenharmony_ci  }
120eace7efcSopenharmony_ci  branch_protector_ret = "pac_ret"
121eace7efcSopenharmony_ci
122eace7efcSopenharmony_ci  include_dirs = [
123eace7efcSopenharmony_ci    "${ability_runtime_native_path}/runtime",
124eace7efcSopenharmony_ci    "${ability_runtime_native_path}/runtime/utils/include",
125eace7efcSopenharmony_ci    "//third_party/zlib/contrib/minizip",
126eace7efcSopenharmony_ci    "//third_party/zlib",
127eace7efcSopenharmony_ci  ]
128eace7efcSopenharmony_ci
129eace7efcSopenharmony_ci  sources = [
130eace7efcSopenharmony_ci    # add mock file
131eace7efcSopenharmony_ci    "js_runtime_first_test.cpp",
132eace7efcSopenharmony_ci    "mock_jsnapi.cpp",
133eace7efcSopenharmony_ci  ]
134eace7efcSopenharmony_ci
135eace7efcSopenharmony_ci  configs = [ "${ability_runtime_services_path}/abilitymgr:abilityms_config" ]
136eace7efcSopenharmony_ci  deps = [
137eace7efcSopenharmony_ci    "//third_party/googletest:gmock_main",
138eace7efcSopenharmony_ci    "//third_party/googletest:gtest_main",
139eace7efcSopenharmony_ci  ]
140eace7efcSopenharmony_ci
141eace7efcSopenharmony_ci  external_deps = [
142eace7efcSopenharmony_ci    "ability_runtime:js_environment",
143eace7efcSopenharmony_ci    "ability_runtime:runtime",
144eace7efcSopenharmony_ci    "bundle_framework:appexecfwk_core",
145eace7efcSopenharmony_ci    "c_utils:utils",
146eace7efcSopenharmony_ci    "ets_runtime:libark_jsruntime",
147eace7efcSopenharmony_ci    "eventhandler:libeventhandler",
148eace7efcSopenharmony_ci    "ffrt:libffrt",
149eace7efcSopenharmony_ci    "hilog:libhilog",
150eace7efcSopenharmony_ci    "ipc:ipc_core",
151eace7efcSopenharmony_ci    "napi:ace_napi",
152eace7efcSopenharmony_ci  ]
153eace7efcSopenharmony_ci}
154eace7efcSopenharmony_ci
155eace7efcSopenharmony_ciohos_unittest("hdc_register_test") {
156eace7efcSopenharmony_ci  module_out_path = module_output_path
157eace7efcSopenharmony_ci
158eace7efcSopenharmony_ci  include_dirs = [
159eace7efcSopenharmony_ci    "${ability_runtime_native_path}/runtime",
160eace7efcSopenharmony_ci    "${ability_runtime_native_path}/runtime/utils/include",
161eace7efcSopenharmony_ci    "//third_party/zlib/contrib/minizip",
162eace7efcSopenharmony_ci    "//third_party/zlib",
163eace7efcSopenharmony_ci  ]
164eace7efcSopenharmony_ci
165eace7efcSopenharmony_ci  sources = [
166eace7efcSopenharmony_ci    # add mock file
167eace7efcSopenharmony_ci    "${ability_runtime_native_path}/runtime/hdc_register.cpp",
168eace7efcSopenharmony_ci    "hdc_register_test.cpp",
169eace7efcSopenharmony_ci  ]
170eace7efcSopenharmony_ci
171eace7efcSopenharmony_ci  configs = [ "${ability_runtime_services_path}/abilitymgr:abilityms_config" ]
172eace7efcSopenharmony_ci  deps = [
173eace7efcSopenharmony_ci    "//third_party/googletest:gmock_main",
174eace7efcSopenharmony_ci    "//third_party/googletest:gtest_main",
175eace7efcSopenharmony_ci  ]
176eace7efcSopenharmony_ci
177eace7efcSopenharmony_ci  external_deps = [
178eace7efcSopenharmony_ci    "bundle_framework:appexecfwk_core",
179eace7efcSopenharmony_ci    "c_utils:utils",
180eace7efcSopenharmony_ci    "hilog:libhilog",
181eace7efcSopenharmony_ci    "ipc:ipc_core",
182eace7efcSopenharmony_ci  ]
183eace7efcSopenharmony_ci}
184eace7efcSopenharmony_ci
185eace7efcSopenharmony_ciohos_unittest("ohos_js_environment_test") {
186eace7efcSopenharmony_ci  module_out_path = module_output_path
187eace7efcSopenharmony_ci
188eace7efcSopenharmony_ci  include_dirs = [ "${ability_runtime_native_path}/runtime" ]
189eace7efcSopenharmony_ci
190eace7efcSopenharmony_ci  sources = [ "ohos_js_environment_test.cpp" ]
191eace7efcSopenharmony_ci
192eace7efcSopenharmony_ci  configs = []
193eace7efcSopenharmony_ci
194eace7efcSopenharmony_ci  deps = [
195eace7efcSopenharmony_ci    "//third_party/googletest:gmock_main",
196eace7efcSopenharmony_ci    "//third_party/googletest:gtest_main",
197eace7efcSopenharmony_ci  ]
198eace7efcSopenharmony_ci
199eace7efcSopenharmony_ci  external_deps = [
200eace7efcSopenharmony_ci    "ability_runtime:js_environment",
201eace7efcSopenharmony_ci    "ability_runtime:runtime",
202eace7efcSopenharmony_ci    "c_utils:utils",
203eace7efcSopenharmony_ci    "ets_runtime:libark_jsruntime",
204eace7efcSopenharmony_ci    "eventhandler:libeventhandler",
205eace7efcSopenharmony_ci    "hilog:libhilog",
206eace7efcSopenharmony_ci    "napi:ace_napi",
207eace7efcSopenharmony_ci  ]
208eace7efcSopenharmony_ci}
209eace7efcSopenharmony_ci
210eace7efcSopenharmony_ciohos_unittest("js_worker_test") {
211eace7efcSopenharmony_ci  module_out_path = module_output_path
212eace7efcSopenharmony_ci
213eace7efcSopenharmony_ci  include_dirs = [
214eace7efcSopenharmony_ci    "${ability_runtime_native_path}/runtime",
215eace7efcSopenharmony_ci    "${ability_runtime_native_path}/runtime/utils/include",
216eace7efcSopenharmony_ci    "${ability_base_kits_path}/extractortool/include",
217eace7efcSopenharmony_ci    "//third_party/zlib/contrib/minizip",
218eace7efcSopenharmony_ci    "//third_party/zlib",
219eace7efcSopenharmony_ci  ]
220eace7efcSopenharmony_ci
221eace7efcSopenharmony_ci  sources = [
222eace7efcSopenharmony_ci    # add mock file
223eace7efcSopenharmony_ci    "js_worker_test.cpp",
224eace7efcSopenharmony_ci  ]
225eace7efcSopenharmony_ci
226eace7efcSopenharmony_ci  configs = [ "${ability_runtime_services_path}/abilitymgr:abilityms_config" ]
227eace7efcSopenharmony_ci  deps = []
228eace7efcSopenharmony_ci
229eace7efcSopenharmony_ci  external_deps = [
230eace7efcSopenharmony_ci    "ability_base:extractortool",
231eace7efcSopenharmony_ci    "ability_runtime:js_environment",
232eace7efcSopenharmony_ci    "ability_runtime:runtime",
233eace7efcSopenharmony_ci    "bundle_framework:appexecfwk_core",
234eace7efcSopenharmony_ci    "c_utils:utils",
235eace7efcSopenharmony_ci    "ets_runtime:libark_jsruntime",
236eace7efcSopenharmony_ci    "eventhandler:libeventhandler",
237eace7efcSopenharmony_ci    "hilog:libhilog",
238eace7efcSopenharmony_ci    "ipc:ipc_core",
239eace7efcSopenharmony_ci    "napi:ace_napi",
240eace7efcSopenharmony_ci  ]
241eace7efcSopenharmony_ci}
242eace7efcSopenharmony_ci
243eace7efcSopenharmony_cigroup("unittest") {
244eace7efcSopenharmony_ci  testonly = true
245eace7efcSopenharmony_ci
246eace7efcSopenharmony_ci  deps = [
247eace7efcSopenharmony_ci    ":hdc_register_test",
248eace7efcSopenharmony_ci    ":js_runtime_first_test",
249eace7efcSopenharmony_ci    ":js_runtime_test",
250eace7efcSopenharmony_ci    ":js_worker_test",
251eace7efcSopenharmony_ci    ":ohos_js_environment_test",
252eace7efcSopenharmony_ci    ":runtime_test",
253eace7efcSopenharmony_ci  ]
254eace7efcSopenharmony_ci}
255