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