• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2024 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_service_path}/services"
18
19ohos_unittest("mtp_device_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    "private = public",
32  ]
33
34  cflags = [
35    "-w",
36    "-DFUSE_USE_VERSION=31",
37    "-D_FILE_OFFSET_BITS=64",
38    "-std=c++11",
39  ]
40
41  include_dirs = [
42    "${storage_daemon_path}/mtpfs/include",
43    "${storage_service_common_path}/include",
44    "${storage_daemon_path}/include",
45    "${storage_service_path}/utils/include",
46    "${storage_service_path}/storage_manager/include",
47    "${storage_interface_path}/innerkits/storage_manager/native",
48  ]
49
50  sources = [
51    "$ROOT_DIR/storage_daemon/ipc/src/storage_manager_client.cpp",
52    "$ROOT_DIR/storage_daemon/mtp/src/mtp_device_manager.cpp",
53    "$ROOT_DIR/storage_daemon/mtp/test/mtp_device_manager_test.cpp",
54    "$ROOT_DIR/storage_daemon/utils/disk_utils.cpp",
55    "$ROOT_DIR/storage_daemon/utils/file_utils.cpp",
56  ]
57
58  external_deps = [
59    "c_utils:utils",
60    "googletest:gtest_main",
61    "hilog:libhilog",
62    "ipc:ipc_single",
63    "samgr:samgr_proxy",
64  ]
65}
66
67ohos_unittest("mtp_device_monitor_test") {
68  branch_protector_ret = "pac_ret"
69  sanitize = {
70    integer_overflow = true
71    cfi = true
72    cfi_cross_dso = true
73    debug = false
74  }
75  module_out_path = "storage_service/storage_daemon"
76
77  defines = [
78    "STORAGE_LOG_TAG = \"StorageDaemon\"",
79    "private = public",
80  ]
81
82  cflags = [
83    "-w",
84    "-DFUSE_USE_VERSION=31",
85    "-D_FILE_OFFSET_BITS=64",
86    "-std=c++11",
87  ]
88
89  include_dirs = [
90    "${storage_daemon_path}/mtpfs/include",
91    "${storage_service_common_path}/include",
92    "${storage_daemon_path}/include",
93    "${storage_service_path}/utils/include",
94    "${storage_service_path}/storage_manager/include",
95    "${storage_interface_path}/innerkits/storage_manager/native",
96  ]
97
98  sources = [
99    "$ROOT_DIR/storage_daemon/ipc/src/storage_manager_client.cpp",
100    "$ROOT_DIR/storage_daemon/mtp/src/mtp_device_manager.cpp",
101    "$ROOT_DIR/storage_daemon/mtp/src/mtp_device_monitor.cpp",
102    "$ROOT_DIR/storage_daemon/mtp/test/mtp_device_monitor_test.cpp",
103    "$ROOT_DIR/storage_daemon/utils/disk_utils.cpp",
104    "$ROOT_DIR/storage_daemon/utils/file_utils.cpp",
105  ]
106
107  external_deps = [
108    "ability_base:want",
109    "c_utils:utils",
110    "config_policy:configpolicy_util",
111    "googletest:gtest_main",
112    "hilog:libhilog",
113    "init:libbeget_proxy",
114    "init:libbegetutil",
115    "ipc:ipc_single",
116    "samgr:samgr_proxy",
117  ]
118
119  if (support_open_source_libmtp &&
120      storage_service_external_storage_qos_trans) {
121    external_deps += [ "libmtp:libmtp" ]
122  }
123}
124
125group("storage_daemon_mtp_test") {
126  testonly = true
127  deps = [
128    ":mtp_device_manager_test",
129    ":mtp_device_monitor_test",
130  ]
131}
132