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