Skip to content

Commit a32cdee

Browse files
committed
Introduce exec_compiled_test_general
This will allow the `run-coverage` mode to easily set environment variable `LLVM_PROFILE_FILE`, and to prevent the executable from being deleted after a successful run.
1 parent 5b51d9c commit a32cdee

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/tools/compiletest/src/runtest.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1598,6 +1598,14 @@ impl<'test> TestCx<'test> {
15981598
}
15991599

16001600
fn exec_compiled_test(&self) -> ProcRes {
1601+
self.exec_compiled_test_general(&[], true)
1602+
}
1603+
1604+
fn exec_compiled_test_general(
1605+
&self,
1606+
env_extra: &[(&str, &str)],
1607+
delete_after_success: bool,
1608+
) -> ProcRes {
16011609
let prepare_env = |cmd: &mut Command| {
16021610
for key in &self.props.unset_exec_env {
16031611
cmd.env_remove(key);
@@ -1606,6 +1614,9 @@ impl<'test> TestCx<'test> {
16061614
for (key, val) in &self.props.exec_env {
16071615
cmd.env(key, val);
16081616
}
1617+
for (key, val) in env_extra {
1618+
cmd.env(key, val);
1619+
}
16091620
};
16101621

16111622
let proc_res = match &*self.config.target {
@@ -1684,7 +1695,7 @@ impl<'test> TestCx<'test> {
16841695
}
16851696
};
16861697

1687-
if proc_res.status.success() {
1698+
if delete_after_success && proc_res.status.success() {
16881699
// delete the executable after running it to save space.
16891700
// it is ok if the deletion failed.
16901701
let _ = fs::remove_file(self.make_exe_name());

0 commit comments

Comments
 (0)