• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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("//build/test.gni")
15import("//foundation/multimedia/av_codec/config.gni")
16
17module_output_path = "av_codec/unittest"
18
19av_codec_unittest_include_dirs = [
20  "$av_codec_root_dir/interfaces/inner_api/native",
21  "$av_codec_root_dir/interfaces/interfaces/inner_api/native",
22]
23
24av_codec_unittest_cflags = [
25  "-std=c++17",
26  "-fno-rtti",
27  "-fno-exceptions",
28  "-Wall",
29  "-fno-common",
30  "-fstack-protector-strong",
31  "-Wshadow",
32  "-FPIC",
33  "-FS",
34  "-O2",
35  "-D_FORTIFY_SOURCE=2",
36  "-fvisibility=hidden",
37  "-Wformat=2",
38  "-Wdate-time",
39  "-Werror",
40  "-Wextra",
41  "-Wimplicit-fallthrough",
42  "-Wsign-compare",
43  "-Wunused-parameter",
44]
45
46##################################################################################################################
47ohos_unittest("av_audio_capi_unit_test") {
48  module_out_path = module_output_path
49  include_dirs = av_codec_unittest_include_dirs
50  include_dirs += [
51    "./",
52    "//third_party/ffmpeg",
53    "$av_codec_root_dir/interfaces/kits/c",
54    "$av_codec_root_dir/services/engine/common/include",
55    "$av_codec_root_dir/services/engine/base/include",
56    "$av_codec_root_dir/services/utils/include",
57    "$av_codec_root_dir/services/engine/codec/include/audio",
58    "$av_codec_root_dir/services/engine/factory",
59  ]
60
61  cflags = av_codec_unittest_cflags
62
63  cflags_cc = cflags
64
65  public_configs = []
66
67  if (av_codec_support_test) {
68    sources = [ "./audio_decoder_capi_unit_test.cpp" ]
69  }
70
71  deps = [
72    "$av_codec_root_dir/interfaces/inner_api/native:av_codec_client",
73    "$av_codec_root_dir/interfaces/kits/c:capi_packages",
74    "$av_codec_root_dir/services/engine/codec/audio:av_codec_audio_ffmpeg_codec",
75    "$av_codec_root_dir/services/services:av_codec_service",
76    "$av_codec_root_dir/services/utils:av_codec_service_utils",
77  ]
78
79  external_deps = [
80    "graphic_surface:surface",
81    "media_foundation:capi_packages",
82  ]
83
84  resource_config_file =
85      "$av_codec_root_dir/test/unittest/resources/ohos_test.xml"
86}
87
88##################################################################################################################
89ohos_unittest("av_audio_codecbase_unit_test") {
90  module_out_path = module_output_path
91  include_dirs = av_codec_unittest_include_dirs
92  include_dirs += [
93    "./",
94    "//third_party/ffmpeg",
95    "$av_codec_root_dir/interfaces/kits/c",
96    "$av_codec_root_dir/services/engine/common/include",
97    "$av_codec_root_dir/services/engine/base/include",
98    "$av_codec_root_dir/services/utils/include",
99    "$av_codec_root_dir/services/engine/codec/include/audio",
100    "$av_codec_root_dir/services/engine/factory",
101  ]
102
103  cflags = av_codec_unittest_cflags
104
105  cflags_cc = cflags
106
107  public_configs = []
108
109  if (av_codec_support_test) {
110    sources = [ "./audio_decoder_codecbase_unit_test.cpp" ]
111  }
112
113  deps = [
114    "$av_codec_root_dir/interfaces/inner_api/native:av_codec_client",
115    "$av_codec_root_dir/interfaces/kits/c:capi_packages",
116    "$av_codec_root_dir/services/engine/codec/audio:av_codec_audio_ffmpeg_codec",
117    "$av_codec_root_dir/services/services:av_codec_service",
118    "$av_codec_root_dir/services/utils:av_codec_service_utils",
119  ]
120
121  external_deps = [
122    "graphic_surface:surface",
123    "hilog:libhilog",
124  ]
125
126  resource_config_file =
127      "$av_codec_root_dir/test/unittest/resources/ohos_test.xml"
128}
129
130##################################################################################################################
131ohos_unittest("av_audio_decode_ability_unit_test") {
132  module_out_path = module_output_path
133  include_dirs = av_codec_unittest_include_dirs
134  include_dirs += [
135    "./",
136    "//third_party/ffmpeg",
137    "$av_codec_root_dir/interfaces/kits/c",
138    "$av_codec_root_dir/services/engine/common/include",
139    "$av_codec_root_dir/services/engine/base/include",
140    "$av_codec_root_dir/services/utils/include",
141    "$av_codec_root_dir/services/engine/codec/include/audio",
142    "$av_codec_root_dir/services/engine/factory",
143  ]
144
145  cflags = av_codec_unittest_cflags
146
147  cflags_cc = cflags
148
149  public_configs = []
150
151  if (av_codec_support_test) {
152    sources = [ "./audio_decoder_ability_unit_test.cpp" ]
153  }
154
155  deps = [
156    "$av_codec_root_dir/interfaces/inner_api/native:av_codec_client",
157    "$av_codec_root_dir/interfaces/kits/c:capi_packages",
158    "$av_codec_root_dir/services/engine/codec/audio:av_codec_audio_ffmpeg_codec",
159    "$av_codec_root_dir/services/services:av_codec_service",
160    "$av_codec_root_dir/services/utils:av_codec_service_utils",
161  ]
162
163  external_deps = [
164    "graphic_surface:surface",
165    "media_foundation:capi_packages",
166  ]
167
168  resource_config_file =
169      "$av_codec_root_dir/test/unittest/resources/ohos_test.xml"
170}
171
172##################################################################################################################
173ohos_unittest("av_audio_inner_unit_test") {
174  module_out_path = module_output_path
175  include_dirs = av_codec_unittest_include_dirs
176  include_dirs += [
177    "./",
178    "//third_party/ffmpeg",
179    "$av_codec_root_dir/interfaces/kits/c",
180    "$av_codec_root_dir/services/engine/common/include",
181    "$av_codec_root_dir/services/engine/base/include",
182    "$av_codec_root_dir/services/utils/include",
183    "$av_codec_root_dir/services/engine/codec/include/audio",
184    "$av_codec_root_dir/services/engine/factory",
185  ]
186
187  cflags = av_codec_unittest_cflags
188
189  cflags_cc = cflags
190
191  public_configs = []
192
193  if (av_codec_support_test) {
194    sources = [ "./audio_decoder_inner_unit_test.cpp" ]
195  }
196
197  deps = [
198    "$av_codec_root_dir/interfaces/inner_api/native:av_codec_client",
199    "$av_codec_root_dir/interfaces/kits/c:capi_packages",
200    "$av_codec_root_dir/services/engine/codec/audio:av_codec_audio_ffmpeg_codec",
201    "$av_codec_root_dir/services/services:av_codec_service",
202    "$av_codec_root_dir/services/utils:av_codec_service_utils",
203  ]
204
205  external_deps = [ "graphic_surface:surface" ]
206
207  resource_config_file =
208      "$av_codec_root_dir/test/unittest/resources/ohos_test.xml"
209}
210
211##################################################################################################################
212ohos_unittest("av_audio_encoder_capi_unit_test") {
213  module_out_path = module_output_path
214  include_dirs = av_codec_unittest_include_dirs
215  include_dirs += [
216    "./",
217    "//third_party/ffmpeg",
218    "$av_codec_root_dir/interfaces/kits/c",
219    "$av_codec_root_dir/services/engine/common/include",
220    "$av_codec_root_dir/services/engine/base/include",
221    "$av_codec_root_dir/services/utils/include",
222    "$av_codec_root_dir/services/engine/codec/include/audio",
223    "$av_codec_root_dir/services/engine/factory",
224  ]
225
226  cflags = av_codec_unittest_cflags
227
228  cflags_cc = cflags
229
230  public_configs = []
231
232  if (av_codec_support_test) {
233    sources = [ "./audio_encoder_capi_unit_test.cpp" ]
234  }
235
236  deps = [
237    "$av_codec_root_dir/interfaces/inner_api/native:av_codec_client",
238    "$av_codec_root_dir/interfaces/kits/c:capi_packages",
239    "$av_codec_root_dir/services/engine/codec/audio:av_codec_audio_ffmpeg_codec",
240    "$av_codec_root_dir/services/services:av_codec_service",
241    "$av_codec_root_dir/services/utils:av_codec_service_utils",
242  ]
243
244  external_deps = [
245    "graphic_surface:surface",
246    "media_foundation:capi_packages",
247  ]
248
249  resource_config_file =
250      "$av_codec_root_dir/test/unittest/resources/ohos_test.xml"
251}
252
253##################################################################################################################
254ohos_unittest("av_audio_encoder_avbuffer_capi_unit_test") {
255  module_out_path = module_output_path
256  include_dirs = av_codec_unittest_include_dirs
257  include_dirs += [
258    "./",
259    "//third_party/ffmpeg",
260    "$av_codec_root_dir/interfaces/kits/c",
261    "$av_codec_root_dir/services/engine/common/include",
262    "$av_codec_root_dir/services/engine/base/include",
263    "$av_codec_root_dir/services/utils/include",
264    "$av_codec_root_dir/services/engine/codec/include/audio",
265    "$av_codec_root_dir/services/engine/factory",
266  ]
267
268  cflags = av_codec_unittest_cflags
269
270  cflags_cc = cflags
271
272  public_configs = []
273
274  if (av_codec_support_test) {
275    sources = [ "./audio_encoder_avbuffer_capi_unit_test.cpp" ]
276  }
277
278  deps = [
279    "$av_codec_root_dir/interfaces/inner_api/native:av_codec_client",
280    "$av_codec_root_dir/interfaces/kits/c:capi_packages",
281    "$av_codec_root_dir/services/engine/codec/audio:av_codec_audio_ffmpeg_codec",
282    "$av_codec_root_dir/services/services:av_codec_service",
283    "$av_codec_root_dir/services/utils:av_codec_service_utils",
284  ]
285
286  external_deps = [
287    "graphic_2d:surface",
288    "media_foundation:capi_packages",
289    "media_foundation:media_foundation",
290  ]
291
292  resource_config_file =
293      "$av_codec_root_dir/test/unittest/resources/ohos_test.xml"
294}
295
296##################################################################################################################
297ohos_unittest("av_audio_decoder_avbuffer_capi_unit_test") {
298  module_out_path = module_output_path
299  include_dirs = av_codec_unittest_include_dirs
300  include_dirs += [
301    "./",
302    "//third_party/ffmpeg",
303    "$av_codec_root_dir/interfaces/kits/c",
304    "$av_codec_root_dir/services/engine/common/include",
305    "$av_codec_root_dir/services/engine/base/include",
306    "$av_codec_root_dir/services/utils/include",
307    "$av_codec_root_dir/services/engine/codec/include/audio",
308    "$av_codec_root_dir/services/engine/factory",
309  ]
310
311  cflags = av_codec_unittest_cflags
312
313  cflags_cc = cflags
314
315  public_configs = []
316
317  if (av_codec_support_test) {
318    sources = [ "./audio_decoder_avbuffer_capi_unit_test.cpp" ]
319  }
320
321  deps = [
322    "$av_codec_root_dir/interfaces/inner_api/native:av_codec_client",
323    "$av_codec_root_dir/interfaces/kits/c:capi_packages",
324    "$av_codec_root_dir/services/engine/codec/audio:av_codec_audio_ffmpeg_codec",
325    "$av_codec_root_dir/services/services:av_codec_service",
326    "$av_codec_root_dir/services/utils:av_codec_service_utils",
327  ]
328
329  external_deps = [
330    "graphic_2d:surface",
331    "media_foundation:capi_packages",
332    "media_foundation:media_foundation",
333  ]
334
335  resource_config_file =
336      "$av_codec_root_dir/test/unittest/resources/ohos_test.xml"
337}
338