• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2022-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/config/features.gni")
15import("//build/test.gni")
16import("//foundation/filemanagement/storage_service/storage_service_aafwk.gni")
17
18ohos_fuzztest("StorageDaemonFuzzTest") {
19  module_out_path = "storage_service/storage_service"
20  fuzz_config_file =
21      "${storage_service_path}/test/fuzztest/storagedaemon_fuzzer"
22  include_dirs = [
23    "${storage_service_common_path}/include",
24    "${storage_daemon_path}/include",
25    "${storage_daemon_path}/include/crypto",
26    "${storage_daemon_path}/include/ipc",
27    "${storage_daemon_path}/include/quota",
28    "${storage_daemon_path}/include/user",
29    "${storage_daemon_path}/include/utils",
30    "${storage_interface_path}/innerkits/storage_manager/native",
31  ]
32  cflags = [
33    "-g",
34    "-O0",
35    "-Wno-unused-variable",
36    "-fno-omit-frame-pointer",
37  ]
38  sources = [
39    "${storage_daemon_path}/crypto/src/key_manager.cpp",
40    "${storage_daemon_path}/ipc/src/storage_daemon.cpp",
41    "${storage_daemon_path}/quota/quota_manager.cpp",
42    "${storage_daemon_path}/user/src/mount_manager.cpp",
43    "${storage_daemon_path}/user/src/mount_manager_ext.cpp",
44    "${storage_daemon_path}/user/src/user_manager.cpp",
45    "${storage_daemon_path}/utils/file_utils.cpp",
46    "${storage_daemon_path}/utils/hi_audit.cpp",
47    "${storage_daemon_path}/utils/mount_argument_utils.cpp",
48    "${storage_daemon_path}/utils/storage_radar.cpp",
49    "${storage_daemon_path}/utils/storage_statistics_radar.cpp",
50    "${storage_daemon_path}/utils/storage_xcollie.cpp",
51    "${storage_daemon_path}/utils/string_utils.cpp",
52    "${storage_daemon_path}/utils/zip_util.cpp",
53    "${storage_manager_path}/innerkits_impl/src/storage_file_raw_data.cpp",
54    "${storage_service_path}/test/fuzztest/storagedaemon_fuzzer/storagedaemon_fuzzer.cpp",
55  ]
56
57  defines = [
58    "STORAGE_LOG_TAG = \"storage_service\"",
59    "private=public",
60  ]
61  deps = [
62    "${storage_daemon_path}:storage_common_utils",
63    "${storage_daemon_path}/libfscrypt:libfscryptutils",
64  ]
65
66  external_deps = [
67    "ability_base:zuri",
68    "ability_runtime:abilitykit_native",
69    "access_token:libaccesstoken_sdk",
70    "app_file_service:fileshare_native",
71    "app_file_service:fileuri_native",
72    "app_file_service:sandbox_helper_native",
73    "bundle_framework:appexecfwk_core",
74    "cJSON:cjson",
75    "c_utils:utils",
76    "eventhandler:libeventhandler",
77    "hicollie:libhicollie",
78    "hilog:libhilog",
79    "hisysevent:libhisysevent",
80    "huks:libhukssdk",
81    "init:libbegetutil",
82    "ipc:ipc_single",
83    "safwk:system_ability_fwk",
84    "samgr:samgr_proxy",
85    "zlib:shared_libz",
86  ]
87
88  if (storage_service_cloud_fuse) {
89    defines += [ "DFS_SERVICE" ]
90    external_deps += [ "dfs_service:cloud_daemon_kit_inner" ]
91  }
92
93  if (enable_user_auth_framework) {
94    defines += [ "USER_AUTH_FRAMEWORK" ]
95    external_deps += [ "user_auth_framework:userauth_client" ]
96  }
97
98  if (enable_tee_client) {
99    defines += [ "RECOVER_KEY_TEE_ENVIRONMENT" ]
100    external_deps += [ "tee_client:libteec" ]
101  }
102
103  if (enable_huks_hdi) {
104    defines += [ "HUKS_IDL_ENVIRONMENT" ]
105    external_deps += [ "drivers_interface_huks:libhuks_proxy_1.1", ]
106  }
107
108  use_exceptions = true
109}
110
111group("fuzztest") {
112  testonly = true
113  deps = [ ":StorageDaemonFuzzTest" ]
114}
115