1# Copyright (C) 2022 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")
15
16SUBSYSTEM_DIR = "//foundation/communication/ipc"
17DBINDER_TEST_ROOT = "$SUBSYSTEM_DIR/services/dbinder/test"
18MODULE_OUTPUT_PATH = "ipc/services/dbinder"
19
20###############################################################################
21config("libtestdbinder_config") {
22  visibility = [ ":*" ]
23  cflags = []
24  if (is_standard_system) {
25    cflags += [ "-DCONFIG_STANDARD_SYSTEM" ]
26  }
27  include_dirs = [
28    "//utils/system/safwk/native/include",
29    "//test/testfwk/developer_test/aw/distributed",
30    "$SUBSYSTEM_DIR/utils/include",
31    "$SUBSYSTEM_DIR/services/dbinder/dbinder_service/include",
32    "$SUBSYSTEM_DIR/interfaces/innerkits/ipc_core/include",
33    "$DBINDER_TEST_ROOT/distributedtest/include",
34  ]
35}
36
37ohos_distributedtest("DbinderTest") {
38  module_out_path = MODULE_OUTPUT_PATH
39
40  sources = [
41    "$DBINDER_TEST_ROOT/distributedtest/src/dbinder_distributed_test.cpp",
42    "$DBINDER_TEST_ROOT/distributedtest/src/dbinder_service_test_helper.cpp",
43    "$DBINDER_TEST_ROOT/distributedtest/src/dbinder_test_service.cpp",
44    "$DBINDER_TEST_ROOT/distributedtest/src/dbinder_test_service_skeleton.cpp",
45  ]
46
47  configs = [ ":libtestdbinder_config" ]
48
49  deps = [
50    ":dbinder_send",
51    ":dbinder_test",
52    "$SUBSYSTEM_DIR/interfaces/innerkits/libdbinder:libdbinder",
53    "//third_party/googletest:gtest_main",
54  ]
55
56  external_deps = [
57    "c_utils:utils",
58    "hilog:libhilog",
59    "hitrace:libhitracechain",
60    "ipc:ipc_core",
61    "samgr:samgr_proxy",
62  ]
63
64  subsystem_name = "communication"
65  resource_config_file = "$SUBSYSTEM_DIR/test/resource/services/ohos_test.xml"
66}
67
68ohos_distributedtest("DbinderTestAgent") {
69  module_out_path = MODULE_OUTPUT_PATH
70
71  sources = [
72    "$DBINDER_TEST_ROOT/distributedtest/src/dbinder_service_test_helper.cpp",
73    "$DBINDER_TEST_ROOT/distributedtest/src/dbinder_test_agent.cpp",
74    "$DBINDER_TEST_ROOT/distributedtest/src/dbinder_test_service.cpp",
75    "$DBINDER_TEST_ROOT/distributedtest/src/dbinder_test_service_skeleton.cpp",
76  ]
77
78  configs = [
79    ":libtestdbinder_config",
80    "$SUBSYSTEM_DIR/config:dsoftbus_header_deps_config",
81  ]
82
83  deps = [
84    ":dbinder_send",
85    ":dbinder_test",
86    "$SUBSYSTEM_DIR/interfaces/innerkits/ipc_core:ipc_core",
87    "//third_party/googletest:gtest",
88  ]
89
90  external_deps = [
91    "c_utils:utils",
92    "hilog:libhilog",
93    "hitrace:libhitracechain",
94    "samgr:samgr_proxy",
95  ]
96
97  subsystem_name = "communication"
98  resource_config_file = "$SUBSYSTEM_DIR/test/resource/services/ohos_test.xml"
99}
100
101###############################################################################
102ohos_executable("dbinder_test") {
103  sources = [
104    "$DBINDER_TEST_ROOT/distributedtest/src/dbinder_test_server_main.cpp",
105    "$DBINDER_TEST_ROOT/distributedtest/src/dbinder_test_service.cpp",
106    "$DBINDER_TEST_ROOT/distributedtest/src/dbinder_test_service_skeleton.cpp",
107  ]
108
109  configs = [ ":libtestdbinder_config" ]
110
111  deps = [ "$SUBSYSTEM_DIR/interfaces/innerkits/ipc_core:ipc_core" ]
112
113  external_deps = [
114    "c_utils:utils",
115    "hilog:libhilog",
116    "hitrace:libhitracechain",
117    "samgr:samgr_proxy",
118  ]
119
120  part_name = "ipc"
121  subsystem_name = "communication"
122}
123
124ohos_executable("dbinder_send") {
125  sources = [
126    "$DBINDER_TEST_ROOT/distributedtest/src/dbinder_test_server_main.cpp",
127    "$DBINDER_TEST_ROOT/distributedtest/src/dbinder_test_service.cpp",
128    "$DBINDER_TEST_ROOT/distributedtest/src/dbinder_test_service_skeleton.cpp",
129  ]
130
131  cflags_cc = [ "-DDBINDER_TEST_SECOND" ]
132
133  configs = [ ":libtestdbinder_config" ]
134
135  deps = [ "$SUBSYSTEM_DIR/interfaces/innerkits/ipc_core:ipc_core" ]
136
137  external_deps = [
138    "c_utils:utils",
139    "hilog:libhilog",
140    "hitrace:libhitracechain",
141    "samgr:samgr_proxy",
142  ]
143
144  part_name = "ipc"
145  subsystem_name = "communication"
146}
147
148ohos_distributedtest_py("dbindertest_py") {
149  module_out_path = MODULE_OUTPUT_PATH
150  sources = [ "test_dbinder.py" ]
151}
152
153###############################################################################
154group("distributedtest") {
155  testonly = true
156  deps = [
157    ":DbinderTest",
158    ":DbinderTestAgent",
159    ":dbinder_send",
160    ":dbinder_test",
161    ":dbindertest_py",
162  ]
163}
164
165group("moduletest") {
166  testonly = true
167  deps = [ "moduletest" ]
168}
169