1# Copyright (c) 2022 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/distributeddatamgr/relational_store/relational_store.gni")
18
19##############################fuzztest##########################################
20ohos_fuzztest("RdbImplFuzzTest") {
21  module_out_path = "relational_store/relational_store"
22
23  include_dirs = [
24    "${relational_store_native_path}/rdb/include",
25    "${relational_store_innerapi_path}/rdb/include",
26    "${distributeddata_base_path}/kv_store/frameworks/innerkitsimpl/rdb",
27    "${distributeddata_base_path}/kv_store/frameworks/innerkitsimpl/rdb/include",
28    "${common_tool_path}/",
29    "//third_party/sqlite/include",
30    "${distributeddata_base_path}/kv_store/frameworks/libs/distributeddb/common/include/relational",
31    "//third_party/jsoncpp/include/json",
32    "//third_party/skia/third_party/externals/spirv-headers/tools/buildHeaders/jsoncpp/dist/json",
33    "//third_party/skia/third_party/externals/swiftshader/third_party/SPIRV-Headers/tools/buildHeaders/jsoncpp/dist/json",
34    "//third_party/jsoncpp/include/json",
35    "//third_party/grpc/src/core/lib/json",
36    "${foundation_systemabilitymgr_path}/safwk/services/safwk/include",
37    "${foundation_systemabilitymgr_path}/samgr/interfaces/innerkits/samgr_proxy/include",
38    "${base_security_dataclassification_path}/interfaces/innerkits/datatransmitmgr/include",
39    "//third_party/json/single_include",
40    "//third_party/googletest/googletest/include/gtest",
41  ]
42
43  cflags = [
44    "-g",
45    "-O0",
46    "-Wno-unused-variable",
47    "-fno-omit-frame-pointer",
48  ]
49
50  fuzz_config_file =
51      "${relational_store_base_path}/test/native/rdb/fuzztest/rdbimpl_fuzzer"
52
53  sources = [ "rdbimpl_fuzzer.cpp" ]
54
55  deps = [
56    "${distributeddata_base_path}/kv_store/frameworks/libs/distributeddb:distributeddb",
57    "${distributeddata_base_path}/relational_store/interfaces/inner_api/rdb:native_rdb_static",
58    "//third_party/jsoncpp:jsoncpp",
59  ]
60
61  external_deps = [
62    "ability_base:zuri",
63    "ability_runtime:dataobs_manager",
64    "c_utils:utils",
65    "hilog:libhilog",
66    "ipc:ipc_core",
67  ]
68}
69
70###############################################################################
71group("fuzztest") {
72  testonly = true
73  deps = []
74  deps += [
75    # deps file
76    ":RdbImplFuzzTest",
77  ]
78}
79###############################################################################
80