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 "${ressched_common}/src/oobe_datashare_utils.cpp", 42 "${ressched_common}/src/oobe_manager.cpp", 43 "src/event_listener_mgr_test.cpp", 44 "src/oobe_datashare_utils_test.cpp", 45 "src/oobe_mgr_test.cpp", 46 "src/res_sched_client_test.cpp", 47 "src/res_sched_service_mock_test.cpp", 48 "src/res_sched_service_test.cpp", 49 "src/scene_recognize_test.cpp", 50 ] 51 52 deps = [ 53 "${ressched_services}:resschedsvc_static", 54 "//third_party/googletest:gtest_main", 55 ] 56 57 external_deps = [ 58 "ability_base:zuri", 59 "ability_runtime:ability_manager", 60 "access_token:libaccesstoken_sdk", 61 "access_token:libnativetoken", 62 "access_token:libtoken_setproc", 63 "c_utils:utils", 64 "data_share:datashare_consumer", 65 "ffrt:libffrt", 66 "hilog:libhilog", 67 "ipc:ipc_single", 68 "window_manager:libdm", 69 ] 70 71 sanitize = { 72 cfi = true 73 cfi_cross_dso = true 74 debug = false 75 } 76 branch_protector_ret = "pac_ret" 77} 78 79ohos_unittest("resschedfwk_test") { 80 module_out_path = module_output_path 81 resource_config_file = "${ressched_test}/resource/resschedfwk/ohos_test.xml" 82 cflags = [ 83 "-Dprivate=public", 84 "-Dprotected=public", 85 ] 86 include_dirs = [ 87 "include", 88 "${ressched_common}/include", 89 "${ressched_interfaces}/innerkits/ressched_client/include", 90 "${ressched_plugins}/socperf_plugin/include", 91 ] 92 93 sources = [ 94 "src/config_reader_test.cpp", 95 "src/notifier_mgr_test.cpp", 96 "src/plugin_mgr_test.cpp", 97 "src/plugin_switch_test.cpp", 98 "src/res_sched_mgr_test.cpp", 99 ] 100 101 deps = [ 102 "${ressched_plugins}/socperf_plugin:socperf_plugin", 103 "${ressched_services}:resschedsvc_static", 104 "//third_party/googletest:gtest_main", 105 ] 106 107 external_deps = [ 108 "ability_runtime:ability_manager", 109 "c_utils:utils", 110 "eventhandler:libeventhandler", 111 "ffrt:libffrt", 112 "hilog:libhilog", 113 "ipc:ipc_single", 114 ] 115 116 defines = [] 117 118 if (ressched_with_resourceschedule_soc_perf_enable) { 119 external_deps += [ "soc_perf:socperf_client" ] 120 defines += [ "RESSCHED_RESOURCESCHEDULE_SOC_PERF_ENABLE" ] 121 } 122 123 if (resource_schedule_service_with_ffrt_enable) { 124 defines += [ "RESOURCE_SCHEDULE_SERVICE_WITH_FFRT_ENABLE" ] 125 } 126 127 sanitize = { 128 cfi = true 129 cfi_cross_dso = true 130 debug = false 131 } 132 branch_protector_ret = "pac_ret" 133} 134