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") 15import("../../tee_client.gni") 16 17component_type = "" 18if (defined(global_parts_info) && 19 defined(global_parts_info.bundlemanager_bundle_framework)) { 20 component_type = "system" 21} 22if (tee_client_features_tui) { 23 ohos_unittest("tuidaemontest") { 24 part_name = "tee_client" 25 test_module = "tee_client" 26 module_out_path = part_name + "/" + test_module 27 28 include_dirs = [ 29 "../../interfaces/inner_api", 30 "../../frameworks/include/", 31 "../../frameworks/include/standard", 32 "../../frameworks/include/standard/teec_system", 33 "../../frameworks/libteec_vendor", 34 "../../services/authentication", 35 "../../services/cadaemon/src/ca_daemon", 36 "../../services/cadaemon/src/tui_daemon", 37 "../../test/unittest", 38 ] 39 defines = [ "ENABLE_FDSAN_CHECK" ] 40 sources = [ 41 "../../frameworks/tee_file/tee_file.c", 42 "../../services/cadaemon/src/tui_daemon/tee_tui_daemon.cpp", 43 "../../services/cadaemon/src/tui_daemon/tee_tui_daemon_wrapper.cpp", 44 "../../services/cadaemon/src/tui_daemon/tui_event.cpp", 45 "stubMock.cpp", 46 "tuidaemontest.cpp", 47 ] 48 49 external_deps = [ 50 "ability_base:want", 51 "c_utils:utils", 52 "call_manager:tel_call_manager_api", 53 "googletest:gmock", 54 "googletest:gtest_main", 55 "hilog:libhilog", 56 "image_framework:image_native", 57 "ipc:ipc_single", 58 "power_manager:powermgr_client", 59 "safwk:system_ability_fwk", 60 "samgr:samgr_proxy", 61 "window_manager:libdm", 62 ] 63 } 64} 65 66ohos_unittest("cadaemontest") { 67 part_name = "tee_client" 68 test_module = "tee_client" 69 module_out_path = part_name + "/" + test_module 70 71 include_dirs = [ 72 "../../interfaces/inner_api", 73 "../../frameworks/include/", 74 "../../frameworks/include/standard", 75 "../../services/cadaemon/src/ca_daemon/", 76 "../../services/authentication/", 77 "../../src/ca_daemon/", 78 "../../frameworks/libteec_vendor/", 79 ] 80 81 sources = [ "cadaemontest.cpp" ] 82 83 deps = [ "../../frameworks/build/standard:libteec" ] 84 85 external_deps = [ 86 "c_utils:utils", 87 "googletest:gtest_main", 88 "hilog:libhilog", 89 "ipc:ipc_single", 90 "safwk:system_ability_fwk", 91 "samgr:samgr_proxy", 92 ] 93 ldflags = [ "--coverage" ] 94} 95 96ohos_unittest("teecvendortest") { 97 part_name = "tee_client" 98 test_module = "tee_client" 99 module_out_path = part_name + "/" + test_module 100 101 include_dirs = [ 102 "../../interfaces/inner_api", 103 "../../frameworks/include/", 104 "../../frameworks/include/standard", 105 "../../services/cadaemon/src/ca_daemon/", 106 "../../services/authentication/", 107 "../../frameworks/libteec_vendor/", 108 "../../frameworks/libteec_client/", 109 ] 110 111 sources = [ "teecvendortest.cpp" ] 112 113 deps = [ "../../frameworks/build/standard:libteec_vendor" ] 114 115 external_deps = [ 116 "c_utils:utils", 117 "googletest:gtest_main", 118 "hilog:libhilog", 119 "ipc:ipc_single", 120 "safwk:system_ability_fwk", 121 ] 122 ldflags = [ "--coverage" ] 123} 124 125ohos_unittest("authenticationtest") { 126 part_name = "tee_client" 127 test_module = "tee_client" 128 module_out_path = part_name + "/" + test_module 129 defines = [ "ENABLE_FDSAN_CHECK" ] 130 include_dirs = [ 131 "../../services/authentication/", 132 "../../interfaces/inner_api/", 133 "../../frameworks/include/", 134 "../../frameworks/include/standard/", 135 "../../test/unittest/authenticationtest_stub/include/", 136 ] 137 138 sources = [ 139 "../../frameworks/tee_file/tee_file.c", 140 "../../services/authentication/tcu_authentication.c", 141 "../../services/authentication/tee_auth_common.c", 142 "../../services/authentication/tee_auth_system.cpp", 143 "../../services/authentication/tee_get_native_cert.c", 144 "authenticationtest.cpp", 145 "authenticationtest_stub/accesstoken_kit.cpp", 146 "authenticationtest_stub/if_system_ability_manager.cpp", 147 "authenticationtest_stub/ipc_skeleton.cpp", 148 "authenticationtest_stub/iservice_registry.cpp", 149 ] 150 151 external_deps = [ 152 "c_utils:utils", 153 "googletest:gmock", 154 "googletest:gmock_main", 155 "googletest:gtest", 156 "googletest:gtest_main", 157 "hilog:libhilog", 158 "ipc:ipc_single", 159 "openssl:libcrypto_shared", 160 ] 161 ldflags = [ "--coverage" ] 162} 163 164ohos_unittest("loadsecfiletest") { 165 part_name = "tee_client" 166 test_module = "tee_client" 167 module_out_path = part_name + "/" + test_module 168 169 include_dirs = [ 170 "../../interfaces/inner_api", 171 "../../frameworks/include/", 172 "../../frameworks/include/standard", 173 "../../services/cadaemon/src/ca_daemon/", 174 "../../services/authentication/", 175 "../../frameworks/libteec_vendor/", 176 "../../frameworks/libteec_client/", 177 "../../frameworks/include/standard/teec_system", 178 ] 179 180 sources = [ "loadsecfiletest.cpp" ] 181 182 deps = [ "../../frameworks/build/standard:libteec_vendor" ] 183 184 external_deps = [ 185 "c_utils:utils", 186 "googletest:gtest_main", 187 "hilog:libhilog", 188 ] 189 ldflags = [ "--coverage" ] 190} 191 192group("unittest") { 193 testonly = true 194 if (component_type == "system") { 195 if (tee_client_features_tui) { 196 deps = [ ":cadaemontest" ] 197 deps += [ ":teecvendortest" ] 198 deps += [ ":authenticationtest" ] 199 deps += [ ":loadsecfiletest" ] 200 deps += [ 201 # deps file 202 ":tuidaemontest", 203 ] 204 } 205 } 206} 207