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 = "bundle_framework/fuzz" 21 22##############################fuzztest########################################## 23ohos_fuzztest("BundleInstallerHostFuzzTest") { 24 module_out_path = module_output_path 25 fuzz_config_file = "../../fuzztest/bundleinstallerhost_fuzzer" 26 27 cflags = [ 28 "-g", 29 "-O0", 30 "-Wno-unused-variable", 31 "-fno-omit-frame-pointer", 32 ] 33 34 use_exceptions = true 35 36 sources = bundle_mgr_source 37 sources -= [ "${services_path}/bundlemgr/src/system_ability_helper.cpp" ] 38 sources += [ 39 "${services_path}/bundlemgr/src/aot/aot_executor.cpp", 40 "${services_path}/bundlemgr/src/installd/installd_host_impl.cpp", 41 "${services_path}/bundlemgr/src/installd/installd_operator.cpp", 42 "${services_path}/bundlemgr/test/mock/src/installd_service.cpp", 43 ] 44 45 sources += [ 46 "${services_path}/bundlemgr/test/mock/src/installd_permission_mgr.cpp", 47 "${services_path}/bundlemgr/test/mock/src/mock_bundle_status.cpp", 48 "${services_path}/bundlemgr/test/mock/src/system_ability_helper.cpp", 49 ] 50 51 sources += bundle_install_sources 52 53 configs = [ "${services_path}/bundlemgr/test:bundlemgr_test_config" ] 54 55 deps = bundle_install_deps 56 deps += [ 57 "${base_path}:appexecfwk_base", 58 "${core_path}:appexecfwk_core", 59 ] 60 61 external_deps = [ 62 "ability_runtime:ability_manager", 63 "access_token:libprivacy_sdk", 64 "access_token:libtokenid_sdk", 65 "appverify:libhapverify", 66 "c_utils:utils", 67 "common_event_service:cesfwk_innerkits", 68 "eventhandler:libeventhandler", 69 "hilog:libhilog", 70 "hitrace:hitrace_meter", 71 "init:libbegetutil", 72 "ipc:ipc_core", 73 "safwk:system_ability_fwk", 74 "samgr:samgr_proxy", 75 ] 76 external_deps += bundle_install_external_deps 77 78 if (bundle_framework_power_mgr_enable) { 79 external_deps += aot_external_deps 80 } 81 82 configs += [ "../../../services/bundlemgr:rdb_config" ] 83 external_deps += [ "relational_store:native_rdb" ] 84 sources += [ 85 "${services_path}/bundlemgr/src/bundle_data_storage_rdb.cpp", 86 "${services_path}/bundlemgr/src/preinstall_data_storage_rdb.cpp", 87 "${services_path}/bundlemgr/src/rdb/bms_rdb_open_callback.cpp", 88 "${services_path}/bundlemgr/src/rdb/rdb_data_manager.cpp", 89 ] 90 91 defines = [] 92 if (current_cpu == "arm64") { 93 defines += [ "ON_64BIT_SYSTEM" ] 94 } 95 if (bundle_framework_app_control) { 96 defines += [ "BUNDLE_FRAMEWORK_APP_CONTROL" ] 97 sources += [ 98 "${services_path}/bundlemgr/src/app_control/app_control_manager.cpp", 99 "${services_path}/bundlemgr/src/app_control/app_control_manager_host_impl.cpp", 100 "${services_path}/bundlemgr/src/app_control/app_control_manager_rdb.cpp", 101 "${services_path}/bundlemgr/src/app_control/app_jump_interceptor_event_subscriber.cpp", 102 "${services_path}/bundlemgr/src/app_control/app_jump_interceptor_manager_rdb.cpp", 103 ] 104 include_dirs = [ "${services_path}/bundlemgr/include/app_control" ] 105 external_deps += [ "c_utils:utils" ] 106 } 107 108 sources += [ "bundleinstallerhost_fuzzer.cpp" ] 109} 110