1# Copyright (c) 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("//build/test.gni")
15
16ohos_rust_unittest("rust_ylong_runtime_test_ut") {
17  module_out_path = "ylong_runtime/ylong_runtime"
18
19  rustflags = [
20    "--cfg=feature=\"fs\"",
21    "--cfg=feature=\"macros\"",
22    "--cfg=feature=\"net\"",
23    "--cfg=feature=\"process\"",
24    "--cfg=feature=\"sync\"",
25    "--cfg=feature=\"signal\"",
26    "--cfg=feature=\"time\"",
27  ]
28
29  sources = [ "../ylong_runtime/src/lib.rs" ]
30  deps = [
31    "../ylong_io:ylong_io",
32    "../ylong_runtime_macros:ylong_runtime_macros(${host_toolchain})",
33    "../ylong_signal:ylong_signal",
34    "//third_party/rust/crates/libc:lib",
35  ]
36}
37
38ohos_rust_systemtest("rust_ylong_runtime_test_sdv") {
39  module_out_path = "ylong_runtime/ylong_runtime"
40
41  rustflags = [
42    "--cfg=gn_test",
43    "--cfg=feature=\"fs\"",
44    "--cfg=feature=\"macros\"",
45    "--cfg=feature=\"net\"",
46    "--cfg=feature=\"process\"",
47    "--cfg=feature=\"sync\"",
48    "--cfg=feature=\"signal\"",
49    "--cfg=feature=\"time\"",
50  ]
51
52  sources = [ "../ylong_runtime/tests/entry.rs" ]
53  deps = [
54    "../ylong_runtime:ylong_runtime",
55    "//third_party/rust/crates/libc:lib",
56  ]
57}
58
59ohos_rust_systemtest("rust_ylong_signal_test_sdv") {
60  module_out_path = "ylong_runtime/ylong_runtime"
61
62  rustflags = [ "--cfg=gn_test" ]
63
64  sources = [ "../ylong_signal/tests/entry.rs" ]
65  deps = [
66    "../ylong_signal:ylong_signal",
67    "//third_party/rust/crates/libc:lib",
68  ]
69}
70
71group("unittest") {
72  testonly = true
73  deps = []
74  if (!use_clang_coverage) {
75    deps += [ ":rust_ylong_runtime_test_ut" ]
76  }
77}
78
79group("sdvtest") {
80  testonly = true
81  deps = []
82  if (!use_clang_coverage) {
83    deps += [
84      ":rust_ylong_runtime_test_sdv",
85      ":rust_ylong_signal_test_sdv",
86    ]
87  }
88}
89