• 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("BundleInstallerHostFuzzTest") {
24  module_out_path = module_output_path
25  fuzz_config_file =
26      "../../../fuzztest/fuzztest_application/bundleinstallerhost_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:libprivacy_sdk",
65    "access_token:libtokenid_sdk",
66    "appverify:libhapverify",
67    "c_utils:utils",
68    "common_event_service:cesfwk_innerkits",
69    "eventhandler:libeventhandler",
70    "hilog:libhilog",
71    "hitrace:hitrace_meter",
72    "init:libbegetutil",
73    "ipc:ipc_core",
74    "safwk:system_ability_fwk",
75    "samgr:samgr_proxy",
76  ]
77  external_deps += bundle_install_external_deps
78
79  if (bundle_framework_power_mgr_enable) {
80    external_deps += aot_external_deps
81  }
82
83  configs += [ "../../../../services/bundlemgr:rdb_config" ]
84  external_deps += [ "relational_store:native_rdb" ]
85  sources += [
86    "${services_path}/bundlemgr/src/bundle_data_storage_rdb.cpp",
87    "${services_path}/bundlemgr/src/preinstall_data_storage_rdb.cpp",
88    "${services_path}/bundlemgr/src/rdb/bms_rdb_open_callback.cpp",
89    "${services_path}/bundlemgr/src/rdb/rdb_data_manager.cpp",
90  ]
91
92  defines = []
93  if (current_cpu == "arm64") {
94    defines += [ "ON_64BIT_SYSTEM" ]
95  }
96  if (bundle_framework_app_control) {
97    defines += [ "BUNDLE_FRAMEWORK_APP_CONTROL" ]
98    sources += [
99      "${services_path}/bundlemgr/src/app_control/app_control_manager.cpp",
100      "${services_path}/bundlemgr/src/app_control/app_control_manager_host_impl.cpp",
101      "${services_path}/bundlemgr/src/app_control/app_control_manager_rdb.cpp",
102      "${services_path}/bundlemgr/src/app_control/app_jump_interceptor_event_subscriber.cpp",
103      "${services_path}/bundlemgr/src/app_control/app_jump_interceptor_manager_rdb.cpp",
104    ]
105    include_dirs = [ "${services_path}/bundlemgr/include/app_control" ]
106    external_deps += [ "c_utils:utils" ]
107  }
108  if (udmf_enabled) {
109    defines += [ "BUNDLE_FRAMEWORK_UDMF_ENABLED" ]
110    external_deps += [ "udmf:udmf_client" ]
111  }
112
113  sources += [ "bundleinstallerhost_fuzzer.cpp" ]
114}
115