1# Copyright (c) 2022-2023 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  ]
31  cflags = [
32    "-g",
33    "-O0",
34    "-Wno-unused-variable",
35    "-fno-omit-frame-pointer",
36  ]
37  sources = [
38    "${storage_daemon_path}/crypto/src/key_manager.cpp",
39    "${storage_daemon_path}/ipc/src/storage_daemon.cpp",
40    "${storage_daemon_path}/ipc/src/storage_daemon_stub.cpp",
41    "${storage_daemon_path}/quota/quota_manager.cpp",
42    "${storage_daemon_path}/user/src/mount_manager.cpp",
43    "${storage_daemon_path}/user/src/user_manager.cpp",
44    "${storage_daemon_path}/utils/file_utils.cpp",
45    "${storage_daemon_path}/utils/mount_argument_utils.cpp",
46    "${storage_daemon_path}/utils/set_flag_utils.cpp",
47    "${storage_daemon_path}/utils/storage_radar.cpp",
48    "${storage_daemon_path}/utils/string_utils.cpp",
49    "${storage_service_path}/test/fuzztest/storagedaemon_fuzzer/storagedaemon_fuzzer.cpp",
50  ]
51
52  defines = [
53    "STORAGE_LOG_TAG = \"storage_service\"",
54    "private=public",
55  ]
56  deps = [
57    "${bundlemanager_framework_path}/services/bundlemgr:libbms",
58    "${storage_daemon_path}/libfscrypt:libfscryptutils",
59  ]
60
61  external_deps = [
62    "ability_base:zuri",
63    "ability_runtime:abilitykit_native",
64    "access_token:libaccesstoken_sdk",
65    "access_token:libnativetoken",
66    "access_token:libtoken_setproc",
67    "app_file_service:fileshare_native",
68    "app_file_service:fileuri_native",
69    "app_file_service:sandbox_helper_native",
70    "bundle_framework:appexecfwk_core",
71    "c_utils:utils",
72    "eventhandler:libeventhandler",
73    "hilog:libhilog",
74    "hisysevent:libhisysevent",
75    "huks:libhukssdk",
76    "init:libbegetutil",
77    "ipc:ipc_single",
78    "safwk:system_ability_fwk",
79    "samgr:samgr_proxy",
80  ]
81
82  if (storage_service_dfs_service) {
83    defines += [ "DFS_SERVICE" ]
84    external_deps += [ "dfs_service:cloud_daemon_kit_inner" ]
85  }
86
87  if (enable_user_auth_framework) {
88    defines += [ "USER_AUTH_FRAMEWORK" ]
89    external_deps += [ "user_auth_framework:userauth_client" ]
90  }
91
92  use_exceptions = true
93}
94
95group("fuzztest") {
96  testonly = true
97  deps = [ ":StorageDaemonFuzzTest" ]
98}
99