1# Copyright (c) 2022-2025 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("//foundation/filemanagement/app_file_service/backup.gni") 16 17ohos_unittest("b_file_info_test") { 18 branch_protector_ret = "pac_ret" 19 sanitize = { 20 integer_overflow = true 21 cfi = true 22 cfi_cross_dso = true 23 debug = false 24 } 25 26 module_out_path = path_module_out_tests 27 28 sources = [ 29 "${path_backup}/frameworks/native/backup_kit_inner/src/b_file_info.cpp", 30 "b_file_info_test.cpp", 31 ] 32 sources += backup_mock_parcel_src 33 34 include_dirs = 35 [ "${path_backup}/interfaces/inner_api/native/backup_kit_inner/impl" ] 36 include_dirs += backup_mock_parcel_include_dirs 37 38 deps = [ 39 "${path_backup}/tests/utils:backup_test_utils", 40 "${path_backup}/utils:backup_utils", 41 ] 42 43 external_deps = [ "hilog:libhilog" ] 44 45 use_exceptions = true 46} 47 48ohos_unittest("backup_sa_impl_test") { 49 branch_protector_ret = "pac_ret" 50 51 module_out_path = path_module_out_tests 52 53 cflags = [ 54 "-Dprivate = public", 55 "-Dprotected = public", 56 ] 57 58 sources = [ 59 "${path_backup_mock}/system_ability_manager/service_registry_mock.cpp", 60 "${path_backup_mock}/utils_mock/src/utils_mock_global_variable.cpp", 61 "service_reverse_test.cpp", 62 "svc_death_recipient_test.cpp", 63 ] 64 65 include_dirs = [ 66 "${path_backup}/services/backup_sa/include", 67 "${path_backup}/frameworks/native/backup_kit_inner/include", 68 "${path_backup}/tests/unittests/backup_api/backup_impl/include", 69 "${path_backup}/interfaces/inner_api/native/backup_kit_inner/impl", 70 ] 71 include_dirs += backup_mock_utils_include 72 73 deps = [ 74 "${path_backup}/interfaces/inner_api/native/backup_kit_inner:backup_kit_inner", 75 "${path_backup}/services/backup_sa:backup_sa_ipc", 76 "${path_backup}/tests/utils:backup_test_utils", 77 "${path_backup}/utils:backup_utils", 78 ] 79 80 external_deps = [ 81 "c_utils:utils", 82 "googletest:gmock_main", 83 "googletest:gtest_main", 84 "hilog:libhilog", 85 "hitrace:hitrace_meter", 86 "init:libbegetutil", 87 "ipc:ipc_core", 88 "samgr:dynamic_cache", 89 "samgr:samgr_proxy", 90 ] 91 92 sanitize = { 93 integer_overflow = true 94 cfi = true 95 cfi_cross_dso = true 96 debug = false 97 blocklist = "${path_backup}/cfi_blocklist.txt" 98 } 99 100 use_exceptions = true 101} 102 103group("backup_impl_test") { 104 testonly = true 105 106 deps = [ 107 ":b_file_info_test", 108 ":backup_sa_impl_test", 109 ] 110} 111