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