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