• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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("../../soc_perf.gni")
16
17module_output_path = "soc_perf/soc_perf"
18
19config("module_private_config") {
20  visibility = [ ":*" ]
21
22  include_dirs = [
23    "${socperf_common}/include",
24    "${socperf_interfaces}/inner_api/socperf_client/include",
25    "${socperf_services}/core/include",
26    "${socperf_services}/dfx/include",
27    "${socperf_services}/server/include",
28  ]
29}
30
31
32ohos_unittest("SocPerfHitraceChainTest") {
33  module_out_path = module_output_path
34
35  sources = [ "dfx/socperf_hitrace_chain_test.cpp" ]
36
37  configs = [ ":module_private_config" ]
38
39  deps = [ "${socperf_services}:socperf_server_static" ]
40
41  external_deps = [
42    "hitrace:libhitracechain",
43    "ipc:ipc_single",
44  ]
45
46  sanitize = {
47    cfi = true
48    cfi_cross_dso = true
49    debug = false
50  }
51  branch_protector_ret = "pac_ret"
52}
53
54ohos_unittest("SocPerfServerTest") {
55  module_out_path = module_output_path
56
57  sources = [
58    "mock/mock_accesstoken_kit.cpp",
59    "mock/mock_system_ability.cpp",
60    "socperf_server_test.cpp",
61  ]
62
63  configs = [ ":module_private_config" ]
64
65  deps = [
66    "${socperf_interfaces}/inner_api/socperf_client:socperf_stub",
67    "${socperf_services}:socperf_server_static",
68  ]
69
70  external_deps = [
71    "access_token:libaccesstoken_sdk",
72    "access_token:libtokenid_sdk",
73    "c_utils:utils",
74    "ffrt:libffrt",
75    "hilog:libhilog",
76    "hitrace:libhitracechain",
77    "ipc:ipc_single",
78    "libxml2:libxml2",
79    "safwk:system_ability_fwk",
80    "samgr:samgr_proxy",
81  ]
82
83  sanitize = {
84    cfi = true
85    cfi_cross_dso = true
86    debug = false
87  }
88  branch_protector_ret = "pac_ret"
89}
90
91ohos_unittest("SocPerfSubTest") {
92  module_out_path = module_output_path
93
94  sources = [ "socperf_sub_test.cpp" ]
95
96  configs = [ ":module_private_config" ]
97
98  deps = [ "${socperf_interfaces}/inner_api/socperf_client:socperf_client" ]
99
100  external_deps = [
101    "c_utils:utils",
102    "ffrt:libffrt",
103    "hilog:libhilog",
104    "ipc:ipc_single",
105    "libxml2:libxml2",
106    "safwk:system_ability_fwk",
107    "samgr:samgr_proxy",
108  ]
109}
110
111ohos_unittest("SocPerfSubMockTest") {
112  module_out_path = module_output_path
113
114  sources = [
115    "mock/mock_socperf_client.cpp",
116    "socperf_sub_mock_test.cpp",
117  ]
118
119  configs = [ ":module_private_config" ]
120
121  deps = [ "${socperf_interfaces}/inner_api/socperf_client:socperf_client" ]
122
123  external_deps = [
124    "c_utils:utils",
125    "ffrt:libffrt",
126    "hilog:libhilog",
127    "ipc:ipc_single",
128    "libxml2:libxml2",
129    "safwk:system_ability_fwk",
130    "samgr:samgr_proxy",
131  ]
132}
133
134ohos_unittest("LRUCache_test") {
135  module_out_path = module_output_path
136  cflags = [
137    "-Dprivate=public",
138    "-Dprotected=public",
139  ]
140  include_dirs = [ "${socperf_common}/include" ]
141
142  sources = [ "socperf_lru_cache_test.cpp" ]
143
144  deps = []
145
146  external_deps = []
147
148  sanitize = {
149    cfi = true
150    cfi_cross_dso = true
151    debug = false
152  }
153  branch_protector_ret = "pac_ret"
154}
155
156group("unittest") {
157  testonly = true
158  deps = [
159    ":LRUCache_test",
160    ":SocPerfHitraceChainTest",
161    ":SocPerfServerTest",
162    ":SocPerfSubMockTest",
163    ":SocPerfSubTest",
164  ]
165}
166