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