1# Copyright (c) 2022 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/test.gni") 16 17ohos_unittest("SecurityGuardConfigManagerTest") { 18 install_enable = true 19 part_name = "security_guard" 20 subsystem_name = "security" 21 module_out_path = part_name + "/" + part_name 22 23 resource_config_file = "resource/ohos_test.xml" 24 25 include_dirs = [ 26 "include", 27 "${sg_root_dir}/frameworks/common/constants/include", 28 "${sg_root_dir}/frameworks/common/interfaces", 29 "${sg_root_dir}/frameworks/common/json/include", 30 "${sg_root_dir}/frameworks/common/task_handler/include", 31 "${sg_root_dir}/frameworks/common/database/include", 32 "${sg_root_dir}/frameworks/common/log/include", 33 "${sg_root_dir}/frameworks/common/utils/include", 34 "${sg_root_dir}/services/bigdata/include", 35 "${sg_root_dir}/test/unittest/mock/data_collect", 36 "${sg_root_dir}/test/unittest/mock/rdb", 37 ] 38 39 sources = [ 40 "${sg_root_dir}/frameworks/common/json/src/json_cfg.cpp", 41 "${sg_root_dir}/frameworks/common/utils/src/security_guard_utils.cpp", 42 "${sg_root_dir}/services/config_manager/src/base_config.cpp", 43 "${sg_root_dir}/services/config_manager/src/config_data_manager.cpp", 44 "${sg_root_dir}/services/config_manager/src/config_manager.cpp", 45 "${sg_root_dir}/services/config_manager/src/config_operator.cpp", 46 "${sg_root_dir}/services/config_manager/src/config_subscriber.cpp", 47 "${sg_root_dir}/services/config_manager/src/event_config.cpp", 48 "${sg_root_dir}/services/config_manager/src/global_app_config.cpp", 49 "${sg_root_dir}/services/config_manager/src/local_app_config.cpp", 50 "${sg_root_dir}/services/config_manager/src/model_cfg_marshalling.cpp", 51 "${sg_root_dir}/services/config_manager/src/model_config.cpp", 52 "src/security_guard_config_manager_test.cpp", 53 ] 54 55 deps = [ "${sg_root_dir}/services/bigdata:sg_bigdata_stamp" ] 56 57 external_deps = [ 58 "ability_base:base", 59 "ability_base:want", 60 "access_token:libaccesstoken_sdk", 61 "access_token:libnativetoken", 62 "access_token:libtoken_setproc", 63 "c_utils:utils", 64 "googletest:gmock", 65 "hilog:libhilog", 66 "ipc:ipc_core", 67 "json:nlohmann_json_static", 68 "kv_store:distributeddata_inner", 69 "safwk:system_ability_fwk", 70 "samgr:samgr_proxy", 71 ] 72 73 sanitize = { 74 integer_overflow = true 75 ubsan = true 76 boundary_sanitize = true 77 cfi = true 78 cfi_cross_dso = true 79 blocklist = "${sg_root_dir}/cfi_blocklist.txt" 80 } 81 stack_protector_ret = true 82} 83 84ohos_unittest("AppInfoDatabseTest") { 85 install_enable = true 86 part_name = "security_guard" 87 subsystem_name = "security" 88 module_out_path = part_name + "/" + part_name 89 90 include_dirs = [ 91 "include", 92 "${sg_root_dir}/frameworks/common/constants/include", 93 "${sg_root_dir}/frameworks/common/interfaces", 94 "${sg_root_dir}/frameworks/common/json/include", 95 "${sg_root_dir}/frameworks/common/task_handler/include", 96 "${sg_root_dir}/frameworks/common/database/include", 97 "${sg_root_dir}/frameworks/common/log/include", 98 "${sg_root_dir}/frameworks/common/utils/include", 99 "${sg_root_dir}/services/bigdata/include", 100 "${sg_root_dir}/services/config_manager/include", 101 "${sg_root_dir}/test/unittest/mock/rdb", 102 "${sg_root_dir}/test/unittest/data_collect/include", 103 ] 104 105 sources = [ 106 "${sg_root_dir}/services/config_manager/src/app_info_rdb_helper.cpp", 107 "${sg_root_dir}/services/config_manager/src/config_database_helper.cpp", 108 "${sg_root_dir}/services/data_collect/store/src/database.cpp", 109 "${sg_root_dir}/services/data_collect/store/src/rdb_event_store_callback.cpp", 110 "src/app_info_database_test.cpp", 111 ] 112 113 deps = [ "${sg_root_dir}/services/bigdata:sg_bigdata_stamp" ] 114 115 external_deps = [ 116 "ability_base:base", 117 "ability_base:want", 118 "access_token:libaccesstoken_sdk", 119 "access_token:libnativetoken", 120 "access_token:libtoken_setproc", 121 "c_utils:utils", 122 "googletest:gmock", 123 "hilog:libhilog", 124 "ipc:ipc_core", 125 "kv_store:distributeddata_inner", 126 "safwk:system_ability_fwk", 127 "samgr:samgr_proxy", 128 ] 129 130 sanitize = { 131 integer_overflow = true 132 ubsan = true 133 boundary_sanitize = true 134 cfi = true 135 cfi_cross_dso = true 136 blocklist = "${sg_root_dir}/cfi_blocklist.txt" 137 } 138 stack_protector_ret = true 139} 140 141group("unittest") { 142 testonly = true 143 deps = [ 144 ":AppInfoDatabseTest", 145 ":SecurityGuardConfigManagerTest", 146 ] 147} 148