• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2025 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
14import("//base/security/security_guard/security_guard.gni")
15import("//build/config/features.gni")
16import("//build/test.gni")
17
18ohos_fuzztest("DatabaseManagerFuzzTest") {
19  module_out_path = fuzz_test_output_path
20  fuzz_config_file =
21      "${sg_root_dir}/test/fuzztest/data_collect/databasemanager_fuzzer"
22
23  include_dirs = [
24    "${sg_root_dir}/services/risk_classify/model_manager/include",
25    "${sg_root_dir}/services/config_manager/include",
26    "${sg_root_dir}/interfaces/inner_api/common/include",
27    "${sg_root_dir}/interfaces/inner_api/collect/include",
28    "${sg_root_dir}/frameworks/common/collect/include",
29    "${sg_root_dir}/interfaces/inner_api/collector/include",
30    "${sg_root_dir}/frameworks/common/collector/include",
31    "${sg_root_dir}/services/bigdata/include",
32    "${sg_root_dir}/services/config_manager/include",
33    "${sg_root_dir}/services/data_collect/sa/include",
34    "${sg_root_dir}/services/data_collect/store/include",
35    "${sg_root_dir}/services/risk_collect/include",
36    "${sg_root_dir}/frameworks/common/constants/include",
37    "${sg_root_dir}/frameworks/common/json/include",
38    "${sg_root_dir}/frameworks/common/task_handler/include",
39    "${sg_root_dir}/frameworks/common/database/include",
40    "${sg_root_dir}/frameworks/common/log/include",
41    "${sg_root_dir}/frameworks/common/utils/include",
42    "${sg_root_dir}/services/collector_manager/include",
43    "${sg_root_dir}/services/risk_classify/model_manager/include",
44    "${sg_root_dir}/interfaces/inner_api/classify/include",
45    "${sg_root_dir}/frameworks/common/classify/include",
46  ]
47  cflags = [
48    "-g",
49    "-O0",
50    "-Wno-unused-variable",
51    "-fno-omit-frame-pointer",
52  ]
53
54  defines = []
55  defines += [
56    "SECURITY_GUARD_EVENT_CFG_SOURCE = \"${security_guard_event_cfg_source}\"",
57    "SECURITY_GUARD_MODEL_CFG_SOURCE = \"${security_guard_model_cfg_source}\"",
58    "SECURITY_GUARD_EVENT_GROUP_CFG_SOURCE = \"${security_guard_event_group_cfg_source}\"",
59    "SECURITY_GUARD_CONFIG_UPDATE_TRUST_LIST_SOURCE = \"${security_guard_config_update_trust_list_source}\"",
60    "SECURITY_GUARD_COLLECTOR_CFG_SOURCE = \"${security_guard_collector_cfg_source}\"",
61    "SECURITY_GUARD_EVENT_FILTER_PATH = \"${security_guard_event_filter_path}\"",
62    "SECURITY_GUARD_EVENT_WRAPPER_PATH = \"${security_guard_event_wrapper_path}\"",
63  ]
64
65  sources = [
66    "${sg_root_dir}/frameworks/common/utils/src/security_guard_utils.cpp",
67    "${sg_root_dir}/frameworks/common/json/src/json_cfg.cpp",
68    "${sg_root_dir}/services/data_collect/sa/acquire_data_callback_proxy.cpp",
69    "${sg_root_dir}/services/data_collect/sa/acquire_data_subscribe_manager.cpp",
70    "${sg_root_dir}/services/data_collect/sa/data_collect_manager_callback_proxy.cpp",
71    "${sg_root_dir}/services/data_collect/sa/data_collect_manager_service.cpp",
72    "${sg_root_dir}/services/data_collect/sa/data_format.cpp",
73    "${sg_root_dir}/services/data_collect/sa/security_event_query_callback_proxy.cpp",
74    "${sg_root_dir}/services/data_collect/store/src/database_helper.cpp",
75    "${sg_root_dir}/services/data_collect/store/src/database_manager.cpp",
76    "${sg_root_dir}/services/data_collect/store/src/file_system_store_helper.cpp",
77    "${sg_root_dir}/services/data_collect/store/src/risk_event_rdb_helper.cpp",
78    "${sg_root_dir}/frameworks/common/collect/src/security_event_filter.cpp",
79    "database_manager_fuzzer.cpp",
80  ]
81
82  deps = [
83    "${sg_root_dir}/frameworks/common/collector:libsg_collector_sdk",
84    "${sg_root_dir}/frameworks/common/collect:libsg_collect_sdk",
85    "${sg_root_dir}/services/bigdata:sg_bigdata_stamp",
86    "${sg_root_dir}/services/collector_manager:security_collector_manager",
87    "${sg_root_dir}/services/config_manager:sg_config_manager",
88    "${sg_root_dir}/services/data_collect:sg_collect_service_database",
89    "${sg_root_dir}/services/data_collect/idl:data_collect_manager_idl_sa_stub",
90    "${sg_root_dir}/services/risk_classify/model_manager:sg_model_manager_stamp",
91  ]
92
93  external_deps = [
94    "access_token:libaccesstoken_sdk",
95    "access_token:libtokenid_sdk",
96    "c_utils:utils",
97    "common_event_service:cesfwk_innerkits",
98    "ffrt:libffrt",
99    "hilog:libhilog",
100    "hisysevent:libhisysevent",
101    "hisysevent:libhisyseventmanager",
102    "ipc:ipc_core",
103    "json:nlohmann_json_static",
104    "safwk:system_ability_fwk",
105    "samgr:samgr_proxy",
106    "sqlite:sqlite",
107    "zlib:libz",
108    "os_account:os_account_innerkits",
109  ]
110  if (security_guard_enable_device_id) {
111    defines += [ "SECURITY_GUARD_ENABLE_DEVICE_ID" ]
112    external_deps += [
113      "device_manager:devicemanagersdk",
114    ]
115  }
116}
117