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##########################################
20if (location_feature_with_gnss) {
21  ohos_fuzztest("GnssFuzzTest") {
22    module_out_path = "location/location"
23    fuzz_config_file = "$LOCATION_ROOT_DIR/test/fuzztest/locator/gnss_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 = [ "gnss_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      "c_utils:utils",
49      "common_event_service:cesfwk_innerkits",
50      "core_service:tel_core_service_api",
51      "drivers_interface_location_agnss:liblocation_agnss_proxy_2.0",
52      "drivers_interface_location_gnss:liblocation_gnss_proxy_2.0",
53      "eventhandler:libeventhandler",
54      "ffrt:libffrt",
55      "hilog:libhilog",
56      "hisysevent:libhisysevent",
57      "init:libbegetutil",
58      "ipc:ipc_core",
59      "samgr:samgr_proxy",
60    ]
61
62    defines = []
63
64    if (telephony_core_service_enable) {
65      external_deps += [ "core_service:tel_core_service_api" ]
66      defines += [ "TEL_CORE_SERVICE_ENABLE" ]
67    }
68
69    if (telephony_cellular_data_enable) {
70      external_deps += [ "cellular_data:tel_cellular_data_api" ]
71      defines += [ "TEL_CELLULAR_DATA_ENABLE" ]
72    }
73
74    if (hdf_drivers_interface_location_agnss_enable) {
75      external_deps +=
76          [ "drivers_interface_location_agnss:liblocation_agnss_proxy_2.0" ]
77      defines += [ "HDF_DRIVERS_INTERFACE_AGNSS_ENABLE" ]
78    }
79
80    if (location_feature_with_gnss &&
81        hdf_drivers_interface_location_gnss_enable) {
82      external_deps +=
83          [ "drivers_interface_location_gnss:liblocation_gnss_proxy_2.0" ]
84      defines += [ "FEATURE_GNSS_SUPPORT" ]
85    }
86
87    if (hdf_drivers_interface_location_geofence_enable) {
88      external_deps += [
89        "drivers_interface_location_geofence:liblocation_geofence_proxy_2.0",
90      ]
91      defines += [ "HDF_DRIVERS_INTERFACE_GEOFENCE_ENABLE" ]
92    }
93
94    if (location_feature_with_passive) {
95      defines += [ "FEATURE_PASSIVE_SUPPORT" ]
96    }
97    if (notification_distributed_notification_service_enable) {
98      defines += [ "NOTIFICATION_ENABLE" ]
99    }
100  }
101} else {
102  ohos_fuzztest("GnssFuzzTest") {
103    module_out_path = "location/location"
104  }
105}
106
107###############################################################################
108group("fuzztest") {
109  testonly = true
110  deps = []
111  deps += [
112    # deps file
113    ":GnssFuzzTest",
114  ]
115}
116###############################################################################
117