1# Copyright (c) 2022-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/device_standby/standby_service.gni")
18module_output_path = "device_standby/device_standby"
19
20##############################fuzztest##########################################
21ohos_fuzztest("DeviceStandbyFuzzTest") {
22  module_out_path = module_output_path
23  fuzz_config_file =
24      "${standby_service_path}/test/fuzztest/devicestandby_fuzzer"
25
26  include_dirs = [
27    "${standby_service_path}/include",
28    "${standby_innerkits_path}:standby_innerkits",
29    "${standby_utils_common_path}:standby_utils_common",
30    "${standby_utils_policy_path}:standby_utils_policy",
31  ]
32
33  cflags = [
34    "-g",
35    "-O0",
36    "-Wno-unused-variable",
37    "-fno-omit-frame-pointer",
38  ]
39
40  cflags_cc = [
41    "-Dprivate=public",
42    "-Dprotected=public",
43  ]
44
45  deps = [
46    "${standby_innerkits_path}:standby_innerkits",
47    "${standby_service_frameworks_path}:standby_fwk",
48    "${standby_service_path}:standby_service_static",
49    "${standby_utils_common_path}:standby_utils_common",
50    "${standby_utils_policy_path}:standby_utils_policy",
51  ]
52
53  sources = [ "devicestandby_fuzzer.cpp" ]
54
55  external_deps = [
56    "ability_base:base",
57    "ability_base:want",
58    "ability_base:zuri",
59    "ability_runtime:app_manager",
60    "ability_runtime:wantagent_innerkits",
61    "bundle_framework:appexecfwk_base",
62    "c_utils:utils",
63    "common_event_service:cesfwk_innerkits",
64    "eventhandler:libeventhandler",
65    "hilog:libhilog",
66    "init:libbegetutil",
67    "ipc:ipc_single",
68    "safwk:system_ability_fwk",
69    "samgr:samgr_proxy",
70    "time_service:time_client",
71  ]
72
73  defines = []
74  if (standby_power_manager_enable) {
75    external_deps += [ "power_manager:powermgr_client" ]
76    defines += [ "STANDBY_POWER_MANAGER_ENABLE" ]
77  }
78  if (device_standby_access_token_enable) {
79    external_deps += [
80      "access_token:libaccesstoken_sdk",
81      "access_token:libnativetoken",
82      "access_token:libtoken_setproc",
83      "access_token:libtokenid_sdk",
84    ]
85    defines += [ "DEVICE_STANDBY_ACCESS_TOKEN_ENABLE" ]
86  }
87}
88
89###############################################################################
90group("fuzztest") {
91  testonly = true
92  deps = []
93  deps += [
94    # deps file
95    ":DeviceStandbyFuzzTest",
96  ]
97}
98###############################################################################
99