1cb7eb8c9Sopenharmony_ci# Copyright (c) 2024 Huawei Device Co., Ltd.
2cb7eb8c9Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
3cb7eb8c9Sopenharmony_ci# you may not use this file except in compliance with the License.
4cb7eb8c9Sopenharmony_ci# You may obtain a copy of the License at
5cb7eb8c9Sopenharmony_ci#
6cb7eb8c9Sopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
7cb7eb8c9Sopenharmony_ci#
8cb7eb8c9Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software
9cb7eb8c9Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
10cb7eb8c9Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11cb7eb8c9Sopenharmony_ci# See the License for the specific language governing permissions and
12cb7eb8c9Sopenharmony_ci# limitations under the License.
13cb7eb8c9Sopenharmony_ci
14cb7eb8c9Sopenharmony_ci#####################hydra-fuzz###################
15cb7eb8c9Sopenharmony_ciimport("//build/config/features.gni")
16cb7eb8c9Sopenharmony_ciimport("//build/ohos.gni")
17cb7eb8c9Sopenharmony_ciimport("//build/test.gni")
18cb7eb8c9Sopenharmony_ciimport("//foundation/filemanagement/dfs_service/distributedfile.gni")
19cb7eb8c9Sopenharmony_ciohos_fuzztest("CloudSyncServiceStubFuzzTest") {
20cb7eb8c9Sopenharmony_ci  module_out_path = "dfs_service/dfs_service"
21cb7eb8c9Sopenharmony_ci  fuzz_config_file =
22cb7eb8c9Sopenharmony_ci      "${distributedfile_path}/test/fuzztest/cloudsyncservicestub_fuzzer"
23cb7eb8c9Sopenharmony_ci  include_dirs = [
24cb7eb8c9Sopenharmony_ci    "${distributedfile_path}/test/fuzztest/fuzz_common",
25cb7eb8c9Sopenharmony_ci    "${innerkits_native_path}/cloudsync_kit_inner",
26cb7eb8c9Sopenharmony_ci    "${media_library_path}/interfaces/inner_api/media_library_helper/include",
27cb7eb8c9Sopenharmony_ci    "${services_path}/cloudsyncservice/include",
28cb7eb8c9Sopenharmony_ci    "${services_path}/cloudsyncservice/include/cycle_task",
29cb7eb8c9Sopenharmony_ci    "${services_path}/cloudsyncservice/include/cycle_task/tasks",
30cb7eb8c9Sopenharmony_ci    "${services_path}/cloudsyncservice/include/data_sync",
31cb7eb8c9Sopenharmony_ci    "${services_path}/cloudsyncservice/include/data_sync/cloud_disk_data_sync",
32cb7eb8c9Sopenharmony_ci    "${services_path}/cloudsyncservice/include/data_sync/gallery_data_sync",
33cb7eb8c9Sopenharmony_ci    "${services_path}/cloudsyncservice/include/ipc",
34cb7eb8c9Sopenharmony_ci    "${services_path}/cloudsyncservice/include/sync_rule",
35cb7eb8c9Sopenharmony_ci    "${services_path}/cloudsyncservice/include/transport",
36cb7eb8c9Sopenharmony_ci    "${services_path}/cloudsyncservice/include/transport/softbus",
37cb7eb8c9Sopenharmony_ci    "${utils_path}/dentry/include",
38cb7eb8c9Sopenharmony_ci  ]
39cb7eb8c9Sopenharmony_ci  cflags = [
40cb7eb8c9Sopenharmony_ci    "-g",
41cb7eb8c9Sopenharmony_ci    "-O0",
42cb7eb8c9Sopenharmony_ci    "-Wno-unused-variable",
43cb7eb8c9Sopenharmony_ci    "-fno-omit-frame-pointer",
44cb7eb8c9Sopenharmony_ci    "-flto",
45cb7eb8c9Sopenharmony_ci    "-fvisibility=hidden",
46cb7eb8c9Sopenharmony_ci    "-Dprivate=public",
47cb7eb8c9Sopenharmony_ci    "--coverage",
48cb7eb8c9Sopenharmony_ci  ]
49cb7eb8c9Sopenharmony_ci  ldflags = [
50cb7eb8c9Sopenharmony_ci    "-flto",
51cb7eb8c9Sopenharmony_ci    "--coverage",
52cb7eb8c9Sopenharmony_ci  ]
53cb7eb8c9Sopenharmony_ci  sources = [
54cb7eb8c9Sopenharmony_ci    "${distributedfile_path}/services/cloudsyncservice/src/ipc/cloud_sync_service_stub.cpp",
55cb7eb8c9Sopenharmony_ci    "${distributedfile_path}/test/fuzztest/cloudsyncservicestub_fuzzer/cloudsyncservicestub_fuzzer.cpp",
56cb7eb8c9Sopenharmony_ci  ]
57cb7eb8c9Sopenharmony_ci
58cb7eb8c9Sopenharmony_ci  deps = [
59cb7eb8c9Sopenharmony_ci    "${innerkits_native_path}/cloud_file_kit_inner:cloudfile_kit",
60cb7eb8c9Sopenharmony_ci    "${services_path}/cloudsyncservice:cloudsync_sa_static",
61cb7eb8c9Sopenharmony_ci    "${utils_path}:libdistributedfileutils_lite",
62cb7eb8c9Sopenharmony_ci  ]
63cb7eb8c9Sopenharmony_ci
64cb7eb8c9Sopenharmony_ci  external_deps = [
65cb7eb8c9Sopenharmony_ci    "ability_base:want",
66cb7eb8c9Sopenharmony_ci    "access_token:libaccesstoken_sdk",
67cb7eb8c9Sopenharmony_ci    "access_token:libnativetoken_shared",
68cb7eb8c9Sopenharmony_ci    "access_token:libtokensetproc_shared",
69cb7eb8c9Sopenharmony_ci    "c_utils:utils",
70cb7eb8c9Sopenharmony_ci    "device_manager:devicemanagersdk",
71cb7eb8c9Sopenharmony_ci    "ffrt:libffrt",
72cb7eb8c9Sopenharmony_ci    "hilog:libhilog",
73cb7eb8c9Sopenharmony_ci    "ipc:ipc_single",
74cb7eb8c9Sopenharmony_ci    "safwk:system_ability_fwk",
75cb7eb8c9Sopenharmony_ci    "samgr:samgr_proxy",
76cb7eb8c9Sopenharmony_ci  ]
77cb7eb8c9Sopenharmony_ci}
78cb7eb8c9Sopenharmony_ci
79cb7eb8c9Sopenharmony_cigroup("fuzztest") {
80cb7eb8c9Sopenharmony_ci  testonly = true
81cb7eb8c9Sopenharmony_ci  deps = [ ":CloudSyncServiceStubFuzzTest" ]
82cb7eb8c9Sopenharmony_ci}
83