• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/config/components/ace_engine/ace_gen_obj.gni")
17import("//build/test.gni")
18import("//foundation/arkui/napi/test/unittest/ut.gni")
19
20ohos_unittest("test_ark_unittest_base") {
21  module_out_path = module_output_path
22
23  include_dirs = common_include
24
25  cflags = [ "-g3" ]
26
27  sources = [
28    "engine/test_ark.cpp",
29    "test_napi.cpp",
30    "test_sendable_napi.cpp",
31  ]
32
33  defines = [ "NAPI_TEST" ]
34
35  deps = [ "../..:ace_napi" ]
36
37  external_deps = [
38    "bounds_checking_function:libsec_shared",
39    "c_utils:utils",
40    "ets_runtime:libark_jsruntime",
41    "eventhandler:libeventhandler",
42  ]
43
44  external_deps += [
45    "googletest:gtest",
46    "googletest:gtest_main",
47    "hilog:libhilog",
48    "libuv:uv",
49  ]
50}
51
52ohos_unittest("test_ark_unittest_threadsafe") {
53  module_out_path = module_output_path
54
55  include_dirs = common_include
56
57  cflags = [ "-g3" ]
58
59  sources = [
60    "engine/test_ark.cpp",
61    "test_napi_threadsafe.cpp",
62  ]
63
64  defines = [ "NAPI_TEST" ]
65
66  deps = [ "../..:ace_napi" ]
67
68  external_deps = [
69    "bounds_checking_function:libsec_shared",
70    "c_utils:utils",
71    "ets_runtime:libark_jsruntime",
72  ]
73
74  external_deps += [
75    "eventhandler:libeventhandler",
76    "googletest:gtest",
77    "googletest:gtest_main",
78    "hilog:libhilog",
79    "libuv:uv",
80  ]
81
82  defines += [ "ENABLE_EVENT_HANDLER" ]
83}
84
85ohos_unittest("test_unittest_sendevent") {
86  module_out_path = module_output_path
87
88  include_dirs = [
89    "./common",
90    "./engine",
91    "../../interfaces/inner_api",
92    "../../interfaces/kits",
93    "../../native_engine",
94  ]
95
96  cflags = [ "-g3" ]
97
98  sources = [
99    "engine/test_ark.cpp",
100    "test_napi_sendevent.cpp",
101  ]
102
103  defines = [ "NAPI_TEST" ]
104
105  deps = [ "../..:ace_napi" ]
106
107  external_deps = [
108    "c_utils:utils",
109    "ets_runtime:libark_jsruntime",
110    "eventhandler:libeventhandler",
111    "googletest:gtest",
112    "googletest:gtest_main",
113    "hilog:libhilog",
114    "libuv:uv",
115  ]
116}
117
118ohos_unittest("test_worker_manager") {
119  module_out_path = module_output_path
120
121  cflags = [ "-g3" ]
122
123  sources = [ "test_worker_manager.cpp" ]
124
125  defines = [ "NAPI_TEST" ]
126
127  deps = [ "../..:ace_napi" ]
128
129  external_deps = [
130    "googletest:gtest",
131    "googletest:gtest_main",
132    "hilog:libhilog",
133  ]
134}
135
136group("unittest") {
137  testonly = true
138  deps = [
139    ":test_ark_unittest_base",
140    ":test_ark_unittest_threadsafe",
141    ":test_unittest_sendevent",
142    ":test_worker_manager",
143  ]
144  if (target_cpu == "arm64" || target_cpu == "x86_64") {
145    deps += [ "cj_native:cj_native_unittest" ]
146  }
147}
148
149if (!ohos_indep_compiler_enable) {
150  #jerry tdd test for phone running
151  group("jerry_tdd_test_run") {
152    testonly = true
153    deps = [ "//third_party/jerryscript/tests/unit-core:jerry_tdd_test" ]
154  }
155
156  #jerry es2015 test for phone running
157  group("jerry_jstest_es2015") {
158    testonly = true
159    deps = [ "//third_party/jerryscript/tests/jerry:jerry_js_test_es2015" ]
160  }
161
162  #jerry es2015 test for host running
163  group("jerry_host_jstest_es2015") {
164    testonly = true
165    deps = [
166      "//third_party/jerryscript/tests/jerry:jerry_host_js_test_es2015",
167      "//third_party/jerryscript/tests/unit-core:jerry_tdd_host_test",
168    ]
169  }
170
171  #jerry es5.1 test for phone running
172  group("jerry_jstest_es5.1") {
173    testonly = true
174    deps = [ "//third_party/jerryscript/tests/jerry:jerry_js_test_es5.1" ]
175  }
176
177  #jerry es5.1 test for host running
178  group("jerry_host_jstest_es5.1") {
179    testonly = true
180    deps = [
181      "//third_party/jerryscript/tests/jerry:jerry_host_js_test_es5.1",
182      "//third_party/jerryscript/tests/unit-core:jerry_tdd_host_test",
183    ]
184  }
185
186  #jerry tdd test for host running
187  group("jerry_tdd_host_test_run") {
188    testonly = true
189    deps = [ "//third_party/jerryscript/tests/unit-core:jerry_tdd_host_test" ]
190  }
191}
192