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 "hisysevent:libhisysevent", 63 "init:libbegetutil" 64 ] 65 } 66} 67 68ohos_unittest("cadaemontest") { 69 part_name = "tee_client" 70 test_module = "tee_client" 71 module_out_path = part_name + "/" + test_module 72 73 include_dirs = [ 74 "../../interfaces/inner_api", 75 "../../frameworks/include/", 76 "../../frameworks/include/standard", 77 "../../services/cadaemon/src/ca_daemon/", 78 "../../services/authentication/", 79 "../../src/ca_daemon/", 80 "../../frameworks/libteec_vendor/", 81 ] 82 83 sources = [ "cadaemontest.cpp" ] 84 85 deps = [ "../../frameworks/build/standard:libteec" ] 86 87 external_deps = [ 88 "c_utils:utils", 89 "googletest:gtest_main", 90 "hilog:libhilog", 91 "ipc:ipc_single", 92 "safwk:system_ability_fwk", 93 "samgr:samgr_proxy", 94 "hisysevent:libhisysevent", 95 ] 96 ldflags = [ "--coverage" ] 97} 98 99ohos_unittest("teecvendortest") { 100 part_name = "tee_client" 101 test_module = "tee_client" 102 module_out_path = part_name + "/" + test_module 103 104 include_dirs = [ 105 "../../interfaces/inner_api", 106 "../../frameworks/include/", 107 "../../frameworks/include/standard", 108 "../../services/cadaemon/src/ca_daemon/", 109 "../../services/authentication/", 110 "../../frameworks/libteec_vendor/", 111 "../../frameworks/libteec_client/", 112 ] 113 114 sources = [ "teecvendortest.cpp" ] 115 116 deps = [ "../../frameworks/build/standard:libteec_vendor" ] 117 118 external_deps = [ 119 "c_utils:utils", 120 "googletest:gtest_main", 121 "hilog:libhilog", 122 "ipc:ipc_single", 123 "safwk:system_ability_fwk", 124 "hisysevent:libhisysevent", 125 ] 126 ldflags = [ "--coverage" ] 127} 128 129ohos_unittest("authenticationtest") { 130 part_name = "tee_client" 131 test_module = "tee_client" 132 module_out_path = part_name + "/" + test_module 133 defines = [ "ENABLE_FDSAN_CHECK" ] 134 include_dirs = [ 135 "../../services/authentication/", 136 "../../interfaces/inner_api/", 137 "../../frameworks/include/", 138 "../../frameworks/include/standard/", 139 "../../test/unittest/authenticationtest_stub/include/", 140 ] 141 142 sources = [ 143 "../../frameworks/tee_file/tee_file.c", 144 "../../services/authentication/tcu_authentication.c", 145 "../../services/authentication/tee_auth_common.c", 146 "../../services/authentication/tee_auth_system.cpp", 147 "../../services/authentication/tee_get_native_cert.c", 148 "authenticationtest.cpp", 149 "authenticationtest_stub/accesstoken_kit.cpp", 150 "authenticationtest_stub/if_system_ability_manager.cpp", 151 "authenticationtest_stub/ipc_skeleton.cpp", 152 "authenticationtest_stub/iservice_registry.cpp", 153 ] 154 155 external_deps = [ 156 "c_utils:utils", 157 "googletest:gmock", 158 "googletest:gmock_main", 159 "googletest:gtest", 160 "googletest:gtest_main", 161 "hilog:libhilog", 162 "ipc:ipc_single", 163 "openssl:libcrypto_shared", 164 "safwk:system_ability_fwk", 165 "samgr:samgr_proxy", 166 "hisysevent:libhisysevent", 167 ] 168 ldflags = [ "--coverage" ] 169} 170 171ohos_unittest("loadsecfiletest") { 172 part_name = "tee_client" 173 test_module = "tee_client" 174 module_out_path = part_name + "/" + test_module 175 176 include_dirs = [ 177 "../../interfaces/inner_api", 178 "../../frameworks/include/", 179 "../../frameworks/include/standard", 180 "../../services/cadaemon/src/ca_daemon/", 181 "../../services/authentication/", 182 "../../frameworks/libteec_vendor/", 183 "../../frameworks/libteec_client/", 184 "../../frameworks/include/standard/teec_system", 185 ] 186 187 sources = [ "loadsecfiletest.cpp" ] 188 189 deps = [ "../../frameworks/build/standard:libteec_vendor" ] 190 191 external_deps = [ 192 "c_utils:utils", 193 "googletest:gtest_main", 194 "hilog:libhilog", 195 "hisysevent:libhisysevent", 196 ] 197 ldflags = [ "--coverage" ] 198} 199 200group("unittest") { 201 testonly = true 202 if (component_type == "system") { 203 deps = [ ":authenticationtest" ] 204 deps += [ ":loadsecfiletest" ] 205 if (tee_client_features_tui) { 206 deps += [ 207 # deps file 208 ":cadaemontest", 209 ":teecvendortest", 210 ":tuidaemontest", 211 ] 212 } 213 } 214} 215