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("AudioPolicyMoreFuzzTest") { 22 module_out_path = "audio_framework/audio_framework_route" 23 fuzz_config_file = "../audiopolicymore_fuzzer" 24 25 include_dirs = [ 26 "../../../services/audio_policy/client/include", 27 "../../../services/audio_policy/server/include", 28 "../../../interfaces/inner_api/native/audiomanager/include", 29 "../../../frameworks/native/commcon/include", 30 "../../../interfaces/inner_api/native/audiocommon/include", 31 "../../../services/audio_policy/server/domain/interrupt/include", 32 "../../../utils/system/safwk/native/include", 33 ] 34 35 cflags = [ 36 "-g", 37 "-O0", 38 "-fno-omit-frame-pointer", 39 ] 40 configs = [ "../../../services/audio_policy:audio_policy_public_config" ] 41 cflags_cc = cflags 42 cflags_cc += [ "-fno-access-control" ] 43 44 sources = [ "audio_policy_more_fuzzer.cpp" ] 45 46 deps = [ 47 "../../../frameworks/native/audioutils:audio_utils", 48 "../../../services/audio_policy:audio_policy_client_static", 49 "../../../services/audio_policy:audio_policy_service_static", 50 ] 51 external_deps = [ 52 "ability_base:session_info", 53 "ability_base:want", 54 "ability_base:zuri", 55 "ability_runtime:ability_connect_callback_stub", 56 "ability_runtime:ability_context_native", 57 "ability_runtime:ability_manager", 58 "ability_runtime:app_context", 59 "ability_runtime:dataobs_manager", 60 "ability_runtime:extension_manager", 61 "ability_runtime:wantagent_innerkits", 62 "access_token:libaccesstoken_sdk", 63 "access_token:libnativetoken_shared", 64 "access_token:libprivacy_sdk", 65 "access_token:libtokenid_sdk", 66 "access_token:libtokensetproc_shared", 67 "background_task_mgr:bgtaskmgr_innerkits", 68 "bounds_checking_function:libsec_shared", 69 "bundle_framework:appexecfwk_base", 70 "bundle_framework:appexecfwk_base", 71 "bundle_framework:appexecfwk_core", 72 "bundle_framework:appexecfwk_core", 73 "c_utils:utils", 74 "c_utils:utils", 75 "data_share:datashare_common", 76 "data_share:datashare_common", 77 "data_share:datashare_consumer", 78 "data_share:datashare_consumer", 79 "drivers_interface_audio:libaudio_proxy_5.0", 80 "eventhandler:libeventhandler", 81 "hdf_core:libhdf_host", 82 "hdf_core:libhdf_ipc_adapter", 83 "hdf_core:libhdf_ipc_adapter", 84 "hdf_core:libhdf_utils", 85 "hdf_core:libhdi", 86 "hdf_core:libhdi", 87 "hdf_core:libpub_utils", 88 "hdf_core:libpub_utils", 89 "hilog:libhilog", 90 "hilog:libhilog", 91 "hisysevent:libhisysevent", 92 "init:libbegetutil", 93 "ipc:ipc_single", 94 "ipc:ipc_single", 95 "kv_store:distributeddata_inner", 96 "kv_store:distributeddata_inner", 97 "media_foundation:media_monitor_client", 98 "media_foundation:media_monitor_common", 99 "os_account:os_account_innerkits", 100 "os_account:os_account_innerkits", 101 "power_manager:power_setting", 102 "power_manager:powermgr_client", 103 "power_manager:powermgr_client", 104 "safwk:system_ability_fwk", 105 "safwk:system_ability_fwk", 106 "samgr:samgr_proxy", 107 ] 108 if (accessibility_enable == true) { 109 external_deps += [ 110 "accessibility:accessibility_common", 111 "accessibility:accessibilityconfig", 112 ] 113 } 114 115 defines = [] 116 if (audio_framework_feature_wired_audio) { 117 defines += [ "AUDIO_WIRED_DETECT" ] 118 } 119 120 if (build_variant == "user") { 121 defines += [ "AUDIO_BUILD_VARIANT_USER" ] 122 } else if (build_variant == "root") { 123 defines += [ "AUDIO_BUILD_VARIANT_ROOT" ] 124 } 125 126 if (audio_framework_feature_support_os_account) { 127 defines += [ "SUPPORT_USER_ACCOUNT" ] 128 } 129 130 if (audio_framework_feature_dtmf_tone) { 131 defines += [ "FEATURE_DTMF_TONE" ] 132 } 133 134 if (audio_framework_config_policy_enable) { 135 defines += [ "USE_CONFIG_POLICY" ] 136 external_deps += [ "config_policy:configpolicy_util" ] 137 } 138 139 if (appgallery_part_enable == true) { 140 defines += [ "FEATURE_APPGALLERY" ] 141 } 142 143 if (bluetooth_part_enable == true) { 144 deps += 145 [ "../../../frameworks/native/bluetoothclient:audio_bluetooth_client" ] 146 external_deps += [ "bluetooth:btframework" ] 147 } 148 149 if (audio_framework_feature_input) { 150 defines += [ "FEATURE_MULTIMODALINPUT_INPUT" ] 151 external_deps += [ "input:libmmi-client" ] 152 } 153 154 if (audio_framework_feature_device_manager) { 155 defines += [ "FEATURE_DEVICE_MANAGER" ] 156 external_deps += [ "device_manager:devicemanagersdk" ] 157 } 158 159 if (use_libfuzzer || use_clang_coverage) { 160 defines += [ "TEST_COVERAGE" ] 161 } 162} 163 164group("fuzztest") { 165 testonly = true 166 deps = [ ":AudioPolicyMoreFuzzTest" ] 167} 168