• 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
14#####################hydra-fuzz###################
15import("//build/test.gni")
16import("../../../../appexecfwk.gni")
17import("../../../../services/bundlemgr/appexecfwk_bundlemgr.gni")
18module_output_path = fuzz_test_path
19
20##############################fuzztest##########################################
21ohos_fuzztest("BMSBundleResourceDrawableFuzzTest") {
22  module_out_path = module_output_path
23  fuzz_config_file =
24      "../../../fuzztest/fuzztest_bundlemanager/bmsbundleresourcedrawable_fuzzer"
25
26  use_exceptions = true
27  module_out_path = module_output_path
28  include_dirs = [ "${test_path}/fuzztest" ]
29  sources = bundle_mgr_source
30  sources += [
31    "${services_path}/bundlemgr/src/aot/aot_executor.cpp",
32    "${services_path}/bundlemgr/src/installd/installd_host_impl.cpp",
33    "${services_path}/bundlemgr/src/installd/installd_operator.cpp",
34    "${services_path}/bundlemgr/src/installd/installd_service.cpp",
35  ]
36
37  sources +=
38      [ "${services_path}/bundlemgr/src/installd/installd_permission_mgr.cpp" ]
39
40  sources += bundle_install_sources
41
42  sources += [ "bmsbundleresourcedrawable_fuzzer.cpp" ]
43
44  configs = [ "${services_path}/bundlemgr/test:bundlemgr_test_config" ]
45  cflags = [
46    "-g",
47    "-O0",
48    "-Wno-unused-variable",
49    "-fno-omit-frame-pointer",
50  ]
51
52  deps = [
53    "${bundle_framework_path}/test/sceneProject/unittest/bundle_app_service/app_service_version1_library1:appService_v1_library1",
54    "${bundle_framework_path}/test/sceneProject/unittest/bundle_app_service/app_service_version1_library2:appService_v1_library2",
55    "${bundle_framework_path}/test/sceneProject/unittest/bundle_app_service/app_service_version2_library1:appService_v2_library1",
56    "${bundle_framework_path}/test/sceneProject/unittest/bundle_app_service/app_service_version2_library2:appService_v2_library2",
57    "${bundle_framework_path}/test/sceneProject/unittest/test_bundle/rightTest:rightTest",
58    "${core_path}:appexecfwk_core",
59  ]
60  deps += bundle_install_deps
61
62  external_deps = [
63    "ability_base:want",
64    "ability_runtime:app_manager",
65    "access_token:el5_filekey_manager_sdk",
66    "access_token:libprivacy_sdk",
67    "access_token:libtokenid_sdk",
68    "appspawn:hnpapi",
69    "appverify:libhapverify",
70    "bounds_checking_function:libsec_shared",
71    "common_event_service:cesfwk_innerkits",
72    "eventhandler:libeventhandler",
73    "hilog:libhilog",
74    "hitrace:hitrace_meter",
75    "init:libbegetutil",
76    "jsoncpp:jsoncpp",
77    "safwk:system_ability_fwk",
78    "samgr:samgr_proxy",
79    "selinux_adapter:librestorecon",
80  ]
81  external_deps += bundle_install_external_deps
82
83  defines = []
84  if (code_signature_enable) {
85    sources += [
86      "${services_path}/bundlemgr/src/aot/aot_sign_data_cache_mgr.cpp",
87      "${services_path}/bundlemgr/src/code_sign_helper.cpp",
88    ]
89    include_dirs += [ "${services_path}/bundlemgr/include" ]
90    external_deps += [
91      "bounds_checking_function:libsec_shared",
92      "code_signature:libcode_sign_utils",
93      "ets_runtime:libcompiler_service",
94    ]
95    defines += [ "CODE_SIGNATURE_ENABLE" ]
96  }
97
98  if (configpolicy_enable) {
99    external_deps += [ "config_policy:configpolicy_util" ]
100    defines += [ "CONFIG_POLOCY_ENABLE" ]
101  }
102
103  if (bundle_framework_app_control) {
104    defines += [ "BUNDLE_FRAMEWORK_APP_CONTROL" ]
105    sources += [
106      "${services_path}/bundlemgr/src/app_control/app_control_manager.cpp",
107      "${services_path}/bundlemgr/src/app_control/app_control_manager_host_impl.cpp",
108      "${services_path}/bundlemgr/src/app_control/app_control_manager_rdb.cpp",
109      "${services_path}/bundlemgr/src/app_control/app_jump_interceptor_event_subscriber.cpp",
110      "${services_path}/bundlemgr/src/app_control/app_jump_interceptor_manager_rdb.cpp",
111    ]
112    include_dirs += [ "${services_path}/bundlemgr/include/app_control" ]
113    external_deps += [ "c_utils:utils" ]
114  }
115  if (current_cpu == "arm64") {
116    defines += [ "USE_BUNDLE_EXTENSION" ]
117  }
118
119  if (build_selinux) {
120    external_deps += [ "selinux_adapter:libhap_restorecon" ]
121  }
122  if (account_enable) {
123    external_deps += [ "os_account:os_account_innerkits" ]
124    defines += [ "ACCOUNT_ENABLE" ]
125  }
126  if (bundle_framework_free_install) {
127    sources += aging
128    sources += free_install
129    sources += distributed_manager
130    external_deps += [
131      "ability_runtime:ability_manager",
132      "ability_runtime:app_manager",
133      "battery_manager:batterysrv_client",
134      "device_usage_statistics:usagestatsinner",
135      "display_manager:displaymgr",
136      "power_manager:powermgr_client",
137      "syscap_codec:syscap_interface_shared",
138    ]
139    defines += [ "BUNDLE_FRAMEWORK_FREE_INSTALL" ]
140  }
141  if (global_resmgr_enable) {
142    defines += [ "GLOBAL_RESMGR_ENABLE" ]
143    external_deps += [ "resource_management:global_resmgr" ]
144  }
145  if (hicollie_enable) {
146    external_deps += [ "hicollie:libhicollie" ]
147    defines += [ "HICOLLIE_ENABLE" ]
148  }
149
150  if (hisysevent_enable) {
151    sources += [ "${services_path}/bundlemgr/src/inner_event_report.cpp" ]
152    external_deps += [ "hisysevent:libhisysevent" ]
153    defines += [ "HISYSEVENT_ENABLE" ]
154  }
155
156  if (bundle_framework_quick_fix) {
157    include_dirs += [ "${services_path}/bundlemgr/src/include/quick_fix" ]
158    sources += quick_fix
159    defines += [ "BUNDLE_FRAMEWORK_QUICK_FIX" ]
160  }
161
162  if (storage_service_enable) {
163    external_deps += [ "storage_service:storage_manager_sa_proxy" ]
164    defines += [ "STORAGE_SERVICE_ENABLE" ]
165  }
166
167  external_deps += [ "kv_store:distributeddata_inner" ]
168  configs += [ "${services_path}/bundlemgr:rdb_config" ]
169  external_deps += [ "relational_store:native_rdb" ]
170  sources += [
171    "${services_path}/bundlemgr/src/bundle_data_storage_rdb.cpp",
172    "${services_path}/bundlemgr/src/preinstall_data_storage_rdb.cpp",
173    "${services_path}/bundlemgr/src/rdb/bms_rdb_open_callback.cpp",
174    "${services_path}/bundlemgr/src/rdb/rdb_data_manager.cpp",
175  ]
176  if (udmf_enabled) {
177    defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ]
178    external_deps += [ "udmf:udmf_client" ]
179    external_deps += [ "udmf:utd_client" ]
180  }
181
182  if (user_auth_framework_impl_enabled) {
183    external_deps += [ "user_auth_framework:userauth_client" ]
184    defines += [ "BMS_USER_AUTH_FRAMEWORK_ENABLED" ]
185    include_dirs += [ "${services_path}/bundlemgr/include/user_auth" ]
186    sources += user_auth
187  }
188
189  if (bms_device_info_manager_part_enabled) {
190    external_deps += [
191      "device_info_manager:distributed_device_profile_common",
192      "device_info_manager:distributed_device_profile_sdk",
193    ]
194    defines += [ "BMS_DEVICE_INFO_MANAGER_ENABLE" ]
195  }
196
197  if (bundle_framework_bundle_resource) {
198    defines += [ "BUNDLE_FRAMEWORK_BUNDLE_RESOURCE" ]
199    external_deps += [ "ability_base:configuration" ]
200    if (bundle_framework_graphics) {
201      defines += [ "BUNDLE_FRAMEWORK_GRAPHICS" ]
202      external_deps += [
203        "ace_engine:drawable_descriptor",
204        "image_framework:image_native",
205      ]
206    }
207    sources += bundle_resource
208  }
209
210  if (global_resmgr_enable) {
211    defines += [ "GLOBAL_RESMGR_ENABLE" ]
212    external_deps += [ "resource_management:global_resmgr" ]
213  }
214  if (global_i18n_enable) {
215    defines += [ "GLOBAL_I18_ENABLE" ]
216    external_deps += [ "i18n:intl_util" ]
217  }
218}
219