# Copyright (C) 2024-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import("//build/test.gni") import("//foundation/filemanagement/dfs_service/distributedfile.gni") ohos_unittest("distributed_file_daemon_test") { branch_protector_ret = "pac_ret" sanitize = { integer_overflow = true cfi = true cfi_cross_dso = true debug = false } module_out_path = "dfs_service/dfs_service_daemon" sources = [ "daemon_test.cpp" ] include_dirs = [ "${distributedfile_path}/frameworks/native/distributed_file_inner/include", "${distributedfile_path}/test/unittests/distributed_file_daemon/include", "${services_path}/distributedfiledaemon/include", "${services_path}/distributedfiledaemon/include/ipc", ] deps = [ "${services_path}/distributedfiledaemon:distributed_file_daemon_kit_inner", "${services_path}/distributedfiledaemon:libdistributedfiledaemon", "${utils_path}:libdistributedfileutils", ] external_deps = [ "ability_base:want", "ability_base:zuri", "access_token:libaccesstoken_sdk", "app_file_service:remote_file_share_native", "app_file_service:sandbox_helper_native", "c_utils:utils", "common_event_service:cesfwk_innerkits", "dataclassification:data_transit_mgr", "device_auth:deviceauth_sdk", "device_manager:devicemanagersdk", "dsoftbus:softbus_client", "eventhandler:libeventhandler", "file_api:securitylabel", "googletest:gmock_main", "googletest:gtest_main", "hilog:libhilog", "hisysevent:libhisysevent", "init:libbegetutil", "ipc:ipc_core", "libfuse:libfuse", "os_account:os_account_innerkits", "safwk:system_ability_fwk", "samgr:samgr_proxy", "storage_service:storage_manager_sa_proxy", "zlib:shared_libz", ] defines = [ "private=public", "LOG_TAG=\"distributedfile_daemon\"", ] use_exceptions = true part_name = "dfs_service" subsystem_name = "filemanagement" } ohos_unittest("distributed_file_daemon_stub_test") { branch_protector_ret = "pac_ret" sanitize = { integer_overflow = true cfi = true cfi_cross_dso = true debug = false blocklist = "${distributedfile_path}/cfi_blocklist.txt" } module_out_path = "dfs_service/dfs_service_daemon" sources = [ "daemon_stub_test.cpp" ] include_dirs = [ "${distributedfile_path}/frameworks/native/distributed_file_inner/include", "${distributedfile_path}/test/unittests/distributed_file_daemon/include", "${services_path}/distributedfiledaemon/include", "${services_path}/distributedfiledaemon/include/ipc", ] deps = [ "${services_path}/distributedfiledaemon:distributed_file_daemon_kit_inner", "${services_path}/distributedfiledaemon:libdistributedfiledaemon", "${utils_path}:libdistributedfileutils", ] external_deps = [ "ability_base:want", "ability_base:zuri", "access_token:libaccesstoken_sdk", "app_file_service:remote_file_share_native", "app_file_service:sandbox_helper_native", "c_utils:utils", "common_event_service:cesfwk_innerkits", "dataclassification:data_transit_mgr", "device_auth:deviceauth_sdk", "device_manager:devicemanagersdk", "dsoftbus:softbus_client", "eventhandler:libeventhandler", "file_api:securitylabel", "googletest:gmock_main", "googletest:gtest_main", "hilog:libhilog", "hisysevent:libhisysevent", "init:libbegetutil", "ipc:ipc_core", "libfuse:libfuse", "os_account:os_account_innerkits", "safwk:system_ability_fwk", "samgr:samgr_proxy", "storage_service:storage_manager_sa_proxy", "zlib:shared_libz", ] defines = [ "private=public", "LOG_TAG=\"distributedfile_daemon\"", ] use_exceptions = true part_name = "dfs_service" subsystem_name = "filemanagement" } ohos_unittest("distributed_file_daemon_stub_sup_test") { branch_protector_ret = "pac_ret" sanitize = { integer_overflow = true cfi = true cfi_cross_dso = true debug = false blocklist = "${distributedfile_path}/cfi_blocklist.txt" } module_out_path = "dfs_service/dfs_service_daemon" sources = [ "${distributedfile_path}/test/mock/message_parcel_mock.cpp", "daemon_stub_sup_test.cpp", ] include_dirs = [ "include", "${distributedfile_path}/frameworks/native/distributed_file_inner/include", "${distributedfile_path}/frameworks/native/distributed_file_inner/include/asset", "${distributedfile_path}/services/distributedfiledaemon/test/mock/include", "${distributedfile_path}/test/unittests/distributed_file_daemon/include", "${distributedfile_path}/test/mock", "${services_path}/distributedfiledaemon/include", "${services_path}/distributedfiledaemon/include/ipc", "${services_path}/distributedfiledaemon/test/mock/include", ] deps = [ "${services_path}/distributedfiledaemon:distributed_file_daemon_kit_inner", "${services_path}/distributedfiledaemon:libdistributedfiledaemon", "${utils_path}:libdistributedfileutils", ] external_deps = [ "ability_base:want", "ability_base:zuri", "access_token:libaccesstoken_sdk", "app_file_service:remote_file_share_native", "app_file_service:sandbox_helper_native", "c_utils:utils", "common_event_service:cesfwk_innerkits", "dataclassification:data_transit_mgr", "device_auth:deviceauth_sdk", "device_manager:devicemanagersdk", "dsoftbus:softbus_client", "eventhandler:libeventhandler", "file_api:securitylabel", "googletest:gmock_main", "googletest:gtest_main", "hilog:libhilog", "hisysevent:libhisysevent", "init:libbegetutil", "ipc:ipc_core", "libfuse:libfuse", "os_account:os_account_innerkits", "safwk:system_ability_fwk", "samgr:samgr_proxy", "storage_service:storage_manager_sa_proxy", "zlib:shared_libz", ] defines = [ "private=public", "LOG_TAG=\"distributedfile_daemon\"", ] use_exceptions = true part_name = "dfs_service" subsystem_name = "filemanagement" } ohos_unittest("daemon_manager_impl_test") { branch_protector_ret = "pac_ret" sanitize = { integer_overflow = true cfi = true cfi_cross_dso = true debug = false blocklist = "${distributedfile_path}/cfi_blocklist.txt" } module_out_path = "dfs_service/dfs_service_daemon" sources = [ "${distributedfile_path}/utils/log/src/utils_log.cpp", "daemon_manager_impl_test.cpp", ] include_dirs = [ "${distributedfile_path}/frameworks/native/distributed_file_inner/include", "${distributedfile_path}/frameworks/native/distributed_file_inner/include/asset", "${distributedfile_path}/services/distributedfiledaemon/test/mock/include", "${distributedfile_path}/test/unittests/distributed_file_daemon/include", "${services_path}/distributedfiledaemon/include", ] deps = [ "${services_path}/distributedfiledaemon:distributed_file_daemon_kit_inner", "${utils_path}:libdistributedfileutils", ] external_deps = [ "app_file_service:remote_file_share_native", "c_utils:utils", "device_manager:devicemanagersdk", "googletest:gmock_main", "googletest:gtest_main", "hilog:libhilog", "ipc:ipc_single", "libfuse:libfuse", ] defines = [ "private=public", "LOG_TAG=\"distributedfile_daemon\"", ] use_exceptions = true part_name = "dfs_service" subsystem_name = "filemanagement" } ohos_unittest("daemon_manager_test") { branch_protector_ret = "pac_ret" sanitize = { integer_overflow = true cfi = true cfi_cross_dso = true debug = false } module_out_path = "dfs_service/dfs_service_daemon" sources = [ "${distributedfile_path}/utils/log/src/utils_log.cpp", "daemon_manager_test.cpp", ] include_dirs = [ "${distributedfile_path}/frameworks/native/distributed_file_inner/include", "${distributedfile_path}/test/unittests/distributed_file_daemon/include", "${services_path}/distributedfiledaemon/include", ] deps = [ "${services_path}/distributedfiledaemon:distributed_file_daemon_kit_inner", "${utils_path}:libdistributedfileutils", ] external_deps = [ "c_utils:utils", "device_manager:devicemanagersdk", "googletest:gmock_main", "googletest:gtest_main", "hilog:libhilog", "ipc:ipc_core", ] defines = [ "private=public", "LOG_TAG=\"distributedfile_daemon\"", ] use_exceptions = true part_name = "dfs_service" subsystem_name = "filemanagement" } ohos_unittest("daemon_service_proxy_test") { branch_protector_ret = "pac_ret" sanitize = { integer_overflow = true cfi = true cfi_cross_dso = true debug = false blocklist = "${distributedfile_path}/cfi_blocklist.txt" } module_out_path = "dfs_service/dfs_service_daemon" sources = [ "${distributedfile_path}/utils/log/src/utils_log.cpp", "daemon_service_proxy_test.cpp", ] include_dirs = [ "${distributedfile_path}/frameworks/native/distributed_file_inner/include", "${distributedfile_path}/test/unittests/distributed_file_daemon/include", "${services_path}/distributedfiledaemon/include", ] deps = [ "${services_path}/distributedfiledaemon:distributed_file_daemon_kit_inner", "${utils_path}:libdistributedfileutils", ] external_deps = [ "ability_base:zuri", "app_file_service:remote_file_share_native", "c_utils:utils", "device_manager:devicemanagersdk", "googletest:gmock_main", "googletest:gtest_main", "hilog:libhilog", "ipc:ipc_core", ] defines = [ "private=public", "LOG_TAG=\"distributedfile_daemon\"", ] use_exceptions = true part_name = "dfs_service" subsystem_name = "filemanagement" } ohos_unittest("connection_detector_test") { branch_protector_ret = "pac_ret" sanitize = { integer_overflow = true cfi = true cfi_cross_dso = true debug = false } module_out_path = "dfs_service/dfs_service_daemon" sources = [ "${distributedfile_path}/utils/log/src/utils_log.cpp", "${services_path}/distributedfiledaemon/src/ipc/connection_detector.cpp", "connection_detector_test.cpp", ] include_dirs = [ "${services_path}/distributedfiledaemon/include/ipc", "${services_path}/distributedfiledaemon/src/ipc", ] deps = [ "${utils_path}:libdistributedfileutils" ] external_deps = [ "ability_base:zuri", "c_utils:utils", "device_manager:devicemanagersdk", "googletest:gmock_main", "googletest:gtest_main", "hilog:libhilog", "ipc:ipc_core", "os_account:os_account_innerkits", ] defines = [ "private=public", "LOG_TAG=\"distributedfile_daemon\"", ] use_exceptions = true part_name = "dfs_service" subsystem_name = "filemanagement" } ohos_unittest("file_dfs_listener_proxy_test") { branch_protector_ret = "pac_ret" sanitize = { integer_overflow = true cfi = true cfi_cross_dso = true debug = false blocklist = "${distributedfile_path}/cfi_blocklist.txt" } module_out_path = "dfs_service/dfs_service_daemon" sources = [ "${distributedfile_path}/test/mock/message_parcel_mock.cpp", "${distributedfile_path}/utils/log/src/utils_log.cpp", "${services_path}/distributedfiledaemon/src/ipc/file_dfs_listener_proxy.cpp", "file_dfs_listener_proxy_test.cpp", ] include_dirs = [ "${distributedfile_path}/frameworks/native/distributed_file_inner/include", "${distributedfile_path}/test/mock", "${distributedfile_path}/test/unittests/distributed_file_daemon/include", "${services_path}/distributedfiledaemon/include/ipc", "${services_path}/distributedfiledaemon/src/ipc", ] deps = [ "${utils_path}:libdistributedfileutils" ] external_deps = [ "ability_base:zuri", "c_utils:utils", "device_manager:devicemanagersdk", "googletest:gmock_main", "googletest:gtest_main", "hilog:libhilog", "ipc:ipc_core", "os_account:os_account_innerkits", "samgr:samgr_proxy", ] defines = [ "private=public", "LOG_TAG=\"distributedfile_daemon\"", ] use_exceptions = true part_name = "dfs_service" subsystem_name = "filemanagement" } ohos_unittest("file_trans_listener_proxy_test") { branch_protector_ret = "pac_ret" sanitize = { integer_overflow = true cfi = true cfi_cross_dso = true debug = false blocklist = "${distributedfile_path}/cfi_blocklist.txt" } module_out_path = "dfs_service/dfs_service_daemon" sources = [ "${distributedfile_path}/test/mock/message_parcel_mock.cpp", "${distributedfile_path}/utils/log/src/utils_log.cpp", "${services_path}/distributedfiledaemon/src/ipc/file_trans_listener_proxy.cpp", "file_trans_listener_proxy_test.cpp", ] include_dirs = [ "${distributedfile_path}/frameworks/native/distributed_file_inner/include", "${distributedfile_path}/test/mock", "${distributedfile_path}/test/unittests/distributed_file_daemon/include", "${services_path}/distributedfiledaemon/include/ipc", "${services_path}/distributedfiledaemon/src/ipc", ] deps = [ "${utils_path}:libdistributedfileutils" ] external_deps = [ "ability_base:zuri", "c_utils:utils", "device_manager:devicemanagersdk", "googletest:gmock_main", "googletest:gtest_main", "hilog:libhilog", "ipc:ipc_core", "os_account:os_account_innerkits", "samgr:samgr_proxy", ] defines = [ "private=public", "LOG_TAG=\"distributedfile_daemon\"", ] use_exceptions = true part_name = "dfs_service" subsystem_name = "filemanagement" } ohos_unittest("trans_mananger_test") { branch_protector_ret = "pac_ret" sanitize = { integer_overflow = true cfi = true cfi_cross_dso = true debug = false } module_out_path = "dfs_service/dfs_service_daemon" sources = [ "${distributedfile_path}/utils/log/src/utils_log.cpp", "${services_path}/distributedfiledaemon/src/ipc/trans_mananger.cpp", "trans_mananger_test.cpp", ] include_dirs = [ "${services_path}/distributedfiledaemon/include/ipc", "${services_path}/distributedfiledaemon/src/ipc", "${distributedfile_path}/frameworks/native/distributed_file_inner/include/", ] deps = [ "${utils_path}:libdistributedfileutils" ] external_deps = [ "ability_base:zuri", "c_utils:utils", "device_manager:devicemanagersdk", "googletest:gmock_main", "googletest:gtest_main", "hilog:libhilog", "ipc:ipc_core", "os_account:os_account_innerkits", ] defines = [ "private=public", "LOG_TAG=\"distributedfile_daemon\"", ] use_exceptions = true part_name = "dfs_service" subsystem_name = "filemanagement" } group("distributed_daemon_test") { testonly = true deps = [ ":connection_detector_test", ":daemon_manager_impl_test", ":daemon_manager_test", ":daemon_service_proxy_test", ":distributed_file_daemon_stub_sup_test", ":distributed_file_daemon_stub_test", ":distributed_file_daemon_test", ":file_dfs_listener_proxy_test", ":file_trans_listener_proxy_test", ":trans_mananger_test", ] }