Skip to content

Commit 94ed9d1

Browse files
committed
rename y.sh test --clean-ui-tests to y.sh clean ui-tests
1 parent 1a8e0c3 commit 94ed9d1

File tree

2 files changed

+45
-46
lines changed

2 files changed

+45
-46
lines changed

build_system/src/clean.rs

Lines changed: 45 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,43 @@
1-
use crate::utils::remove_file;
1+
use crate::utils::{remove_file, run_command};
22

33
use std::fs::remove_dir_all;
44

55
#[derive(Default)]
6-
struct CleanArg {
7-
all: bool,
6+
enum CleanArg {
7+
/// `clean all`
8+
All,
9+
/// `clean ui-tests`
10+
UiTests,
11+
/// `clean --help`
12+
#[default]
13+
Help,
814
}
915

1016
impl CleanArg {
11-
fn new() -> Result<Option<Self>, String> {
12-
let mut args = CleanArg::default();
13-
17+
fn new() -> Result<Self, String> {
1418
// We skip the binary and the "clean" option.
1519
for arg in std::env::args().skip(2) {
16-
match arg.as_str() {
17-
"all" => args.all = true,
18-
"--help" => {
19-
Self::usage();
20-
return Ok(None);
21-
}
22-
a => return Err(format!("Unknown argument `{}`", a)),
23-
}
20+
return match arg.as_str() {
21+
"all" => Ok(Self::All),
22+
"ui-tests" => Ok(Self::UiTests),
23+
"--help" => Ok(Self::Help),
24+
a => Err(format!("Unknown argument `{}`", a)),
25+
};
2426
}
25-
Ok(Some(args))
27+
Ok(Self::default())
2628
}
29+
}
2730

28-
fn usage() {
29-
println!(
30-
r#"
31-
`clean` command help:
31+
fn usage() {
32+
println!(
33+
r#"
34+
`clean` command help:
3235
33-
all : Clean all data
34-
--help : Show this help
35-
"#
36-
)
37-
}
36+
all : Clean all data
37+
ui-tests : Clean ui tests
38+
--help : Show this help
39+
"#
40+
)
3841
}
3942

4043
fn clean_all() -> Result<(), String> {
@@ -60,14 +63,25 @@ fn clean_all() -> Result<(), String> {
6063
Ok(())
6164
}
6265

63-
pub fn run() -> Result<(), String> {
64-
let args = match CleanArg::new()? {
65-
Some(a) => a,
66-
None => return Ok(()),
67-
};
66+
fn clean_ui_tests() -> Result<(), String> {
67+
run_command(
68+
&[
69+
&"find",
70+
&"rust/build/x86_64-unknown-linux-gnu/test/ui/",
71+
&"-name",
72+
&"stamp",
73+
&"-delete",
74+
],
75+
None,
76+
)?;
77+
Ok(())
78+
}
6879

69-
if args.all {
70-
clean_all()?;
80+
pub fn run() -> Result<(), String> {
81+
match CleanArg::new()? {
82+
CleanArg::All => clean_all()?,
83+
CleanArg::UiTests => clean_ui_tests()?,
84+
CleanArg::Help => usage(),
7185
}
7286
Ok(())
7387
}

build_system/src/test.rs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ fn get_runners() -> Runners {
3232
("Run failing rustc tests", test_failing_rustc),
3333
);
3434
runners.insert("--test-libcore", ("Run libcore tests", test_libcore));
35-
runners.insert("--clean-ui-tests", ("Clean ui tests", clean_ui_tests));
3635
runners.insert("--clean", ("Empty cargo target directory", clean));
3736
runners.insert("--build-sysroot", ("Build sysroot", build_sysroot));
3837
runners.insert("--std-tests", ("Run std tests", std_tests));
@@ -1086,20 +1085,6 @@ fn test_successful_rustc(env: &Env, args: &TestArg) -> Result<(), String> {
10861085
})
10871086
}
10881087

1089-
fn clean_ui_tests(_env: &Env, _args: &TestArg) -> Result<(), String> {
1090-
run_command(
1091-
&[
1092-
&"find",
1093-
&"rust/build/x86_64-unknown-linux-gnu/test/ui/",
1094-
&"-name",
1095-
&"stamp",
1096-
&"-delete",
1097-
],
1098-
None,
1099-
)?;
1100-
Ok(())
1101-
}
1102-
11031088
fn run_all(env: &Env, args: &TestArg) -> Result<(), String> {
11041089
clean(env, args)?;
11051090
mini_tests(env, args)?;

0 commit comments

Comments
 (0)