• 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 = "securitycloudgovernance"
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/file_util.cpp",
52    "${sg_root_dir}/frameworks/common/utils/src/json_util.cpp",
53    "${sg_root_dir}/frameworks/common/utils/src/security_guard_utils.cpp",
54    "${sg_root_dir}/services/config_manager/src/base_config.cpp",
55    "${sg_root_dir}/services/config_manager/src/config_data_manager.cpp",
56    "${sg_root_dir}/services/config_manager/src/config_manager.cpp",
57    "${sg_root_dir}/services/config_manager/src/config_operator.cpp",
58    "${sg_root_dir}/services/config_manager/src/config_subscriber.cpp",
59    "${sg_root_dir}/services/config_manager/src/event_config.cpp",
60    "${sg_root_dir}/services/config_manager/src/event_group_config.cpp",
61    "${sg_root_dir}/services/config_manager/src/model_cfg_marshalling.cpp",
62    "${sg_root_dir}/services/config_manager/src/model_config.cpp",
63    "src/security_guard_config_manager_test.cpp",
64  ]
65
66  deps = [
67    "${sg_root_dir}/frameworks/common/classify:libsg_classify_sdk",
68    "${sg_root_dir}/frameworks/common/collect:libsg_collect_sdk",
69    "${sg_root_dir}/services/bigdata:sg_bigdata_stamp",
70  ]
71
72  external_deps = [
73    "ability_base:base",
74    "ability_base:want",
75    "access_token:libaccesstoken_sdk",
76    "access_token:libnativetoken",
77    "access_token:libtoken_setproc",
78    "cJSON:cjson",
79    "c_utils:utils",
80    "googletest:gmock",
81    "hilog:libhilog",
82    "ipc:ipc_core",
83    "json:nlohmann_json_static",
84    "safwk:system_ability_fwk",
85    "samgr:samgr_proxy",
86    "selinux_adapter:librestorecon",
87    "ffrt:libffrt",
88  ]
89}
90
91ohos_unittest("AppInfoDatabseTest") {
92  install_enable = true
93  part_name = "security_guard"
94  subsystem_name = "securitycloudgovernance"
95  module_out_path = part_name + "/" + part_name
96
97  include_dirs = [
98    "include",
99    "${sg_root_dir}/frameworks/common/constants/include",
100    "${sg_root_dir}/interfaces/inner_api/common/include",
101    "${sg_root_dir}/interfaces/inner_api/classify/include",
102    "${sg_root_dir}/frameworks/common/classify/include",
103    "${sg_root_dir}/frameworks/common/json/include",
104    "${sg_root_dir}/frameworks/common/task_handler/include",
105    "${sg_root_dir}/frameworks/common/database/include",
106    "${sg_root_dir}/frameworks/common/log/include",
107    "${sg_root_dir}/frameworks/common/utils/include",
108    "${sg_root_dir}/services/bigdata/include",
109    "${sg_root_dir}/services/config_manager/include",
110    "${sg_root_dir}/test/unittest/data_collect/include",
111  ]
112
113  sources = [
114    "${sg_root_dir}/services/data_collect/store/src/database.cpp",
115    "${sg_root_dir}/services/data_collect/store/src/generic_values.cpp",
116    "${sg_root_dir}/services/data_collect/store/src/sg_sqlite_helper.cpp",
117    "${sg_root_dir}/services/data_collect/store/src/sqlite_helper.cpp",
118    "${sg_root_dir}/services/data_collect/store/src/statement.cpp",
119    "${sg_root_dir}/services/data_collect/store/src/variant_value.cpp",
120    "src/app_info_database_test.cpp",
121  ]
122
123  deps = [ "${sg_root_dir}/services/bigdata:sg_bigdata_stamp" ]
124
125  external_deps = [
126    "ability_base:base",
127    "ability_base:want",
128    "access_token:libaccesstoken_sdk",
129    "access_token:libnativetoken",
130    "access_token:libtoken_setproc",
131    "c_utils:utils",
132    "googletest:gmock",
133    "hilog:libhilog",
134    "ipc:ipc_core",
135    "safwk:system_ability_fwk",
136    "samgr:samgr_proxy",
137    "sqlite:sqlite",
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