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