Skip to content

Commit 6feddae

Browse files
committed
tests: serialize interactive evtx_dump tests
Rexpect/pty-based tests are flaky when run concurrently under the default Rust test harness; lock them to run one-at-a-time.
1 parent fee4f59 commit 6feddae

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

tests/test_cli_interactive.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,18 @@ mod tests {
1313
use rexpect::spawn;
1414
use std::fs::File;
1515
use std::io::{Read, Write};
16+
use std::sync::Mutex;
1617
use tempfile::tempdir;
1718

19+
// These tests rely on pty semantics and can behave flakily when executed concurrently.
20+
// Serialize them to ensure stable behavior under the default Rust test runner.
21+
static INTERACTIVE_TEST_LOCK: Mutex<()> = Mutex::new(());
22+
1823
// It should behave the same on windows, but interactive testing relies on unix pty internals.
1924
#[test]
2025
#[cfg(not(target_os = "windows"))]
2126
fn test_it_confirms_before_overwriting_a_file() {
27+
let _guard = INTERACTIVE_TEST_LOCK.lock().unwrap();
2228
let d = tempdir().unwrap();
2329
let f = d.as_ref().join("test.out");
2430

@@ -54,6 +60,7 @@ mod tests {
5460
#[test]
5561
#[cfg(not(target_os = "windows"))]
5662
fn test_it_confirms_before_overwriting_a_file_and_quits() {
63+
let _guard = INTERACTIVE_TEST_LOCK.lock().unwrap();
5764
let d = tempdir().unwrap();
5865
let f = d.as_ref().join("test.out");
5966

0 commit comments

Comments
 (0)