• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2024 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/config/features.gni")
15import("//build/test.gni")
16import("../../../accessibility.gni")
17import("../../../appgallery.gni")
18import("../../../av_session.gni")
19import("../../../bluetooth_part.gni")
20import("../../../config.gni")
21
22ohos_fuzztest("AudioPolicyServiceEnhanceFuzzTest") {
23  module_out_path = "audio_framework/audio_framework_route"
24  fuzz_config_file = "../audiopolicyserviceenhance_fuzzer"
25
26  include_dirs = [
27    "../../../services/audio_policy/server/include",
28    "../../../services/audio_policy/server/include/service",
29    "../../../services/audio_policy/server/include/service/manager",
30    "../../../services/audio_policy/server/include/service/service",
31    "../../../../../communication/bluetooth/interfaces/inner_api/include",
32  ]
33  cflags = [
34    "-g",
35    "-O0",
36    "-Wno-unused-variable",
37    "-fno-omit-frame-pointer",
38  ]
39
40  cflags_cc = cflags
41  cflags_cc += [ "-fno-access-control" ]
42
43  configs = [ "../../../services/audio_policy:audio_policy_public_config" ]
44
45  sources = [ "audio_policy_service_enhance_fuzzer.cpp" ]
46
47  deps = [
48    "../../../services/audio_policy:audio_policy_service_static",
49    "../../../services/audio_service:audio_client",
50  ]
51
52  external_deps = [
53    "ability_base:session_info",
54    "ability_base:want",
55    "ability_base:zuri",
56    "ability_runtime:ability_connect_callback_stub",
57    "ability_runtime:ability_context_native",
58    "ability_runtime:app_context",
59    "ability_runtime:dataobs_manager",
60    "ability_runtime:extension_manager",
61    "access_token:libaccesstoken_sdk",
62    "access_token:libnativetoken_shared",
63    "access_token:libprivacy_sdk",
64    "access_token:libtokenid_sdk",
65    "access_token:libtokensetproc_shared",
66    "bounds_checking_function:libsec_shared",
67    "bundle_framework:appexecfwk_base",
68    "bundle_framework:appexecfwk_core",
69    "c_utils:utils",
70    "data_share:datashare_common",
71    "data_share:datashare_consumer",
72    "drivers_interface_audio:libaudio_proxy_4.0",
73    "eventhandler:libeventhandler",
74    "hdf_core:libhdf_host",
75    "hdf_core:libhdf_ipc_adapter",
76    "hdf_core:libhdf_utils",
77    "hdf_core:libhdi",
78    "hdf_core:libpub_utils",
79    "hilog:libhilog",
80    "hisysevent:libhisysevent",
81    "init:libbegetutil",
82    "ipc:ipc_single",
83    "kv_store:distributeddata_inner",
84    "media_foundation:media_monitor_client",
85    "media_foundation:media_monitor_common",
86    "os_account:os_account_innerkits",
87    "power_manager:power_setting",
88    "power_manager:powermgr_client",
89    "pulseaudio:pulse",
90    "relational_store:native_appdatafwk",
91    "safwk:system_ability_fwk",
92    "samgr:samgr_proxy",
93  ]
94
95  public_external_deps = [ "ffrt:libffrt" ]
96
97  public_external_deps += [
98    "libxml2:libxml2",
99    "openssl:libcrypto_shared",
100  ]
101
102  if (accessibility_enable == true) {
103    external_deps += [
104      "accessibility:accessibility_common",
105      "accessibility:accessibilityconfig",
106    ]
107  }
108
109  if (avsession_part_enable == true) {
110    external_deps += [
111      "ability_base:want",
112      "ability_runtime:wantagent_innerkits",
113      "av_session:avsession_client",
114      "input:libmmi-client",
115    ]
116  }
117
118  defines = []
119
120  if (audio_framework_feature_usb_audio) {
121    defines += [ "USB_ENABLE" ]
122    external_deps += [ "usb_manager:usbsrv_client" ]
123  }
124
125  if (build_variant == "user") {
126    defines += [ "AUDIO_BUILD_VARIANT_USER" ]
127  } else if (build_variant == "root") {
128    defines += [ "AUDIO_BUILD_VARIANT_ROOT" ]
129  }
130
131  if (audio_framework_feature_support_os_account) {
132    defines += [ "SUPPORT_USER_ACCOUNT" ]
133  }
134
135  if (audio_framework_feature_dtmf_tone) {
136    defines += [ "FEATURE_DTMF_TONE" ]
137  }
138
139  if (audio_framework_config_policy_enable) {
140    defines += [ "USE_CONFIG_POLICY" ]
141    external_deps += [ "config_policy:configpolicy_util" ]
142  }
143
144  if (accessibility_enable == true) {
145    external_deps += [
146      "accessibility:accessibility_common",
147      "accessibility:accessibilityconfig",
148    ]
149  }
150
151  if (appgallery_part_enable == true) {
152    defines += [ "FEATURE_APPGALLERY" ]
153  }
154
155  if (bluetooth_part_enable == true) {
156    deps +=
157        [ "../../../frameworks/native/bluetoothclient:audio_bluetooth_client" ]
158    external_deps += [ "bluetooth:btframework" ]
159  }
160
161  if (audio_framework_feature_input) {
162    defines += [ "FEATURE_MULTIMODALINPUT_INPUT" ]
163    external_deps += [ "input:libmmi-client" ]
164  }
165
166  if (audio_framework_feature_device_manager) {
167    defines += [ "FEATURE_DEVICE_MANAGER" ]
168    external_deps += [ "device_manager:devicemanagersdk" ]
169  }
170
171  if (use_libfuzzer || use_clang_coverage) {
172    defines += [ "TEST_COVERAGE" ]
173  }
174
175  if (accessibility_enable == true) {
176    cflags += [ "-DACCESSIBILITY_ENABLE" ]
177  }
178
179  if (bluetooth_part_enable == true) {
180    cflags += [ "-DBLUETOOTH_ENABLE" ]
181  }
182
183  if (avsession_part_enable == true) {
184    cflags += [ "-DAVSESSION_ENABLE" ]
185  }
186}
187
188group("fuzztest") {
189  testonly = true
190  deps = [ ":AudioPolicyServiceEnhanceFuzzTest" ]
191}
192