From 1eb1171f553b54a9adc1069f3b0e777165def8a0 Mon Sep 17 00:00:00 2001 From: pedrocarlo Date: Tue, 26 Aug 2025 12:26:20 -0300 Subject: [PATCH] do not fault on Fsync until we correctly define the expected behaviour in the simulator --- simulator/runner/io.rs | 2 +- simulator/runner/memory/file.rs | 5 +++-- simulator/runner/memory/io.rs | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/simulator/runner/io.rs b/simulator/runner/io.rs index d6cdcace7..dbb0b3953 100644 --- a/simulator/runner/io.rs +++ b/simulator/runner/io.rs @@ -7,7 +7,7 @@ use rand::{RngCore, SeedableRng}; use rand_chacha::ChaCha8Rng; use turso_core::{Clock, IO, Instant, OpenFlags, PlatformIO, Result}; -use crate::runner::{clock::SimulatorClock, file::SimulatorFile, SimIO}; +use crate::runner::{SimIO, clock::SimulatorClock, file::SimulatorFile}; pub(crate) struct SimulatorIO { pub(crate) inner: Box, diff --git a/simulator/runner/memory/file.rs b/simulator/runner/memory/file.rs index e648ef23d..573a70820 100644 --- a/simulator/runner/memory/file.rs +++ b/simulator/runner/memory/file.rs @@ -5,7 +5,7 @@ use std::{ use rand::{Rng as _, SeedableRng}; use rand_chacha::ChaCha8Rng; -use tracing::{instrument, Level}; +use tracing::{Level, instrument}; use turso_core::{Completion, File, Result}; use crate::runner::{ @@ -131,7 +131,8 @@ impl MemorySimFile { } fn insert_op(&self, op: OperationType) { - let fault = self.fault.get(); + // FIXME: currently avoid any fsync faults until we correctly define the expected behaviour in the simulator + let fault = self.fault.get() && !matches!(op, OperationType::Sync { .. }); if fault { let mut io_tracker = self.io_tracker.borrow_mut(); match &op { diff --git a/simulator/runner/memory/io.rs b/simulator/runner/memory/io.rs index 8b07ba819..1a2ea49a8 100644 --- a/simulator/runner/memory/io.rs +++ b/simulator/runner/memory/io.rs @@ -5,11 +5,11 @@ use indexmap::IndexMap; use parking_lot::Mutex; use rand::{RngCore, SeedableRng}; use rand_chacha::ChaCha8Rng; -use turso_core::{Clock, Completion, Instant, OpenFlags, Result, IO}; +use turso_core::{Clock, Completion, IO, Instant, OpenFlags, Result}; +use crate::runner::SimIO; use crate::runner::clock::SimulatorClock; use crate::runner::memory::file::MemorySimFile; -use crate::runner::SimIO; /// File descriptor pub type Fd = String;