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("GnssAbilityFuzzTest") {
21  module_out_path = "location/location"
22  fuzz_config_file =
23      "$LOCATION_ROOT_DIR/test/fuzztest/locator/gnssability_fuzzer"
24  include_dirs = [
25    "$LOCATION_GNSS_ROOT/include",
26    "$LOCATION_LOCATOR_ROOT/include",
27    "$LOCATION_ROOT_DIR/interfaces/inner_api/include",
28  ]
29  cflags = [
30    "-g",
31    "-O0",
32    "-Wno-unused-variable",
33    "-fno-omit-frame-pointer",
34  ]
35  sources = [ "gnssability_fuzzer.cpp" ]
36  deps = [
37    "$ARKUI_ROOT_DIR/napi:ace_napi",
38    "$LOCATION_GNSS_ROOT:lbsservice_gnss_static",
39    "$LOCATION_LOCATOR_ROOT:lbsservice_locator_static",
40    "$LOCATION_ROOT_DIR/frameworks/js/napi:geolocation_static",
41    "$LOCATION_ROOT_DIR/frameworks/location_common/common:lbsservice_common_static",
42    "$LOCATION_ROOT_DIR/frameworks/native/geofence_sdk:geofence_sdk_static",
43    "$LOCATION_ROOT_DIR/frameworks/native/locator_sdk:locator_sdk_static",
44    "$SAMGR_ROOT_DIR/safwk/interfaces/innerkits/safwk:system_ability_fwk",
45  ]
46  external_deps = [
47    "access_token:libaccesstoken_sdk",
48    "access_token:libnativetoken",
49    "access_token:libtoken_setproc",
50    "c_utils:utils",
51    "common_event_service:cesfwk_innerkits",
52    "core_service:tel_core_service_api",
53    "drivers_interface_location_agnss:liblocation_agnss_proxy_2.0",
54    "drivers_interface_location_gnss:liblocation_gnss_proxy_2.0",
55    "eventhandler:libeventhandler",
56    "ffrt:libffrt",
57    "hilog:libhilog",
58    "hisysevent:libhisysevent",
59    "init:libbegetutil",
60    "ipc:ipc_core",
61    "samgr:samgr_proxy",
62  ]
63
64  defines = []
65
66  if (telephony_core_service_enable) {
67    external_deps += [ "core_service:tel_core_service_api" ]
68    defines += [ "TEL_CORE_SERVICE_ENABLE" ]
69  }
70
71  if (telephony_cellular_data_enable) {
72    external_deps += [ "cellular_data:tel_cellular_data_api" ]
73    defines += [ "TEL_CELLULAR_DATA_ENABLE" ]
74  }
75
76  if (hdf_drivers_interface_location_agnss_enable) {
77    external_deps +=
78        [ "drivers_interface_location_agnss:liblocation_agnss_proxy_2.0" ]
79    defines += [ "HDF_DRIVERS_INTERFACE_AGNSS_ENABLE" ]
80  }
81
82  if (location_feature_with_gnss &&
83      hdf_drivers_interface_location_gnss_enable) {
84    external_deps +=
85        [ "drivers_interface_location_gnss:liblocation_gnss_proxy_2.0" ]
86    defines += [ "FEATURE_GNSS_SUPPORT" ]
87  }
88
89  if (hdf_drivers_interface_location_geofence_enable) {
90    external_deps +=
91        [ "drivers_interface_location_geofence:liblocation_geofence_proxy_2.0" ]
92    defines += [ "HDF_DRIVERS_INTERFACE_GEOFENCE_ENABLE" ]
93  }
94
95  if (location_feature_with_passive) {
96    defines += [ "FEATURE_PASSIVE_SUPPORT" ]
97  }
98}
99
100###############################################################################
101group("fuzztest") {
102  testonly = true
103  deps = []
104  deps += [
105    # deps file
106    ":GnssAbilityFuzzTest",
107  ]
108}
109###############################################################################
110