1# Copyright (c) 2021 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("//build/test.gni")
15import("//foundation/filemanagement/storage_service/storage_service_aafwk.gni")
16
17ROOT_DIR = "${storage_daemon_path}"
18
19ohos_unittest("disk_manager_test") {
20  branch_protector_ret = "pac_ret"
21  sanitize = {
22    integer_overflow = true
23    cfi = true
24    cfi_cross_dso = true
25    debug = false
26  }
27  module_out_path = "storage_service/storage_daemon"
28
29  defines = [
30    "STORAGE_LOG_TAG = \"StorageDaemon\"",
31    "LOG_DOMAIN = 0xD004301",
32  ]
33
34  include_dirs = [
35    "$ROOT_DIR/include",
36    "${storage_service_path}/utils/include",
37    "${storage_manager_path}/include",
38    "${storage_interface_path}/innerkits/storage_manager/native",
39    "${storage_service_common_path}/include",
40  ]
41
42  sources = [
43    "$ROOT_DIR/disk/src/disk_config.cpp",
44    "$ROOT_DIR/disk/src/disk_info.cpp",
45    "$ROOT_DIR/disk/src/disk_manager.cpp",
46    "$ROOT_DIR/disk/test/disk_manager_test.cpp",
47    "$ROOT_DIR/ipc/src/storage_manager_client.cpp",
48    "$ROOT_DIR/netlink/src/netlink_data.cpp",
49    "$ROOT_DIR/volume/src/external_volume_info.cpp",
50    "$ROOT_DIR/volume/src/process.cpp",
51    "$ROOT_DIR/volume/src/volume_info.cpp",
52    "$ROOT_DIR/volume/src/volume_manager.cpp",
53  ]
54
55  deps = [
56    "$ROOT_DIR:storage_common_utils",
57    "//third_party/googletest:gtest_main",
58  ]
59
60  external_deps = [
61    "c_utils:utils",
62    "hilog:libhilog",
63    "init:libbegetutil",
64    "ipc:ipc_single",
65    "safwk:system_ability_fwk",
66    "samgr:samgr_proxy",
67    "storage_service:storage_manager_sa_proxy",
68  ]
69}
70
71ohos_unittest("disk_info_test") {
72  branch_protector_ret = "pac_ret"
73  sanitize = {
74    integer_overflow = true
75    cfi = true
76    cfi_cross_dso = true
77    debug = false
78    blocklist = "${storage_service_path}/cfi_blocklist.txt"
79  }
80  module_out_path = "storage_service/storage_daemon"
81
82  defines = [
83    "STORAGE_LOG_TAG = \"StorageDaemon\"",
84    "LOG_DOMAIN = 0xD004301",
85  ]
86
87  include_dirs = [
88    "$ROOT_DIR/disk/test",
89    "$ROOT_DIR/include",
90    "${storage_service_path}/utils/include",
91    "${storage_manager_path}/include",
92    "${storage_interface_path}/innerkits/storage_manager/native",
93    "${storage_service_common_path}/include",
94  ]
95
96  sources = [
97    "$ROOT_DIR/disk/src/disk_info.cpp",
98    "$ROOT_DIR/disk/test/disk_info_test.cpp",
99    "$ROOT_DIR/ipc/src/storage_manager_client.cpp",
100    "$ROOT_DIR/netlink/src/netlink_data.cpp",
101    "$ROOT_DIR/volume/src/external_volume_info.cpp",
102    "$ROOT_DIR/volume/src/process.cpp",
103    "$ROOT_DIR/volume/src/volume_info.cpp",
104    "$ROOT_DIR/volume/src/volume_manager.cpp",
105  ]
106
107  deps = [
108    "$ROOT_DIR:storage_common_utils",
109    "//third_party/googletest:gmock_main",
110    "//third_party/googletest:gtest_main",
111  ]
112
113  external_deps = [
114    "c_utils:utils",
115    "hilog:libhilog",
116    "init:libbegetutil",
117    "ipc:ipc_single",
118    "safwk:system_ability_fwk",
119    "samgr:samgr_proxy",
120    "storage_service:storage_manager_sa_proxy",
121  ]
122}
123
124ohos_unittest("disk_config_test") {
125  branch_protector_ret = "pac_ret"
126  sanitize = {
127    integer_overflow = true
128    cfi = true
129    cfi_cross_dso = true
130    debug = false
131  }
132  module_out_path = "storage_service/storage_daemon"
133
134  defines = [
135    "STORAGE_LOG_TAG = \"StorageDaemon\"",
136    "LOG_DOMAIN = 0xD004301",
137  ]
138
139  include_dirs = [
140    "$ROOT_DIR/disk/test",
141    "$ROOT_DIR/include",
142    "${storage_service_path}/utils/include",
143    "${storage_manager_path}/include",
144    "${storage_interface_path}/innerkits/storage_manager/native",
145    "${storage_service_common_path}/include",
146  ]
147
148  sources = [
149    "$ROOT_DIR/disk/src/disk_config.cpp",
150    "$ROOT_DIR/disk/test/disk_config_test.cpp",
151  ]
152
153  deps = [ "//third_party/googletest:gmock_main" ]
154
155  external_deps = [
156    "c_utils:utils",
157    "hilog:libhilog",
158    "ipc:ipc_single",
159    "safwk:system_ability_fwk",
160  ]
161}
162
163group("storage_daemon_disk_test") {
164  testonly = true
165  deps = [
166    ":disk_config_test",
167    ":disk_info_test",
168    ":disk_manager_test",
169  ]
170}
171