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/test.gni")
17import("//foundation/resourceschedule/background_task_mgr/bgtaskmgr.gni")
18module_output_path = "background_task_mgr/background_task_mgr"
19
20##############################fuzztest##########################################
21ohos_fuzztest("BgTaskSystemEventObserverFuzzTest") {
22  module_out_path = module_output_path
23  fuzz_config_file =
24      "${bgtaskmgr_test_path}/fuzztest/bgtasksystemeventobserver_fuzzer"
25
26  include_dirs = [ "../common" ]
27  cflags = [
28    "-g",
29    "-O0",
30    "-Wno-unused-variable",
31    "-fno-omit-frame-pointer",
32    "-Dprivate=public",
33    "-Dprotected=public",
34  ]
35
36  cflags_cc = [
37    "-fvisibility=hidden",
38    "-fdata-sections",
39    "-ffunction-sections",
40    "-fvisibility-inlines-hidden",
41    "-Os",
42  ]
43
44  sources = [
45    "../common/fuzztest_helper.cpp",
46    "bgtasksystemeventobserver_fuzzer.cpp",
47  ]
48
49  deps = [
50    "${bgtaskmgr_interfaces_path}/innerkits:bgtaskmgr_innerkits",
51    "${bgtaskmgr_services_path}:bgtaskmgr_service_static",
52  ]
53
54  external_deps = [
55    "ability_base:base",
56    "ability_base:want",
57    "ability_base:zuri",
58    "ability_runtime:ability_manager",
59    "ability_runtime:app_manager",
60    "ability_runtime:wantagent_innerkits",
61    "access_token:libaccesstoken_sdk",
62    "access_token:libnativetoken",
63    "access_token:libtoken_setproc",
64    "access_token:libtokenid_sdk",
65    "bundle_framework:appexecfwk_base",
66    "bundle_framework:appexecfwk_core",
67    "c_utils:utils",
68    "common_event_service:cesfwk_innerkits",
69    "eventhandler:libeventhandler",
70    "hilog:libhilog",
71    "hisysevent:libhisysevent",
72    "init:libbegetutil",
73    "ipc:ipc_single",
74    "resource_management:global_resmgr",
75    "safwk:system_ability_fwk",
76    "samgr:samgr_proxy",
77  ]
78
79  if (has_os_account_part) {
80    cflags_cc += [ "-DHAS_OS_ACCOUNT_PART" ]
81    external_deps += [ "os_account:os_account_innerkits" ]
82  }
83
84  if (distributed_notification_enable) {
85    cflags_cc += [ "-DDISTRIBUTED_NOTIFICATION_ENABLE" ]
86    external_deps += [ "distributed_notification_service:ans_innerkits" ]
87    sources += [ "${bgtaskmgr_services_path}/continuous_task/src/task_notification_subscriber.cpp" ]
88  }
89
90  if (background_task_mgr_graphics) {
91    cflags_cc += [ "-DSUPPORT_GRAPHICS" ]
92    external_deps += [ "i18n:intl_util" ]
93  }
94
95  subsystem_name = "resourceschedule"
96  part_name = "background_task_mgr"
97}
98
99###############################################################################
100group("fuzztest") {
101  testonly = true
102  deps = []
103  deps += [
104    # deps file
105    ":BgTaskSystemEventObserverFuzzTest",
106  ]
107}
108###############################################################################
109