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 ] 54 55 external_deps = [ 56 "c_utils:utils", 57 "hilog:libhilog", 58 "hitrace:libhitracechain", 59 "ipc:ipc_core", 60 "samgr:samgr_proxy", 61 ] 62 63 subsystem_name = "communication" 64 resource_config_file = "$SUBSYSTEM_DIR/test/resource/services/ohos_test.xml" 65} 66 67ohos_distributedtest("DbinderTestAgent") { 68 module_out_path = MODULE_OUTPUT_PATH 69 70 sources = [ 71 "$DBINDER_TEST_ROOT/distributedtest/src/dbinder_service_test_helper.cpp", 72 "$DBINDER_TEST_ROOT/distributedtest/src/dbinder_test_agent.cpp", 73 "$DBINDER_TEST_ROOT/distributedtest/src/dbinder_test_service.cpp", 74 "$DBINDER_TEST_ROOT/distributedtest/src/dbinder_test_service_skeleton.cpp", 75 ] 76 77 configs = [ 78 ":libtestdbinder_config", 79 "$SUBSYSTEM_DIR/config:dsoftbus_header_deps_config", 80 ] 81 82 deps = [ 83 ":dbinder_send", 84 ":dbinder_test", 85 "$SUBSYSTEM_DIR/interfaces/innerkits/ipc_core:ipc_core", 86 "//third_party/googletest:gtest", 87 ] 88 89 external_deps = [ 90 "c_utils:utils", 91 "hilog:libhilog", 92 "hitrace:libhitracechain", 93 "samgr:samgr_proxy", 94 ] 95 96 subsystem_name = "communication" 97 resource_config_file = "$SUBSYSTEM_DIR/test/resource/services/ohos_test.xml" 98} 99 100############################################################################### 101ohos_executable("dbinder_test") { 102 sources = [ 103 "$DBINDER_TEST_ROOT/distributedtest/src/dbinder_test_server_main.cpp", 104 "$DBINDER_TEST_ROOT/distributedtest/src/dbinder_test_service.cpp", 105 "$DBINDER_TEST_ROOT/distributedtest/src/dbinder_test_service_skeleton.cpp", 106 ] 107 108 configs = [ ":libtestdbinder_config" ] 109 110 deps = [ "$SUBSYSTEM_DIR/interfaces/innerkits/ipc_core:ipc_core" ] 111 112 external_deps = [ 113 "c_utils:utils", 114 "hilog:libhilog", 115 "hitrace:libhitracechain", 116 "samgr:samgr_proxy", 117 ] 118 119 part_name = "ipc" 120 subsystem_name = "communication" 121} 122 123ohos_executable("dbinder_send") { 124 sources = [ 125 "$DBINDER_TEST_ROOT/distributedtest/src/dbinder_test_server_main.cpp", 126 "$DBINDER_TEST_ROOT/distributedtest/src/dbinder_test_service.cpp", 127 "$DBINDER_TEST_ROOT/distributedtest/src/dbinder_test_service_skeleton.cpp", 128 ] 129 130 cflags_cc = [ "-DDBINDER_TEST_SECOND" ] 131 132 configs = [ ":libtestdbinder_config" ] 133 134 deps = [ "$SUBSYSTEM_DIR/interfaces/innerkits/ipc_core:ipc_core" ] 135 136 external_deps = [ 137 "c_utils:utils", 138 "hilog:libhilog", 139 "hitrace:libhitracechain", 140 "samgr:samgr_proxy", 141 ] 142 143 part_name = "ipc" 144 subsystem_name = "communication" 145} 146 147ohos_distributedtest_py("dbindertest_py") { 148 module_out_path = MODULE_OUTPUT_PATH 149 sources = [ "test_dbinder.py" ] 150} 151 152############################################################################### 153group("distributedtest") { 154 testonly = true 155 deps = [ 156 ":DbinderTest", 157 ":DbinderTestAgent", 158 ":dbinder_send", 159 ":dbinder_test", 160 ":dbindertest_py", 161 ] 162} 163 164group("moduletest") { 165 testonly = true 166 deps = [ "moduletest" ] 167} 168