• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (C) 2021-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("../../thermalmgr.gni")
16
17module_output_path = "thermal_manager/thermal_manager"
18
19###############################################################################
20config("module_private_config") {
21  visibility = [ ":*" ]
22  include_dirs = [
23    "include",
24    "${ability_runtime_services_path}/appmgr/include",
25    "${thermal_manager_path}/test/common/include",
26    "${thermal_service_zidl}/include",
27  ]
28}
29
30deps_ex = [
31  "ability_base:base",
32  "ability_base:want",
33  "ability_runtime:wantagent_innerkits",
34  "access_token:libaccesstoken_sdk",
35  "access_token:libnativetoken",
36  "access_token:libtoken_setproc",
37  "hdf_core:libhdi",
38  "bundle_framework:appexecfwk_base",
39  "common_event_service:cesfwk_innerkits",
40  "c_utils:utils",
41  "libxml2:libxml2",
42  "drivers_interface_thermal:libthermal_proxy_1.1",
43  "hilog:libhilog",
44  "ipc:ipc_core",
45  "power_manager:powermgr_client",
46  "safwk:system_ability_fwk",
47  "samgr:samgr_proxy",
48  "time_service:time_client",
49]
50
51ohos_systemtest("ThermalMgrInterfaceTest") {
52  module_out_path = "${module_output_path}"
53
54  sources = [
55    "${thermal_manager_path}/test/common/src/thermal_test.cpp",
56    "src/thermal_mgr_interface_test.cpp",
57  ]
58
59  configs = [
60    "${utils_path}:utils_config",
61    "${utils_path}:coverage_flags",
62    ":module_private_config",
63  ]
64
65  include_dirs = [
66    "include",
67    "${thermal_manager_path}/services/native/include",
68    "${thermal_manager_path}/services/native/include/thermal_action",
69    "${thermal_manager_path}/services/native/include/thermal_observer",
70    "${thermal_manager_path}/services/native/include/thermal_policy",
71    "${thermal_manager_path}/services/native/include/thermal_observer/state_machine",
72    "${thermal_manager_path}/services/native/include/thermal_action/action",
73    "${thermal_manager_path}/test/unittest/include",
74    "${thermal_manager_path}/services/zidl/include",
75  ]
76
77  deps = [
78    "${thermal_inner_api}:thermalsrv_client",
79    "${thermal_manager_path}/services:thermalservice",
80    "${thermal_manager_path}/test/common:mock_thermalsrv_client",
81    "${thermal_service_zidl}:thermalmgr_proxy",
82    "${thermal_service_zidl}:thermalmgr_stub",
83    "//third_party/googletest:gmock_main",
84    "//third_party/googletest:gtest_main",
85  ]
86  external_deps = deps_ex
87
88  defines = []
89  if (has_thermal_airplane_manager_part) {
90    defines += [ "HAS_THERMAL_AIRPLANE_MANAGER_PART" ]
91    external_deps += [ "netmanager_base:net_conn_manager_if" ]
92  }
93}
94
95ohos_systemtest("ThermalMgrSystemTest") {
96  resource_config_file =
97      "${thermal_manager_path}/test/resource/system_test/ohos_test.xml"
98
99  module_out_path = "${module_output_path}"
100
101  sources = [
102    "${thermal_manager_path}/test/unittest/src/thermal_config_file_parser.cpp",
103    "src/thermal_mgr_system_test.cpp",
104  ]
105
106  configs = [
107    "${utils_path}:utils_config",
108    "${utils_path}:coverage_flags",
109  ]
110
111  include_dirs = [
112    "include",
113    "${thermal_manager_path}/services/zidl/include",
114    "${thermal_manager_path}/services/native/include",
115    "${thermal_manager_path}/services/native/include/thermal_action",
116    "${thermal_manager_path}/services/native/include/thermal_observer",
117    "${thermal_manager_path}/services/native/include/thermal_policy",
118    "${thermal_manager_path}/services/native/include/thermal_observer/state_machine",
119    "${thermal_manager_path}/services/native/include/thermal_action/action",
120    "${thermal_manager_path}/test/unittest/include",
121  ]
122
123  deps = [
124    "${thermal_manager_path}/services:thermalservice",
125    "${thermal_manager_path}/test/common:mock_thermalsrv_client",
126    "//third_party/googletest:gmock_main",
127    "//third_party/googletest:gtest_main",
128  ]
129  external_deps = deps_ex
130
131  defines = []
132  if (has_thermal_airplane_manager_part) {
133    defines += [ "HAS_THERMAL_AIRPLANE_MANAGER_PART" ]
134    external_deps += [ "netmanager_base:net_conn_manager_if" ]
135  }
136}
137
138ohos_systemtest("ThermalMgrDialogTest") {
139  module_out_path = "${module_output_path}"
140
141  sources = [ "src/thermal_mgr_dialog_test.cpp" ]
142
143  configs = [
144    "${utils_path}:utils_config",
145    "${utils_path}:coverage_flags",
146  ]
147
148  include_dirs = [
149    "include",
150    "${thermal_manager_path}/services/zidl/include",
151    "${thermal_manager_path}/services/native/include",
152    "${thermal_manager_path}/services/native/include/thermal_action",
153    "${thermal_manager_path}/services/native/include/thermal_observer",
154    "${thermal_manager_path}/services/native/include/thermal_policy",
155    "${thermal_manager_path}/services/native/include/thermal_observer/state_machine",
156    "${thermal_manager_path}/services/native/include/thermal_action/action",
157  ]
158
159  deps = [
160    "${thermal_manager_path}/services:thermalservice",
161    "${thermal_service_zidl}:thermalmgr_proxy",
162    "${thermal_service_zidl}:thermalmgr_stub",
163    "${utils_path}:thermal_utils",
164    "//third_party/googletest:gmock_main",
165    "//third_party/googletest:gtest_main",
166  ]
167  external_deps = deps_ex
168
169  defines = []
170  if (has_thermal_airplane_manager_part) {
171    defines += [ "HAS_THERMAL_AIRPLANE_MANAGER_PART" ]
172    external_deps += [ "netmanager_base:net_conn_manager_if" ]
173  }
174}
175
176ohos_systemtest("ThermalLevelEventSystemTest") {
177  module_out_path = module_output_path
178
179  sanitize = {
180    cfi = true
181    cfi_cross_dso = true
182    debug = false
183    blocklist = "../cfi_blocklist.txt"
184  }
185
186  sources = [
187    "${thermal_manager_path}/test/common/src/thermal_test.cpp",
188    "src/thermal_level_event_system_test.cpp",
189  ]
190
191  configs = [
192    "${utils_path}:utils_config",
193    ":module_private_config",
194    "${utils_path}:coverage_flags",
195  ]
196
197  deps = [
198    "${thermal_inner_api}:thermalsrv_client",
199    "${thermal_manager_path}/services:thermalservice",
200    "${thermal_manager_path}/test/common:mock_thermalsrv_client",
201    "//third_party/googletest:gtest_main",
202  ]
203  external_deps = deps_ex
204
205  defines = []
206  if (defined(global_parts_info) &&
207      defined(global_parts_info.powermgr_battery_manager)) {
208    defines += [ "BATTERY_MANAGER_ENABLE" ]
209    external_deps += [ "battery_manager:batterysrv_client" ]
210  }
211
212  if (has_thermal_airplane_manager_part) {
213    defines += [ "HAS_THERMAL_AIRPLANE_MANAGER_PART" ]
214    external_deps += [ "netmanager_base:net_conn_manager_if" ]
215  }
216}
217
218group("systemtest") {
219  testonly = true
220
221  deps = [
222    ":ThermalLevelEventSystemTest",
223    ":ThermalMgrDialogTest",
224    ":ThermalMgrInterfaceTest",
225  ]
226}
227