• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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    "${sg_root_dir}/interfaces/inner_api/classify/include",
38    "${sg_root_dir}/frameworks/common/classify/include",
39  ]
40
41  defines = []
42  defines += [
43    "SECURITY_GUARD_EVENT_CFG_SOURCE = \"${security_guard_event_cfg_source}\"",
44    "SECURITY_GUARD_MODEL_CFG_SOURCE = \"${security_guard_model_cfg_source}\"",
45    "SECURITY_GUARD_EVENT_GROUP_CFG_SOURCE = \"${security_guard_event_group_cfg_source}\"",
46    "SECURITY_GUARD_CONFIG_UPDATE_TRUST_LIST_SOURCE = \"${security_guard_config_update_trust_list_source}\"",
47    "SECURITY_GUARD_COLLECTOR_CFG_SOURCE = \"${security_guard_collector_cfg_source}\"",
48  ]
49  sources = [
50    "${sg_root_dir}/frameworks/common/json/src/json_cfg.cpp",
51    "${sg_root_dir}/frameworks/common/utils/src/security_guard_utils.cpp",
52    "${sg_root_dir}/services/config_manager/src/base_config.cpp",
53    "${sg_root_dir}/services/config_manager/src/config_data_manager.cpp",
54    "${sg_root_dir}/services/config_manager/src/config_manager.cpp",
55    "${sg_root_dir}/services/config_manager/src/config_operator.cpp",
56    "${sg_root_dir}/services/config_manager/src/config_subscriber.cpp",
57    "${sg_root_dir}/services/config_manager/src/event_config.cpp",
58    "${sg_root_dir}/services/config_manager/src/event_group_config.cpp",
59    "${sg_root_dir}/services/config_manager/src/model_cfg_marshalling.cpp",
60    "${sg_root_dir}/services/config_manager/src/model_config.cpp",
61    "src/security_guard_config_manager_test.cpp",
62  ]
63
64  deps = [
65    "${sg_root_dir}/frameworks/common/classify:libsg_classify_sdk",
66    "${sg_root_dir}/services/bigdata:sg_bigdata_stamp",
67  ]
68
69  external_deps = [
70    "ability_base:base",
71    "ability_base:want",
72    "access_token:libaccesstoken_sdk",
73    "access_token:libnativetoken",
74    "access_token:libtoken_setproc",
75    "c_utils:utils",
76    "googletest:gmock",
77    "hilog:libhilog",
78    "ipc:ipc_core",
79    "json:nlohmann_json_static",
80    "safwk:system_ability_fwk",
81    "samgr:samgr_proxy",
82  ]
83
84  sanitize = {
85    integer_overflow = true
86    ubsan = true
87    boundary_sanitize = true
88    cfi = true
89    cfi_cross_dso = true
90    blocklist = "${sg_root_dir}/cfi_blocklist.txt"
91  }
92  branch_protector_ret = "pac_ret"
93}
94
95ohos_unittest("AppInfoDatabseTest") {
96  install_enable = true
97  part_name = "security_guard"
98  subsystem_name = "security"
99  module_out_path = part_name + "/" + part_name
100
101  include_dirs = [
102    "include",
103    "${sg_root_dir}/frameworks/common/constants/include",
104    "${sg_root_dir}/interfaces/inner_api/common/include",
105    "${sg_root_dir}/interfaces/inner_api/classify/include",
106    "${sg_root_dir}/frameworks/common/classify/include",
107    "${sg_root_dir}/frameworks/common/json/include",
108    "${sg_root_dir}/frameworks/common/task_handler/include",
109    "${sg_root_dir}/frameworks/common/database/include",
110    "${sg_root_dir}/frameworks/common/log/include",
111    "${sg_root_dir}/frameworks/common/utils/include",
112    "${sg_root_dir}/services/bigdata/include",
113    "${sg_root_dir}/services/config_manager/include",
114    "${sg_root_dir}/test/unittest/mock/rdb",
115    "${sg_root_dir}/test/unittest/data_collect/include",
116  ]
117
118  sources = [
119    "${sg_root_dir}/services/data_collect/store/src/database.cpp",
120    "${sg_root_dir}/services/data_collect/store/src/rdb_event_store_callback.cpp",
121    "src/app_info_database_test.cpp",
122  ]
123
124  deps = [ "${sg_root_dir}/services/bigdata:sg_bigdata_stamp" ]
125
126  external_deps = [
127    "ability_base:base",
128    "ability_base:want",
129    "access_token:libaccesstoken_sdk",
130    "access_token:libnativetoken",
131    "access_token:libtoken_setproc",
132    "c_utils:utils",
133    "googletest:gmock",
134    "hilog:libhilog",
135    "ipc:ipc_core",
136    "safwk:system_ability_fwk",
137    "samgr:samgr_proxy",
138  ]
139
140  sanitize = {
141    integer_overflow = true
142    ubsan = true
143    boundary_sanitize = true
144    cfi = true
145    cfi_cross_dso = true
146    blocklist = "${sg_root_dir}/cfi_blocklist.txt"
147  }
148  branch_protector_ret = "pac_ret"
149}
150
151group("unittest") {
152  testonly = true
153  deps = [
154    ":AppInfoDatabseTest",
155    ":SecurityGuardConfigManagerTest",
156  ]
157}
158