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