1# Copyright (c) 2021 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("//foundation/arkui/napi/napi.gni")
15
16import("//build/test.gni")
17import("//foundation/ability/form_fwk/form_fwk.gni")
18import("//foundation/arkui/ace_engine/ace_config.gni")
19import("//foundation/arkui/napi/test/unittest/ut.gni")
20
21if (is_standard_system) {
22  module_output_path = "ace_engine/napi"
23} else {
24  module_output_path = "ace_engine_full/napi"
25}
26
27ohos_unittest("test_ark_unittest") {
28  module_out_path = module_output_path
29
30  include_dirs = ark_include
31
32  cflags = [ "-g3" ]
33
34  sources = [
35    "engine/test_ark.cpp",
36    "test_napi.cpp",
37    "test_sendable_napi.cpp",
38  ]
39
40  defines = [ "NAPI_TEST" ]
41
42  deps = ark_deps
43
44  deps += [ "../..:ace_napi" ]
45
46  external_deps = [
47    "bounds_checking_function:libsec_shared",
48    "c_utils:utils",
49  ]
50
51  external_deps += [ "hilog:libhilog" ]
52  external_deps += [ "ets_runtime:libark_jsruntime" ]
53}
54
55ohos_unittest("test_ark_unittest_threadsafe") {
56  module_out_path = module_output_path
57
58  include_dirs = ark_include
59
60  cflags = [ "-g3" ]
61
62  sources = [
63    "engine/test_ark.cpp",
64    "test_napi_threadsafe.cpp",
65  ]
66
67  defines = [ "NAPI_TEST" ]
68
69  deps = ark_deps
70  deps += [ "../..:ace_napi" ]
71
72  external_deps = [ "bounds_checking_function:libsec_shared" ]
73
74  external_deps += [
75    "eventhandler:libeventhandler",
76    "hilog:libhilog",
77  ]
78  external_deps += [ "ets_runtime:libark_jsruntime" ]
79}
80
81ohos_unittest("test_ark_api_allowlist") {
82  module_out_path = module_output_path
83
84  include_dirs = ark_include
85
86  cflags = [ "-g3" ]
87
88  sources = [
89    "engine/test_ark.cpp",
90    "test_ark_api_allowlist.cpp",
91  ]
92
93  defines = [ "NAPI_TEST" ]
94
95  deps = ark_deps
96  deps += [ "../..:ace_napi" ]
97  deps += [ "${form_render_service_path}/..:formrender" ]
98
99  external_deps = [ "bounds_checking_function:libsec_shared" ]
100
101  external_deps += [ "hilog:libhilog" ]
102  external_deps += [ "ets_runtime:libark_jsruntime" ]
103}
104
105group("unittest") {
106  testonly = true
107  deps = [
108    ":test_ark_api_allowlist",
109    ":test_ark_unittest",
110    ":test_ark_unittest_threadsafe",
111    "cj_native:cj_native_unittest",
112  ]
113  if (target_cpu == "arm64") {
114    deps += [ "jsvm:jsvm_unittest" ]
115  }
116}
117
118#jerry tdd test for phone running
119group("jerry_tdd_test_run") {
120  testonly = true
121  deps = [ "//third_party/jerryscript/tests/unit-core:jerry_tdd_test" ]
122}
123
124#jerry es2015 test for phone running
125group("jerry_jstest_es2015") {
126  testonly = true
127  deps = [ "//third_party/jerryscript/tests/jerry:jerry_js_test_es2015" ]
128}
129
130#jerry es2015 test for host running
131group("jerry_host_jstest_es2015") {
132  testonly = true
133  deps = [
134    "//third_party/jerryscript/tests/jerry:jerry_host_js_test_es2015",
135    "//third_party/jerryscript/tests/unit-core:jerry_tdd_host_test",
136  ]
137}
138
139#jerry es5.1 test for phone running
140group("jerry_jstest_es5.1") {
141  testonly = true
142  deps = [ "//third_party/jerryscript/tests/jerry:jerry_js_test_es5.1" ]
143}
144
145#jerry es5.1 test for host running
146group("jerry_host_jstest_es5.1") {
147  testonly = true
148  deps = [
149    "//third_party/jerryscript/tests/jerry:jerry_host_js_test_es5.1",
150    "//third_party/jerryscript/tests/unit-core:jerry_tdd_host_test",
151  ]
152}
153
154#jerry tdd test for host running
155group("jerry_tdd_host_test_run") {
156  testonly = true
157  deps = [ "//third_party/jerryscript/tests/unit-core:jerry_tdd_host_test" ]
158}
159