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
14import("//build/config/features.gni")
15import("//build/ohos.gni")
16import("//build/test.gni")
17import("../../../callmanager.gni")
18
19#####################hydra-fuzz###################
20CALL_MANAGER_PATH = "../../.."
21
22##############################fuzztest##########################################
23
24ohos_fuzztest("AudioDeviceFuzzTest") {
25  module_output_path = "call_manager/call_manager"
26  module_out_path = module_output_path
27  fuzz_config_file = "${CALL_MANAGER_PATH}/test/fuzztest/audiodevice_fuzzer"
28  _cfi_blocklist_path = "../../cfi_blocklist.txt"
29
30  include_dirs = [
31    "${CALL_MANAGER_PATH}/interfaces/innerkits",
32    "${CALL_MANAGER_PATH}/test/fuzztest/common_fuzzer",
33  ]
34  include_dirs += call_manager_include_dirs
35
36  deps = [
37    "${CALL_MANAGER_PATH}/frameworks/native:tel_call_manager_api",
38    "//third_party/cJSON:cjson",
39    "//third_party/libphonenumber/cpp:phonenumber_standard",
40  ]
41
42  external_deps = [
43    "access_token:libnativetoken",
44    "access_token:libtoken_setproc",
45  ]
46  external_deps += call_manager_external_deps
47
48  defines = [
49    "TELEPHONY_LOG_TAG = \"CallManagerFuzzTest\"",
50    "LOG_DOMAIN = 0xD000F00",
51  ]
52  defines += call_manager_defines
53
54  cflags = [
55    "-g",
56    "-O0",
57    "-Wno-unused-variable",
58    "-fno-omit-frame-pointer",
59    "-flto",
60    "-fvisibility=hidden",
61    "-fsanitize=cfi",
62    "-fsanitize-cfi-cross-dso",
63    "-fsanitize-blacklist=" + rebase_path(_cfi_blocklist_path, root_build_dir),
64  ]
65
66  ldflags = [
67    "-flto",
68    "-fsanitize=cfi",
69    "-fsanitize-cfi-cross-dso",
70  ]
71
72  sources = [
73    "${CALL_MANAGER_PATH}/test/fuzztest/common_fuzzer/addcalltoken_fuzzer.cpp",
74    "audiodevice_fuzzer.cpp",
75  ]
76  sources += call_manager_sources
77}
78
79###############################################################################
80group("fuzztest") {
81  testonly = true
82  deps = []
83  deps += [
84    # deps file
85    ":AudioDeviceFuzzTest",
86  ]
87}
88###############################################################################
89