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