Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit bb7ab82

Browse files
committed
Remove a lot of redundant rustc arguments for tests
1 parent f311ef5 commit bb7ab82

File tree

1 file changed

+19
-122
lines changed

1 file changed

+19
-122
lines changed

build_system/tests.rs

Lines changed: 19 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -26,24 +26,10 @@ impl TestCase {
2626

2727
const NO_SYSROOT_SUITE: &[TestCase] = &[
2828
TestCase::new("build.mini_core", &|runner| {
29-
runner.run_rustc([
30-
"example/mini_core.rs",
31-
"--crate-name",
32-
"mini_core",
33-
"--crate-type",
34-
"lib,dylib",
35-
"--target",
36-
&runner.target_compiler.triple,
37-
]);
29+
runner.run_rustc(["example/mini_core.rs", "--crate-type", "lib,dylib"]);
3830
}),
3931
TestCase::new("build.example", &|runner| {
40-
runner.run_rustc([
41-
"example/example.rs",
42-
"--crate-type",
43-
"lib",
44-
"--target",
45-
&runner.target_compiler.triple,
46-
]);
32+
runner.run_rustc(["example/example.rs", "--crate-type", "lib"]);
4733
}),
4834
TestCase::new("jit.mini_core_hello_world", &|runner| {
4935
let mut jit_cmd = runner.rustc_command([
@@ -53,8 +39,6 @@ const NO_SYSROOT_SUITE: &[TestCase] = &[
5339
"example/mini_core_hello_world.rs",
5440
"--cfg",
5541
"jit",
56-
"--target",
57-
&runner.target_compiler.triple,
5842
]);
5943
jit_cmd.env("CG_CLIF_JIT_ARGS", "abc bcd");
6044
spawn_and_wait(jit_cmd);
@@ -67,69 +51,30 @@ const NO_SYSROOT_SUITE: &[TestCase] = &[
6751
"example/mini_core_hello_world.rs",
6852
"--cfg",
6953
"jit",
70-
"--target",
71-
&runner.target_compiler.triple,
7254
]);
7355
jit_cmd.env("CG_CLIF_JIT_ARGS", "abc bcd");
7456
spawn_and_wait(jit_cmd);
7557
}),
7658
TestCase::new("aot.mini_core_hello_world", &|runner| {
77-
runner.run_rustc([
78-
"example/mini_core_hello_world.rs",
79-
"--crate-name",
80-
"mini_core_hello_world",
81-
"--crate-type",
82-
"bin",
83-
"-g",
84-
"--target",
85-
&runner.target_compiler.triple,
86-
]);
59+
runner.run_rustc(["example/mini_core_hello_world.rs"]);
8760
runner.run_out_command("mini_core_hello_world", ["abc", "bcd"]);
8861
}),
8962
];
9063

9164
const BASE_SYSROOT_SUITE: &[TestCase] = &[
9265
TestCase::new("aot.arbitrary_self_types_pointers_and_wrappers", &|runner| {
93-
runner.run_rustc([
94-
"example/arbitrary_self_types_pointers_and_wrappers.rs",
95-
"--crate-name",
96-
"arbitrary_self_types_pointers_and_wrappers",
97-
"--crate-type",
98-
"bin",
99-
"--target",
100-
&runner.target_compiler.triple,
101-
]);
66+
runner.run_rustc(["example/arbitrary_self_types_pointers_and_wrappers.rs"]);
10267
runner.run_out_command("arbitrary_self_types_pointers_and_wrappers", []);
10368
}),
10469
TestCase::new("aot.issue_91827_extern_types", &|runner| {
105-
runner.run_rustc([
106-
"example/issue-91827-extern-types.rs",
107-
"--crate-name",
108-
"issue_91827_extern_types",
109-
"--crate-type",
110-
"bin",
111-
"--target",
112-
&runner.target_compiler.triple,
113-
]);
114-
runner.run_out_command("issue_91827_extern_types", []);
70+
runner.run_rustc(["example/issue-91827-extern-types.rs"]);
71+
runner.run_out_command("issue-91827-extern-types", []);
11572
}),
11673
TestCase::new("build.alloc_system", &|runner| {
117-
runner.run_rustc([
118-
"example/alloc_system.rs",
119-
"--crate-type",
120-
"lib",
121-
"--target",
122-
&runner.target_compiler.triple,
123-
]);
74+
runner.run_rustc(["example/alloc_system.rs", "--crate-type", "lib"]);
12475
}),
12576
TestCase::new("aot.alloc_example", &|runner| {
126-
runner.run_rustc([
127-
"example/alloc_example.rs",
128-
"--crate-type",
129-
"bin",
130-
"--target",
131-
&runner.target_compiler.triple,
132-
]);
77+
runner.run_rustc(["example/alloc_example.rs"]);
13378
runner.run_out_command("alloc_example", []);
13479
}),
13580
TestCase::new("jit.std_example", &|runner| {
@@ -138,8 +83,6 @@ const BASE_SYSROOT_SUITE: &[TestCase] = &[
13883
"-Cllvm-args=mode=jit",
13984
"-Cprefer-dynamic",
14085
"example/std_example.rs",
141-
"--target",
142-
&runner.target_compiler.triple,
14386
]);
14487

14588
eprintln!("[JIT-lazy] std_example");
@@ -148,83 +91,34 @@ const BASE_SYSROOT_SUITE: &[TestCase] = &[
14891
"-Cllvm-args=mode=jit-lazy",
14992
"-Cprefer-dynamic",
15093
"example/std_example.rs",
151-
"--target",
152-
&runner.target_compiler.triple,
15394
]);
15495
}),
15596
TestCase::new("aot.std_example", &|runner| {
156-
runner.run_rustc([
157-
"example/std_example.rs",
158-
"--crate-type",
159-
"bin",
160-
"--target",
161-
&runner.target_compiler.triple,
162-
]);
97+
runner.run_rustc(["example/std_example.rs"]);
16398
runner.run_out_command("std_example", ["arg"]);
16499
}),
165100
TestCase::new("aot.dst_field_align", &|runner| {
166-
runner.run_rustc([
167-
"example/dst-field-align.rs",
168-
"--crate-name",
169-
"dst_field_align",
170-
"--crate-type",
171-
"bin",
172-
"--target",
173-
&runner.target_compiler.triple,
174-
]);
175-
runner.run_out_command("dst_field_align", []);
101+
runner.run_rustc(["example/dst-field-align.rs"]);
102+
runner.run_out_command("dst-field-align", []);
176103
}),
177104
TestCase::new("aot.subslice-patterns-const-eval", &|runner| {
178-
runner.run_rustc([
179-
"example/subslice-patterns-const-eval.rs",
180-
"--crate-type",
181-
"bin",
182-
"-Cpanic=abort",
183-
"--target",
184-
&runner.target_compiler.triple,
185-
]);
105+
runner.run_rustc(["example/subslice-patterns-const-eval.rs"]);
186106
runner.run_out_command("subslice-patterns-const-eval", []);
187107
}),
188108
TestCase::new("aot.track-caller-attribute", &|runner| {
189-
runner.run_rustc([
190-
"example/track-caller-attribute.rs",
191-
"--crate-type",
192-
"bin",
193-
"-Cpanic=abort",
194-
"--target",
195-
&runner.target_compiler.triple,
196-
]);
109+
runner.run_rustc(["example/track-caller-attribute.rs"]);
197110
runner.run_out_command("track-caller-attribute", []);
198111
}),
199112
TestCase::new("aot.float-minmax-pass", &|runner| {
200-
runner.run_rustc([
201-
"example/float-minmax-pass.rs",
202-
"--crate-type",
203-
"bin",
204-
"-Cpanic=abort",
205-
"--target",
206-
&runner.target_compiler.triple,
207-
]);
113+
runner.run_rustc(["example/float-minmax-pass.rs"]);
208114
runner.run_out_command("float-minmax-pass", []);
209115
}),
210116
TestCase::new("aot.mod_bench", &|runner| {
211-
runner.run_rustc([
212-
"example/mod_bench.rs",
213-
"--crate-type",
214-
"bin",
215-
"--target",
216-
&runner.target_compiler.triple,
217-
]);
117+
runner.run_rustc(["example/mod_bench.rs"]);
218118
runner.run_out_command("mod_bench", []);
219119
}),
220120
TestCase::new("aot.issue-72793", &|runner| {
221-
runner.run_rustc([
222-
"example/issue-72793.rs",
223-
"--crate-type",
224-
"bin",
225-
"--target",
226-
&runner.target_compiler.triple,
227-
]);
121+
runner.run_rustc(["example/issue-72793.rs"]);
228122
runner.run_out_command("issue-72793", []);
229123
}),
230124
];
@@ -501,6 +395,9 @@ impl TestRunner {
501395
cmd.arg("--out-dir");
502396
cmd.arg(format!("{}", BUILD_EXAMPLE_OUT_DIR.to_path(&self.dirs).display()));
503397
cmd.arg("-Cdebuginfo=2");
398+
cmd.arg("--target");
399+
cmd.arg(&self.target_compiler.triple);
400+
cmd.arg("-Cpanic=abort");
504401
cmd.args(args);
505402
cmd
506403
}

0 commit comments

Comments
 (0)