• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 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/config/features.gni")
15import("//build/test.gni")
16import("../../../accessibility.gni")
17import("../../../appgallery.gni")
18import("../../../bluetooth_part.gni")
19import("../../../config.gni")
20
21ohos_fuzztest("AudioPolicyStubFuzzTest") {
22  module_out_path = "audio_framework/audio_framework_route"
23  fuzz_config_file = "../audiopolicystub_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  ]
31
32  cflags = [
33    "-g",
34    "-O0",
35    "-Wno-unused-variable",
36    "-fno-omit-frame-pointer",
37  ]
38
39  cflags_cc = cflags
40  cflags_cc += [ "-fno-access-control" ]
41
42  configs = [ "../../../services/audio_policy:audio_policy_public_config" ]
43
44  sources = [ "audio_policy_stub_fuzzer.cpp" ]
45
46  defines = []
47  if (audio_framework_feature_dtmf_tone) {
48    defines += [ "FEATURE_DTMF_TONE" ]
49  }
50  if (use_libfuzzer || use_clang_coverage) {
51    defines += [ "TEST_COVERAGE" ]
52  }
53
54  deps = [
55    "../../../services/audio_service/idl:audio_framework_interface",
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    "ability_runtime:wantagent_innerkits",
65    "access_token:libaccesstoken_sdk",
66    "access_token:libnativetoken_shared",
67    "access_token:libtokensetproc_shared",
68    "background_task_mgr:bgtaskmgr_innerkits",
69    "bundle_framework:appexecfwk_base",
70    "bundle_framework:appexecfwk_core",
71    "c_utils:utils",
72    "data_share:datashare_common",
73    "data_share:datashare_consumer",
74    "hdf_core:libhdf_ipc_adapter",
75    "hdf_core:libhdi",
76    "hdf_core:libpub_utils",
77    "hilog:libhilog",
78    "ipc:ipc_single",
79    "kv_store:distributeddata_inner",
80    "media_foundation:media_monitor_client",
81    "media_foundation:media_monitor_common",
82    "os_account:os_account_innerkits",
83    "power_manager:powermgr_client",
84    "relational_store:native_appdatafwk",
85    "safwk:system_ability_fwk",
86    "samgr:samgr_proxy",
87  ]
88  if (accessibility_enable == true) {
89    external_deps += [
90      "accessibility:accessibility_common",
91      "accessibility:accessibilityconfig",
92    ]
93  }
94
95  if (build_variant == "user") {
96    defines += [ "AUDIO_BUILD_VARIANT_USER" ]
97  } else if (build_variant == "root") {
98    defines += [ "AUDIO_BUILD_VARIANT_ROOT" ]
99  }
100
101  if (audio_framework_feature_support_os_account) {
102    defines += [ "SUPPORT_USER_ACCOUNT" ]
103  }
104
105  if (audio_framework_feature_dtmf_tone) {
106    defines += [ "FEATURE_DTMF_TONE" ]
107  }
108
109  if (audio_framework_config_policy_enable) {
110    defines += [ "USE_CONFIG_POLICY" ]
111    external_deps += [ "config_policy:configpolicy_util" ]
112  }
113
114  if (accessibility_enable == true) {
115    external_deps += [
116      "accessibility:accessibility_common",
117      "accessibility:accessibilityconfig",
118    ]
119  }
120
121  if (appgallery_part_enable == true) {
122    defines += [ "FEATURE_APPGALLERY" ]
123  }
124
125  if (bluetooth_part_enable == true) {
126    deps +=
127        [ "../../../frameworks/native/bluetoothclient:audio_bluetooth_client" ]
128    external_deps += [ "bluetooth:btframework" ]
129  }
130
131  if (audio_framework_feature_input) {
132    defines += [ "FEATURE_MULTIMODALINPUT_INPUT" ]
133    external_deps += [ "input:libmmi-client" ]
134  }
135
136  if (audio_framework_feature_device_manager) {
137    defines += [ "FEATURE_DEVICE_MANAGER" ]
138    external_deps += [ "device_manager:devicemanagersdk" ]
139  }
140}
141
142group("fuzztest") {
143  testonly = true
144  # deps = [ ":AudioPolicyStubFuzzTest" ]
145}
146