From b0cd184f1e821a0681439d176b0d54b98b0b7115 Mon Sep 17 00:00:00 2001 From: Pekka Enberg Date: Fri, 5 Sep 2025 10:07:49 +0300 Subject: [PATCH 1/2] sqlite3: Use in-memory database in test_prepare_misuse() There's no need for a file. --- sqlite3/tests/compat/mod.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/sqlite3/tests/compat/mod.rs b/sqlite3/tests/compat/mod.rs index 52ed3d8fa..d4aab1688 100644 --- a/sqlite3/tests/compat/mod.rs +++ b/sqlite3/tests/compat/mod.rs @@ -149,10 +149,7 @@ mod tests { fn test_prepare_misuse() { unsafe { let mut db = ptr::null_mut(); - assert_eq!( - sqlite3_open(c"../testing/testing_clone.db".as_ptr(), &mut db), - SQLITE_OK - ); + assert_eq!(sqlite3_open(c":memory:".as_ptr(), &mut db), SQLITE_OK); let mut stmt = ptr::null_mut(); assert_eq!( From 55f37398e4f40d6f96eaab28bf4482c09ea3c67a Mon Sep 17 00:00:00 2001 From: Pekka Enberg Date: Fri, 5 Sep 2025 10:15:55 +0300 Subject: [PATCH 2/2] sqlite3: Remove broken sqlite3_checkpoint() test cases They're both using the same database file which is wrong (tests run in parallel). But more importantly, they test almost nothing, and we have a better checkpoint test already. --- sqlite3/tests/compat/mod.rs | 76 ------------------------------------- 1 file changed, 76 deletions(-) diff --git a/sqlite3/tests/compat/mod.rs b/sqlite3/tests/compat/mod.rs index d4aab1688..2608a9cdc 100644 --- a/sqlite3/tests/compat/mod.rs +++ b/sqlite3/tests/compat/mod.rs @@ -162,82 +162,6 @@ mod tests { } } - #[test] - fn test_wal_checkpoint() { - unsafe { - // Test with valid db - let mut db = ptr::null_mut(); - assert_eq!( - sqlite3_open(c"../testing/testing_clone.db".as_ptr(), &mut db), - SQLITE_OK - ); - assert_eq!(sqlite3_wal_checkpoint(db, ptr::null()), SQLITE_OK); - assert_eq!(sqlite3_close(db), SQLITE_OK); - } - } - - #[test] - fn test_wal_checkpoint_v2() { - unsafe { - // Test with valid db - let mut db = ptr::null_mut(); - assert_eq!( - sqlite3_open(c"../testing/testing_clone.db".as_ptr(), &mut db), - SQLITE_OK - ); - - let mut log_size = 0; - let mut checkpoint_count = 0; - - // Test different checkpoint modes - assert_eq!( - sqlite3_wal_checkpoint_v2( - db, - ptr::null(), - SQLITE_CHECKPOINT_PASSIVE, - &mut log_size, - &mut checkpoint_count - ), - SQLITE_OK - ); - - // TODO: uncomment when SQLITE_CHECKPOINT_FULL is supported - // assert_eq!( - // sqlite3_wal_checkpoint_v2( - // db, - // ptr::null(), - // SQLITE_CHECKPOINT_FULL, - // &mut log_size, - // &mut checkpoint_count - // ), - // SQLITE_OK - // ); - - assert_eq!( - sqlite3_wal_checkpoint_v2( - db, - ptr::null(), - SQLITE_CHECKPOINT_RESTART, - &mut log_size, - &mut checkpoint_count - ), - SQLITE_OK - ); - - assert_eq!( - sqlite3_wal_checkpoint_v2( - db, - ptr::null(), - SQLITE_CHECKPOINT_TRUNCATE, - &mut log_size, - &mut checkpoint_count - ), - SQLITE_OK - ); - - assert_eq!(sqlite3_close(db), SQLITE_OK); - } - } #[test] fn test_sqlite3_bind_int() { unsafe {