15ccb8f90Sopenharmony_ci# Copyright (c) 2021-2023 Huawei Device Co., Ltd. 25ccb8f90Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License"); 35ccb8f90Sopenharmony_ci# you may not use this file except in compliance with the License. 45ccb8f90Sopenharmony_ci# You may obtain a copy of the License at 55ccb8f90Sopenharmony_ci# 65ccb8f90Sopenharmony_ci# http://www.apache.org/licenses/LICENSE-2.0 75ccb8f90Sopenharmony_ci# 85ccb8f90Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software 95ccb8f90Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS, 105ccb8f90Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 115ccb8f90Sopenharmony_ci# See the License for the specific language governing permissions and 125ccb8f90Sopenharmony_ci# limitations under the License. 135ccb8f90Sopenharmony_ci 145ccb8f90Sopenharmony_ciimport("//build/test.gni") 155ccb8f90Sopenharmony_ciimport("../../powermgr.gni") 165ccb8f90Sopenharmony_ci 175ccb8f90Sopenharmony_cimodule_output_path = "${powermgr_part_name}/powermgr_native" 185ccb8f90Sopenharmony_ci 195ccb8f90Sopenharmony_ci############################################################################### 205ccb8f90Sopenharmony_ciconfig("module_private_config") { 215ccb8f90Sopenharmony_ci visibility = [ ":*" ] 225ccb8f90Sopenharmony_ci 235ccb8f90Sopenharmony_ci include_dirs = [ 245ccb8f90Sopenharmony_ci "include", 255ccb8f90Sopenharmony_ci "mock", 265ccb8f90Sopenharmony_ci "${powermgr_service_path}/native/src/hibernate", 275ccb8f90Sopenharmony_ci "${powermgr_service_path}/native/src/runninglock", 285ccb8f90Sopenharmony_ci "${powermgr_service_path}/native/src/shutdown", 295ccb8f90Sopenharmony_ci "${powermgr_service_path}/native/src/suspend", 305ccb8f90Sopenharmony_ci "${powermgr_service_path}/native/src/wakeup", 315ccb8f90Sopenharmony_ci "${powermgr_service_path}/native/src/screenoffpre", 325ccb8f90Sopenharmony_ci ] 335ccb8f90Sopenharmony_ci 345ccb8f90Sopenharmony_ci if (power_manager_feature_wakeup_action) { 355ccb8f90Sopenharmony_ci include_dirs += [ "${powermgr_service_path}/native/src/wakeup_action" ] 365ccb8f90Sopenharmony_ci } 375ccb8f90Sopenharmony_ci} 385ccb8f90Sopenharmony_ci 395ccb8f90Sopenharmony_cideps_ex = [ 405ccb8f90Sopenharmony_ci "ability_base:base", 415ccb8f90Sopenharmony_ci "ability_base:want", 425ccb8f90Sopenharmony_ci "ability_runtime:ability_manager", 435ccb8f90Sopenharmony_ci "bundle_framework:appexecfwk_base", 445ccb8f90Sopenharmony_ci "bundle_framework:appexecfwk_core", 455ccb8f90Sopenharmony_ci "c_utils:utils", 465ccb8f90Sopenharmony_ci "common_event_service:cesfwk_innerkits", 475ccb8f90Sopenharmony_ci "ffrt:libffrt", 485ccb8f90Sopenharmony_ci "hilog:libhilog", 495ccb8f90Sopenharmony_ci "input:libmmi-client", 505ccb8f90Sopenharmony_ci "ipc:ipc_core", 515ccb8f90Sopenharmony_ci "power_manager:power_ffrt", 525ccb8f90Sopenharmony_ci "safwk:system_ability_fwk", 535ccb8f90Sopenharmony_ci "samgr:samgr_proxy", 545ccb8f90Sopenharmony_ci] 555ccb8f90Sopenharmony_ci 565ccb8f90Sopenharmony_ciif (has_sensors_sensor_part) { 575ccb8f90Sopenharmony_ci deps_ex += [ "sensor:sensor_interface_native" ] 585ccb8f90Sopenharmony_ci} 595ccb8f90Sopenharmony_ciif (has_hiviewdfx_hisysevent_part) { 605ccb8f90Sopenharmony_ci deps_ex += [ "hisysevent:libhisysevent" ] 615ccb8f90Sopenharmony_ci} 625ccb8f90Sopenharmony_ci 635ccb8f90Sopenharmony_ci##############################systemtest########################################## 645ccb8f90Sopenharmony_ci 655ccb8f90Sopenharmony_ciohos_systemtest("ces_system") { 665ccb8f90Sopenharmony_ci module_out_path = module_output_path 675ccb8f90Sopenharmony_ci 685ccb8f90Sopenharmony_ci sources = [ "src/ces_system_test.cpp" ] 695ccb8f90Sopenharmony_ci 705ccb8f90Sopenharmony_ci configs = [ 715ccb8f90Sopenharmony_ci "${powermgr_utils_path}:utils_config", 725ccb8f90Sopenharmony_ci ":module_private_config", 735ccb8f90Sopenharmony_ci "${powermgr_utils_path}:coverage_flags", 745ccb8f90Sopenharmony_ci ] 755ccb8f90Sopenharmony_ci 765ccb8f90Sopenharmony_ci deps = [ 775ccb8f90Sopenharmony_ci "${powermgr_inner_api}:powermgr_client", 785ccb8f90Sopenharmony_ci "${powermgr_service_path}:powermgr_stub", 795ccb8f90Sopenharmony_ci "${powermgr_service_path}:powermgrservice", 805ccb8f90Sopenharmony_ci "${powermgr_service_path}/native/src/actions:powermgr_actions", 815ccb8f90Sopenharmony_ci "//third_party/googletest:gtest_main", 825ccb8f90Sopenharmony_ci ] 835ccb8f90Sopenharmony_ci 845ccb8f90Sopenharmony_ci external_deps = deps_ex 855ccb8f90Sopenharmony_ci} 865ccb8f90Sopenharmony_ci 875ccb8f90Sopenharmony_ci##############################mocksystemtest########################################## 885ccb8f90Sopenharmony_ci 895ccb8f90Sopenharmony_ciohos_systemtest("test_power_mgr_mock_system") { 905ccb8f90Sopenharmony_ci module_out_path = module_output_path 915ccb8f90Sopenharmony_ci 925ccb8f90Sopenharmony_ci sanitize = { 935ccb8f90Sopenharmony_ci cfi = true 945ccb8f90Sopenharmony_ci cfi_cross_dso = true 955ccb8f90Sopenharmony_ci debug = false 965ccb8f90Sopenharmony_ci blocklist = "../cfi_blocklist.txt" 975ccb8f90Sopenharmony_ci } 985ccb8f90Sopenharmony_ci 995ccb8f90Sopenharmony_ci sources = [ "src/power_mgr_mock_system_test.cpp" ] 1005ccb8f90Sopenharmony_ci 1015ccb8f90Sopenharmony_ci configs = [ 1025ccb8f90Sopenharmony_ci "${powermgr_utils_path}:utils_config", 1035ccb8f90Sopenharmony_ci ":module_private_config", 1045ccb8f90Sopenharmony_ci "${powermgr_utils_path}:coverage_flags", 1055ccb8f90Sopenharmony_ci ] 1065ccb8f90Sopenharmony_ci 1075ccb8f90Sopenharmony_ci deps = [ 1085ccb8f90Sopenharmony_ci "${powermgr_inner_api}:powermgr_client", 1095ccb8f90Sopenharmony_ci "${powermgr_service_path}:powermgr_stub", 1105ccb8f90Sopenharmony_ci "${powermgr_service_path}:powermgrservice", 1115ccb8f90Sopenharmony_ci "${powermgr_service_path}/native/src/actions:powermgr_actions", 1125ccb8f90Sopenharmony_ci "//third_party/googletest:gmock_main", 1135ccb8f90Sopenharmony_ci "//third_party/googletest:gtest_main", 1145ccb8f90Sopenharmony_ci ] 1155ccb8f90Sopenharmony_ci 1165ccb8f90Sopenharmony_ci external_deps = deps_ex 1175ccb8f90Sopenharmony_ci} 1185ccb8f90Sopenharmony_ci 1195ccb8f90Sopenharmony_ci################################powersavemode################################ 1205ccb8f90Sopenharmony_ci 1215ccb8f90Sopenharmony_ciohos_systemtest("test_power_mgr_powersavemode") { 1225ccb8f90Sopenharmony_ci module_out_path = module_output_path 1235ccb8f90Sopenharmony_ci 1245ccb8f90Sopenharmony_ci sources = [ "src/power_mgr_powersavemode_test.cpp" ] 1255ccb8f90Sopenharmony_ci 1265ccb8f90Sopenharmony_ci sanitize = { 1275ccb8f90Sopenharmony_ci cfi = true 1285ccb8f90Sopenharmony_ci cfi_cross_dso = true 1295ccb8f90Sopenharmony_ci debug = false 1305ccb8f90Sopenharmony_ci blocklist = "../cfi_blocklist.txt" 1315ccb8f90Sopenharmony_ci } 1325ccb8f90Sopenharmony_ci 1335ccb8f90Sopenharmony_ci configs = [ 1345ccb8f90Sopenharmony_ci "${powermgr_utils_path}:utils_config", 1355ccb8f90Sopenharmony_ci ":module_private_config", 1365ccb8f90Sopenharmony_ci "${powermgr_utils_path}:coverage_flags", 1375ccb8f90Sopenharmony_ci ] 1385ccb8f90Sopenharmony_ci 1395ccb8f90Sopenharmony_ci deps = [ 1405ccb8f90Sopenharmony_ci "${powermgr_inner_api}:powermgr_client", 1415ccb8f90Sopenharmony_ci "${powermgr_service_path}:powermgr_stub", 1425ccb8f90Sopenharmony_ci "${powermgr_service_path}:powermgrservice", 1435ccb8f90Sopenharmony_ci "${powermgr_service_path}/native/src/actions:powermgr_actions", 1445ccb8f90Sopenharmony_ci "//third_party/googletest:gmock_main", 1455ccb8f90Sopenharmony_ci "//third_party/googletest:gtest_main", 1465ccb8f90Sopenharmony_ci ] 1475ccb8f90Sopenharmony_ci 1485ccb8f90Sopenharmony_ci external_deps = deps_ex 1495ccb8f90Sopenharmony_ci} 1505ccb8f90Sopenharmony_ci 1515ccb8f90Sopenharmony_ci################################powermgrsystem################################ 1525ccb8f90Sopenharmony_ci 1535ccb8f90Sopenharmony_ciohos_systemtest("test_power_mgr_system") { 1545ccb8f90Sopenharmony_ci module_out_path = module_output_path 1555ccb8f90Sopenharmony_ci 1565ccb8f90Sopenharmony_ci resource_config_file = 1575ccb8f90Sopenharmony_ci "${powermgr_root_path}/test/systemtest/resources/ohos_test.xml" 1585ccb8f90Sopenharmony_ci 1595ccb8f90Sopenharmony_ci sources = [ "src/power_mgr_system_test.cpp" ] 1605ccb8f90Sopenharmony_ci 1615ccb8f90Sopenharmony_ci configs = [ 1625ccb8f90Sopenharmony_ci "${powermgr_utils_path}:utils_config", 1635ccb8f90Sopenharmony_ci ":module_private_config", 1645ccb8f90Sopenharmony_ci "${powermgr_utils_path}:coverage_flags", 1655ccb8f90Sopenharmony_ci ] 1665ccb8f90Sopenharmony_ci 1675ccb8f90Sopenharmony_ci deps = [ 1685ccb8f90Sopenharmony_ci "${powermgr_inner_api}:powermgr_client", 1695ccb8f90Sopenharmony_ci "${powermgr_service_path}:powermgr_stub", 1705ccb8f90Sopenharmony_ci "${powermgr_service_path}:powermgrservice", 1715ccb8f90Sopenharmony_ci "${powermgr_service_path}/native/src/actions:powermgr_actions", 1725ccb8f90Sopenharmony_ci "//third_party/googletest:gmock_main", 1735ccb8f90Sopenharmony_ci "//third_party/googletest:gtest_main", 1745ccb8f90Sopenharmony_ci ] 1755ccb8f90Sopenharmony_ci 1765ccb8f90Sopenharmony_ci external_deps = deps_ex 1775ccb8f90Sopenharmony_ci} 1785ccb8f90Sopenharmony_ci 1795ccb8f90Sopenharmony_ci################################fastshutdown################################ 1805ccb8f90Sopenharmony_ci 1815ccb8f90Sopenharmony_ciohos_systemtest("test_power_mgr_shutdown_fast") { 1825ccb8f90Sopenharmony_ci module_out_path = module_output_path 1835ccb8f90Sopenharmony_ci 1845ccb8f90Sopenharmony_ci sources = [ "src/power_mgr_shutdown_fast_test.cpp" ] 1855ccb8f90Sopenharmony_ci 1865ccb8f90Sopenharmony_ci sanitize = { 1875ccb8f90Sopenharmony_ci cfi = true 1885ccb8f90Sopenharmony_ci cfi_cross_dso = true 1895ccb8f90Sopenharmony_ci debug = false 1905ccb8f90Sopenharmony_ci blocklist = "../cfi_blocklist.txt" 1915ccb8f90Sopenharmony_ci } 1925ccb8f90Sopenharmony_ci 1935ccb8f90Sopenharmony_ci configs = [ 1945ccb8f90Sopenharmony_ci "${powermgr_utils_path}:utils_config", 1955ccb8f90Sopenharmony_ci ":module_private_config", 1965ccb8f90Sopenharmony_ci "${powermgr_utils_path}:coverage_flags", 1975ccb8f90Sopenharmony_ci ] 1985ccb8f90Sopenharmony_ci 1995ccb8f90Sopenharmony_ci deps = [ 2005ccb8f90Sopenharmony_ci "${powermgr_inner_api}:powermgr_client", 2015ccb8f90Sopenharmony_ci "${powermgr_service_path}:powermgr_stub", 2025ccb8f90Sopenharmony_ci "${powermgr_service_path}:powermgrservice", 2035ccb8f90Sopenharmony_ci "${powermgr_service_path}/native/src/actions:powermgr_actions", 2045ccb8f90Sopenharmony_ci "//third_party/googletest:gmock_main", 2055ccb8f90Sopenharmony_ci "//third_party/googletest:gtest_main", 2065ccb8f90Sopenharmony_ci ] 2075ccb8f90Sopenharmony_ci 2085ccb8f90Sopenharmony_ci external_deps = deps_ex 2095ccb8f90Sopenharmony_ci} 2105ccb8f90Sopenharmony_ci 2115ccb8f90Sopenharmony_ci################################powerevent################################ 2125ccb8f90Sopenharmony_ci 2135ccb8f90Sopenharmony_ciohos_systemtest("test_power_level_event_system_test_off") { 2145ccb8f90Sopenharmony_ci module_out_path = module_output_path 2155ccb8f90Sopenharmony_ci 2165ccb8f90Sopenharmony_ci sources = [ "src/power_level_event_system_test_off.cpp" ] 2175ccb8f90Sopenharmony_ci 2185ccb8f90Sopenharmony_ci sanitize = { 2195ccb8f90Sopenharmony_ci cfi = true 2205ccb8f90Sopenharmony_ci cfi_cross_dso = true 2215ccb8f90Sopenharmony_ci debug = false 2225ccb8f90Sopenharmony_ci blocklist = "../cfi_blocklist.txt" 2235ccb8f90Sopenharmony_ci } 2245ccb8f90Sopenharmony_ci 2255ccb8f90Sopenharmony_ci configs = [ 2265ccb8f90Sopenharmony_ci "${powermgr_utils_path}:utils_config", 2275ccb8f90Sopenharmony_ci ":module_private_config", 2285ccb8f90Sopenharmony_ci "${powermgr_utils_path}:coverage_flags", 2295ccb8f90Sopenharmony_ci ] 2305ccb8f90Sopenharmony_ci 2315ccb8f90Sopenharmony_ci deps = [ 2325ccb8f90Sopenharmony_ci "${powermgr_inner_api}:powermgr_client", 2335ccb8f90Sopenharmony_ci "${powermgr_service_path}:powermgr_stub", 2345ccb8f90Sopenharmony_ci "${powermgr_service_path}:powermgrservice", 2355ccb8f90Sopenharmony_ci "${powermgr_service_path}/native/src/actions:powermgr_actions", 2365ccb8f90Sopenharmony_ci "//third_party/googletest:gmock_main", 2375ccb8f90Sopenharmony_ci "//third_party/googletest:gtest_main", 2385ccb8f90Sopenharmony_ci ] 2395ccb8f90Sopenharmony_ci 2405ccb8f90Sopenharmony_ci external_deps = deps_ex 2415ccb8f90Sopenharmony_ci} 2425ccb8f90Sopenharmony_ci 2435ccb8f90Sopenharmony_ci################################powerevent################################ 2445ccb8f90Sopenharmony_ci 2455ccb8f90Sopenharmony_ciohos_systemtest("test_power_level_event_system_test_on") { 2465ccb8f90Sopenharmony_ci module_out_path = module_output_path 2475ccb8f90Sopenharmony_ci 2485ccb8f90Sopenharmony_ci sources = [ "src/power_level_event_system_test_on.cpp" ] 2495ccb8f90Sopenharmony_ci 2505ccb8f90Sopenharmony_ci sanitize = { 2515ccb8f90Sopenharmony_ci cfi = true 2525ccb8f90Sopenharmony_ci cfi_cross_dso = true 2535ccb8f90Sopenharmony_ci debug = false 2545ccb8f90Sopenharmony_ci blocklist = "../cfi_blocklist.txt" 2555ccb8f90Sopenharmony_ci } 2565ccb8f90Sopenharmony_ci 2575ccb8f90Sopenharmony_ci configs = [ 2585ccb8f90Sopenharmony_ci "${powermgr_utils_path}:utils_config", 2595ccb8f90Sopenharmony_ci ":module_private_config", 2605ccb8f90Sopenharmony_ci "${powermgr_utils_path}:coverage_flags", 2615ccb8f90Sopenharmony_ci ] 2625ccb8f90Sopenharmony_ci 2635ccb8f90Sopenharmony_ci deps = [ 2645ccb8f90Sopenharmony_ci "${powermgr_inner_api}:powermgr_client", 2655ccb8f90Sopenharmony_ci "${powermgr_service_path}:powermgr_stub", 2665ccb8f90Sopenharmony_ci "${powermgr_service_path}:powermgrservice", 2675ccb8f90Sopenharmony_ci "${powermgr_service_path}/native/src/actions:powermgr_actions", 2685ccb8f90Sopenharmony_ci "//third_party/googletest:gmock_main", 2695ccb8f90Sopenharmony_ci "//third_party/googletest:gtest_main", 2705ccb8f90Sopenharmony_ci ] 2715ccb8f90Sopenharmony_ci 2725ccb8f90Sopenharmony_ci external_deps = deps_ex 2735ccb8f90Sopenharmony_ci} 2745ccb8f90Sopenharmony_ci 2755ccb8f90Sopenharmony_ci##############################sttest########################################## 2765ccb8f90Sopenharmony_ciohos_systemtest("test_power_st_mgr_mock") { 2775ccb8f90Sopenharmony_ci module_out_path = module_output_path 2785ccb8f90Sopenharmony_ci 2795ccb8f90Sopenharmony_ci sanitize = { 2805ccb8f90Sopenharmony_ci cfi = true 2815ccb8f90Sopenharmony_ci cfi_cross_dso = true 2825ccb8f90Sopenharmony_ci debug = false 2835ccb8f90Sopenharmony_ci blocklist = "../cfi_blocklist.txt" 2845ccb8f90Sopenharmony_ci } 2855ccb8f90Sopenharmony_ci 2865ccb8f90Sopenharmony_ci sources = [ "src/power_mgr_st_mock_test.cpp" ] 2875ccb8f90Sopenharmony_ci 2885ccb8f90Sopenharmony_ci configs = [ 2895ccb8f90Sopenharmony_ci "${powermgr_utils_path}:utils_config", 2905ccb8f90Sopenharmony_ci ":module_private_config", 2915ccb8f90Sopenharmony_ci "${powermgr_utils_path}:coverage_flags", 2925ccb8f90Sopenharmony_ci ] 2935ccb8f90Sopenharmony_ci 2945ccb8f90Sopenharmony_ci deps = [ 2955ccb8f90Sopenharmony_ci "${powermgr_inner_api}:powermgr_client", 2965ccb8f90Sopenharmony_ci "${powermgr_service_path}:powermgr_stub", 2975ccb8f90Sopenharmony_ci "${powermgr_service_path}:powermgrservice", 2985ccb8f90Sopenharmony_ci "${powermgr_service_path}/native/src/actions:powermgr_actions", 2995ccb8f90Sopenharmony_ci "//third_party/googletest:gmock_main", 3005ccb8f90Sopenharmony_ci "//third_party/googletest:gtest_main", 3015ccb8f90Sopenharmony_ci ] 3025ccb8f90Sopenharmony_ci 3035ccb8f90Sopenharmony_ci external_deps = deps_ex 3045ccb8f90Sopenharmony_ci} 3055ccb8f90Sopenharmony_ci 3065ccb8f90Sopenharmony_ci##############################suspendsttest########################################## 3075ccb8f90Sopenharmony_ciohos_systemtest("test_power_st_mgr_mock_suspend") { 3085ccb8f90Sopenharmony_ci module_out_path = module_output_path 3095ccb8f90Sopenharmony_ci 3105ccb8f90Sopenharmony_ci sanitize = { 3115ccb8f90Sopenharmony_ci cfi = true 3125ccb8f90Sopenharmony_ci cfi_cross_dso = true 3135ccb8f90Sopenharmony_ci debug = false 3145ccb8f90Sopenharmony_ci blocklist = "../cfi_blocklist.txt" 3155ccb8f90Sopenharmony_ci } 3165ccb8f90Sopenharmony_ci 3175ccb8f90Sopenharmony_ci sources = [ "src/power_mgr_st_suspend_test.cpp" ] 3185ccb8f90Sopenharmony_ci 3195ccb8f90Sopenharmony_ci configs = [ 3205ccb8f90Sopenharmony_ci "${powermgr_utils_path}:utils_config", 3215ccb8f90Sopenharmony_ci ":module_private_config", 3225ccb8f90Sopenharmony_ci "${powermgr_utils_path}:coverage_flags", 3235ccb8f90Sopenharmony_ci ] 3245ccb8f90Sopenharmony_ci 3255ccb8f90Sopenharmony_ci deps = [ 3265ccb8f90Sopenharmony_ci "${powermgr_inner_api}:powermgr_client", 3275ccb8f90Sopenharmony_ci "${powermgr_service_path}:powermgr_stub", 3285ccb8f90Sopenharmony_ci "${powermgr_service_path}:powermgrservice", 3295ccb8f90Sopenharmony_ci "${powermgr_service_path}/native/src/actions:powermgr_actions", 3305ccb8f90Sopenharmony_ci "//third_party/googletest:gtest_main", 3315ccb8f90Sopenharmony_ci ] 3325ccb8f90Sopenharmony_ci 3335ccb8f90Sopenharmony_ci external_deps = deps_ex 3345ccb8f90Sopenharmony_ci} 3355ccb8f90Sopenharmony_ci 3365ccb8f90Sopenharmony_cigroup("systemtest_powermgr") { 3375ccb8f90Sopenharmony_ci testonly = true 3385ccb8f90Sopenharmony_ci deps = [ 3395ccb8f90Sopenharmony_ci ":test_power_level_event_system_test_off", 3405ccb8f90Sopenharmony_ci ":test_power_level_event_system_test_on", 3415ccb8f90Sopenharmony_ci ":test_power_mgr_mock_system", 3425ccb8f90Sopenharmony_ci ":test_power_mgr_powersavemode", 3435ccb8f90Sopenharmony_ci ":test_power_mgr_shutdown_fast", 3445ccb8f90Sopenharmony_ci ":test_power_mgr_system", 3455ccb8f90Sopenharmony_ci ":test_power_st_mgr_mock", 3465ccb8f90Sopenharmony_ci ":test_power_st_mgr_mock_suspend", 3475ccb8f90Sopenharmony_ci ] 3485ccb8f90Sopenharmony_ci} 349