• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 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_static_library("storage_daemon_stub_fuzztest") {
19  branch_protector_ret = "pac_ret"
20  sanitize = {
21    integer_overflow = true
22    ubsan = true
23    boundary_sanitize = true
24    cfi = true
25    cfi_cross_dso = true
26    debug = false
27  }
28
29  sources = [
30    "${storage_daemon_path}/ipc/src/storage_daemon.cpp",
31    "${storage_daemon_path}/ipc/src/storage_daemon_provider.cpp",
32    "${storage_daemon_path}/quota/quota_manager.cpp",
33    "${storage_daemon_path}/user/src/mount_manager.cpp",
34    "${storage_daemon_path}/user/src/mount_manager_ext.cpp",
35    "${storage_daemon_path}/user/src/user_manager.cpp",
36  ]
37
38  defines = [
39    "STORAGE_LOG_TAG = \"StorageDaemon\"",
40    "LOG_DOMAIN = 0xD004301",
41    "KMSG_LOG",
42  ]
43
44  cflags = [
45    "-fstack-protector-strong",
46    "-O2",
47  ]
48
49  configs = [ "${storage_daemon_path}:storage_daemon_config" ]
50
51  deps = [
52    "${storage_daemon_path}/crypto:libsdcrypto",
53    "${storage_daemon_path}:storage_common_utils",
54    "${storage_daemon_path}:storage_daemon_ipc",
55    "${storage_interface_path}/innerkits/storage_manager/native:storage_manager_sa_proxy",
56  ]
57
58  external_deps = [
59    "ability_base:base",
60    "ability_base:want",
61    "ability_base:zuri",
62    "app_file_service:fileshare_native",
63    "app_file_service:fileuri_native",
64    "app_file_service:sandbox_helper_native",
65    "bounds_checking_function:libsec_shared",
66    "bundle_framework:appexecfwk_base",
67    "bundle_framework:appexecfwk_core",
68    "cJSON:cjson",
69    "c_utils:utils",
70    "crypto_framework:crypto_framework_lib",
71    "eventhandler:libeventhandler",
72    "hicollie:libhicollie",
73    "hilog:libhilog",
74    "hisysevent:libhisysevent",
75    "hitrace:hitrace_meter",
76    "huks:libhukssdk",
77    "init:libbegetutil",
78    "ipc:ipc_single",
79    "openssl:libcrypto_shared",
80    "os_account:os_account_innerkits",
81    "safwk:system_ability_fwk",
82    "samgr:samgr_proxy",
83  ]
84
85  if (enable_user_auth_framework) {
86    defines += [ "USER_AUTH_FRAMEWORK" ]
87    external_deps += [ "user_auth_framework:userauth_client" ]
88  }
89
90  subsystem_name = "filemanagement"
91  part_name = "storage_service"
92}
93
94ohos_fuzztest("StorageDaemonStubFuzzTest") {
95  module_out_path = "storage_service/storage_service"
96  fuzz_config_file = "${storage_service_path}/test/fuzztest/storagedaemonstub_fuzzer"
97
98  defines = [
99    "STORAGE_LOG_TAG = \"storage_service\"",
100    "STORAGE_DAEMON_FUZZ_TEST",
101  ]
102  deps = [
103    ":storage_daemon_stub_fuzztest",
104    "${storage_daemon_path}/crypto:libsdcrypto",
105    "${storage_daemon_path}:storage_common_utils",
106    "${storage_interface_path}/innerkits/storage_manager/native:storage_manager_sa_proxy",
107  ]
108
109  sources = [
110    "${storage_service_path}/test/fuzztest/storagedaemonstub_fuzzer/storagedaemonstub_fuzzer.cpp",
111  ]
112
113  configs = [ "${storage_daemon_path}:storage_daemon_config" ]
114
115  external_deps = [
116    "ability_base:base",
117    "ability_base:want",
118    "ability_base:zuri",
119    "app_file_service:fileshare_native",
120    "app_file_service:fileuri_native",
121    "app_file_service:sandbox_helper_native",
122    "bounds_checking_function:libsec_shared",
123    "bundle_framework:appexecfwk_base",
124    "bundle_framework:appexecfwk_core",
125    "cJSON:cjson",
126    "c_utils:utils",
127    "eventhandler:libeventhandler",
128    "hicollie:libhicollie",
129    "hilog:libhilog",
130    "hisysevent:libhisysevent",
131    "hitrace:hitrace_meter",
132    "huks:libhukssdk",
133    "init:libbegetutil",
134    "ipc:ipc_single",
135    "openssl:libcrypto_shared",
136    "os_account:os_account_innerkits",
137    "safwk:system_ability_fwk",
138    "samgr:samgr_proxy",
139  ]
140
141  if (enable_user_auth_framework) {
142    defines += [ "USER_AUTH_FRAMEWORK" ]
143    external_deps += [ "user_auth_framework:userauth_client" ]
144  }
145
146  cflags = [
147    "-g",
148    "-O0",
149    "-Wno-unused-variable",
150    "-fno-omit-frame-pointer",
151  ]
152}
153
154group("fuzztest") {
155  testonly = true
156  deps = [ ":StorageDaemonStubFuzzTest" ]
157}
158