1# Copyright (c) 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")
15camera_test_path = "//drivers/peripheral/camera/test/hdi/"
16
17if (defined(ohos_lite)) {
18  import("//build/lite/config/test.gni")
19  import("../../../../../hdf_core/adapter/uhdf/uhdf.gni")
20
21  config("camhdi_at_test_config") {
22    visibility = [ ":*" ]
23    cflags_cc = [
24      "-DGST_DISABLE_DEPRECATED",
25      "-DHAVE_CONFIG_H",
26      "-DCOLORSPACE=\"videoconvert\"",
27      "--coverage",
28    ]
29    ldflags = [ "--coverage" ]
30    cflags_cc += [ "-std=c++17" ]
31  }
32
33  unittest("camera_test_at") {
34    output_extension = "bin"
35    output_dir = "$root_out_dir/test/unittest/hdf"
36    sources = [
37      "$camera_path/../../test/common/callback/src/camera_device_callback.cpp",
38      "$camera_path/../../test/common/callback/src/camera_host_callback.cpp",
39      "$camera_path/../../test/common/callback/src/stream_operator_callback.cpp",
40    ]
41
42    include_dirs = [
43      "$camera_path/../../interfaces/include",
44      "$camera_path/../../interfaces/hdi_passthrough",
45      "$camera_path/../../test/common/callback/include",
46      "$camera_path/include",
47      "$camera_path/../../hdi_service/v1_0/include",
48      "$camera_path/../v4l2/src/stream_operator/stream_tunnel/lite",
49      "$camera_path/device_manager/include/",
50      "$camera_path/device_manager/include/mpi",
51      "$camera_path/utils/event",
52      "$camera_path/../../base",
53      "$camera_path/../../display/interfaces/include",
54
55      #producer
56      "$camera_path/pipeline_core/utils",
57      "$camera_path/pipeline_core/include",
58      "$camera_path/pipeline_core/host_stream/include",
59      "$camera_path/pipeline_core/nodes/include",
60      "$camera_path/pipeline_core/nodes/src/node_base",
61      "$camera_path/pipeline_core/nodes/src/dummy_node",
62      "$camera_path/pipeline_core/pipeline_impl/src/strategy/config",
63      "$camera_path/pipeline_core/pipeline_impl/include",
64      "$camera_path/pipeline_core/pipeline_impl/src",
65      "$camera_path/pipeline_core/pipeline_impl/src/builder",
66      "$camera_path/pipeline_core/pipeline_impl/src/dispatcher",
67      "$camera_path/pipeline_core/pipeline_impl/src/parser",
68      "$camera_path/pipeline_core/pipeline_impl/src/strategy",
69      "$camera_path/pipeline_core/ipp/include",
70    ]
71
72    public_deps = [
73      "$camera_path/../../hdi_service/v1_0:camera_host_service_1.0",
74      "$hdf_uhdf_path/utils:libhdf_utils",
75      "../../../../hdf_core/adapter/uhdf/manager:hdf_core",
76    ]
77    external_deps = [
78      "drivers_interface_camera:libbuffer_producer_sequenceable_1.0",
79      "drivers_interface_camera:metadata",
80      "graphic_surface:surface",
81      "hdf_core:hdf_platform",
82      "hdf_core:hdf_posix_osal",
83      "hilog_lite:hilog_shared",
84    ]
85  }
86} else {
87  import("//build/ohos.gni")
88  import("//build/test.gni")
89
90  module_output_path = "drivers_peripheral_camera/camera"
91
92  config("camhdi_at_test_config") {
93    visibility = [ ":*" ]
94    cflags_cc = [
95      "-DGST_DISABLE_DEPRECATED",
96      "-DHAVE_CONFIG_H",
97      "-DCOLORSPACE=\"videoconvert\"",
98      "--coverage",
99    ]
100    ldflags = [ "--coverage" ]
101  }
102
103  ohos_unittest("camera_test_at") {
104    testonly = true
105    module_out_path = module_output_path
106    sources = [
107      "$camera_test_path/v1_0/src/camera_3a_uttest.cpp",
108      "$camera_test_path/v1_0/src/camera_hal_hisysevent_test.cpp",
109      "$camera_test_path/v1_0/src/device_ability_uttest.cpp",
110      "$camera_test_path/v1_0/src/hdi_device_uttest.cpp",
111      "$camera_test_path/v1_0/src/hdi_host_uttest.cpp",
112      "$camera_test_path/v1_0/src/hdi_stream_uttest.cpp",
113      "$camera_test_path/v1_0/src/ut_common.cpp",
114    ]
115
116    include_dirs = [
117      # common includes
118      "$camera_test_path/v1_0/include",
119      "$camera_path/../../interfaces/include",
120      "$camera_path/include",
121    ]
122
123    deps = []
124
125    if (is_standard_system) {
126      external_deps = [
127        "c_utils:utils",
128        "hdf_core:libhdf_host",
129        "hdf_core:libhdf_ipc_adapter",
130        "hdf_core:libhdf_utils",
131        "hdf_core:libhdi",
132        "hilog:libhilog",
133        "ipc:ipc_single",
134      ]
135    } else {
136      external_deps = [ "hilog:libhilog" ]
137    }
138
139    external_deps += [
140      "drivers_interface_camera:libbuffer_producer_sequenceable_1.0",
141      "drivers_interface_camera:libcamera_proxy_1.0",
142      "drivers_interface_camera:metadata",
143      "googletest:gmock_main",
144      "googletest:gtest",
145      "googletest:gtest_main",
146      "graphic_surface:surface",
147      "samgr:samgr_proxy",
148    ]
149    public_configs = [ ":camhdi_at_test_config" ]
150  }
151}
152