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("//base/location/config.gni")
16import("//build/config/features.gni")
17import("//build/test.gni")
18
19##############################fuzztest##########################################
20ohos_fuzztest("CachedLocationCallbackHostFuzzTest") {
21  module_out_path = "location/location"
22  fuzz_config_file = "$LOCATION_ROOT_DIR/test/fuzztest/locator/cachedlocationcallbackhost_fuzzer"
23  include_dirs = [
24    "$LOCATION_ROOT_DIR/frameworks/js/napi/include",
25    "$LOCATION_ROOT_DIR/interfaces/inner_api/include",
26    "$LOCATION_ROOT_DIR/services/location_locator/locator/include",
27    "$LOCATION_ROOT_DIR/services/location_locator/callback/include",
28    "$LOCATION_ROOT_DIR/services/location_network/network/include",
29    "$LOCATION_ROOT_DIR/services/location_passive/passive/include",
30    "$LOCATION_ROOT_DIR/services/location_geocode/geocode/include",
31    "$LOCATION_ROOT_DIR/services/location_gnss/gnss/include",
32  ]
33  cflags = [
34    "-g",
35    "-O0",
36    "-Wno-unused-variable",
37    "-fno-omit-frame-pointer",
38  ]
39  sources = [ "cachedlocationcallbackhost_fuzzer.cpp" ]
40  deps = [
41    "$LOCATION_ROOT_DIR/frameworks/js/napi:geolocation_static",
42    "$LOCATION_ROOT_DIR/frameworks/location_common/common:lbsservice_common_static",
43    "$LOCATION_ROOT_DIR/frameworks/native/geofence_sdk:geofence_sdk_static",
44    "$LOCATION_ROOT_DIR/frameworks/native/locator_sdk:locator_sdk_static",
45    "$LOCATION_ROOT_DIR/services/location_geocode/geocode:lbsservice_geocode_static",
46    "$LOCATION_ROOT_DIR/services/location_gnss/gnss:lbsservice_gnss_static",
47    "$LOCATION_ROOT_DIR/services/location_locator/locator:lbsservice_locator_static",
48    "$LOCATION_ROOT_DIR/services/location_network/network:lbsservice_network_static",
49    "$LOCATION_ROOT_DIR/services/location_passive/passive:lbsservice_passive_static",
50    "//third_party/libuv:uv",
51  ]
52  external_deps = [
53    "access_token:libaccesstoken_sdk",
54    "access_token:libnativetoken",
55    "access_token:libtoken_setproc",
56    "c_utils:utils",
57    "common_event_service:cesfwk_innerkits",
58    "core_service:tel_core_service_api",
59    "drivers_interface_location_agnss:liblocation_agnss_proxy_2.0",
60    "drivers_interface_location_gnss:liblocation_gnss_proxy_2.0",
61    "eventhandler:libeventhandler",
62    "ffrt:libffrt",
63    "hilog:libhilog",
64    "hisysevent:libhisysevent",
65    "init:libbegetutil",
66    "ipc:ipc_core",
67    "napi:ace_napi",
68    "safwk:system_ability_fwk",
69    "samgr:samgr_proxy",
70  ]
71
72  defines = []
73  if (location_feature_with_geocode) {
74    defines += [ "FEATURE_GEOCODE_SUPPORT" ]
75  }
76
77  if (location_feature_with_gnss) {
78    defines += [ "FEATURE_GNSS_SUPPORT" ]
79  }
80
81  if (location_feature_with_network) {
82    defines += [ "FEATURE_NETWORK_SUPPORT" ]
83  }
84
85  if (location_feature_with_passive) {
86    defines += [ "FEATURE_PASSIVE_SUPPORT" ]
87  }
88}
89
90###############################################################################
91group("fuzztest") {
92  testonly = true
93  deps = []
94  deps += [
95    # deps file
96    ":CachedLocationCallbackHostFuzzTest",
97  ]
98}
99###############################################################################
100