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