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("../../../bluetooth_part.gni") 19import("../../../config.gni") 20 21ohos_fuzztest("AudioPolicyProxyFuzzTest") { 22 module_out_path = "audio_framework/audio_framework_route" 23 fuzz_config_file = "../audiopolicyproxy_fuzzer" 24 25 include_dirs = [ 26 "../../../services/audio_policy/client/include", 27 "../../../services/audio_policy/server/include", 28 "../../../services/audio_policy/server/include/service", 29 "../../../services/audio_policy/server/include/service/manager", 30 "../../../../../communication/bluetooth/interfaces/inner_api/include", 31 ] 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_proxy_fuzzer.cpp" ] 46 47 defines = [] 48 if (audio_framework_feature_dtmf_tone) { 49 defines += [ "FEATURE_DTMF_TONE" ] 50 } 51 if (use_libfuzzer || use_clang_coverage) { 52 defines += [ "TEST_COVERAGE" ] 53 } 54 55 deps = [ 56 "../../../frameworks/native/audioutils:audio_utils", 57 "../../../services/audio_policy:audio_policy_client_static", 58 "../../../services/audio_policy:audio_policy_service_static", 59 ] 60 61 external_deps = [ 62 "ability_base:want", 63 "ability_runtime:extension_manager", 64 "access_token:libaccesstoken_sdk", 65 "access_token:libnativetoken_shared", 66 "access_token:libtokensetproc_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 "hdf_core:libhdf_ipc_adapter", 73 "hdf_core:libhdi", 74 "hdf_core:libpub_utils", 75 "hilog:libhilog", 76 "ipc:ipc_single", 77 "kv_store:distributeddata_inner", 78 "media_foundation:media_monitor_client", 79 "media_foundation:media_monitor_common", 80 "os_account:os_account_innerkits", 81 "power_manager:powermgr_client", 82 "pulseaudio:pulse", 83 "relational_store:native_appdatafwk", 84 "safwk:system_ability_fwk", 85 "samgr:samgr_proxy", 86 ] 87 if (accessibility_enable == true) { 88 external_deps += [ 89 "accessibility:accessibility_common", 90 "accessibility:accessibilityconfig", 91 ] 92 } 93 94 if (build_variant == "user") { 95 defines += [ "AUDIO_BUILD_VARIANT_USER" ] 96 } else if (build_variant == "root") { 97 defines += [ "AUDIO_BUILD_VARIANT_ROOT" ] 98 } 99 100 if (audio_framework_feature_support_os_account) { 101 defines += [ "SUPPORT_USER_ACCOUNT" ] 102 } 103 104 if (audio_framework_feature_dtmf_tone) { 105 defines += [ "FEATURE_DTMF_TONE" ] 106 } 107 108 if (audio_framework_config_policy_enable) { 109 defines += [ "USE_CONFIG_POLICY" ] 110 external_deps += [ "config_policy:configpolicy_util" ] 111 } 112 113 if (accessibility_enable == true) { 114 external_deps += [ 115 "accessibility:accessibility_common", 116 "accessibility:accessibilityconfig", 117 ] 118 } 119 120 if (appgallery_part_enable == true) { 121 defines += [ "FEATURE_APPGALLERY" ] 122 } 123 124 if (bluetooth_part_enable == true) { 125 deps += 126 [ "../../../frameworks/native/bluetoothclient:audio_bluetooth_client" ] 127 external_deps += [ "bluetooth:btframework" ] 128 } 129 130 if (audio_framework_feature_input) { 131 defines += [ "FEATURE_MULTIMODALINPUT_INPUT" ] 132 external_deps += [ "input:libmmi-client" ] 133 } 134 135 if (audio_framework_feature_device_manager) { 136 defines += [ "FEATURE_DEVICE_MANAGER" ] 137 external_deps += [ "device_manager:devicemanagersdk" ] 138 } 139} 140 141group("fuzztest") { 142 testonly = true 143 deps = [ ":AudioPolicyProxyFuzzTest" ] 144} 145