• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_core",
72    "common_event_service:cesfwk_innerkits",
73    "eventhandler:libeventhandler",
74    "hilog:libhilog",
75    "hitrace:hitrace_meter",
76    "init:libbegetutil",
77    "ipc:ipc_core",
78    "safwk:system_ability_fwk",
79    "samgr:samgr_proxy",
80    "selinux_adapter:librestorecon",
81  ]
82
83  external_deps += [
84    "ability_runtime:ability_manager",
85    "ability_runtime:app_manager",
86    "battery_manager:batterysrv_client",
87    "display_manager:displaymgr",
88    "ffrt:libffrt",
89    "power_manager:powermgr_client",
90    "syscap_codec:syscap_interface_shared",
91  ]
92
93  external_deps += bundle_install_external_deps
94
95  if (bundle_framework_power_mgr_enable) {
96    external_deps += aot_external_deps
97  }
98
99  configs += [ "../../../../services/bundlemgr:rdb_config" ]
100  external_deps += [ "relational_store:native_rdb" ]
101  sources += [
102    "${services_path}/bundlemgr/src/bundle_data_storage_rdb.cpp",
103    "${services_path}/bundlemgr/src/preinstall_data_storage_rdb.cpp",
104    "${services_path}/bundlemgr/src/rdb/bms_rdb_open_callback.cpp",
105    "${services_path}/bundlemgr/src/rdb/rdb_data_manager.cpp",
106  ]
107
108  defines = []
109  include_dirs = []
110  if (device_usage_statistics_enabled) {
111    external_deps += [ "device_usage_statistics:usagestatsinner" ]
112    defines += [ "DEVICE_USAGE_STATISTICS_ENABLED" ]
113  }
114  if (code_signature_enable) {
115    sources += [
116      "${services_path}/bundlemgr/src/aot/aot_sign_data_cache_mgr.cpp",
117      "${services_path}/bundlemgr/src/code_sign_helper.cpp",
118    ]
119    include_dirs += [ "${services_path}/bundlemgr/include" ]
120    external_deps += [
121      "bounds_checking_function:libsec_shared",
122      "code_signature:libcode_sign_utils",
123      "ets_runtime:libcompiler_service",
124    ]
125    defines += [ "CODE_SIGNATURE_ENABLE" ]
126  }
127  if (current_cpu == "arm64") {
128    defines += [ "ON_64BIT_SYSTEM" ]
129  }
130  if (bundle_framework_app_control) {
131    defines += [ "BUNDLE_FRAMEWORK_APP_CONTROL" ]
132    sources += [
133      "${services_path}/bundlemgr/src/app_control/app_control_manager.cpp",
134      "${services_path}/bundlemgr/src/app_control/app_control_manager_host_impl.cpp",
135      "${services_path}/bundlemgr/src/app_control/app_control_manager_rdb.cpp",
136      "${services_path}/bundlemgr/src/app_control/app_jump_interceptor_event_subscriber.cpp",
137      "${services_path}/bundlemgr/src/app_control/app_jump_interceptor_manager_rdb.cpp",
138    ]
139    include_dirs += [ "${services_path}/bundlemgr/include/app_control" ]
140    external_deps += [ "c_utils:utils" ]
141  }
142  if (udmf_enabled) {
143    defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ]
144    external_deps += [ "udmf:utd_client" ]
145  }
146
147  if (user_auth_framework_impl_enabled) {
148    external_deps += [ "user_auth_framework:userauth_client" ]
149    defines += [ "BMS_USER_AUTH_FRAMEWORK_ENABLED" ]
150    include_dirs += [ "${services_path}/bundlemgr/include/user_auth" ]
151    sources += user_auth
152  }
153
154  sources += [ "bundleinstalldhost_fuzzer.cpp" ]
155}
156