From 81041c3206a42d92a6becd1b5aecaf15e0ddd1c5 Mon Sep 17 00:00:00 2001 From: Bruno Mendes Date: Sat, 20 Apr 2024 17:38:02 +0100 Subject: [PATCH] Use release test build in CI --- .github/workflows/ci.yml | 2 +- tests/winatchess.rs | 20 +++++++++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b0080e69..07c830c7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,7 +43,7 @@ jobs: uses: taiki-e/install-action@cargo-llvm-cov - name: Test with coverage - run: cargo llvm-cov --all-features --workspace --codecov --output-path codecov.json + run: cargo llvm-cov -r -v --all-features --workspace --codecov --output-path codecov.json - name: Upload coverage to Codecov uses: codecov/codecov-action@v4 diff --git a/tests/winatchess.rs b/tests/winatchess.rs index c0a50411..bfdbed87 100644 --- a/tests/winatchess.rs +++ b/tests/winatchess.rs @@ -19,9 +19,16 @@ const SCENARIO_SEARCH_TIME: Duration = Duration::new(1, 0); const SCENARIO_THREADS: u16 = 4; fn expect_search(fen: &str, mov: &str) { - for cof in &[1, 5, 30, 90] { - let duration = SCENARIO_SEARCH_TIME * *cof; - let quick_constraint = SearchConstraint { + let table = Arc::new(SearchTable::new(DEFAULT_TABLE_SIZE_MB * SCENARIO_THREADS as usize)); + + for cof in 1.. { + let duration = SCENARIO_SEARCH_TIME * cof; + + if duration > Duration::new(30, 0) { + panic!("Search failed for {} {}", fen, mov); + } + + let constraint = SearchConstraint { time_constraint: Some(TimeConstraint { initial_instant: Instant::now(), move_time: duration, @@ -33,13 +40,12 @@ fn expect_search(fen: &str, mov: &str) { game_history: vec![], }; - let table = SearchTable::new(DEFAULT_TABLE_SIZE_MB * SCENARIO_THREADS as usize); let result = search_iterative_deepening_multithread( &Position::from_fen(fen).unwrap(), 0, MAX_DEPTH, - Arc::new(table), - &quick_constraint, + table.clone(), + &constraint, ); if result.unwrap().to_string() == mov { @@ -47,7 +53,7 @@ fn expect_search(fen: &str, mov: &str) { } } - panic!("Search failed for {} {}", fen, mov); + unreachable!() } const WAC_POSITIONS: &str =