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_fuzztest("StorageDaemonProviderCreateShareFileFuzzTest") { 19 module_out_path = "storage_service/storage_service" 20 fuzz_config_file = "${storage_service_path}/test/fuzztest/storagedaemonprovidercreatesharefile_fuzzer" 21 include_dirs = [ 22 "${storage_service_common_path}/include", 23 "${storage_daemon_path}/include", 24 "${storage_daemon_path}/include/crypto", 25 "${storage_daemon_path}/include/ipc", 26 "${storage_daemon_path}/include/quota", 27 "${storage_daemon_path}/include/user", 28 "${storage_interface_path}/innerkits/storage_manager/native", 29 ] 30 cflags = [ 31 "-g", 32 "-O0", 33 "-Wno-unused-variable", 34 "-fno-omit-frame-pointer", 35 ] 36 sources = [ 37 "${storage_daemon_path}/crypto/src/key_manager.cpp", 38 "${storage_daemon_path}/ipc/src/storage_daemon.cpp", 39 "${storage_daemon_path}/ipc/src/storage_daemon_provider.cpp", 40 "${storage_daemon_path}/quota/quota_manager.cpp", 41 "${storage_daemon_path}/user/src/mount_manager.cpp", 42 "${storage_daemon_path}/user/src/mount_manager_ext.cpp", 43 "${storage_daemon_path}/user/src/user_manager.cpp", 44 "${storage_manager_path}/innerkits_impl/src/storage_file_raw_data.cpp", 45 "${storage_service_path}/test/fuzztest/storagedaemonprovidercreatesharefile_fuzzer/storagedaemonprovidercreatesharefile_fuzzer.cpp", 46 ] 47 48 defines = [ 49 "STORAGE_LOG_TAG = \"storage_service\"", 50 "STORAGE_DAEMON_FUZZ_TEST", 51 ] 52 deps = [ 53 "${storage_daemon_path}:storage_common_utils", 54 "${storage_daemon_path}:storage_daemon_ipc", 55 "${storage_daemon_path}/libfscrypt:libfscryptutils", 56 ] 57 58 external_deps = [ 59 "ability_base:zuri", 60 "ability_runtime:abilitykit_native", 61 "app_file_service:fileshare_native", 62 "app_file_service:fileuri_native", 63 "app_file_service:sandbox_helper_native", 64 "bundle_framework:appexecfwk_core", 65 "cJSON:cjson", 66 "c_utils:utils", 67 "eventhandler:libeventhandler", 68 "hicollie:libhicollie", 69 "hilog:libhilog", 70 "hisysevent:libhisysevent", 71 "huks:libhukssdk", 72 "init:libbegetutil", 73 "ipc:ipc_single", 74 "safwk:system_ability_fwk", 75 "samgr:samgr_proxy", 76 "zlib:shared_libz", 77 ] 78 79 if (storage_service_cloud_fuse) { 80 defines += [ "DFS_SERVICE" ] 81 external_deps += [ "dfs_service:cloud_daemon_kit_inner" ] 82 } 83 84 if (enable_user_auth_framework) { 85 defines += [ "USER_AUTH_FRAMEWORK" ] 86 external_deps += [ "user_auth_framework:userauth_client" ] 87 } 88 89 if (enable_tee_client) { 90 defines += [ "RECOVER_KEY_TEE_ENVIRONMENT" ] 91 external_deps += [ "tee_client:libteec" ] 92 } 93 94 use_exceptions = true 95} 96 97group("fuzztest") { 98 testonly = true 99 deps = [ ":StorageDaemonProviderCreateShareFileFuzzTest" ] 100} 101