From 312de35d3aa33c2c58386ca1544046c54c6d4da2 Mon Sep 17 00:00:00 2001 From: bit-aloo Date: Fri, 4 Jul 2025 20:54:09 +0530 Subject: [PATCH] restructure try_run_tests --- src/bootstrap/src/utils/exec.rs | 12 +++--------- src/bootstrap/src/utils/render_tests.rs | 19 ++++++++++--------- 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/src/bootstrap/src/utils/exec.rs b/src/bootstrap/src/utils/exec.rs index c5b3c322be4d..487077835ac6 100644 --- a/src/bootstrap/src/utils/exec.rs +++ b/src/bootstrap/src/utils/exec.rs @@ -223,7 +223,7 @@ impl<'a> BootstrapCommand { /// Mark the command as being executed, disarming the drop bomb. /// If this method is not called before the command is dropped, its drop will panic. - fn mark_as_executed(&mut self) { + pub fn mark_as_executed(&mut self) { self.drop_bomb.defuse(); } @@ -625,18 +625,12 @@ impl ExecutionContext { exit!(1); } -<<<<<<< HEAD - pub fn stream<'a>( -======= /// Spawns the command with configured stdout and stderr handling. /// - /// Returns `None` if in dry-run mode and the command is not allowed to run. - /// - /// Panics if the command fails to spawn. + /// Returns None if in dry-run mode or Panics if the command fails to spawn. pub fn stream( ->>>>>>> c2e83361cec (add comment to exec) &self, - command: &'a mut BootstrapCommand, + command: &mut BootstrapCommand, stdout: OutputMode, stderr: OutputMode, ) -> Option { diff --git a/src/bootstrap/src/utils/render_tests.rs b/src/bootstrap/src/utils/render_tests.rs index 73a22ec28260..934699d736b4 100644 --- a/src/bootstrap/src/utils/render_tests.rs +++ b/src/bootstrap/src/utils/render_tests.rs @@ -34,16 +34,17 @@ pub(crate) fn try_run_tests( cmd: &mut BootstrapCommand, stream: bool, ) -> bool { - if !run_tests(builder, cmd, stream) { - if builder.fail_fast { - crate::exit!(1); - } else { - builder.config.exec_ctx().add_to_delay_failure(format!("{cmd:?}")); - false - } - } else { - true + if run_tests(builder, cmd, stream) { + return true; } + + if builder.fail_fast { + crate::exit!(1); + } + + builder.config.exec_ctx().add_to_delay_failure(format!("{cmd:?}")); + + false } fn run_tests(builder: &Builder<'_>, cmd: &mut BootstrapCommand, stream: bool) -> bool {