diff --git a/Cargo.lock b/Cargo.lock index b55e32afc..0e9165f6b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1719,8 +1719,10 @@ dependencies = [ name = "limbo_ext_tests" version = "0.0.16" dependencies = [ + "env_logger 0.11.6", "lazy_static", "limbo_ext", + "log", "mimalloc", ] @@ -1895,9 +1897,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.25" +version = "0.4.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04cbf5b083de1c7e0222a7a51dbfdba1cbe1c6ab0b15e29fff3f6c077fd9cd9f" +checksum = "30bde2b3dc3671ae49d8e2e9f044c7c005836e7a023ee57cffa25ab82764bb9e" [[package]] name = "lru" diff --git a/extensions/tests/Cargo.toml b/extensions/tests/Cargo.toml index 84c9cbae2..aa3ba8fdb 100644 --- a/extensions/tests/Cargo.toml +++ b/extensions/tests/Cargo.toml @@ -13,8 +13,10 @@ crate-type = ["cdylib", "lib"] static= [ "limbo_ext/static" ] [dependencies] +env_logger = "0.11.6" lazy_static = "1.5.0" limbo_ext = { workspace = true, features = ["static"] } +log = "0.4.26" [target.'cfg(not(target_family = "wasm"))'.dependencies] mimalloc = { version = "0.1", default-features = false } diff --git a/extensions/tests/src/lib.rs b/extensions/tests/src/lib.rs index caf065ede..92e4f874f 100644 --- a/extensions/tests/src/lib.rs +++ b/extensions/tests/src/lib.rs @@ -12,6 +12,7 @@ use std::sync::Mutex; register_extension! { vtabs: { KVStoreVTab }, + scalars: { test_scalar }, vfs: { TestFS }, } @@ -134,7 +135,7 @@ impl VTabCursor for KVStoreCursor { if self.index.is_some_and(|c| c < self.rows.len()) { self.rows[self.index.unwrap_or(0)].0 } else { - println!("rowid: -1"); + log::error!("rowid: -1"); -1 } } @@ -175,6 +176,8 @@ impl VfsExtension for TestFS { const NAME: &'static str = "testvfs"; type File = TestFile; fn open_file(&self, path: &str, flags: i32, _direct: bool) -> ExtResult { + let _ = env_logger::try_init(); + log::debug!("opening file with testing VFS: {} flags: {}", path, flags); let file = OpenOptions::new() .read(true) .write(true) @@ -188,6 +191,7 @@ impl VfsExtension for TestFS { #[cfg(not(target_family = "wasm"))] impl VfsFile for TestFile { fn read(&mut self, buf: &mut [u8], count: usize, offset: i64) -> ExtResult { + log::debug!("reading file with testing VFS: bytes: {count} offset: {offset}"); if self.file.seek(SeekFrom::Start(offset as u64)).is_err() { return Err(ResultCode::Error); } @@ -198,6 +202,7 @@ impl VfsFile for TestFile { } fn write(&mut self, buf: &[u8], count: usize, offset: i64) -> ExtResult { + log::debug!("writing to file with testing VFS: bytes: {count} offset: {offset}"); if self.file.seek(SeekFrom::Start(offset as u64)).is_err() { return Err(ResultCode::Error); } @@ -208,6 +213,7 @@ impl VfsFile for TestFile { } fn sync(&self) -> ExtResult<()> { + log::debug!("syncing file with testing VFS"); self.file.sync_all().map_err(|_| ResultCode::Error) }