xref: /aosp_15_r20/external/bazelbuild-rules_rust/test/test_env/BUILD.bazel (revision d4726bddaa87cc4778e7472feed243fa4b6c267f)
1*d4726bddSHONG Yifanload("//rust:defs.bzl", "rust_binary", "rust_test")
2*d4726bddSHONG Yifan
3*d4726bddSHONG Yifanrust_binary(
4*d4726bddSHONG Yifan    name = "hello-world",
5*d4726bddSHONG Yifan    srcs = ["src/main.rs"],
6*d4726bddSHONG Yifan    edition = "2018",
7*d4726bddSHONG Yifan)
8*d4726bddSHONG Yifan
9*d4726bddSHONG Yifanfilegroup(
10*d4726bddSHONG Yifan    name = "hello_world_main",
11*d4726bddSHONG Yifan    srcs = ["src/main.rs"],
12*d4726bddSHONG Yifan)
13*d4726bddSHONG Yifan
14*d4726bddSHONG Yifanrust_test(
15*d4726bddSHONG Yifan    name = "test_run",
16*d4726bddSHONG Yifan    srcs = ["tests/run.rs"],
17*d4726bddSHONG Yifan    data = [
18*d4726bddSHONG Yifan        ":hello-world",
19*d4726bddSHONG Yifan        ":hello_world_main",
20*d4726bddSHONG Yifan    ],
21*d4726bddSHONG Yifan    edition = "2018",
22*d4726bddSHONG Yifan    env = {
23*d4726bddSHONG Yifan        "FERRIS_SAYS": "Hello fellow Rustaceans!",
24*d4726bddSHONG Yifan        "HELLO_WORLD_BIN_ROOTPATH": "$(rootpath :hello-world)",
25*d4726bddSHONG Yifan    },
26*d4726bddSHONG Yifan)
27*d4726bddSHONG Yifan
28*d4726bddSHONG Yifanrust_test(
29*d4726bddSHONG Yifan    name = "test_manifest_dir",
30*d4726bddSHONG Yifan    srcs = ["tests/manifest_dir.rs"],
31*d4726bddSHONG Yifan    data = ["src/manifest_dir_file.txt"],
32*d4726bddSHONG Yifan    edition = "2018",
33*d4726bddSHONG Yifan)
34