1# Copyright (c) 2024 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
14#####################hydra-fuzz###################
15import("//build/config/features.gni")
16import("//build/test.gni")
17import("//foundation/filemanagement/app_file_service/app_file_service.gni")
18import("//foundation/filemanagement/app_file_service/backup.gni")
19
20##############################fuzztest##########################################
21ohos_fuzztest("BackupExtFuzzTest") {
22  module_out_path = "app_file_service/app_file_service"
23  fuzz_config_file = "${app_file_service_path}/test/fuzztest/backupext_fuzzer"
24  include_dirs = [
25    "${path_ability_runtime}/services/common/include",
26    "${path_ability_runtime}/interfaces/kits/native/appkit/ability_runtime",
27    "${path_backup}/frameworks/native/backup_ext/include",
28    "${path_backup}/interfaces/inner_api/native/backup_kit_inner/impl",
29    "${path_backup}/utils/include",
30  ]
31  cflags = [
32    "-g",
33    "-O0",
34    "-Wno-unused-variable",
35    "-fno-omit-frame-pointer",
36  ]
37  sources = [
38    "${path_backup}/frameworks/native/backup_ext/src/ext_backup.cpp",
39    "${path_backup}/frameworks/native/backup_ext/src/ext_backup_context.cpp",
40    "${path_backup}/frameworks/native/backup_ext/src/ext_backup_context_js.cpp",
41    "${path_backup}/frameworks/native/backup_ext/src/ext_backup_js.cpp",
42    "${path_backup}/frameworks/native/backup_ext/src/ext_backup_loader.cpp",
43    "${path_backup}/frameworks/native/backup_ext/src/ext_extension.cpp",
44    "${path_backup}/frameworks/native/backup_ext/src/ext_extension_stub.cpp",
45    "${path_backup}/frameworks/native/backup_ext/src/sub_ext_extension.cpp",
46    "${path_backup}/frameworks/native/backup_ext/src/tar_file.cpp",
47    "${path_backup}/frameworks/native/backup_ext/src/untar_file.cpp",
48    "backupext_fuzzer.cpp",
49  ]
50
51  deps = [
52    "${path_backup}/interfaces/inner_api/native/backup_kit_inner:backup_kit_inner",
53    "${path_backup}/interfaces/innerkits/native:sandbox_helper_native",
54    "${path_backup}/utils:backup_utils",
55  ]
56
57  external_deps = [
58    "ability_base:want",
59    "ability_runtime:ability_context_native",
60    "ability_runtime:abilitykit_native",
61    "ability_runtime:app_context",
62    "ability_runtime:appkit_native",
63    "ability_runtime:runtime",
64    "access_token:libaccesstoken_sdk",
65    "bundle_framework:appexecfwk_core",
66    "c_utils:utils",
67    "hilog:libhilog",
68    "hitrace:hitrace_meter",
69    "ipc:ipc_core",
70    "jsoncpp:jsoncpp",
71    "napi:ace_napi",
72  ]
73
74  defines = [
75    "LOG_TAG=\"app_file_service\"",
76    "LOG_DOMAIN=0xD004303",
77    "private = public",
78  ]
79
80  use_exceptions = true
81}
82###############################################################################
83