• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2025 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/ohos.gni")
15import("//build/ohos_var.gni")
16import("//build/test.gni")
17
18mechbody_module_output_path =
19    "mechbody_controller/mechbody_controller/mechbodyservicetest"
20
21mechbody_path =
22    "//foundation/distributedhardware/mechbody_controller"
23
24config("mech_test_config") {
25  visibility = [ ":*" ]
26  include_dirs = [
27    "${mechbody_path}/services/include",
28    "${mechbody_path}/services/src",
29    "${mechbody_path}/services/include/connect",
30    "${mechbody_path}/services/include/controller",
31    "${mechbody_path}/services/include/motion",
32    "${mechbody_path}/services/include/transport",
33    "${mechbody_path}/services/include/transport/command",
34    "${mechbody_path}/interface/inner_api",
35  ]
36}
37
38mech_external_deps = [
39  "ability_base:base",
40  "access_token:libaccesstoken_sdk",
41  "access_token:libtokensetproc_shared",
42  "bluetooth:btcommon",
43  "bluetooth:btframework",
44  "cJSON:cjson",
45  "c_utils:utils",
46  "camera_framework:camera_framework",
47  "eventhandler:libeventhandler",
48  "graphic_surface:surface",
49  "hilog:libhilog",
50  "init:libbegetutil",
51  "input:libmmi-client",
52  "input:oh_input_manager",
53  "ipc:ipc_core",
54  "safwk:system_ability_fwk",
55  "samgr:samgr_proxy",
56  "sensor:sensor_interface_native",
57]
58
59mech_public_deps = [ "${mechbody_path}/services:mechbody_service" ]
60
61ohos_unittest("mc_montion_manager_test") {
62  visibility = [ ":*" ]
63
64  module_out_path = mechbody_module_output_path
65
66  sanitize = {
67    cfi = true
68    cfi_cross_dso = true
69    debug = false
70  }
71
72  sources = [ "motion/mc_motion_manager_test.cpp" ]
73
74  configs = [
75    ":mech_test_config",
76    "${mechbody_path}/test/resource:coverage_flags",
77  ]
78
79  external_deps = mech_external_deps
80  public_deps = mech_public_deps
81
82  part_name = "mechbody_controller"
83  subsystem_name = "distributedhardware"
84}
85
86ohos_unittest("mc_transport_command_test") {
87  cflags = [ "-Dprivate=public" ]
88  visibility = [ ":*" ]
89
90  module_out_path = mechbody_module_output_path
91
92  sanitize = {
93    cfi = true
94    cfi_cross_dso = true
95    debug = false
96  }
97
98  sources = [
99    "transport/mc_data_buffer_test.cpp",
100    "transport/mc_protocol_convertor_test.cpp",
101  ]
102
103  configs = [
104    ":mech_test_config",
105    "${mechbody_path}/test/resource:coverage_flags",
106  ]
107
108  external_deps = mech_external_deps
109  public_deps = mech_public_deps
110
111  part_name = "mechbody_controller"
112  subsystem_name = "distributedhardware"
113}
114
115ohos_unittest("ble_send_manager_test") {
116  visibility = [ ":*" ]
117
118  module_out_path = mechbody_module_output_path
119
120  cflags = [ "-Dprivate=public" ]
121
122  sanitize = {
123    cfi = true
124    cfi_cross_dso = true
125    debug = false
126  }
127
128  sources = [ "ble_send_manager_test.cpp" ]
129
130  configs = [
131    ":mech_test_config",
132    "${mechbody_path}/test/resource:coverage_flags",
133  ]
134
135  external_deps = mech_external_deps
136  public_deps = mech_public_deps
137
138  part_name = "mechbody_controller"
139  subsystem_name = "distributedhardware"
140}
141
142ohos_unittest("connect_manager_test") {
143  visibility = [ ":*" ]
144
145  module_out_path = mechbody_module_output_path
146
147  cflags = [ "-Dprivate=public" ]
148
149  sanitize = {
150    cfi = true
151    cfi_cross_dso = true
152    debug = false
153  }
154
155  sources = [
156    "connect_manager/bluetooth_state_test.cpp",
157    "connect_manager/connect_manager_test.cpp",
158  ]
159
160  configs = [
161    ":mech_test_config",
162    "${mechbody_path}/test/resource:coverage_flags",
163  ]
164
165  external_deps = mech_external_deps
166  public_deps = mech_public_deps
167
168  part_name = "mechbody_controller"
169  subsystem_name = "distributedhardware"
170}
171
172ohos_unittest("mc_send_manager_test") {
173  visibility = [ ":*" ]
174
175  module_out_path = mechbody_module_output_path
176
177  cflags = [ "-Dprivate=public" ]
178
179  sanitize = {
180    cfi = true
181    cfi_cross_dso = true
182    debug = false
183  }
184
185  sources = [ "mc_send_manager/mc_send_manager_test.cpp" ]
186
187  configs = [
188    ":mech_test_config",
189    "${mechbody_path}/test/resource:coverage_flags",
190  ]
191
192  external_deps = mech_external_deps
193  public_deps = mech_public_deps
194
195  part_name = "mechbody_controller"
196  subsystem_name = "distributedhardware"
197}
198
199ohos_unittest("mc_subcription_center_test") {
200  visibility = [ ":*" ]
201
202  module_out_path = mechbody_module_output_path
203
204  cflags = [ "-Dprivate=public" ]
205
206  sanitize = {
207    cfi = true
208    cfi_cross_dso = true
209    debug = false
210  }
211
212  sources = [ "mc_subcription_center/mc_subcription_center_test.cpp" ]
213
214  configs = [
215    ":mech_test_config",
216    "${mechbody_path}/test/resource:coverage_flags",
217  ]
218
219  external_deps = mech_external_deps
220  public_deps = mech_public_deps
221
222  part_name = "mechbody_controller"
223  subsystem_name = "distributedhardware"
224}
225
226ohos_unittest("mc_command_test") {
227  cflags = [ "-Dprivate=public" ]
228  visibility = [ ":*" ]
229
230  module_out_path = mechbody_module_output_path
231
232  sanitize = {
233    cfi = true
234    cfi_cross_dso = true
235    debug = false
236  }
237
238  sources = [ "transport/command/mc_command_test.cpp" ]
239
240  configs = [
241    ":mech_test_config",
242    "${mechbody_path}/test/resource:coverage_flags",
243  ]
244
245  external_deps = mech_external_deps
246  public_deps = mech_public_deps
247
248  part_name = "mechbody_controller"
249  subsystem_name = "distributedhardware"
250}
251
252ohos_unittest("mechbody_controller_stub_test") {
253  visibility = [ ":*" ]
254
255  module_out_path = mechbody_module_output_path
256
257  cflags = [ "-Dprivate=public" ]
258
259  sanitize = {
260    cfi = true
261    cfi_cross_dso = true
262    debug = false
263  }
264
265  sources = [ "mechbody_controller_stub_test.cpp" ]
266
267  configs = [
268    ":mech_test_config",
269    "${mechbody_path}/test/resource:coverage_flags",
270  ]
271
272  external_deps = mech_external_deps
273  public_deps = mech_public_deps
274
275  part_name = "mechbody_controller"
276  subsystem_name = "distributedhardware"
277}
278
279ohos_unittest("mechbody_controller_service_test") {
280  visibility = [ ":*" ]
281
282  module_out_path = mechbody_module_output_path
283
284  cflags = [ "-Dprivate=public" ]
285
286  sanitize = {
287    cfi = true
288    cfi_cross_dso = true
289    debug = false
290  }
291
292  sources = [ "mechbody_controller_service_test.cpp" ]
293
294  configs = [
295    ":mech_test_config",
296    "${mechbody_path}/test/resource:coverage_flags",
297  ]
298
299  external_deps = mech_external_deps
300  public_deps = mech_public_deps
301
302  part_name = "mechbody_controller"
303  subsystem_name = "distributedhardware"
304}
305
306ohos_unittest("mc_camera_tracking_controller_test") {
307  visibility = [ ":*" ]
308
309  module_out_path = mechbody_module_output_path
310
311  cflags = [ "-Dprivate=public" ]
312
313  sanitize = {
314    cfi = true
315    cfi_cross_dso = true
316    debug = false
317  }
318
319  sources = [ "controller/mc_camera_tracking_controller_test.cpp" ]
320
321  configs = [
322    ":mech_test_config",
323    "${mechbody_path}/test/resource:coverage_flags",
324  ]
325
326  external_deps = mech_external_deps
327  public_deps = mech_public_deps
328
329  part_name = "mechbody_controller"
330  subsystem_name = "distributedhardware"
331}
332
333group("unittest") {
334  testonly = true
335  deps = [
336    ":ble_send_manager_test",
337    ":connect_manager_test",
338    ":mc_camera_tracking_controller_test",
339    ":mc_command_test",
340    ":mc_montion_manager_test",
341    ":mc_send_manager_test",
342    ":mc_subcription_center_test",
343    ":mc_transport_command_test",
344    ":mechbody_controller_service_test",
345    ":mechbody_controller_stub_test",
346  ]
347}
348