• 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
19avsource_unittest_cflags = [
20  "-std=c++17",
21  "-fno-rtti",
22  "-fno-exceptions",
23  "-Wall",
24  "-fno-common",
25  "-fstack-protector-strong",
26  "-Wshadow",
27  "-FPIC",
28  "-FS",
29  "-O2",
30  "-D_FORTIFY_SOURCE=2",
31  "-fvisibility=hidden",
32  "-Wformat=2",
33  "-Wdate-time",
34  "-Werror",
35  "-Wextra",
36  "-Wimplicit-fallthrough",
37  "-Wsign-compare",
38  "-Wunused-parameter",
39]
40
41################################################################################################################muxer
42ohos_unittest("avsource_capi_unit_test") {
43  module_out_path = module_output_path
44  include_dirs = [
45    "./",
46    "./capi",
47    "$av_codec_root_dir/interfaces/inner_api/native",
48    "$av_codec_root_dir/interfaces/kits/c",
49    "$av_codec_root_dir/test/unittest/format_test",
50    "$av_codec_root_dir/test/unittest/format_test/capi",
51    "$av_codec_root_dir/test/nativedemo/include",
52    "$av_codec_root_dir/test/nativedemo/avdemuxer/server_demo",
53    "//third_party/ffmpeg",
54  ]
55
56  cflags = avsource_unittest_cflags
57
58  if (av_codec_support_source) {
59    sources = [
60      "$av_codec_root_dir/test/nativedemo/avdemuxer/server_demo/file_server_demo.cpp",
61      "./avsource_hevc_unit_test.cpp",
62      "./avsource_unit_test.cpp",
63      "./avsource_uri_unit_test.cpp",
64      "./capi/avsource_capi_mock.cpp",
65      "./capi/avsource_capi_mock_factory.cpp",
66    ]
67  }
68
69  if (target_cpu == "arm64") {
70    av_codec_path = "\"/system/lib64\""
71  } else {
72    av_codec_path = "\"/system/lib\""
73  }
74  defines = [ "AV_CODEC_PATH=${av_codec_path}" ]
75
76  deps = [ "$av_codec_root_dir/interfaces/kits/c:capi_packages" ]
77  public_deps =
78      [ "$av_codec_root_dir/test/unittest/common:av_codec_capi_unit_test" ]
79  external_deps = [
80    "av_codec:av_codec_client",
81    "c_utils:utils",
82    "graphic_2d:libgraphic_utils",
83    "graphic_surface:surface",
84    "hilog:libhilog",
85    "media_foundation:capi_packages",
86    "media_foundation:media_foundation",
87  ]
88
89  resource_config_file =
90      "$av_codec_root_dir/test/unittest/resources/ohos_test.xml"
91}
92
93#################################################################################################################muxer
94ohos_unittest("avsource_inner_unit_test") {
95  module_out_path = module_output_path
96  include_dirs = [
97    "./",
98    "./inner",
99    "$av_codec_root_dir/interfaces/inner_api/native",
100    "$av_codec_root_dir/interfaces/kits/c",
101    "$av_codec_root_dir/test/unittest/format_test",
102    "$av_codec_root_dir/test/unittest/format_test/inner",
103    "$av_codec_root_dir/test/nativedemo/include",
104    "$av_codec_root_dir/test/nativedemo/avdemuxer/server_demo",
105    "//third_party/ffmpeg",
106  ]
107
108  if (target_cpu == "arm64") {
109    av_codec_path = "\"/system/lib64\""
110  } else {
111    av_codec_path = "\"/system/lib\""
112  }
113  defines = [
114    "AV_CODEC_PATH=${av_codec_path}",
115    "AVSOURCE_INNER_UNIT_TEST",
116  ]
117
118  cflags = avsource_unittest_cflags
119
120  if (av_codec_support_source) {
121    sources = [
122      "$av_codec_root_dir/test/nativedemo/avdemuxer/server_demo/file_server_demo.cpp",
123      "./avsource_hevc_unit_test.cpp",
124      "./avsource_unit_test.cpp",
125      "./avsource_uri_unit_test.cpp",
126      "./inner/avsource_inner_mock.cpp",
127      "./inner/avsource_inner_mock_factory.cpp",
128    ]
129  }
130  public_deps =
131      [ "$av_codec_root_dir/test/unittest/common:av_codec_inner_unit_test" ]
132  external_deps = [
133    "av_codec:av_codec_client",
134    "c_utils:utils",
135    "graphic_2d:libgraphic_utils",
136    "graphic_surface:surface",
137    "hilog:libhilog",
138    "media_foundation:media_foundation",
139  ]
140
141  resource_config_file =
142      "$av_codec_root_dir/test/unittest/resources/ohos_test.xml"
143}
144