Skip to content

Commit a09712e

Browse files
committed
Use fs::remove_dir_all instead of cargo clean
1 parent 9bc113f commit a09712e

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

build_system/tests.rs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ pub(crate) static LIBCORE_TESTS: CargoProject =
119119

120120
const EXTENDED_SYSROOT_SUITE: &[TestCase] = &[
121121
TestCase::custom("test.rust-random/rand", &|runner| {
122-
spawn_and_wait(RAND.clean(&runner.target_compiler.cargo, &runner.dirs));
122+
RAND.clean(&runner.dirs);
123123

124124
if runner.is_native {
125125
eprintln!("[TEST] rust-random/rand");
@@ -134,11 +134,11 @@ const EXTENDED_SYSROOT_SUITE: &[TestCase] = &[
134134
}
135135
}),
136136
TestCase::custom("test.simple-raytracer", &|runner| {
137-
spawn_and_wait(SIMPLE_RAYTRACER.clean(&runner.host_compiler.cargo, &runner.dirs));
137+
SIMPLE_RAYTRACER.clean(&runner.dirs);
138138
spawn_and_wait(SIMPLE_RAYTRACER.build(&runner.target_compiler, &runner.dirs));
139139
}),
140140
TestCase::custom("test.libcore", &|runner| {
141-
spawn_and_wait(LIBCORE_TESTS.clean(&runner.host_compiler.cargo, &runner.dirs));
141+
LIBCORE_TESTS.clean(&runner.dirs);
142142

143143
if runner.is_native {
144144
spawn_and_wait(LIBCORE_TESTS.test(&runner.target_compiler, &runner.dirs));
@@ -150,7 +150,7 @@ const EXTENDED_SYSROOT_SUITE: &[TestCase] = &[
150150
}
151151
}),
152152
TestCase::custom("test.regex-shootout-regex-dna", &|runner| {
153-
spawn_and_wait(REGEX.clean(&runner.target_compiler.cargo, &runner.dirs));
153+
REGEX.clean(&runner.dirs);
154154

155155
// newer aho_corasick versions throw a deprecation warning
156156
let lint_rust_flags = format!("{} --cap-lints warn", runner.target_compiler.rustflags);
@@ -194,7 +194,7 @@ const EXTENDED_SYSROOT_SUITE: &[TestCase] = &[
194194
}
195195
}),
196196
TestCase::custom("test.regex", &|runner| {
197-
spawn_and_wait(REGEX.clean(&runner.host_compiler.cargo, &runner.dirs));
197+
REGEX.clean(&runner.dirs);
198198

199199
// newer aho_corasick versions throw a deprecation warning
200200
let lint_rust_flags = format!("{} --cap-lints warn", runner.target_compiler.rustflags);
@@ -221,7 +221,7 @@ const EXTENDED_SYSROOT_SUITE: &[TestCase] = &[
221221
}
222222
}),
223223
TestCase::custom("test.portable-simd", &|runner| {
224-
spawn_and_wait(PORTABLE_SIMD.clean(&runner.host_compiler.cargo, &runner.dirs));
224+
PORTABLE_SIMD.clean(&runner.dirs);
225225

226226
let mut build_cmd = PORTABLE_SIMD.build(&runner.target_compiler, &runner.dirs);
227227
build_cmd.arg("--all-targets");
@@ -293,7 +293,6 @@ struct TestRunner {
293293
is_native: bool,
294294
jit_supported: bool,
295295
dirs: Dirs,
296-
host_compiler: Compiler,
297296
target_compiler: Compiler,
298297
}
299298

@@ -303,8 +302,6 @@ impl TestRunner {
303302
let jit_supported =
304303
is_native && host_triple.contains("x86_64") && !host_triple.contains("windows");
305304

306-
let host_compiler = Compiler::clif_with_triple(&dirs, host_triple);
307-
308305
let mut target_compiler = Compiler::clif_with_triple(&dirs, target_triple);
309306
if !is_native {
310307
target_compiler.set_cross_linker_and_runner();
@@ -323,7 +320,7 @@ impl TestRunner {
323320
target_compiler.rustflags.push_str(" -Clink-arg=-undefined -Clink-arg=dynamic_lookup");
324321
}
325322

326-
Self { is_native, jit_supported, dirs, host_compiler, target_compiler }
323+
Self { is_native, jit_supported, dirs, target_compiler }
327324
}
328325

329326
pub fn run_testsuite(&self, tests: &[TestCase]) {

build_system/utils.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,8 @@ impl CargoProject {
146146
cmd
147147
}
148148

149-
#[must_use]
150-
pub(crate) fn clean(&self, cargo: &Path, dirs: &Dirs) -> Command {
151-
self.base_cmd("clean", cargo, dirs)
149+
pub(crate) fn clean(&self, dirs: &Dirs) {
150+
let _ = fs::remove_dir_all(self.target_dir(dirs));
152151
}
153152

154153
#[must_use]

0 commit comments

Comments
 (0)