1# Copyright (c) 2022-2023 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("//base/security/certificate_manager/cert_manager.gni") 15import("//build/test.gni") 16 17module_output_path = "certificate_manager/certificate_manager" 18 19ohos_unittest("cm_sdk_test") { 20 module_out_path = module_output_path 21 sources = [ 22 "unittest/src/cm_abort_test.cpp", 23 "unittest/src/cm_app_cert_test.cpp", 24 "unittest/src/cm_finish_test.cpp", 25 "unittest/src/cm_get_auth_list_test.cpp", 26 "unittest/src/cm_get_certinfo_test.cpp", 27 "unittest/src/cm_get_certlist_test.cpp", 28 "unittest/src/cm_get_user_ca_cert_list.cpp", 29 "unittest/src/cm_grant_test.cpp", 30 "unittest/src/cm_init_test.cpp", 31 "unittest/src/cm_is_authed_test.cpp", 32 "unittest/src/cm_pri_app_cert_test.cpp", 33 "unittest/src/cm_remove_grant_test.cpp", 34 "unittest/src/cm_set_status_test.cpp", 35 "unittest/src/cm_sys_app_cert_test.cpp", 36 "unittest/src/cm_test_common.cpp", 37 "unittest/src/cm_update_test.cpp", 38 "unittest/src/cm_user_cert_test.cpp", 39 ] 40 41 include_dirs = [ "unittest/include" ] 42 cflags_cc = [ 43 "-Wall", 44 "-Werror", 45 ] 46 cflags = cflags_cc 47 branch_protector_ret = "pac_ret" 48 sanitize = { 49 cfi = true 50 cfi_cross_dso = true 51 boundary_sanitize = true 52 debug = false 53 integer_overflow = true 54 ubsan = true 55 } 56 57 deps = [ 58 "${cert_manager_root_dir}/frameworks/cert_manager_standard/main:cert_manager_standard_frameworks", 59 "${cert_manager_root_dir}/interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk", 60 ] 61 external_deps = [ 62 "access_token:libaccesstoken_sdk", 63 "access_token:libnativetoken", 64 "access_token:libtoken_setproc", 65 "bounds_checking_function:libsec_static", 66 "cJSON:cjson_static", 67 "c_utils:utils", 68 "googletest:gtest", 69 "openssl:libcrypto_shared", 70 "selinux_adapter:librestorecon", 71 ] 72 resource_config_file = "./resource/certificate_manager/ohos_test.xml" 73 74 defines = [] 75 if (certificate_manager_deps_huks_enabled == "software") { 76 defines += [ "DEPS_HKS_UNTRUSTED_RUNNING_ENV" ] 77 } 78} 79 80group("unittest") { 81 testonly = true 82 deps = [ ":cm_sdk_test" ] 83} 84 85group("module_test") { 86 testonly = true 87 deps = [ "./unittest/module_test:cm_module_test" ] 88} 89 90group("permission_test") { 91 testonly = true 92 deps = [ 93 "./unittest/common_permission_test:cm_common_permission_test", 94 "./unittest/inner_permission_test:cm_inner_permission_test", 95 ] 96} 97 98group("multi_thread_test") { 99 testonly = true 100 deps = [ "./unittest/multi_thread_test:cm_multi_thread_test" ] 101} 102