]> git.lizzy.rs Git - rust.git/commitdiff
Use fs::remove_dir_all instead of cargo clean
authorbjorn3 <17426603+bjorn3@users.noreply.github.com>
Sat, 14 Jan 2023 12:36:56 +0000 (12:36 +0000)
committerbjorn3 <17426603+bjorn3@users.noreply.github.com>
Sat, 14 Jan 2023 14:18:11 +0000 (14:18 +0000)
build_system/tests.rs
build_system/utils.rs

index 4d638a4eced108f3cf5a372a003682201669f449..4203a3859e1a167bcad4141d7b698908fa9024da 100644 (file)
@@ -119,7 +119,7 @@ const fn jit_bin(config: &'static str, source: &'static str, args: &'static str)
 
 const EXTENDED_SYSROOT_SUITE: &[TestCase] = &[
     TestCase::custom("test.rust-random/rand", &|runner| {
-        spawn_and_wait(RAND.clean(&runner.target_compiler.cargo, &runner.dirs));
+        RAND.clean(&runner.dirs);
 
         if runner.is_native {
             eprintln!("[TEST] rust-random/rand");
@@ -134,11 +134,11 @@ const fn jit_bin(config: &'static str, source: &'static str, args: &'static str)
         }
     }),
     TestCase::custom("test.simple-raytracer", &|runner| {
-        spawn_and_wait(SIMPLE_RAYTRACER.clean(&runner.host_compiler.cargo, &runner.dirs));
+        SIMPLE_RAYTRACER.clean(&runner.dirs);
         spawn_and_wait(SIMPLE_RAYTRACER.build(&runner.target_compiler, &runner.dirs));
     }),
     TestCase::custom("test.libcore", &|runner| {
-        spawn_and_wait(LIBCORE_TESTS.clean(&runner.host_compiler.cargo, &runner.dirs));
+        LIBCORE_TESTS.clean(&runner.dirs);
 
         if runner.is_native {
             spawn_and_wait(LIBCORE_TESTS.test(&runner.target_compiler, &runner.dirs));
@@ -150,7 +150,7 @@ const fn jit_bin(config: &'static str, source: &'static str, args: &'static str)
         }
     }),
     TestCase::custom("test.regex-shootout-regex-dna", &|runner| {
-        spawn_and_wait(REGEX.clean(&runner.target_compiler.cargo, &runner.dirs));
+        REGEX.clean(&runner.dirs);
 
         // newer aho_corasick versions throw a deprecation warning
         let lint_rust_flags = format!("{} --cap-lints warn", runner.target_compiler.rustflags);
@@ -194,7 +194,7 @@ const fn jit_bin(config: &'static str, source: &'static str, args: &'static str)
         }
     }),
     TestCase::custom("test.regex", &|runner| {
-        spawn_and_wait(REGEX.clean(&runner.host_compiler.cargo, &runner.dirs));
+        REGEX.clean(&runner.dirs);
 
         // newer aho_corasick versions throw a deprecation warning
         let lint_rust_flags = format!("{} --cap-lints warn", runner.target_compiler.rustflags);
@@ -221,7 +221,7 @@ const fn jit_bin(config: &'static str, source: &'static str, args: &'static str)
         }
     }),
     TestCase::custom("test.portable-simd", &|runner| {
-        spawn_and_wait(PORTABLE_SIMD.clean(&runner.host_compiler.cargo, &runner.dirs));
+        PORTABLE_SIMD.clean(&runner.dirs);
 
         let mut build_cmd = PORTABLE_SIMD.build(&runner.target_compiler, &runner.dirs);
         build_cmd.arg("--all-targets");
@@ -293,7 +293,6 @@ struct TestRunner {
     is_native: bool,
     jit_supported: bool,
     dirs: Dirs,
-    host_compiler: Compiler,
     target_compiler: Compiler,
 }
 
@@ -303,8 +302,6 @@ pub fn new(dirs: Dirs, host_triple: String, target_triple: String) -> Self {
         let jit_supported =
             is_native && host_triple.contains("x86_64") && !host_triple.contains("windows");
 
-        let host_compiler = Compiler::clif_with_triple(&dirs, host_triple);
-
         let mut target_compiler = Compiler::clif_with_triple(&dirs, target_triple);
         if !is_native {
             target_compiler.set_cross_linker_and_runner();
@@ -323,7 +320,7 @@ pub fn new(dirs: Dirs, host_triple: String, target_triple: String) -> Self {
             target_compiler.rustflags.push_str(" -Clink-arg=-undefined -Clink-arg=dynamic_lookup");
         }
 
-        Self { is_native, jit_supported, dirs, host_compiler, target_compiler }
+        Self { is_native, jit_supported, dirs, target_compiler }
     }
 
     pub fn run_testsuite(&self, tests: &[TestCase]) {
index f2b1fecedc16ba1febb0dc9acec939bae5db62a4..935177a00ba87f8d43b795879f7bc6baa4baf821 100644 (file)
@@ -146,9 +146,8 @@ pub(crate) fn fetch(&self, cargo: impl AsRef<Path>, dirs: &Dirs) -> Command {
         cmd
     }
 
-    #[must_use]
-    pub(crate) fn clean(&self, cargo: &Path, dirs: &Dirs) -> Command {
-        self.base_cmd("clean", cargo, dirs)
+    pub(crate) fn clean(&self, dirs: &Dirs) {
+        let _ = fs::remove_dir_all(self.target_dir(dirs));
     }
 
     #[must_use]