• 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    "ffrt:libffrt",
87    "syscap_codec:syscap_interface_shared",
88  ]
89
90  external_deps += bundle_install_external_deps
91
92  if (bundle_framework_power_mgr_enable) {
93    external_deps += aot_external_deps
94  }
95
96  configs += [ "../../../../services/bundlemgr:rdb_config" ]
97  external_deps += [ "relational_store:native_rdb" ]
98  sources += [
99    "${services_path}/bundlemgr/src/bundle_data_storage_rdb.cpp",
100    "${services_path}/bundlemgr/src/preinstall_data_storage_rdb.cpp",
101    "${services_path}/bundlemgr/src/rdb/bms_rdb_open_callback.cpp",
102    "${services_path}/bundlemgr/src/rdb/rdb_data_manager.cpp",
103  ]
104
105  defines = []
106  include_dirs = []
107  if (device_usage_statistics_enabled) {
108    external_deps += [ "device_usage_statistics:usagestatsinner" ]
109    defines += [ "DEVICE_USAGE_STATISTICS_ENABLED" ]
110  }
111  if (code_signature_enable) {
112    sources += [
113      "${services_path}/bundlemgr/src/aot/aot_sign_data_cache_mgr.cpp",
114      "${services_path}/bundlemgr/src/code_sign_helper.cpp",
115    ]
116    include_dirs += [ "${services_path}/bundlemgr/include" ]
117    external_deps += [
118      "bounds_checking_function:libsec_shared",
119      "code_signature:libcode_sign_utils",
120      "ets_runtime:libcompiler_service",
121    ]
122    defines += [ "CODE_SIGNATURE_ENABLE" ]
123  }
124  if (current_cpu == "arm64") {
125    defines += [ "ON_64BIT_SYSTEM" ]
126  }
127  if (bundle_framework_app_control) {
128    defines += [ "BUNDLE_FRAMEWORK_APP_CONTROL" ]
129    sources += [
130      "${services_path}/bundlemgr/src/app_control/app_control_manager.cpp",
131      "${services_path}/bundlemgr/src/app_control/app_control_manager_host_impl.cpp",
132      "${services_path}/bundlemgr/src/app_control/app_control_manager_rdb.cpp",
133      "${services_path}/bundlemgr/src/app_control/app_jump_interceptor_event_subscriber.cpp",
134      "${services_path}/bundlemgr/src/app_control/app_jump_interceptor_manager_rdb.cpp",
135    ]
136    include_dirs += [ "${services_path}/bundlemgr/include/app_control" ]
137    external_deps += [ "c_utils:utils" ]
138  }
139  if (udmf_enabled) {
140    defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ]
141    external_deps += [ "udmf:utd_client" ]
142  }
143
144  if (user_auth_framework_impl_enabled) {
145    external_deps += [ "user_auth_framework:userauth_client" ]
146    defines += [ "BMS_USER_AUTH_FRAMEWORK_ENABLED" ]
147    include_dirs += [ "${services_path}/bundlemgr/include/user_auth" ]
148    sources += user_auth
149  }
150
151  sources += [ "bundleinstalldhost_fuzzer.cpp" ]
152}
153