• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2024 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("../../../services/samgr/var.gni")
19module_output_path = "samgr/samgr"
20samgr_dir = "../../.."
21samgr_services_dir = "${samgr_dir}/services/samgr/native"
22
23config("sam_fuzz_test_config") {
24  include_dirs = [
25    "${samgr_dir}/services/dfx/include",
26    "${samgr_dir}/services/lsamgr/include",
27    "${samgr_dir}/services/samgr/native/test/unittest/include",
28  ]
29}
30
31##############################fuzztest##########################################
32ohos_fuzztest("SamgrDumperFuzzTest") {
33  module_out_path = module_output_path
34
35  fuzz_config_file = "${samgr_dir}/test/fuzztest/samgrdumper_fuzzer"
36
37  configs = [
38    ":sam_fuzz_test_config",
39    "${samgr_dir}/services/samgr/native:sam_config",
40    "${samgr_dir}/test/resource:coverage_flags",
41  ]
42
43  cflags = [
44    "-g",
45    "-O0",
46    "-Wno-unused-variable",
47    "-fno-omit-frame-pointer",
48  ]
49  sources = [
50    "${samgr_dir}/services/dfx/source/hisysevent_adapter.cpp",
51    "${samgr_dir}/utils/native/source/tools.cpp",
52    "${samgr_services_dir}/source/ability_death_recipient.cpp",
53    "${samgr_services_dir}/source/collect/device_param_collect.cpp",
54    "${samgr_services_dir}/source/collect/device_status_collect_manager.cpp",
55    "${samgr_services_dir}/source/collect/device_timed_collect.cpp",
56    "${samgr_services_dir}/source/collect/icollect_plugin.cpp",
57    "${samgr_services_dir}/source/ffrt_handler.cpp",
58    "${samgr_services_dir}/source/memory_guard.cpp",
59    "${samgr_services_dir}/source/rpc_callback_imp.cpp",
60    "${samgr_services_dir}/source/samgr_time_handler.cpp",
61    "${samgr_services_dir}/source/schedule/system_ability_event_handler.cpp",
62    "${samgr_services_dir}/source/schedule/system_ability_state_machine.cpp",
63    "${samgr_services_dir}/source/schedule/system_ability_state_scheduler.cpp",
64    "${samgr_services_dir}/source/system_ability_manager.cpp",
65    "${samgr_services_dir}/source/system_ability_manager_dumper.cpp",
66    "${samgr_services_dir}/source/system_ability_manager_stub.cpp",
67    "${samgr_services_dir}/source/system_ability_manager_util.cpp",
68    "${samgr_services_dir}/test/unittest/src/mock_permission.cpp",
69    "${samgr_services_dir}/test/unittest/src/sa_status_change_mock.cpp",
70    "samgrdumper_fuzzer.cpp",
71  ]
72  deps = [ "//foundation/systemabilitymgr/samgr/interfaces/innerkits/dynamic_cache:dynamic_cache" ]
73
74  external_deps = [
75    "access_token:libaccesstoken_sdk",
76    "c_utils:utils",
77    "config_policy:configpolicy_util",
78    "ffrt:libffrt",
79    "hilog:libhilog",
80    "hisysevent:libhisysevent",
81    "hisysevent:libhisysevent_easy",
82    "hitrace:hitrace_meter",
83    "init:libbeget_proxy",
84    "init:libbegetutil",
85    "ipc:ipc_core",
86    "ipc:ipc_single",
87    "ipc:libdbinder",
88    "json:nlohmann_json_static",
89    "safwk:system_ability_fwk",
90    "samgr:samgr_common",
91    "samgr:samgr_proxy",
92  ]
93  defines = []
94  if (hicollie_able) {
95    external_deps += [ "hicollie:libhicollie" ]
96    defines += [ "HICOLLIE_ENABLE" ]
97  }
98
99  if (samgr_support_access_token) {
100    external_deps += [
101      "access_token:libnativetoken_shared",
102      "access_token:libtokensetproc_shared",
103    ]
104    defines += [ "SUPPORT_ACCESS_TOKEN" ]
105  }
106
107  if (support_device_manager) {
108    sources +=
109        [ "${samgr_services_dir}/source/collect/device_networking_collect.cpp" ]
110    external_deps += [ "device_manager:devicemanagersdk" ]
111    defines += [ "SUPPORT_DEVICE_MANAGER" ]
112  }
113
114  if (support_penglai_mode) {
115    defines += [ "SUPPORT_PENGLAI_MODE" ]
116  }
117  defines += ["SAMGR_USE_FFRT"]
118}
119
120group("fuzztest") {
121  testonly = true
122  deps = []
123
124  deps += [
125    # deps file
126    ":SamgrDumperFuzzTest",
127  ]
128}
129