• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2024-2025 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_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  deps = [ "${storage_daemon_path}:storage_common_utils" ]
59
60  external_deps = [
61    "c_utils:utils",
62    "googletest:gtest_main",
63    "hilog:libhilog",
64    "ipc:ipc_single",
65    "samgr:samgr_proxy",
66    "usb_manager:usbsrv_client",
67  ]
68}
69
70ohos_unittest("mtp_device_monitor_test") {
71  branch_protector_ret = "pac_ret"
72  sanitize = {
73    integer_overflow = true
74    cfi = true
75    cfi_cross_dso = true
76    debug = false
77  }
78  module_out_path = "storage_service/storage_service/storage_daemon"
79
80  defines = [
81    "STORAGE_LOG_TAG = \"StorageDaemon\"",
82    "private = public",
83  ]
84
85  cflags = [
86    "-w",
87    "-DFUSE_USE_VERSION=31",
88    "-D_FILE_OFFSET_BITS=64",
89    "-std=c++11",
90  ]
91
92  include_dirs = [
93    "${storage_daemon_path}/mtpfs/include",
94    "${storage_service_common_path}/include",
95    "${storage_daemon_path}/include",
96    "${storage_service_path}/utils/include",
97    "${storage_service_path}/storage_manager/include",
98    "${storage_interface_path}/innerkits/storage_manager/native",
99  ]
100
101  sources = [
102    "$ROOT_DIR/storage_daemon/ipc/src/storage_manager_client.cpp",
103    "$ROOT_DIR/storage_daemon/mtp/src/mtp_device_manager.cpp",
104    "$ROOT_DIR/storage_daemon/mtp/src/mtp_device_monitor.cpp",
105    "$ROOT_DIR/storage_daemon/mtp/test/mtp_device_monitor_test.cpp",
106    "$ROOT_DIR/storage_daemon/utils/disk_utils.cpp",
107    "$ROOT_DIR/storage_daemon/utils/file_utils.cpp",
108  ]
109
110  deps = [ "${storage_daemon_path}:storage_common_utils" ]
111
112  external_deps = [
113    "ability_base:want",
114    "c_utils:utils",
115    "googletest:gtest_main",
116    "hilog:libhilog",
117    "hitrace:hitrace_meter",
118    "init:libbeget_proxy",
119    "init:libbegetutil",
120    "ipc:ipc_single",
121    "samgr:samgr_proxy",
122    "usb_manager:usbsrv_client",
123  ]
124
125  if (support_open_source_libmtp &&
126      storage_service_external_storage_qos_trans) {
127    external_deps += [ "libmtp:libmtp" ]
128  }
129}
130
131group("storage_daemon_mtp_test") {
132  testonly = true
133  deps = [
134    ":mtp_device_manager_test",
135    ":mtp_device_monitor_test",
136  ]
137}
138