From 84acae36d835d7c5b346ea75b918290ebc48b234 Mon Sep 17 00:00:00 2001 From: Li Junchen Date: Mon, 23 Sep 2024 17:05:47 +0800 Subject: [PATCH] internal: check build status after rerun in test mode (#336) --- crates/moonbuild/src/entry.rs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/crates/moonbuild/src/entry.rs b/crates/moonbuild/src/entry.rs index 4a8feabb..bda9b825 100644 --- a/crates/moonbuild/src/entry.rs +++ b/crates/moonbuild/src/entry.rs @@ -970,7 +970,10 @@ async fn handle_test_result( { let state = crate::runtest::load_moon_proj(module, moonc_opt, moonbuild_opt)?; - n2_run_interface(state, moonbuild_opt)?; + let result = n2_run_interface(state, moonbuild_opt)?; + if result.is_none() { + break; + } } let mut cur_res = execute_test( @@ -987,6 +990,7 @@ async fn handle_test_result( let mut cnt = 1; let limit = moonbuild_opt.test_opt.as_ref().map(|it| it.limit).unwrap(); + let mut rerun_error = false; while let Err(TestFailedStatus::ExpectTestFailed(ref etf)) = cur_res { if cnt >= limit { break; @@ -1000,7 +1004,11 @@ async fn handle_test_result( { let state = crate::runtest::load_moon_proj(module, moonc_opt, moonbuild_opt)?; - n2_run_interface(state, moonbuild_opt)?; + let result = n2_run_interface(state, moonbuild_opt)?; + if result.is_none() { + rerun_error = true; + break; + } } cur_res = execute_test( @@ -1018,6 +1026,10 @@ async fn handle_test_result( cnt += 1; } + if rerun_error { + break; + } + // update the previous test result *item = cur_res; }