• 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
23vcodec_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/vcodec_test/",
39  "$MEDIA_ROOT_DIR/test/unittest/common/include/",
40]
41
42vcodec_fuzztest_cflags = [
43  "-std=c++17",
44  "-fno-rtti",
45  "-fno-exceptions",
46  "-Wall",
47  "-fno-common",
48  "-fstack-protector-strong",
49  "-Wshadow",
50  "-FPIC",
51  "-FS",
52  "-O2",
53  "-D_FORTIFY_SOURCE=2",
54  "-fvisibility=hidden",
55  "-Wformat=2",
56  "-Wdate-time",
57  "-Werror",
58  "-Wextra",
59  "-Wimplicit-fallthrough",
60  "-Wsign-compare",
61  "-Wunused-parameter",
62]
63
64##############################fuzztest##########################################
65ohos_fuzztest("VCodecConfigureFuzzTest") {
66  module_out_path = module_output_path
67  fuzz_config_file = "//foundation//multimedia/player_framework/test/fuzztest/avcodec_fuzztest/vcodecconfigure_fuzzer"
68
69  resource_config_file = "//foundation/multimedia/player_framework/test/fuzztest/resource/ohos_test.xml"
70  include_dirs = vcodec_fuzztest_include_dirs
71  include_dirs += [
72    "//foundation/multimedia/player_framework/services/utils/include",
73    "//foundation/multimedia/player_framework/test/fuzztest/common/",
74    "$MEDIA_ROOT_DIR/test/fuzztest/vcodecconfigure_fuzzer",
75  ]
76  cflags = vcodec_fuzztest_cflags
77  cflags += [
78    "-g",
79    "-O0",
80    "-Wno-unused-variable",
81    "-fno-omit-frame-pointer",
82  ]
83  if (multimedia_player_framework_support_codec) {
84    sources = [
85      "$MEDIA_AVCODEC_TEST_DIR/native/avcodec_mock_factory.cpp",
86      "$MEDIA_AVCODEC_TEST_DIR/native/avformat/avformat_native_mock.cpp",
87      "$MEDIA_AVCODEC_TEST_DIR/native/avmemory/avmemory_native_mock.cpp",
88      "$MEDIA_AVCODEC_TEST_DIR/native/surface/surface_native_mock.cpp",
89      "$MEDIA_AVCODEC_TEST_DIR/native/videodecoder/videodec_native_mock.cpp",
90      "$MEDIA_AVCODEC_TEST_DIR/native/videoencoder/videoenc_native_mock.cpp",
91      "$MEDIA_AVCODEC_TEST_DIR/vcodec_test/vdec_mock.cpp",
92      "$MEDIA_AVCODEC_TEST_DIR/vcodec_test/venc_mock.cpp",
93      "vcodecconfigure_fuzzer.cpp",
94    ]
95  }
96  deps = [
97    "//foundation/graphic/graphic_2d:libsurface",
98    "//foundation/graphic/graphic_2d/frameworks/surface:surface",
99    "//foundation/graphic/graphic_2d/rosen/modules/render_service_client:librender_service_client",
100    "//foundation/multimedia/player_framework/interfaces/inner_api/native:media_client",
101    "//foundation/window/window_manager/wm:libwm",
102  ]
103  external_deps = [
104    "hiviewdfx_hilog_native:libhilog",
105    "ipc:ipc_core",
106    "multimedia_player_framework:media_client",
107  ]
108}
109
110###############################################################################
111
112