• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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")
18module_output_path = "samgr/samgr"
19samgr_dir = "//foundation/systemabilitymgr/samgr"
20samgr_services_dir = "${samgr_dir}/services/samgr/native"
21
22config("sam_fuzz_test_config") {
23  include_dirs = [
24    "//foundation/systemabilitymgr/samgr/services/dfx/include",
25    "//foundation/systemabilitymgr/samgr/services/lsamgr/include",
26    "//foundation/systemabilitymgr/samgr/services/samgr/native/test/unittest/include",
27  ]
28}
29
30##############################fuzztest##########################################
31ohos_fuzztest("SystemAbilityManagerFuzzTest") {
32  module_out_path = module_output_path
33
34  fuzz_config_file = "//foundation/systemabilitymgr/samgr/test/fuzztest/systemabilitymanager_fuzzer"
35
36  configs = [
37    ":sam_fuzz_test_config",
38    "${samgr_dir}/services/samgr/native:sam_config",
39    "//foundation/systemabilitymgr/samgr/test/resource:coverage_flags",
40  ]
41
42  cflags = [
43    "-g",
44    "-O0",
45    "-Wno-unused-variable",
46    "-fno-omit-frame-pointer",
47  ]
48  sources = [
49    "${samgr_dir}/utils/native/source/tools.cpp",
50    "${samgr_services_dir}/source/system_ability_manager.cpp",
51    "${samgr_services_dir}/source/system_ability_manager_stub.cpp",
52    "//foundation/systemabilitymgr/samgr/services/dfx/source/hisysevent_adapter.cpp",
53    "//foundation/systemabilitymgr/samgr/services/samgr/native/source/ability_death_recipient.cpp",
54    "//foundation/systemabilitymgr/samgr/services/samgr/native/source/rpc_callback_imp.cpp",
55    "//foundation/systemabilitymgr/samgr/services/samgr/native/test/unittest/src/mock_permission.cpp",
56    "systemabilitymanager_fuzzer.cpp",
57  ]
58  deps = []
59
60  external_deps = [
61    "access_token:libaccesstoken_sdk",
62    "access_token:libnativetoken",
63    "access_token:libtoken_setproc",
64    "c_utils:utils",
65    "eventhandler:libeventhandler",
66    "hisysevent_native:libhisysevent",
67    "hitrace_native:hitrace_meter",
68    "hiviewdfx_hilog_native:libhilog",
69    "init:libbeget_proxy",
70    "init:libbegetutil",
71    "ipc:ipc_core",
72    "ipc:libdbinder",
73    "samgr:samgr_common",
74    "samgr:samgr_proxy",
75  ]
76  public_deps = [ "//third_party/libxml2:libxml2" ]
77}
78
79group("fuzztest") {
80  testonly = true
81  deps = []
82
83  deps += [
84    # deps file
85    ":SystemAbilityManagerFuzzTest",
86  ]
87}
88