Skip to content

Commit 80348b0

Browse files
committed
Set FORCE_DISK_SPILL in CI, drop RAII guard and --test-threads=1
1 parent a54ce1c commit 80348b0

2 files changed

Lines changed: 15 additions & 20 deletions

File tree

.github/workflows/pr_main.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,10 @@ jobs:
183183
cargo test --release -p stark --features disk-spill disk_spill
184184
185185
- name: Run prover disk-spill tests
186+
env:
187+
FORCE_DISK_SPILL: "1"
186188
run: |
187-
cargo test --release -p lambda-vm-prover --features disk-spill -- --test-threads=1 disk_spill count_table_lengths
189+
cargo test --release -p lambda-vm-prover --features disk-spill -- disk_spill count_table_lengths
188190
189191
build-prover-tests:
190192
name: Build prover tests

prover/src/tests/disk_spill_tests.rs

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,25 @@
11
//! End-to-end tests forcing `StorageMode::Disk` via the `FORCE_DISK_SPILL` env var.
2+
//!
3+
//! Run with `FORCE_DISK_SPILL=1` set in the environment, e.g.
4+
//! `FORCE_DISK_SPILL=1 cargo test --features disk-spill disk_spill`. Tests
5+
//! fail fast if the var is unset to avoid silent loss of coverage.
26
37
use crate::VmProof;
48
use crate::tables::MaxRowsConfig;
59
use crate::test_utils::asm_elf_bytes;
610
use stark::proof::options::GoldilocksCubicProofOptions;
711

8-
/// RAII guard that sets `FORCE_DISK_SPILL` for the test's scope and clears it
9-
/// on drop. Tests must run with `--test-threads=1`.
10-
struct ForceDiskGuard;
11-
12-
impl ForceDiskGuard {
13-
fn new() -> Self {
14-
// SAFETY: tests run with --test-threads=1, no concurrent env access.
15-
unsafe { std::env::set_var("FORCE_DISK_SPILL", "1") };
16-
Self
17-
}
18-
}
19-
20-
impl Drop for ForceDiskGuard {
21-
fn drop(&mut self) {
22-
// SAFETY: same as new().
23-
unsafe { std::env::remove_var("FORCE_DISK_SPILL") };
24-
}
12+
fn require_force_disk_spill() {
13+
assert_eq!(
14+
std::env::var("FORCE_DISK_SPILL").as_deref(),
15+
Ok("1"),
16+
"set FORCE_DISK_SPILL=1 before running disk-spill tests",
17+
);
2518
}
2619

2720
#[test]
2821
fn test_disk_spill_prove_verify_and_roundtrip_small() {
29-
let _guard = ForceDiskGuard::new();
22+
require_force_disk_spill();
3023
let elf_bytes = asm_elf_bytes("sub");
3124
let opts = GoldilocksCubicProofOptions::with_blowup(2).expect("blowup=2 is always valid");
3225
let proof = crate::prove_with_options(&elf_bytes, &opts, &MaxRowsConfig::default())
@@ -46,7 +39,7 @@ fn test_disk_spill_prove_verify_and_roundtrip_small() {
4639

4740
#[test]
4841
fn test_disk_spill_prove_verify_and_roundtrip_chunked() {
49-
let _guard = ForceDiskGuard::new();
42+
require_force_disk_spill();
5043
let elf_bytes = asm_elf_bytes("all_instructions_64");
5144
let opts = GoldilocksCubicProofOptions::with_blowup(2).expect("blowup=2 is always valid");
5245
let proof = crate::prove_with_options(&elf_bytes, &opts, &MaxRowsConfig::small())

0 commit comments

Comments
 (0)