mirror of
https://github.com/aljazceru/turso.git
synced 2026-02-11 03:04:22 +01:00
Add cfg attributes for running under Miri
This commit is contained in:
@@ -16,7 +16,7 @@ use std::{
|
||||
sync::{atomic::Ordering, LazyLock},
|
||||
};
|
||||
|
||||
#[cfg(not(target_family = "wasm"))]
|
||||
#[cfg(all(not(target_family = "wasm"), not(miri)))]
|
||||
#[global_allocator]
|
||||
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
mod dynamic;
|
||||
mod vtab_xconnect;
|
||||
use crate::schema::{Schema, Table};
|
||||
#[cfg(all(target_os = "linux", feature = "io_uring"))]
|
||||
#[cfg(all(target_os = "linux", feature = "io_uring", not(miri)))]
|
||||
use crate::UringIO;
|
||||
use crate::{function::ExternalFunc, Connection, Database};
|
||||
use crate::{vtab::VirtualTable, SymbolTable};
|
||||
@@ -146,7 +146,7 @@ impl Database {
|
||||
let io: Arc<dyn IO> = match vfs {
|
||||
"memory" => Arc::new(MemoryIO::new()),
|
||||
"syscall" => Arc::new(SyscallIO::new()?),
|
||||
#[cfg(all(target_os = "linux", feature = "io_uring"))]
|
||||
#[cfg(all(target_os = "linux", feature = "io_uring", not(miri)))]
|
||||
"io_uring" => Arc::new(UringIO::new()?),
|
||||
other => match get_vfs_modules().iter().find(|v| v.0 == vfs) {
|
||||
Some((_, vfs)) => vfs.clone(),
|
||||
|
||||
@@ -717,13 +717,13 @@ impl TempBufferCache {
|
||||
}
|
||||
|
||||
cfg_block! {
|
||||
#[cfg(all(target_os = "linux", feature = "io_uring"))] {
|
||||
#[cfg(all(target_os = "linux", feature = "io_uring", not(miri)))] {
|
||||
mod io_uring;
|
||||
#[cfg(feature = "fs")]
|
||||
pub use io_uring::UringIO;
|
||||
}
|
||||
|
||||
#[cfg(target_family = "unix")] {
|
||||
#[cfg(all(target_family = "unix", not(miri)))] {
|
||||
mod unix;
|
||||
#[cfg(feature = "fs")]
|
||||
pub use unix::UnixIO;
|
||||
@@ -731,7 +731,7 @@ cfg_block! {
|
||||
pub use PlatformIO as SyscallIO;
|
||||
}
|
||||
|
||||
#[cfg(not(any(target_family = "unix", target_os = "android", target_os = "ios")))] {
|
||||
#[cfg(any(not(any(target_family = "unix", target_os = "android", target_os = "ios")), miri))] {
|
||||
mod generic;
|
||||
pub use generic::GenericIO as PlatformIO;
|
||||
pub use PlatformIO as SyscallIO;
|
||||
|
||||
@@ -53,9 +53,9 @@ use crate::{incremental::view::AllViewsTxState, translate::emitter::TransactionM
|
||||
use core::str;
|
||||
pub use error::{CompletionError, LimboError};
|
||||
pub use io::clock::{Clock, Instant};
|
||||
#[cfg(all(feature = "fs", target_family = "unix"))]
|
||||
#[cfg(all(feature = "fs", target_family = "unix", not(miri)))]
|
||||
pub use io::UnixIO;
|
||||
#[cfg(all(feature = "fs", target_os = "linux", feature = "io_uring"))]
|
||||
#[cfg(all(feature = "fs", target_os = "linux", feature = "io_uring", not(miri)))]
|
||||
pub use io::UringIO;
|
||||
pub use io::{
|
||||
Buffer, Completion, CompletionType, File, GroupCompletion, MemoryIO, OpenFlags, PlatformIO,
|
||||
@@ -791,7 +791,7 @@ impl Database {
|
||||
None => match vfs.as_ref() {
|
||||
"memory" => Arc::new(MemoryIO::new()),
|
||||
"syscall" => Arc::new(SyscallIO::new()?),
|
||||
#[cfg(all(target_os = "linux", feature = "io_uring"))]
|
||||
#[cfg(all(target_os = "linux", feature = "io_uring", not(miri)))]
|
||||
"io_uring" => Arc::new(UringIO::new()?),
|
||||
other => {
|
||||
return Err(LimboError::InvalidArgument(format!("no such VFS: {other}")));
|
||||
|
||||
@@ -427,7 +427,7 @@ impl Arena {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
#[cfg(all(unix, not(miri)))]
|
||||
mod arena {
|
||||
#[cfg(target_vendor = "apple")]
|
||||
use libc::MAP_ANON as MAP_ANONYMOUS;
|
||||
@@ -463,7 +463,7 @@ mod arena {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(unix))]
|
||||
#[cfg(any(not(unix), miri))]
|
||||
mod arena {
|
||||
pub fn alloc(len: usize) -> *mut u8 {
|
||||
let layout = std::alloc::Layout::from_size_align(len, std::mem::size_of::<u8>()).unwrap();
|
||||
|
||||
Reference in New Issue
Block a user