Skip to content

Commit

Permalink
internal: check build status after rerun in test mode (#336)
Browse files Browse the repository at this point in the history
  • Loading branch information
lijunchen authored Sep 23, 2024
1 parent d47a98e commit 84acae3
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions crates/moonbuild/src/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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;
Expand All @@ -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(
Expand All @@ -1018,6 +1026,10 @@ async fn handle_test_result(
cnt += 1;
}

if rerun_error {
break;
}

// update the previous test result
*item = cur_res;
}
Expand Down

0 comments on commit 84acae3

Please sign in to comment.