1# Copyright (c) 2023 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/config/features.gni") 16import("//build/ohos.gni") 17import("//build/test.gni") 18import("../../../../appexecfwk.gni") 19import("../../../../services/bundlemgr/appexecfwk_bundlemgr.gni") 20module_output_path = fuzz_test_path 21 22##############################fuzztest########################################## 23ohos_fuzztest("BundleInstalldHostFuzzTest") { 24 module_out_path = module_output_path 25 fuzz_config_file = 26 "../../../fuzztest/fuzztest_application/bundleinstalldhost_fuzzer" 27 28 cflags = [ 29 "-g", 30 "-O0", 31 "-Wno-unused-variable", 32 "-fno-omit-frame-pointer", 33 ] 34 35 use_exceptions = true 36 37 sources = bundle_mgr_source 38 sources -= [ "${services_path}/bundlemgr/src/system_ability_helper.cpp" ] 39 sources += [ 40 "${services_path}/bundlemgr/src/aot/aot_executor.cpp", 41 "${services_path}/bundlemgr/src/installd/installd_host_impl.cpp", 42 "${services_path}/bundlemgr/src/installd/installd_operator.cpp", 43 "${services_path}/bundlemgr/test/mock/src/installd_service.cpp", 44 ] 45 46 sources += [ 47 "${services_path}/bundlemgr/test/mock/src/installd_permission_mgr.cpp", 48 "${services_path}/bundlemgr/test/mock/src/mock_bundle_status.cpp", 49 "${services_path}/bundlemgr/test/mock/src/system_ability_helper.cpp", 50 ] 51 52 sources += bundle_install_sources 53 54 configs = [ "${services_path}/bundlemgr/test:bundlemgr_test_config" ] 55 56 deps = bundle_install_deps 57 deps += [ 58 "${base_path}:appexecfwk_base", 59 "${core_path}:appexecfwk_core", 60 ] 61 62 external_deps = [ 63 "ability_runtime:ability_manager", 64 "access_token:el5_filekey_manager_sdk", 65 "access_token:libprivacy_sdk", 66 "access_token:libtokenid_sdk", 67 "appspawn:hnpapi", 68 "appverify:libhapverify", 69 "bounds_checking_function:libsec_shared", 70 "c_utils:utils", 71 "common_event_service:cesfwk_innerkits", 72 "eventhandler:libeventhandler", 73 "hilog:libhilog", 74 "hitrace:hitrace_meter", 75 "init:libbegetutil", 76 "ipc:ipc_core", 77 "safwk:system_ability_fwk", 78 "samgr:samgr_proxy", 79 ] 80 81 external_deps += [ 82 "ability_runtime:ability_manager", 83 "ability_runtime:app_manager", 84 "battery_manager:batterysrv_client", 85 "device_usage_statistics:usagestatsinner", 86 "display_manager:displaymgr", 87 "ffrt:libffrt", 88 "power_manager:powermgr_client", 89 "syscap_codec:syscap_interface_shared", 90 ] 91 92 external_deps += bundle_install_external_deps 93 94 if (bundle_framework_power_mgr_enable) { 95 external_deps += aot_external_deps 96 } 97 98 configs += [ "../../../../services/bundlemgr:rdb_config" ] 99 external_deps += [ "relational_store:native_rdb" ] 100 sources += [ 101 "${services_path}/bundlemgr/src/bundle_data_storage_rdb.cpp", 102 "${services_path}/bundlemgr/src/preinstall_data_storage_rdb.cpp", 103 "${services_path}/bundlemgr/src/rdb/bms_rdb_open_callback.cpp", 104 "${services_path}/bundlemgr/src/rdb/rdb_data_manager.cpp", 105 ] 106 107 defines = [] 108 include_dirs = [] 109 if (code_signature_enable) { 110 sources += [ 111 "${services_path}/bundlemgr/src/aot/aot_sign_data_cache_mgr.cpp", 112 "${services_path}/bundlemgr/src/code_sign_helper.cpp", 113 ] 114 include_dirs += [ "${services_path}/bundlemgr/include" ] 115 external_deps += [ 116 "bounds_checking_function:libsec_shared", 117 "code_signature:libcode_sign_utils", 118 "ets_runtime:libcompiler_service", 119 ] 120 defines += [ "CODE_SIGNATURE_ENABLE" ] 121 } 122 if (current_cpu == "arm64") { 123 defines += [ "ON_64BIT_SYSTEM" ] 124 } 125 if (bundle_framework_app_control) { 126 defines += [ "BUNDLE_FRAMEWORK_APP_CONTROL" ] 127 sources += [ 128 "${services_path}/bundlemgr/src/app_control/app_control_manager.cpp", 129 "${services_path}/bundlemgr/src/app_control/app_control_manager_host_impl.cpp", 130 "${services_path}/bundlemgr/src/app_control/app_control_manager_rdb.cpp", 131 "${services_path}/bundlemgr/src/app_control/app_jump_interceptor_event_subscriber.cpp", 132 "${services_path}/bundlemgr/src/app_control/app_jump_interceptor_manager_rdb.cpp", 133 ] 134 include_dirs += [ "${services_path}/bundlemgr/include/app_control" ] 135 external_deps += [ "c_utils:utils" ] 136 } 137 if (udmf_enabled) { 138 defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ] 139 external_deps += [ "udmf:utd_client" ] 140 } 141 142 sources += [ "bundleinstalldhost_fuzzer.cpp" ] 143} 144