]> git.lizzy.rs Git - rust.git/commitdiff
compiletest: Delete the executable immediately after running.
authorkennytm <kennytm@gmail.com>
Sun, 11 Feb 2018 19:04:43 +0000 (03:04 +0800)
committerkennytm <kennytm@gmail.com>
Sun, 11 Feb 2018 19:13:25 +0000 (03:13 +0800)
This should save a lot of space on musl test cases (whose standard library
are linked statically).

src/tools/compiletest/src/runtest.rs

index 46df211cbaf65f225df1c55278e5a3b39c51c5aa..940721f1cc1f0ae5f42d6233e32d1d748ab6a7ea 100644 (file)
@@ -1343,7 +1343,7 @@ fn document(&self, out_dir: &Path) -> ProcRes {
     fn exec_compiled_test(&self) -> ProcRes {
         let env = &self.props.exec_env;
 
-        match &*self.config.target {
+        let proc_res = match &*self.config.target {
             // This is pretty similar to below, we're transforming:
             //
             //      program arg1 arg2
@@ -1398,7 +1398,13 @@ fn exec_compiled_test(&self) -> ProcRes {
                     None,
                 )
             }
-        }
+        };
+
+        // delete the executable after running it to save space.
+        // it is ok if the deletion failed.
+        let _ = fs::remove_file(self.make_exe_name());
+
+        proc_res
     }
 
     /// For each `aux-build: foo/bar` annotation, we check to find the