1# Copyright (c) 2022-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("../../ressched.gni") 16 17group("unittest") { 18 testonly = true 19 deps = [ 20 ":resschedfwk_test", 21 ":resschedservice_test", 22 ] 23} 24 25module_output_path = "resource_schedule_service/ressched" 26 27ohos_unittest("resschedservice_test") { 28 module_out_path = module_output_path 29 resource_config_file = "${ressched_test}/resource/resschedfwk/ohos_test.xml" 30 cflags = [ 31 "-Dprivate=public", 32 "-Dprotected=public", 33 ] 34 include_dirs = [ 35 "./include", 36 "${ressched_common}/include", 37 "${ressched_interfaces}/innerkits/ressched_client/include", 38 ] 39 40 sources = [ 41 "src/event_listener_mgr_test.cpp", 42 "src/oobe_datashare_utils_test.cpp", 43 "src/oobe_mgr_test.cpp", 44 "src/res_sched_client_test.cpp", 45 "src/res_sched_service_mock_test.cpp", 46 "src/res_sched_service_test.cpp", 47 "src/scene_recognize_test.cpp", 48 ] 49 50 deps = [ "${ressched_services}:resschedsvc_static" ] 51 52 external_deps = [ 53 "ability_base:zuri", 54 "ability_runtime:ability_manager", 55 "access_token:libaccesstoken_sdk", 56 "access_token:libnativetoken", 57 "access_token:libtoken_setproc", 58 "cJSON:cjson", 59 "c_utils:utils", 60 "data_share:datashare_consumer", 61 "ffrt:libffrt", 62 "hilog:libhilog", 63 "ipc:ipc_single", 64 "selinux_adapter:librestorecon", 65 "window_manager:libdm", 66 ] 67 68 sanitize = { 69 cfi = true 70 cfi_cross_dso = true 71 debug = false 72 } 73 branch_protector_ret = "pac_ret" 74} 75 76ohos_unittest("resschedfwk_test") { 77 module_out_path = module_output_path 78 resource_config_file = "${ressched_test}/resource/resschedfwk/ohos_test.xml" 79 cflags = [ 80 "-Dprivate=public", 81 "-Dprotected=public", 82 ] 83 include_dirs = [ 84 "include", 85 "${ressched_common}/include", 86 "${ressched_interfaces}/innerkits/ressched_client/include", 87 "${ressched_plugins}/socperf_plugin/include", 88 ] 89 90 sources = [ 91 "src/batch_log_printer_test.cpp", 92 "src/config_reader_test.cpp", 93 "src/notifier_mgr_test.cpp", 94 "src/plugin_mgr_test.cpp", 95 "src/plugin_switch_test.cpp", 96 "src/res_sched_mgr_test.cpp", 97 ] 98 99 deps = [ 100 "${ressched_plugins}/socperf_plugin:socperf_plugin_static", 101 "${ressched_services}:resschedsvc_static", 102 ] 103 104 external_deps = [ 105 "ability_runtime:ability_manager", 106 "cJSON:cjson", 107 "c_utils:utils", 108 "eventhandler:libeventhandler", 109 "ffrt:libffrt", 110 "hilog:libhilog", 111 "ipc:ipc_single", 112 "selinux_adapter:librestorecon", 113 ] 114 115 defines = [] 116 117 if (ressched_with_resourceschedule_soc_perf_enable) { 118 external_deps += [ "soc_perf:socperf_client" ] 119 defines += [ "RESSCHED_RESOURCESCHEDULE_SOC_PERF_ENABLE" ] 120 } 121 122 if (resource_schedule_service_with_ffrt_enable) { 123 defines += [ "RESOURCE_SCHEDULE_SERVICE_WITH_FFRT_ENABLE" ] 124 } 125 126 sanitize = { 127 cfi = true 128 cfi_cross_dso = true 129 debug = false 130 } 131 branch_protector_ret = "pac_ret" 132} 133