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/socperftest"
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}/server/include",
27  ]
28}
29
30ohos_unittest("SocPerfServerTest") {
31  module_out_path = module_output_path
32
33  sources = [
34    "mock/mock_accesstoken_kit.cpp",
35    "mock/mock_system_ability.cpp",
36    "socperf_server_test.cpp",
37  ]
38
39  configs = [ ":module_private_config" ]
40
41  deps = [
42    "${socperf_services}:socperf_server_static",
43    "//third_party/googletest:gtest_main",
44    "//third_party/libxml2:libxml2",
45  ]
46
47  external_deps = [
48    "access_token:libaccesstoken_sdk",
49    "access_token:libtokenid_sdk",
50    "c_utils:utils",
51    "eventhandler:libeventhandler",
52    "ffrt:libffrt",
53    "hilog:libhilog",
54    "ipc:ipc_single",
55    "safwk:system_ability_fwk",
56    "samgr:samgr_proxy",
57  ]
58
59  sanitize = {
60    cfi = true
61    cfi_cross_dso = true
62    debug = false
63  }
64  branch_protector_ret = "pac_ret"
65}
66
67ohos_unittest("SocPerfSubTest") {
68  module_out_path = module_output_path
69
70  sources = [ "socperf_sub_test.cpp" ]
71
72  configs = [ ":module_private_config" ]
73
74  deps = [
75    "${socperf_interfaces}/inner_api/socperf_client:socperf_client",
76    "//third_party/googletest:gtest_main",
77    "//third_party/libxml2:libxml2",
78  ]
79
80  external_deps = [
81    "c_utils:utils",
82    "eventhandler:libeventhandler",
83    "ffrt:libffrt",
84    "hilog:libhilog",
85    "ipc:ipc_single",
86    "safwk:system_ability_fwk",
87    "samgr:samgr_proxy",
88  ]
89}
90
91ohos_unittest("SocPerfSubMockTest") {
92  module_out_path = module_output_path
93
94  sources = [
95    "mock/mock_socperf_client.cpp",
96    "socperf_sub_mock_test.cpp",
97  ]
98
99  configs = [ ":module_private_config" ]
100
101  deps = [
102    "${socperf_interfaces}/inner_api/socperf_client:socperf_client",
103    "//third_party/googletest:gtest_main",
104    "//third_party/libxml2:libxml2",
105  ]
106
107  external_deps = [
108    "c_utils:utils",
109    "eventhandler:libeventhandler",
110    "ffrt:libffrt",
111    "hilog:libhilog",
112    "ipc:ipc_single",
113    "safwk:system_ability_fwk",
114    "samgr:samgr_proxy",
115  ]
116}
117
118group("unittest") {
119  testonly = true
120  deps = [
121    ":SocPerfServerTest",
122    ":SocPerfSubMockTest",
123    ":SocPerfSubTest",
124  ]
125}
126