xref: /aosp_15_r20/external/bazelbuild-rules_rust/test/process_wrapper/BUILD.bazel (revision d4726bddaa87cc4778e7472feed243fa4b6c267f)
1*d4726bddSHONG Yifanload("@bazel_skylib//rules:build_test.bzl", "build_test")
2*d4726bddSHONG Yifanload("@bazel_skylib//rules:diff_test.bzl", "diff_test")
3*d4726bddSHONG Yifanload("@rules_cc//cc:defs.bzl", "cc_binary")
4*d4726bddSHONG Yifanload("//rust:defs.bzl", "rust_binary", "rust_test")
5*d4726bddSHONG Yifanload("//test/process_wrapper:process_wrapper_tester.bzl", "process_wrapper_tester")
6*d4726bddSHONG Yifan
7*d4726bddSHONG Yifancc_binary(
8*d4726bddSHONG Yifan    name = "process_wrapper_tester",
9*d4726bddSHONG Yifan    srcs = [
10*d4726bddSHONG Yifan        "process_wrapper_tester.cc",
11*d4726bddSHONG Yifan    ],
12*d4726bddSHONG Yifan    visibility = ["//visibility:public"],
13*d4726bddSHONG Yifan)
14*d4726bddSHONG Yifan
15*d4726bddSHONG Yifanfilegroup(
16*d4726bddSHONG Yifan    name = "env_files",
17*d4726bddSHONG Yifan    srcs = [
18*d4726bddSHONG Yifan        "test_files/env_file1",
19*d4726bddSHONG Yifan        "test_files/env_file2",
20*d4726bddSHONG Yifan        "test_files/env_file3",
21*d4726bddSHONG Yifan    ],
22*d4726bddSHONG Yifan)
23*d4726bddSHONG Yifan
24*d4726bddSHONG Yifanfilegroup(
25*d4726bddSHONG Yifan    name = "arg_files",
26*d4726bddSHONG Yifan    srcs = [
27*d4726bddSHONG Yifan        "test_files/arg_file1",
28*d4726bddSHONG Yifan        "test_files/arg_file2",
29*d4726bddSHONG Yifan        "test_files/arg_file3",
30*d4726bddSHONG Yifan    ],
31*d4726bddSHONG Yifan)
32*d4726bddSHONG Yifan
33*d4726bddSHONG Yifanfilegroup(
34*d4726bddSHONG Yifan    name = "stdout_file",
35*d4726bddSHONG Yifan    srcs = [
36*d4726bddSHONG Yifan        "test_files/stdout",
37*d4726bddSHONG Yifan    ],
38*d4726bddSHONG Yifan)
39*d4726bddSHONG Yifan
40*d4726bddSHONG Yifanfilegroup(
41*d4726bddSHONG Yifan    name = "stderr_file",
42*d4726bddSHONG Yifan    srcs = [
43*d4726bddSHONG Yifan        "test_files/stderr",
44*d4726bddSHONG Yifan    ],
45*d4726bddSHONG Yifan)
46*d4726bddSHONG Yifan
47*d4726bddSHONG Yifanprocess_wrapper_tester(
48*d4726bddSHONG Yifan    name = "process_wrapper_basic",
49*d4726bddSHONG Yifan    test_config = "basic",
50*d4726bddSHONG Yifan)
51*d4726bddSHONG Yifan
52*d4726bddSHONG Yifanprocess_wrapper_tester(
53*d4726bddSHONG Yifan    name = "process_wrapper_subst_pwd",
54*d4726bddSHONG Yifan    test_config = "subst-pwd",
55*d4726bddSHONG Yifan)
56*d4726bddSHONG Yifan
57*d4726bddSHONG Yifanprocess_wrapper_tester(
58*d4726bddSHONG Yifan    name = "process_wrapper_stdout",
59*d4726bddSHONG Yifan    test_config = "stdout",
60*d4726bddSHONG Yifan)
61*d4726bddSHONG Yifan
62*d4726bddSHONG Yifanprocess_wrapper_tester(
63*d4726bddSHONG Yifan    name = "process_wrapper_stderr",
64*d4726bddSHONG Yifan    test_config = "stderr",
65*d4726bddSHONG Yifan)
66*d4726bddSHONG Yifan
67*d4726bddSHONG Yifanprocess_wrapper_tester(
68*d4726bddSHONG Yifan    name = "process_wrapper_env_files",
69*d4726bddSHONG Yifan    env_files = [
70*d4726bddSHONG Yifan        ":env_files",
71*d4726bddSHONG Yifan    ],
72*d4726bddSHONG Yifan    test_config = "env-files",
73*d4726bddSHONG Yifan)
74*d4726bddSHONG Yifan
75*d4726bddSHONG Yifanprocess_wrapper_tester(
76*d4726bddSHONG Yifan    name = "process_wrapper_arg_files",
77*d4726bddSHONG Yifan    arg_files = [
78*d4726bddSHONG Yifan        ":arg_files",
79*d4726bddSHONG Yifan    ],
80*d4726bddSHONG Yifan    test_config = "arg-files",
81*d4726bddSHONG Yifan)
82*d4726bddSHONG Yifan
83*d4726bddSHONG Yifanprocess_wrapper_tester(
84*d4726bddSHONG Yifan    name = "process_wrapper_copy_output",
85*d4726bddSHONG Yifan    test_config = "copy-output",
86*d4726bddSHONG Yifan)
87*d4726bddSHONG Yifan
88*d4726bddSHONG Yifanprocess_wrapper_tester(
89*d4726bddSHONG Yifan    name = "process_wrapper_combined",
90*d4726bddSHONG Yifan    arg_files = [
91*d4726bddSHONG Yifan        ":arg_files",
92*d4726bddSHONG Yifan    ],
93*d4726bddSHONG Yifan    env_files = [
94*d4726bddSHONG Yifan        ":env_files",
95*d4726bddSHONG Yifan    ],
96*d4726bddSHONG Yifan    test_config = "combined",
97*d4726bddSHONG Yifan)
98*d4726bddSHONG Yifan
99*d4726bddSHONG Yifanbuild_test(
100*d4726bddSHONG Yifan    name = "basic_test",
101*d4726bddSHONG Yifan    targets = [
102*d4726bddSHONG Yifan        ":process_wrapper_basic",
103*d4726bddSHONG Yifan    ],
104*d4726bddSHONG Yifan)
105*d4726bddSHONG Yifan
106*d4726bddSHONG Yifanbuild_test(
107*d4726bddSHONG Yifan    name = "subst_pwd_test",
108*d4726bddSHONG Yifan    targets = [
109*d4726bddSHONG Yifan        ":process_wrapper_subst_pwd",
110*d4726bddSHONG Yifan    ],
111*d4726bddSHONG Yifan)
112*d4726bddSHONG Yifan
113*d4726bddSHONG Yifandiff_test(
114*d4726bddSHONG Yifan    name = "stdout_test",
115*d4726bddSHONG Yifan    file1 = ":stdout_file",
116*d4726bddSHONG Yifan    file2 = ":process_wrapper_stdout",
117*d4726bddSHONG Yifan)
118*d4726bddSHONG Yifan
119*d4726bddSHONG Yifandiff_test(
120*d4726bddSHONG Yifan    name = "stderr_test",
121*d4726bddSHONG Yifan    file1 = ":stderr_file",
122*d4726bddSHONG Yifan    file2 = ":process_wrapper_stderr",
123*d4726bddSHONG Yifan)
124*d4726bddSHONG Yifan
125*d4726bddSHONG Yifanbuild_test(
126*d4726bddSHONG Yifan    name = "env_files_test",
127*d4726bddSHONG Yifan    targets = [
128*d4726bddSHONG Yifan        ":process_wrapper_env_files",
129*d4726bddSHONG Yifan    ],
130*d4726bddSHONG Yifan)
131*d4726bddSHONG Yifan
132*d4726bddSHONG Yifanbuild_test(
133*d4726bddSHONG Yifan    name = "arg_files_test",
134*d4726bddSHONG Yifan    targets = [
135*d4726bddSHONG Yifan        ":process_wrapper_arg_files",
136*d4726bddSHONG Yifan    ],
137*d4726bddSHONG Yifan)
138*d4726bddSHONG Yifan
139*d4726bddSHONG Yifanbuild_test(
140*d4726bddSHONG Yifan    name = "copy_output_test",
141*d4726bddSHONG Yifan    targets = [
142*d4726bddSHONG Yifan        ":process_wrapper_copy_output",
143*d4726bddSHONG Yifan    ],
144*d4726bddSHONG Yifan)
145*d4726bddSHONG Yifan
146*d4726bddSHONG Yifanbuild_test(
147*d4726bddSHONG Yifan    name = "combined_test",
148*d4726bddSHONG Yifan    targets = [
149*d4726bddSHONG Yifan        ":process_wrapper_combined",
150*d4726bddSHONG Yifan    ],
151*d4726bddSHONG Yifan)
152*d4726bddSHONG Yifan
153*d4726bddSHONG Yifanrust_binary(
154*d4726bddSHONG Yifan    name = "fake_rustc",
155*d4726bddSHONG Yifan    srcs = ["fake_rustc.rs"],
156*d4726bddSHONG Yifan    edition = "2018",
157*d4726bddSHONG Yifan)
158*d4726bddSHONG Yifan
159*d4726bddSHONG Yifanrust_test(
160*d4726bddSHONG Yifan    name = "rustc_quit_on_rmeta",
161*d4726bddSHONG Yifan    srcs = ["rustc_quit_on_rmeta.rs"],
162*d4726bddSHONG Yifan    data = [
163*d4726bddSHONG Yifan        ":fake_rustc",
164*d4726bddSHONG Yifan        "//util/process_wrapper",
165*d4726bddSHONG Yifan    ],
166*d4726bddSHONG Yifan    edition = "2018",
167*d4726bddSHONG Yifan    deps = ["//tools/runfiles"],
168*d4726bddSHONG Yifan)
169