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_native"
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  "access_token:libaccesstoken_sdk",
34  "access_token:libnativetoken",
35  "access_token:libtoken_setproc",
36  "hdf_core:libhdi",
37  "bundle_framework:appexecfwk_base",
38  "common_event_service:cesfwk_innerkits",
39  "c_utils:utils",
40  "libxml2:libxml2",
41  "drivers_interface_thermal:libthermal_proxy_1.1",
42  "hilog:libhilog",
43  "ipc:ipc_core",
44  "power_manager:powermgr_client",
45  "safwk:system_ability_fwk",
46  "samgr:samgr_proxy",
47]
48
49ohos_systemtest("ThermalMgrInterfaceTest") {
50  module_out_path = "${module_output_path}"
51
52  sources = [
53    "${thermal_manager_path}/test/common/src/thermal_test.cpp",
54    "src/thermal_mgr_interface_test.cpp",
55  ]
56
57  configs = [
58    "${utils_path}:utils_config",
59    "${utils_path}:coverage_flags",
60    ":module_private_config",
61  ]
62
63  include_dirs = [
64    "include",
65    "${thermal_manager_path}/services/native/include",
66    "${thermal_manager_path}/services/native/include/thermal_action",
67    "${thermal_manager_path}/services/native/include/thermal_observer",
68    "${thermal_manager_path}/services/native/include/thermal_policy",
69    "${thermal_manager_path}/services/native/include/thermal_observer/state_machine",
70    "${thermal_manager_path}/services/native/include/thermal_action/action",
71    "${thermal_manager_path}/test/unittest/include",
72    "${thermal_manager_path}/services/zidl/include",
73  ]
74
75  deps = [
76    "${thermal_inner_api}:thermalsrv_client",
77    "${thermal_manager_path}/services:thermalservice",
78    "${thermal_manager_path}/test/common:mock_thermalsrv_client",
79    "${thermal_service_zidl}:thermalmgr_proxy",
80    "${thermal_service_zidl}:thermalmgr_stub",
81    "//third_party/googletest:gmock_main",
82    "//third_party/googletest:gtest_main",
83  ]
84  external_deps = deps_ex
85}
86
87ohos_systemtest("ThermalMgrSystemTest") {
88  resource_config_file =
89      "${thermal_manager_path}/test/resource/system_test/ohos_test.xml"
90
91  module_out_path = "${module_output_path}"
92
93  sources = [
94    "${thermal_manager_path}/test/unittest/src/thermal_config_file_parser.cpp",
95    "src/thermal_mgr_system_test.cpp",
96  ]
97
98  configs = [
99    "${utils_path}:utils_config",
100    "${utils_path}:coverage_flags",
101  ]
102
103  include_dirs = [
104    "include",
105    "${thermal_manager_path}/services/zidl/include",
106    "${thermal_manager_path}/services/native/include",
107    "${thermal_manager_path}/services/native/include/thermal_action",
108    "${thermal_manager_path}/services/native/include/thermal_observer",
109    "${thermal_manager_path}/services/native/include/thermal_policy",
110    "${thermal_manager_path}/services/native/include/thermal_observer/state_machine",
111    "${thermal_manager_path}/services/native/include/thermal_action/action",
112    "${thermal_manager_path}/test/unittest/include",
113  ]
114
115  deps = [
116    "${thermal_manager_path}/services:thermalservice",
117    "${thermal_manager_path}/test/common:mock_thermalsrv_client",
118    "//third_party/googletest:gmock_main",
119    "//third_party/googletest:gtest_main",
120  ]
121  external_deps = deps_ex
122}
123
124ohos_systemtest("ThermalMgrDialogTest") {
125  module_out_path = "${module_output_path}"
126
127  sources = [ "src/thermal_mgr_dialog_test.cpp" ]
128
129  configs = [
130    "${utils_path}:utils_config",
131    "${utils_path}:coverage_flags",
132  ]
133
134  include_dirs = [
135    "include",
136    "${thermal_manager_path}/services/zidl/include",
137    "${thermal_manager_path}/services/native/include",
138    "${thermal_manager_path}/services/native/include/thermal_action",
139    "${thermal_manager_path}/services/native/include/thermal_observer",
140    "${thermal_manager_path}/services/native/include/thermal_policy",
141    "${thermal_manager_path}/services/native/include/thermal_observer/state_machine",
142    "${thermal_manager_path}/services/native/include/thermal_action/action",
143  ]
144
145  deps = [
146    "${thermal_manager_path}/services:thermalservice",
147    "${thermal_service_zidl}:thermalmgr_proxy",
148    "${thermal_service_zidl}:thermalmgr_stub",
149    "${utils_path}:thermal_utils",
150    "//third_party/googletest:gmock_main",
151    "//third_party/googletest:gtest_main",
152  ]
153  external_deps = deps_ex
154}
155
156ohos_systemtest("ThermalLevelEventSystemTest") {
157  module_out_path = module_output_path
158
159  sanitize = {
160    cfi = true
161    cfi_cross_dso = true
162    debug = false
163    blocklist = "../cfi_blocklist.txt"
164  }
165
166  sources = [
167    "${thermal_manager_path}/test/common/src/thermal_test.cpp",
168    "src/thermal_level_event_system_test.cpp",
169  ]
170
171  configs = [
172    "${utils_path}:utils_config",
173    ":module_private_config",
174    "${utils_path}:coverage_flags",
175  ]
176
177  deps = [
178    "${thermal_inner_api}:thermalsrv_client",
179    "${thermal_manager_path}/services:thermalservice",
180    "${thermal_manager_path}/test/common:mock_thermalsrv_client",
181    "//third_party/googletest:gtest_main",
182  ]
183  external_deps = deps_ex
184
185  defines = []
186  if (defined(global_parts_info) &&
187      defined(global_parts_info.powermgr_battery_manager)) {
188    defines += [ "BATTERY_MANAGER_ENABLE" ]
189    external_deps += [ "battery_manager:batterysrv_client" ]
190  }
191}
192
193group("systemtest") {
194  testonly = true
195
196  deps = [
197    ":ThermalLevelEventSystemTest",
198    ":ThermalMgrDialogTest",
199    ":ThermalMgrInterfaceTest",
200  ]
201}
202