• 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")
18import("../../../services/samgr/var.gni")
19module_output_path = "samgr/samgr"
20samgr_dir = "//foundation/systemabilitymgr/samgr"
21samgr_services_dir = "${samgr_dir}/services/samgr/native"
22
23config("sam_fuzz_test_config") {
24  include_dirs = [
25    "//foundation/systemabilitymgr/samgr/services/dfx/include",
26    "//foundation/systemabilitymgr/samgr/services/lsamgr/include",
27    "//foundation/systemabilitymgr/samgr/services/samgr/native/test/unittest/include",
28  ]
29}
30
31##############################fuzztest##########################################
32ohos_fuzztest("SystemAbilityManagerFuzzTest") {
33  module_out_path = module_output_path
34
35  fuzz_config_file = "//foundation/systemabilitymgr/samgr/test/fuzztest/systemabilitymanager_fuzzer"
36
37  configs = [
38    ":sam_fuzz_test_config",
39    "${samgr_dir}/services/samgr/native:sam_config",
40    "//foundation/systemabilitymgr/samgr/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}/utils/native/source/tools.cpp",
51    "${samgr_services_dir}/source/collect/device_param_collect.cpp",
52    "${samgr_services_dir}/source/collect/device_status_collect_manager.cpp",
53    "${samgr_services_dir}/source/collect/device_timed_collect.cpp",
54    "${samgr_services_dir}/source/collect/icollect_plugin.cpp",
55    "${samgr_services_dir}/source/memory_guard.cpp",
56    "${samgr_services_dir}/source/schedule/system_ability_event_handler.cpp",
57    "${samgr_services_dir}/source/schedule/system_ability_state_machine.cpp",
58    "${samgr_services_dir}/source/schedule/system_ability_state_scheduler.cpp",
59    "${samgr_services_dir}/source/system_ability_manager.cpp",
60    "${samgr_services_dir}/source/system_ability_manager_stub.cpp",
61    "//foundation/systemabilitymgr/samgr/services/dfx/source/hicollie_helper.cpp",
62    "//foundation/systemabilitymgr/samgr/services/dfx/source/hisysevent_adapter.cpp",
63    "//foundation/systemabilitymgr/samgr/services/samgr/native/source/ability_death_recipient.cpp",
64    "//foundation/systemabilitymgr/samgr/services/samgr/native/source/rpc_callback_imp.cpp",
65    "//foundation/systemabilitymgr/samgr/services/samgr/native/test/unittest/src/mock_permission.cpp",
66    "systemabilitymanager_fuzzer.cpp",
67  ]
68  deps = []
69
70  external_deps = [
71    "access_token:libaccesstoken_sdk",
72    "access_token:libnativetoken",
73    "access_token:libtoken_setproc",
74    "c_utils:utils",
75    "eventhandler:libeventhandler",
76    "hilog:libhilog",
77    "hisysevent:libhisysevent",
78    "hitrace:hitrace_meter",
79    "init:libbeget_proxy",
80    "init:libbegetutil",
81    "ipc:ipc_core",
82    "ipc:libdbinder",
83    "safwk:system_ability_fwk",
84    "samgr:samgr_common",
85    "samgr:samgr_proxy",
86  ]
87  defines = []
88  if (hicollie_able) {
89    external_deps += [ "hicollie:libhicollie" ]
90    defines += [ "HICOLLIE_ENABLE" ]
91  }
92
93  if (ressched_able) {
94    external_deps += [ "resource_schedule_service:ressched_client" ]
95    defines += [ "RESSCHED_ENABLE" ]
96  }
97
98  if (support_device_manager) {
99    sources +=
100        [ "${samgr_services_dir}/source/collect/device_networking_collect.cpp" ]
101    external_deps += [ "device_manager:devicemanagersdk" ]
102    defines += [ "SUPPORT_DEVICE_MANAGER" ]
103  }
104}
105
106group("fuzztest") {
107  testonly = true
108  deps = []
109
110  deps += [
111    # deps file
112    ":SystemAbilityManagerFuzzTest",
113  ]
114}
115