1# Copyright (C) 2022 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/ohos.gni") 15import("//build/ohos_var.gni") 16import("//build/test.gni") 17 18module_output_path = "qosmanagertest/" 19 20gtest_public_deps = [ "//third_party/googletest:gtest_main" ] 21 22config("test_config") { 23 include_dirs = [ 24 "../include/", 25 "../frameworks/concurrent_task_client/include", 26 "../interfaces/inner_api/", 27 "../services/include/", 28 "//third_party/jsoncpp/include/", 29 "//foundation/resourceschedule/frame_aware_sched/common/include/", 30 ] 31} 32 33config("ffrt_test_config") { 34 include_dirs = [ 35 "//foundation/resourceschedule/resourceschedule_qos_manager/interfaces/inner_api/", 36 "//foundation/resourceschedule/resourceschedule_qos_manager/include", 37 ] 38 39 cflags = [ 40 "-Wno-unused-variable", 41 "-Wno-unused-function", 42 ] 43 44 defines = [ 45 "QOS_INTERVAL", 46 "QOS_DISPATCH", 47 "QOS_RTG", 48 "QOS_MULTI_RTG", 49 "QOS_RTG_RT", 50 "QOS_CHECKPOINT", 51 "QOS_SUBMIT", 52 "QOS_DEMO", 53 "ATRACE_MODE=0", # 0 is off, 5 is bytrace, 6 is pmu 54 "ATRACE_LEVEL=0", 55 "ATRACE_LOGI_ENABLE=0", 56 "ATRACE_LOGD_ENABLE=0", 57 "ATRACE_SCOPE_LOG_ENABLE=0", 58 "ATRACE_DURATION_LOG_ENABLE=0", 59 "FFRT_RELEASE", 60 "DISABLE_MONITOR", 61 ] 62 63 if (target_cpu == "arm64") { 64 defines += [ "ARM64_TEST" ] 65 } 66} 67 68ohos_unittest("concurrent_svc_intf_test") { 69 module_out_path = module_output_path 70 71 configs = [ ":test_config" ] 72 73 sources = [ "unittest/phone/concurrent_svc_intf_test.cpp" ] 74 deps = [ "../frameworks/concurrent_task_client:concurrent_task_client" ] 75 external_deps = [ 76 "c_utils:utils", 77 "eventhandler:libeventhandler", 78 "hilog:libhilog", 79 "ipc:ipc_single", 80 "safwk:system_ability_fwk", 81 "samgr:samgr_proxy", 82 ] 83 84 if (is_standard_system) { 85 public_deps = gtest_public_deps 86 } 87 88 subsystem_name = "resourceschedule" 89 part_name = "resourceschedule_qos_manager" 90} 91 92ohos_unittest("concurrent_task_client_test") { 93 module_out_path = module_output_path 94 95 configs = [ 96 ":ffrt_test_config", 97 ":test_config", 98 ] 99 100 sources = [ "unittest/phone/concurrent_task_client_test.cpp" ] 101 deps = [ "../frameworks/concurrent_task_client:concurrent_task_client" ] 102 103 if (is_standard_system) { 104 public_deps = gtest_public_deps 105 } 106 107 external_deps = [ 108 "hilog:libhilog", 109 "ipc:ipc_single", 110 ] 111 112 subsystem_name = "resourceschedule" 113 part_name = "resourceschedule_qos_manager" 114} 115 116ohos_unittest("concurrent_task_controller_test") { 117 module_out_path = module_output_path 118 119 configs = [ 120 ":ffrt_test_config", 121 ":test_config", 122 ] 123 124 sources = [ "unittest/phone/concurrent_task_controller_test.cpp" ] 125 deps = [ 126 "../frameworks/concurrent_task_client:concurrent_task_client", 127 "../services:concurrentsvc", 128 "//third_party/jsoncpp:jsoncpp", 129 ] 130 131 external_deps = [ 132 "c_utils:utils", 133 "hilog:libhilog", 134 "safwk:system_ability_fwk", 135 "samgr:samgr_proxy", 136 ] 137 138 if (is_standard_system) { 139 public_deps = gtest_public_deps 140 } 141 142 subsystem_name = "resourceschedule" 143 part_name = "resourceschedule_qos_manager" 144} 145 146ohos_unittest("concurrent_task_service_ability_test") { 147 module_out_path = module_output_path 148 149 configs = [ 150 ":ffrt_test_config", 151 ":test_config", 152 ] 153 154 sources = [ "unittest/phone/concurrent_task_service_ability_test.cpp" ] 155 deps = [ 156 "../frameworks/concurrent_task_client:concurrent_task_client", 157 "../services:concurrentsvc", 158 ] 159 external_deps = [ 160 "c_utils:utils", 161 "hilog:libhilog", 162 "safwk:system_ability_fwk", 163 "samgr:samgr_proxy", 164 ] 165 166 if (is_standard_system) { 167 public_deps = gtest_public_deps 168 } 169 170 subsystem_name = "resourceschedule" 171 part_name = "resourceschedule_qos_manager" 172} 173 174ohos_unittest("qos_interface_test") { 175 module_out_path = module_output_path 176 177 configs = [ 178 ":ffrt_test_config", 179 ":test_config", 180 ] 181 182 sources = [ "unittest/phone/qos_interface_test.cpp" ] 183 deps = [ 184 "../frameworks/concurrent_task_client:concurrent_task_client", 185 "../services:concurrentsvc", 186 ] 187 external_deps = [ 188 "c_utils:utils", 189 "hilog:libhilog", 190 "safwk:system_ability_fwk", 191 "samgr:samgr_proxy", 192 ] 193 194 if (is_standard_system) { 195 public_deps = gtest_public_deps 196 } 197 198 subsystem_name = "resourceschedule" 199 part_name = "resourceschedule_qos_manager" 200} 201 202ohos_unittest("qos_manager_test") { 203 module_out_path = module_output_path 204 205 configs = [ 206 ":ffrt_test_config", 207 ":test_config", 208 ] 209 210 sources = [ "unittest/phone/qos_manager_test.cpp" ] 211 deps = [ 212 "../frameworks/concurrent_task_client:concurrent_task_client", 213 "../services:concurrentsvc", 214 ] 215 external_deps = [ 216 "c_utils:utils", 217 "hilog:libhilog", 218 "safwk:system_ability_fwk", 219 "samgr:samgr_proxy", 220 ] 221 222 if (is_standard_system) { 223 public_deps = gtest_public_deps 224 } 225 226 subsystem_name = "resourceschedule" 227 part_name = "resourceschedule_qos_manager" 228} 229 230ohos_unittest("concurrent_task_service_test") { 231 module_out_path = module_output_path 232 233 configs = [ 234 ":ffrt_test_config", 235 ":test_config", 236 ] 237 238 sources = [ "unittest/phone/concurrent_task_service_test.cpp" ] 239 deps = [ 240 "../frameworks/concurrent_task_client:concurrent_task_client", 241 "../services:concurrentsvc", 242 ] 243 external_deps = [ 244 "c_utils:utils", 245 "hilog:libhilog", 246 "safwk:system_ability_fwk", 247 "samgr:samgr_proxy", 248 ] 249 250 if (is_standard_system) { 251 public_deps = gtest_public_deps 252 } 253 254 subsystem_name = "resourceschedule" 255 part_name = "resourceschedule_qos_manager" 256} 257 258group("concurrent_unittest") { 259 testonly = true 260 deps = [] 261 if (!is_asan) { 262 deps += [ 263 ":concurrent_svc_intf_test", 264 ":concurrent_task_client_test", 265 ":concurrent_task_controller_test", 266 ":concurrent_task_service_ability_test", 267 ":concurrent_task_service_test", 268 ":qos_interface_test", 269 ":qos_manager_test", 270 ] 271 } 272} 273