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 = [] 26 cflags_cc += [ "-std=c++17" ] 27 } 28 29 unittest("camera_test_v4l2_ut") { 30 output_extension = "bin" 31 output_dir = "$root_out_dir/test/unittest/hdf" 32 sources = [ 33 # buffer manager test 34 "$ut_root_path/buffer_manager/buffer_manager_utest.cpp", 35 ] 36 include_dirs = [ 37 # camera common includes 38 "$camera_path/include", 39 "$camera_path/../../interfaces/include", 40 "$camera_path/../../interfaces/hdi_passthrough", 41 "$camera_path/../../test/common/callback/include", 42 "$camera_path/utils/event", 43 44 # device manager includes 45 "$camera_path/device_manager/include", 46 47 # buffer manager includes 48 "$camera_path/buffer_manager/include", 49 "$camera_path/buffer_manager/src/buffer_adapter/lite", 50 "//third_party/googletest/googletest/include", 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 = [ "$camera_path/buffer_manager:camera_buffer_manager" ] 75 external_deps = [ 76 "../../../../hdf_core/adapter/uhdf/manager:hdf_core", 77 "drivers_interface_camera:libbuffer_producer_sequenceable_1.0", 78 "drivers_interface_camera:metadata", 79 "graphic_chipsetsdk:surface", 80 "hdf_core:hdf_posix_osal", 81 ] 82 } 83} else { 84 import("//build/test.gni") 85 import("../../../../../hdf_core/adapter/uhdf2/uhdf.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_test_v4l2_ut") { 100 testonly = true 101 module_out_path = module_output_path 102 sources = [ 103 # v4l2 adapter test 104 "$ut_root_path/v4l2/camera_ability_test.cpp", 105 "$ut_root_path/v4l2/camera_capture_test.cpp", 106 "$ut_root_path/v4l2/camera_fps_test.cpp", 107 "$ut_root_path/v4l2/camera_preview_test.cpp", 108 "$ut_root_path/v4l2/camera_stabili_test.cpp", 109 "$ut_root_path/v4l2/camera_video_test.cpp", 110 "$ut_root_path/v4l2/double_preview_test.cpp", 111 "$ut_root_path/v4l2/hdfcamera_facedetect.cpp", 112 "$ut_root_path/v4l2/meta_data_test.cpp", 113 "$ut_root_path/v4l2/stream_customer.cpp", 114 "$ut_root_path/v4l2/test_camera_base.cpp", 115 "$ut_root_path/v4l2/usb_camera_test.cpp", 116 "$ut_root_path/v4l2/usb_camera_test_mult.cpp", 117 ] 118 119 include_dirs = [ 120 # common includes 121 "//third_party/googletest/googletest/include", 122 "$camera_path/../../display/interfaces/include", 123 "$camera_path/../../display/hdi_service/gralloc/include", 124 125 # camera common includes 126 "$camera_path/include", 127 "$camera_path/../../interfaces/include", 128 "$camera_path/../../interfaces/hdi_ipc", 129 "$camera_path/utils/event", 130 "$camera_path/../../interfaces/hdi_ipc/utils/include", 131 "$camera_path/../../interfaces/hdi_ipc/callback/host/include", 132 "$camera_path/../../interfaces/hdi_ipc/callback/device/include", 133 "$camera_path/../../interfaces/hdi_ipc/callback/operator/include", 134 "$camera_path/../../test/common/callback/include", 135 136 # device manager includes 137 "$camera_path/device_manager/include", 138 139 # buffer manager includes 140 "$camera_path/buffer_manager/include", 141 "$camera_path/buffer_manager/src/buffer_adapter/standard", 142 143 # pipeline core includes 144 "$camera_path/pipeline_core", 145 "$camera_path/pipeline_core/host_stream/include", 146 "$camera_path/pipeline_core/utils", 147 "$camera_path/pipeline_core/nodes/include", 148 "$camera_path/pipeline_core/nodes/src/node_base", 149 "$camera_path/pipeline_core/nodes/src/sink_node", 150 "$camera_path/pipeline_core/nodes/src/sensor_node", 151 "$camera_path/pipeline_core/nodes/src/merge_node", 152 "$camera_path/pipeline_core/nodes/src/dummy_node", 153 "$camera_path/pipeline_core/pipeline_impl/include", 154 "$camera_path/pipeline_core/pipeline_impl/src", 155 "$camera_path/pipeline_core/include", 156 "$camera_path/pipeline_core/pipeline_impl/src/builder", 157 "$camera_path/pipeline_core/pipeline_impl/src/dispatcher", 158 "$camera_path/pipeline_core/pipeline_impl/src/parser", 159 "$camera_path/pipeline_core/pipeline_impl/src/strategy", 160 "$camera_path/pipeline_core/pipeline_impl/src/strategy/config", 161 "$camera_path/pipeline_core/ipp/include", 162 163 # hdi service includes 164 "$camera_path/../../hdi_service/v1_0/include", 165 166 # vdi impl includes 167 "$camera_path/../v4l2/src/stream_operator/stream_tunnel/standard", 168 169 # metadata manager includes 170 "$camera_path/metadata_manager/include", 171 ] 172 173 deps = [ 174 "$camera_path/../../hdi_service/v1_0:camera_host_service_1.0_static", 175 "$camera_path/buffer_manager:camera_buffer_manager", 176 "//third_party/googletest:gmock_main", 177 "//third_party/googletest:gtest", 178 "//third_party/googletest:gtest_main", 179 ] 180 181 if (is_standard_system) { 182 external_deps = [ 183 "c_utils:utils", 184 "drivers_interface_camera:libcamera_proxy_1.0", 185 "drivers_interface_camera:libcamera_stub_1.0", 186 "hdf_core:libhdf_utils", 187 "hilog:libhilog", 188 "samgr:samgr_proxy", 189 ] 190 } else { 191 external_deps = [ "hilog:libhilog" ] 192 } 193 194 external_deps += [ 195 "drivers_interface_camera:libbuffer_producer_sequenceable_1.0", 196 "drivers_interface_camera:metadata", 197 "graphic_chipsetsdk:surface", 198 "ipc:ipc_single", 199 "samgr:samgr_proxy", 200 ] 201 public_configs = [ ":camera_ut_test_config" ] 202 } 203} 204