1# Copyright (c) 2021 - 2023 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("../../../camera.gni")
15
16ut_root_path = ".."
17
18if (defined(ohos_lite)) {
19  import("//build/lite/config/test.gni")
20  import("../../../../../hdf_core/adapter/uhdf/uhdf.gni")
21
22  config("camera_ut_test_config") {
23    visibility = [ ":*" ]
24
25    cflags_cc = [ "--coverage" ]
26    cflags_cc += [ "-std=c++17" ]
27    ldflags = [ "--coverage" ]
28  }
29
30  unittest("camera_buffer_manager_ut") {
31    output_extension = "bin"
32    output_dir = "$root_out_dir/test/unittest/hdf"
33    sources = [
34      # buffer manager test
35      "$ut_root_path/buffer_manager/buffer_manager_utest.cpp",
36    ]
37    include_dirs = [
38      # camera common includes
39      "$camera_path/include",
40      "$camera_path/../../interfaces/include",
41      "$camera_path/../../interfaces/hdi_passthrough",
42      "$camera_path/../../test/common/callback/include",
43      "$camera_path/utils/event",
44
45      # device manager includes
46      "$camera_path/device_manager/include",
47
48      # buffer manager includes
49      "$camera_path/buffer_manager/include",
50      "$camera_path/buffer_manager/src/buffer_adapter/lite",
51      "$camera_path/../../base",
52      "$camera_path/../../display/interfaces/include",
53
54      # pipeline core includes
55      "$camera_path/pipeline_core",
56      "$camera_path/pipeline_core/host_stream/include",
57      "$camera_path/pipeline_core/utils",
58      "$camera_path/pipeline_core/nodes/include",
59      "$camera_path/pipeline_core/nodes/src/node_base",
60      "$camera_path/pipeline_core/nodes/src/sink_node",
61      "$camera_path/pipeline_core/nodes/src/sensor_node",
62      "$camera_path/pipeline_core/nodes/src/merge_node",
63      "$camera_path/pipeline_core/nodes/src/dummy_node",
64      "$camera_path/pipeline_core/pipeline_impl/include",
65      "$camera_path/pipeline_core/pipeline_impl/src",
66      "$camera_path/pipeline_core/include",
67      "$camera_path/pipeline_core/pipeline_impl/src/builder",
68      "$camera_path/pipeline_core/pipeline_impl/src/dispatcher",
69      "$camera_path/pipeline_core/pipeline_impl/src/parser",
70      "$camera_path/pipeline_core/pipeline_impl/src/strategy",
71      "$camera_path/pipeline_core/pipeline_impl/src/strategy/config",
72      "$camera_path/pipeline_core/ipp/include",
73    ]
74    public_deps =
75        [ "$camera_path/buffer_manager:peripheral_camera_buffer_manager" ]
76    external_deps = [
77      "../../../../hdf_core/adapter/uhdf/manager:hdf_core",
78      "drivers_interface_camera:libbuffer_producer_sequenceable_1.0",
79      "drivers_interface_camera:metadata",
80      "graphic_surface:surface",
81      "hdf_core:hdf_posix_osal",
82    ]
83  }
84} else {
85  import("//build/test.gni")
86
87  module_output_path = "drivers_peripheral_camera/camera"
88
89  config("camera_ut_test_config") {
90    visibility = [ ":*" ]
91
92    cflags_cc = [
93      "-Wno-error",
94      "-std=c++17",
95    ]
96
97    ldflags = [ "--coverage" ]
98  }
99  ohos_unittest("camera_buffer_manager_ut") {
100    testonly = true
101    module_out_path = module_output_path
102    sources = [
103      # buffer manager test
104      "$ut_root_path/buffer_manager/buffer_manager_utest.cpp",
105    ]
106
107    include_dirs = [
108      # camera common includes
109      "$camera_path/include",
110      "$camera_path/../../interfaces/include",
111      "$camera_path/../../interfaces/hdi_ipc",
112      "$camera_path/utils/event",
113      "$camera_path/../../interfaces/hdi_ipc/utils/include",
114      "$camera_path/../../interfaces/hdi_ipc/callback/host/include",
115      "$camera_path/../../interfaces/hdi_ipc/callback/device/include",
116      "$camera_path/../../interfaces/hdi_ipc/callback/operator/include",
117      "$camera_path/../../test/common/callback/include",
118
119      # device manager includes
120      "$camera_path/device_manager/include",
121
122      # buffer manager includes
123      "$camera_path/buffer_manager/include",
124      "$camera_path/buffer_manager/src/buffer_adapter/standard",
125
126      # pipeline core includes
127      "$camera_path/pipeline_core",
128      "$camera_path/pipeline_core/host_stream/include",
129      "$camera_path/pipeline_core/utils",
130      "$camera_path/pipeline_core/nodes/include",
131      "$camera_path/pipeline_core/nodes/src/node_base",
132      "$camera_path/pipeline_core/nodes/src/sink_node",
133      "$camera_path/pipeline_core/nodes/src/sensor_node",
134      "$camera_path/pipeline_core/nodes/src/merge_node",
135      "$camera_path/pipeline_core/nodes/src/dummy_node",
136      "$camera_path/pipeline_core/pipeline_impl/include",
137      "$camera_path/pipeline_core/pipeline_impl/src",
138      "$camera_path/pipeline_core/include",
139      "$camera_path/pipeline_core/pipeline_impl/src/builder",
140      "$camera_path/pipeline_core/pipeline_impl/src/dispatcher",
141      "$camera_path/pipeline_core/pipeline_impl/src/parser",
142      "$camera_path/pipeline_core/pipeline_impl/src/strategy",
143      "$camera_path/pipeline_core/pipeline_impl/src/strategy/config",
144      "$camera_path/pipeline_core/ipp/include",
145
146      # hdi service includes
147      "$camera_path/../../hdi_service/v1_0/include",
148
149      # vdi impl includes
150      "$camera_path/../v4l2/src/stream_operator/stream_tunnel/standard",
151
152      # metadata manager includes
153      "$camera_path/metadata_manager/include",
154    ]
155
156    deps = [
157      "$camera_path/../../hdi_service/v1_0:camera_host_service_1.0_static",
158      "$camera_path/buffer_manager:peripheral_camera_buffer_manager",
159    ]
160
161    if (is_standard_system) {
162      external_deps = [
163        "c_utils:utils",
164        "drivers_interface_camera:libcamera_proxy_1.0",
165        "drivers_interface_camera:libcamera_stub_1.0",
166        "hdf_core:libhdf_utils",
167        "hilog:libhilog",
168        "samgr:samgr_proxy",
169      ]
170    } else {
171      external_deps = [ "hilog:libhilog" ]
172    }
173
174    external_deps += [
175      "drivers_interface_camera:libbuffer_producer_sequenceable_1.0",
176      "drivers_interface_camera:metadata",
177      "googletest:gmock_main",
178      "googletest:gtest",
179      "googletest:gtest_main",
180      "graphic_surface:surface",
181      "ipc:ipc_single",
182      "samgr:samgr_proxy",
183    ]
184    public_configs = [ ":camera_ut_test_config" ]
185  }
186}
187