1# Copyright (c) 2024 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("../../../../services/samgr/var.gni") 16 17rust_cxx("samgr_rust_test_gen") { 18 sources = [ "mem.rs" ] 19} 20 21ohos_static_library("samgr_rust_test_c") { 22 sources = [ "cxx/samgr_rust_test_mem.cpp" ] 23 24 sources += get_target_outputs(":samgr_rust_test_gen") 25 26 include_dirs = [ 27 "include", 28 "${target_gen_dir}/src", 29 ] 30 31 deps = [ 32 ":samgr_rust_test_gen", 33 "//third_party/rust/crates/cxx:cxx_cppdeps", 34 ] 35 36 external_deps = [ "c_utils:utils" ] 37 38 subsystem_name = "systemabilitymgr" 39 part_name = "samgr" 40} 41 42ohos_rust_unittest("rust_samgr_ut_test") { 43 module_out_path = "samgr/samgr_rust" 44 45 sources = [ "../src/lib.rs" ] 46 external_deps = [ 47 "hilog:hilog_rust", 48 "ipc:ipc_rust", 49 ] 50 51 deps = [ 52 "../../rust:samgr_rust_cpp", 53 "//third_party/rust/crates/cxx:lib", 54 ] 55 56 subsystem_name = "systemabilitymgr" 57 part_name = "samgr" 58} 59 60ohos_rust_systemtest("rust_samgr_sdv_test") { 61 module_out_path = "samgr/samgr_rust" 62 63 rustflags = [ "--cfg=gn_test" ] 64 65 sources = [ "entry.rs" ] 66 67 deps = [ 68 ":samgr_rust_test_c", 69 "../../rust:samgr_rust", 70 "//third_party/rust/crates/cxx:lib", 71 ] 72 external_deps = [ 73 "hilog:hilog_rust", 74 "ipc:ipc_rust", 75 "safwk:system_ability_fwk_rust", 76 ] 77 defines = [] 78 if (samgr_support_access_token) { 79 external_deps += [ 80 "access_token:libnativetoken", 81 "access_token:libtoken_setproc", 82 ] 83 defines += [ "SUPPORT_ACCESS_TOKEN" ] 84 } 85 86 subsystem_name = "systemabilitymgr" 87 part_name = "samgr" 88} 89 90group("unittest") { 91 testonly = true 92 deps = [ 93 ":rust_samgr_sdv_test", 94 ":rust_samgr_ut_test", 95 ] 96} 97