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/work_scheduler/workscheduler.gni")
18module_output_path = "work_scheduler/work_scheduler"
19
20config("worksched_private_config") {
21  include_dirs = [
22    "${worksched_service_path}/zidl/include",
23    "${worksched_service_path}/native/include",
24  ]
25}
26
27##############################fuzztest##########################################
28ohos_fuzztest("WorkSchedulerStopAndClearWorksFuzzTest") {
29  module_out_path = module_output_path
30  fuzz_config_file =
31      "${worksched_test_path}/fuzztest/workschedulerstopandclearworks_fuzzer"
32
33  configs = [ ":worksched_private_config" ]
34  cflags = [
35    "-g",
36    "-O0",
37    "-Wno-unused-variable",
38    "-fno-omit-frame-pointer",
39    "-Dprivate=public",
40    "-Dprotected=public",
41  ]
42  sources = [ "workschedulerstopandclearworks_fuzzer.cpp" ]
43
44  deps = [
45    "${worksched_frameworks_path}:workschedclient",
46    "${worksched_frameworks_path}/extension:workschedextension",
47    "${worksched_service_path}:workschedservice_static",
48    "${worksched_utils_path}:workschedutils",
49    "//third_party/jsoncpp",
50  ]
51
52  external_deps = [
53    "ability_base:want",
54    "ability_runtime:ability_manager",
55    "ability_runtime:app_manager",
56    "bundle_framework:appexecfwk_base",
57    "bundle_framework:appexecfwk_core",
58    "c_utils:utils",
59    "common_event_service:cesfwk_innerkits",
60    "data_share:datashare_consumer",
61    "eventhandler:libeventhandler",
62    "ffrt:libffrt",
63    "hilog:libhilog",
64    "hisysevent:libhisysevent",
65    "ipc:ipc_single",
66    "resource_management:global_resmgr",
67    "safwk:system_ability_fwk",
68    "samgr:samgr_proxy",
69  ]
70
71  resource_config_file = "${worksched_test_path}/resource/ohos_test.xml"
72
73  defines = [ "WORK_SCHEDULER_TEST" ]
74  if (bundle_active_enable) {
75    external_deps += [ "device_usage_statistics:usagestatsinner" ]
76    defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ]
77  }
78  if (device_standby_enable) {
79    external_deps += [ "device_standby:standby_innerkits" ]
80    defines += [ "DEVICE_STANDBY_ENABLE" ]
81  }
82  if (resourceschedule_bgtaskmgr_enable) {
83    external_deps += [ "background_task_mgr:bgtaskmgr_innerkits" ]
84    defines += [ "RESOURCESCHEDULE_BGTASKMGR_ENABLE" ]
85  }
86  if (powermgr_battery_manager_enable) {
87    external_deps += [ "battery_manager:batterysrv_client" ]
88    defines += [ "POWERMGR_BATTERY_MANAGER_ENABLE" ]
89  }
90  if (powermgr_thermal_manager_enable) {
91    external_deps += [ "thermal_manager:thermalsrv_client" ]
92    defines += [ "POWERMGR_THERMAL_MANAGER_ENABLE" ]
93  }
94  if (powermgr_power_manager_enable) {
95    external_deps += [ "power_manager:powermgr_client" ]
96    defines += [ "POWERMGR_POWER_MANAGER_ENABLE" ]
97  }
98  if (workscheduler_with_communication_netmanager_base_enable) {
99    defines += [ "COMMUNICATION_NETMANAGER_BASE_ENABLE" ]
100    external_deps += [ "netmanager_base:net_conn_manager_if" ]
101  }
102}
103
104###############################################################################
105group("fuzztest") {
106  testonly = true
107  deps = []
108  deps += [
109    # deps file
110    ":WorkSchedulerStopAndClearWorksFuzzTest",
111  ]
112}
113###############################################################################
114