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}/interfaces/inner_api/common/include",
28    "${sg_root_dir}/frameworks/common/constants/include",
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/model_cfg_marshalling.cpp",
49    "${sg_root_dir}/services/config_manager/src/model_config.cpp",
50    "src/security_guard_config_manager_test.cpp",
51  ]
52
53  deps = [ "${sg_root_dir}/services/bigdata:sg_bigdata_stamp" ]
54
55  external_deps = [
56    "ability_base:base",
57    "ability_base:want",
58    "access_token:libaccesstoken_sdk",
59    "access_token:libnativetoken",
60    "access_token:libtoken_setproc",
61    "c_utils:utils",
62    "googletest:gmock",
63    "hilog:libhilog",
64    "ipc:ipc_core",
65    "json:nlohmann_json_static",
66    "kv_store:distributeddata_inner",
67    "safwk:system_ability_fwk",
68    "samgr:samgr_proxy",
69  ]
70
71  sanitize = {
72    integer_overflow = true
73    ubsan = true
74    boundary_sanitize = true
75    cfi = true
76    cfi_cross_dso = true
77    blocklist = "${sg_root_dir}/cfi_blocklist.txt"
78  }
79  branch_protector_ret = "pac_ret"
80}
81
82ohos_unittest("AppInfoDatabseTest") {
83  install_enable = true
84  part_name = "security_guard"
85  subsystem_name = "security"
86  module_out_path = part_name + "/" + part_name
87
88  include_dirs = [
89    "include",
90    "${sg_root_dir}/frameworks/common/constants/include",
91    "${sg_root_dir}/interfaces/inner_api/common/include",
92    "${sg_root_dir}/frameworks/common/json/include",
93    "${sg_root_dir}/frameworks/common/task_handler/include",
94    "${sg_root_dir}/frameworks/common/database/include",
95    "${sg_root_dir}/frameworks/common/log/include",
96    "${sg_root_dir}/frameworks/common/utils/include",
97    "${sg_root_dir}/services/bigdata/include",
98    "${sg_root_dir}/services/config_manager/include",
99    "${sg_root_dir}/test/unittest/mock/rdb",
100    "${sg_root_dir}/test/unittest/data_collect/include",
101  ]
102
103  sources = [
104    "${sg_root_dir}/services/data_collect/store/src/database.cpp",
105    "${sg_root_dir}/services/data_collect/store/src/rdb_event_store_callback.cpp",
106    "src/app_info_database_test.cpp",
107  ]
108
109  deps = [ "${sg_root_dir}/services/bigdata:sg_bigdata_stamp" ]
110
111  external_deps = [
112    "ability_base:base",
113    "ability_base:want",
114    "access_token:libaccesstoken_sdk",
115    "access_token:libnativetoken",
116    "access_token:libtoken_setproc",
117    "c_utils:utils",
118    "googletest:gmock",
119    "hilog:libhilog",
120    "ipc:ipc_core",
121    "kv_store:distributeddata_inner",
122    "safwk:system_ability_fwk",
123    "samgr:samgr_proxy",
124  ]
125
126  sanitize = {
127    integer_overflow = true
128    ubsan = true
129    boundary_sanitize = true
130    cfi = true
131    cfi_cross_dso = true
132    blocklist = "${sg_root_dir}/cfi_blocklist.txt"
133  }
134  branch_protector_ret = "pac_ret"
135}
136
137group("unittest") {
138  testonly = true
139  deps = [
140    ":AppInfoDatabseTest",
141    ":SecurityGuardConfigManagerTest",
142  ]
143}
144