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 14import("//build/test.gni") 15import("../../../powermgr.gni") 16 17module_output_path = "power_manager/power_manager" 18 19##############################fuzztest########################################## 20ohos_fuzztest("SetForceTimingOutFuzzTest") { 21 module_out_path = module_output_path 22 fuzz_config_file = 23 "${powermgr_root_path}/test/fuzztest/setforcetimingout_fuzzer" 24 25 include_dirs = [ 26 "${powermgr_service_path}/native/src/hibernate", 27 "${powermgr_service_path}/native/src/proximity_sensor_controller", 28 "${powermgr_service_path}/native/src/runninglock", 29 "${powermgr_service_path}/native/src/shutdown", 30 "${powermgr_service_path}/native/src/suspend", 31 "${powermgr_service_path}/native/src/wakeup", 32 "${powermgr_service_path}/native/src/screenoffpre", 33 "../power_utils", 34 ] 35 36 if (power_manager_feature_wakeup_action) { 37 include_dirs += [ "${powermgr_service_path}/native/src/wakeup_action" ] 38 } 39 40 configs = [ 41 "${powermgr_utils_path}:coverage_flags", 42 "${powermgr_utils_path}:utils_config", 43 ] 44 45 cflags = [ 46 "-g", 47 "-O0", 48 "-Wno-unused-variable", 49 "-fno-omit-frame-pointer", 50 ] 51 sources = [ 52 "../power_utils/power_fuzzer.cpp", 53 "./setforcetimingout_fuzzer_test.cpp", 54 ] 55 deps = [ 56 "${powermgr_inner_api}:powermgr_stub", 57 "${powermgr_service_path}:powermgrservice", 58 "${powermgr_service_path}/native/src/actions:powermgr_actions", 59 ] 60 61 external_deps = [ 62 "ability_runtime:ability_manager", 63 "cJSON:cjson", 64 "c_utils:utils", 65 "ffrt:libffrt", 66 "hilog:libhilog", 67 "input:libmmi-client", 68 "ipc:ipc_core", 69 "libxml2:libxml2", 70 "power_manager:power_ffrt", 71 "safwk:system_ability_fwk", 72 "window_manager:libwm_lite", 73 ] 74 defines = [] 75 76 if (has_hiviewdfx_hisysevent_part) { 77 external_deps += [ "hisysevent:libhisysevent" ] 78 } 79 80 if (has_hiviewdfx_hitrace_part) { 81 external_deps += [ "hitrace:hitrace_meter" ] 82 } 83 84 if (power_manager_feature_movement) { 85 defines += [ "MSDP_MOVEMENT_ENABLE" ] 86 } 87 88 if (use_libfuzzer) { 89 defines += [ "FUZZ_TEST" ] 90 } 91 92 if (power_manager_feature_screen_on_timeout_check) { 93 defines += [ "SCREEN_ON_TIMEOUT_CHECK" ] 94 external_deps += [ 95 "ability_runtime:app_manager", 96 "window_manager:libwm", 97 ] 98 } 99 100 if (has_display_manager_part) { 101 defines += [ "HAS_DISPLAY_MANAGER" ] 102 external_deps += [ 103 "display_manager:displaymgr", 104 "window_manager:libdm_lite", 105 ] 106 } 107 108 if (has_device_standby_part) { 109 external_deps += [ "device_standby:standby_innerkits" ] 110 } 111 112 if (has_multimodalinput_input_part) { 113 external_deps += [ "input:libmmi-client" ] 114 } 115 116 if (has_sensors_sensor_part) { 117 external_deps += [ "sensor:sensor_interface_native" ] 118 } 119 120 if (power_manager_feature_poweroff_charge && defined(global_parts_info) && 121 defined(global_parts_info.powermgr_battery_manager)) { 122 defines += [ "POWER_MANAGER_POWEROFF_CHARGE" ] 123 external_deps += [ "battery_manager:batterysrv_client" ] 124 } 125 126 if (power_manager_feature_doubleclick) { 127 defines += [ "POWER_DOUBLECLICK_ENABLE" ] 128 } 129 130 if (power_manager_feature_pickup) { 131 defines += [ "POWER_PICKUP_ENABLE" ] 132 } 133 134 if (power_manager_feature_power_dialog) { 135 defines += [ "POWER_MANAGER_POWER_DIALOG" ] 136 } 137 138 if (power_manager_feature_force_sleep_broadcast) { 139 defines += [ "POWER_MANAGER_ENABLE_FORCE_SLEEP_BROADCAST" ] 140 } 141 142 if (power_manager_feature_charging_type_setting && 143 defined(global_parts_info) && 144 defined(global_parts_info.powermgr_battery_manager)) { 145 defines += [ "POWER_MANAGER_ENABLE_CHARGING_TYPE_SETTING" ] 146 external_deps += [ "battery_manager:batterysrv_client" ] 147 } 148 149 if (power_manager_feature_external_screen_management) { 150 defines += [ "POWER_MANAGER_ENABLE_EXTERNAL_SCREEN_MANAGEMENT" ] 151 } 152 153 if (factory == true) { 154 defines += [ "CONFIG_FACTORY_MODE" ] 155 } 156} 157