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 "//commonlibrary/c_utils/base/include", 29 "//utils/system/safwk/native/include", 30 "//test/testfwk/developer_test/aw/distributed", 31 "$SUBSYSTEM_DIR/utils/include", 32 "$SUBSYSTEM_DIR/services/dbinder/dbinder_service/include", 33 "$SUBSYSTEM_DIR/interfaces/innerkits/ipc_core/include", 34 "$DBINDER_TEST_ROOT/distributedtest/include", 35 ] 36} 37 38ohos_distributedtest("DbinderTest") { 39 module_out_path = MODULE_OUTPUT_PATH 40 41 sources = [ 42 "$DBINDER_TEST_ROOT/distributedtest/src/dbinder_distributed_test.cpp", 43 "$DBINDER_TEST_ROOT/distributedtest/src/dbinder_service_test_helper.cpp", 44 "$DBINDER_TEST_ROOT/distributedtest/src/dbinder_test_service.cpp", 45 "$DBINDER_TEST_ROOT/distributedtest/src/dbinder_test_service_skeleton.cpp", 46 ] 47 48 configs = [ ":libtestdbinder_config" ] 49 50 deps = [ 51 ":dbinder_send", 52 ":dbinder_test", 53 "$SUBSYSTEM_DIR/interfaces/innerkits/libdbinder:libdbinder", 54 "//third_party/googletest:gtest_main", 55 ] 56 57 external_deps = [ 58 "c_utils:utils", 59 "hilog:libhilog", 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 = [ ":libtestdbinder_config" ] 79 80 deps = [ 81 ":dbinder_send", 82 ":dbinder_test", 83 "$SUBSYSTEM_DIR/interfaces/innerkits/ipc_core:ipc_core", 84 "//third_party/googletest:gtest", 85 ] 86 87 external_deps = [ 88 "c_utils:utils", 89 "dsoftbus:softbus_client", 90 "hilog:libhilog", 91 "samgr:samgr_proxy", 92 ] 93 94 subsystem_name = "communication" 95 resource_config_file = "$SUBSYSTEM_DIR/test/resource/services/ohos_test.xml" 96} 97 98############################################################################### 99ohos_executable("dbinder_test") { 100 sources = [ 101 "$DBINDER_TEST_ROOT/distributedtest/src/dbinder_test_server_main.cpp", 102 "$DBINDER_TEST_ROOT/distributedtest/src/dbinder_test_service.cpp", 103 "$DBINDER_TEST_ROOT/distributedtest/src/dbinder_test_service_skeleton.cpp", 104 ] 105 106 configs = [ ":libtestdbinder_config" ] 107 108 deps = [ "$SUBSYSTEM_DIR/interfaces/innerkits/ipc_core:ipc_core" ] 109 110 external_deps = [ 111 "c_utils:utils", 112 "hilog:libhilog", 113 "samgr:samgr_proxy", 114 ] 115 116 part_name = "ipc" 117 subsystem_name = "communication" 118} 119 120ohos_executable("dbinder_send") { 121 sources = [ 122 "$DBINDER_TEST_ROOT/distributedtest/src/dbinder_test_server_main.cpp", 123 "$DBINDER_TEST_ROOT/distributedtest/src/dbinder_test_service.cpp", 124 "$DBINDER_TEST_ROOT/distributedtest/src/dbinder_test_service_skeleton.cpp", 125 ] 126 127 cflags_cc = [ "-DDBINDER_TEST_SECOND" ] 128 129 configs = [ ":libtestdbinder_config" ] 130 131 deps = [ "$SUBSYSTEM_DIR/interfaces/innerkits/ipc_core:ipc_core" ] 132 133 external_deps = [ 134 "c_utils:utils", 135 "hilog:libhilog", 136 "samgr:samgr_proxy", 137 ] 138 139 part_name = "ipc" 140 subsystem_name = "communication" 141} 142 143ohos_distributedtest_py("dbindertest_py") { 144 module_out_path = MODULE_OUTPUT_PATH 145 sources = [ "test_dbinder.py" ] 146} 147 148############################################################################### 149group("distributedtest") { 150 testonly = true 151 deps = [ 152 ":DbinderTest", 153 ":DbinderTestAgent", 154 ":dbinder_send", 155 ":dbinder_test", 156 ":dbindertest_py", 157 ] 158} 159 160group("moduletest") { 161 testonly = true 162 deps = [ "moduletest" ] 163} 164