• 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("../../../bluetooth_part.gni")
19import("../../../config.gni")
20
21ohos_fuzztest("AudioPolicyManagerFuzzTest") {
22  module_out_path = "audio_framework/audio_framework_route"
23  fuzz_config_file = "../audiopolicymanager_fuzzer"
24
25  include_dirs = [
26    ".././../frameworks/native/audiopolicy/include",
27    "../../../services/audio_policy/client/service",
28  ]
29
30  cflags = [
31    "-g",
32    "-O0",
33    "-Wno-unused-variable",
34    "-fno-omit-frame-pointer",
35  ]
36
37  cflags_cc = cflags
38  cflags_cc += [ "-fno-access-control" ]
39
40  configs = [ "../../../services/audio_policy:audio_policy_public_config" ]
41
42  sources = [ "audio_policy_manager_fuzzer.cpp" ]
43
44  defines = []
45  if (audio_framework_feature_dtmf_tone) {
46    defines += [ "FEATURE_DTMF_TONE" ]
47  }
48  if (use_libfuzzer || use_clang_coverage) {
49    defines += [ "TEST_COVERAGE" ]
50  }
51
52  deps = [
53    "../../../services/audio_service/idl:audio_framework_interface",
54    "../../../frameworks/native/audioutils:audio_utils",
55    "../../../services/audio_policy:audio_policy_client_static",
56    "../../../services/audio_policy:audio_policy_service_static",
57  ]
58
59  external_deps = [
60    "ability_base:want",
61    "ability_runtime:extension_manager",
62    "ability_runtime:wantagent_innerkits",
63    "access_token:libaccesstoken_sdk",
64    "access_token:libnativetoken_shared",
65    "access_token:libtokensetproc_shared",
66    "background_task_mgr:bgtaskmgr_innerkits",
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 = [ ":AudioPolicyManagerFuzzTest" ]
144}
145