• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2022 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
14#####################hydra-fuzz###################
15import("//build/config/features.gni")
16import("//build/test.gni")
17import("//foundation/multimedia/player_framework/config.gni")
18module_output_path = "player_framework/avcodec"
19MEDIA_ROOT_DIR = "//foundation/multimedia/player_framework/"
20MEDIA_AVCODEC_TEST_DIR =
21    "//foundation/multimedia/player_framework/test/unittest/avcodec_test/"
22
23acodec_fuzztest_include_dirs = [
24  "//graphic/graphic_2d/interfaces/innerkits/surface",
25  "//foundation//window/window_manager/interfaces/innerkits/wm",
26  "$MEDIA_ROOT_DIR/interfaces/inner_api/native",
27  "$MEDIA_ROOT_DIR/test/unittest/avcodec_test/",
28  "$MEDIA_ROOT_DIR/test/unittest/avcodec_test/native/audiodecoder/",
29  "$MEDIA_ROOT_DIR/test/unittest/avcodec_test/native/audioencoder/",
30  "$MEDIA_ROOT_DIR/test/unittest/avcodec_test/native/avcodec_info/",
31  "$MEDIA_ROOT_DIR/test/unittest/avcodec_test/native/avcodec_list/",
32  "$MEDIA_ROOT_DIR/test/unittest/avcodec_test/native/avformat/",
33  "$MEDIA_ROOT_DIR/test/unittest/avcodec_test/native/avmemory/",
34  "$MEDIA_ROOT_DIR/test/unittest/avcodec_test/native/enum/",
35  "$MEDIA_ROOT_DIR/test/unittest/avcodec_test/native/surface/",
36  "$MEDIA_ROOT_DIR/test/unittest/avcodec_test/native/videodecoder/",
37  "$MEDIA_ROOT_DIR/test/unittest/avcodec_test/native/videoencoder/",
38  "$MEDIA_ROOT_DIR/test/unittest/avcodec_test/acodec_test/",
39  "$MEDIA_ROOT_DIR/test/unittest/avcodec_test/vcodec_test/",
40  "$MEDIA_ROOT_DIR/test/unittest/common/include/",
41]
42
43acodec_fuzztest_cflags = [
44  "-std=c++17",
45  "-std=c++17",
46  "-fno-rtti",
47  "-fno-exceptions",
48  "-Wall",
49  "-fno-common",
50  "-fstack-protector-strong",
51  "-Wshadow",
52  "-FPIC",
53  "-FS",
54  "-O2",
55  "-D_FORTIFY_SOURCE=2",
56  "-fvisibility=hidden",
57  "-Wformat=2",
58  "-Wdate-time",
59  "-Werror",
60  "-Wextra",
61  "-Wimplicit-fallthrough",
62  "-Wsign-compare",
63  "-Wunused-parameter",
64]
65
66##############################fuzztest##########################################
67ohos_fuzztest("ACodecFileFuzzTest") {
68  module_out_path = module_output_path
69  fuzz_config_file = "//foundation//multimedia/player_framework/test/fuzztest/avcodec_fuzztest/acodecfile_fuzzer"
70
71  resource_config_file = "//foundation/multimedia/player_framework/test/fuzztest/resource/ohos_test.xml"
72  include_dirs = acodec_fuzztest_include_dirs
73  include_dirs += [
74    "//foundation/multimedia/player_framework/services/utils/include",
75    "//foundation/multimedia/player_framework/test/fuzztest/common/",
76    "$MEDIA_ROOT_DIR/test/fuzztest/acodecfile_fuzzer",
77  ]
78  cflags = acodec_fuzztest_cflags
79  cflags += [
80    "-g",
81    "-O0",
82    "-Wno-unused-variable",
83    "-fno-omit-frame-pointer",
84  ]
85  if (multimedia_player_framework_support_codec) {
86    sources = [
87      "$MEDIA_AVCODEC_TEST_DIR/acodec_test/acodec_mock.cpp",
88      "$MEDIA_AVCODEC_TEST_DIR/native/audiodecoder/audiodec_native_mock.cpp",
89      "$MEDIA_AVCODEC_TEST_DIR/native/audioencoder/audioenc_native_mock.cpp",
90      "$MEDIA_AVCODEC_TEST_DIR/native/avcodec_mock_factory.cpp",
91      "$MEDIA_AVCODEC_TEST_DIR/native/avformat/avformat_native_mock.cpp",
92      "$MEDIA_AVCODEC_TEST_DIR/native/avmemory/avmemory_native_mock.cpp",
93      "$MEDIA_AVCODEC_TEST_DIR/native/surface/surface_native_mock.cpp",
94      "$MEDIA_AVCODEC_TEST_DIR/native/videodecoder/videodec_native_mock.cpp",
95      "$MEDIA_AVCODEC_TEST_DIR/native/videoencoder/videoenc_native_mock.cpp",
96      "$MEDIA_AVCODEC_TEST_DIR/vcodec_test/vdec_mock.cpp",
97      "$MEDIA_AVCODEC_TEST_DIR/vcodec_test/venc_mock.cpp",
98      "../../common/aw_common.cpp",
99      "acodecfile_fuzzer.cpp",
100    ]
101  }
102  deps = [
103    "//foundation/graphic/graphic_2d:libsurface",
104    "//foundation/graphic/graphic_2d/frameworks/surface:surface",
105    "//foundation/graphic/graphic_2d/rosen/modules/render_service_client:librender_service_client",
106    "//foundation/multimedia/player_framework/interfaces/inner_api/native:media_client",
107    "//foundation/window/window_manager/wm:libwm",
108  ]
109  external_deps = [
110    "hiviewdfx_hilog_native:libhilog",
111    "ipc:ipc_core",
112    "multimedia_player_framework:media_client",
113  ]
114}
115
116###############################################################################
117
118