1# Copyright (c) 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
14module_output_path = "updater/updater"
15
16import("//base/update/updater/updater_default_cfg.gni")
17
18#####################hydra-fuzz###################
19import("//build/config/features.gni")
20import("//build/test.gni")
21updater_path = rebase_path("${updater_absolutely_path}", ".")
22
23##############################fuzztest##########################################
24ohos_fuzztest("BinFlowFuzzTest") {
25  module_out_path = module_output_path
26  resource_config_file =
27      "${updater_path}/test/fuzztest/fuzz_src_data/ohos_test.xml"
28  fuzz_config_file = "${updater_path}/test/fuzztest/binflow_fuzzer"
29  sources = [ "binflow_fuzzer.cpp" ]
30
31  sources += [
32    "${updater_path}/services/flow_update/update_bin/bin_flow_update.cpp",
33    "${updater_path}/services/flow_update/update_bin/bin_process.cpp",
34    "${updater_path}/services/flow_update/update_bin/component_processor.cpp",
35    "${updater_path}/services/updater_binary/update_image_block.cpp",
36    "${updater_path}/services/updater_binary/update_image_patch.cpp",
37    "${updater_path}/services/updater_binary/update_partitions.cpp",
38    "${updater_path}/services/updater_binary/update_processor.cpp",
39  ]
40
41  include_dirs = [
42    "${updater_path}/interfaces/kits/include",
43    "${updater_path}/services",
44    "${updater_path}/services/common",
45    "${updater_path}/services/flow_update",
46    "${updater_path}/services/include",
47    "${updater_path}/services/include/applypatch",
48    "${updater_path}/services/include/log",
49    "${updater_path}/services/include/package",
50    "${updater_path}/services/include/script",
51    "${updater_path}/services/package",
52    "${updater_path}/services/package/pkg_algorithm",
53    "${updater_path}/services/package/pkg_manager",
54    "${updater_path}/services/package/pkg_package",
55    "${updater_path}/services/script",
56    "${updater_path}/services/flow_update/update_bin",
57    "${updater_path}/test/unittest",
58    "${updater_path}/utils/include",
59  ]
60
61  deps = [
62    "${updater_path}/interfaces/kits/misc_info:libmiscinfo",
63    "${updater_path}/interfaces/kits/packages:libpackageExt",
64    "${updater_path}/interfaces/kits/slot_info:libslotinfo",
65    "${updater_path}/services/applypatch:libapplypatch",
66    "${updater_path}/services/fs_manager:libfsmanager",
67    "${updater_path}/services/log:libupdaterlog",
68    "${updater_path}/services/package:libupdaterpackage",
69    "${updater_path}/services/script:libupdaterscript",
70    "${updater_path}/utils:libutils",
71  ]
72  external_deps = [
73    "bounds_checking_function:libsec_static",
74    "bzip2:libbz2",
75    "cJSON:cjson",
76    "hilog:libhilog",
77    "init:libbegetutil_static",
78    "openssl:libcrypto_shared",
79  ]
80
81  cflags = [
82    "-g",
83    "-O0",
84    "-Wno-unused-variable",
85    "-fno-omit-frame-pointer",
86  ]
87
88  defines = [ "UPDATER_UT" ]
89  subsystem_name = "updater"
90  part_name = "updater"
91}
92