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