From 66ee33a43730d99409a586a1fd437b320d14f903 Mon Sep 17 00:00:00 2001 From: kennytm Date: Mon, 12 Feb 2018 03:04:43 +0800 Subject: [PATCH 1/2] compiletest: Delete the executable immediately after running. This should save a lot of space on musl test cases (whose standard library are linked statically). --- src/tools/compiletest/src/runtest.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 46df211cbaf65..940721f1cc1f0 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -1343,7 +1343,7 @@ impl<'test> TestCx<'test> { 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 @@ impl<'test> TestCx<'test> { 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 From 00bce71144643c7b6c46f9feb6be69de6a61ceed Mon Sep 17 00:00:00 2001 From: Mark Simulacrum Date: Sun, 11 Feb 2018 16:27:33 -0700 Subject: [PATCH 2/2] Delete executables if the test ran successfully. This isn't a perfect heuristic, but since the amount of run-fail tests is far lower than run-pass tests for now, it should be sufficient to ensure that we don't run into CI limits. This makes it possible to run the test binary manually (e.g., under gdb/lldb) if it failed to attempt to find out why. --- src/tools/compiletest/src/runtest.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 940721f1cc1f0..a87809dd7bcfd 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -1400,9 +1400,11 @@ impl<'test> TestCx<'test> { } }; - // delete the executable after running it to save space. - // it is ok if the deletion failed. - let _ = fs::remove_file(self.make_exe_name()); + if proc_res.status.success() { + // 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 }