Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/sqlite/blob/master/test/walckptnoop.test # sqlite [Ported from github.com/sqlite/sqlite] Fix bugs in and improve the interface to the ".check" command of the CLI. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `sqlite / test / walckptnoop.test` 114 lines ยท 2376 bytes Raw Blame History 1 # 2025 September 5 2 # 3 # The author disclaims copyright to this source code. In place of 4 # a legal notice, here is a blessing: 5 # 6 # May you do good and not evil. 7 # May you find forgiveness for yourself and forgive others. 8 # May you share freely, never taking more than you give. 9 # 10 #*********************************************************************** 11 # This file implements regression tests for SQLite library. The 12 # focus of this file is testing the operation of the library in 13 # "PRAGMA wal_checkpoint = noop" mode. 14 # 15 16 set testdir [file dirname $argv0] 17 source $testdir/tester.tcl 18 source $testdir/lock_common.tcl 19 source $testdir/malloc_common.tcl 20 source $testdir/wal_common.tcl 21 22 set testprefix walckptnoop 23 24 ifcapable !wal {finish_test ; return } 25 26 set VAL 123 27 28 proc myrand {} { 29 global VAL 30 31 set A `1103515245` 32 set C 12345 33 set M `2147483648` 34 35 set VAL [expr {($A * $VAL + $C) % $M}] 36 return $VAL 37 } 38 39 proc myrandomblob {n} { 40 set l [list] 41 for {set i 0} {$i < $n} {incr i} { 42 lappend l [expr [myrand] % 256] 43 } 44 binary format c* $l 45 } 46 47 db func myrandomblob myrandomblob 48 49 50 do_execsql_test 1.0 { 51 PRAGMA page_size=1024; 52 PRAGMA auto_vacuum=NONE; 53 PRAGMA secure_delete=OFF; 54 VACUUM; 55 CREATE TABLE t1(x INTEGER PRIMARY KEY, y TEXT); 56 CREATE INDEX i1 ON t1(y); 57 PRAGMA journal_mode = wal; 58 59 WITH s(i) AS ( 60 SELECT 1 UNION ALL SELECT i+1 FROM s WHERE i<1000 61 ) 62 INSERT INTO t1 SELECT NULL, hex(myrandomblob(64)) FROM s; 63 } {0 wal} 64 65 do_execsql_test 1.1 { 66 PRAGMA wal_checkpoint = noop; 67 } {0 298 0} 68 do_execsql_test 1.2 { 69 PRAGMA wal_checkpoint = noop; 70 } {0 298 0} 71 do_execsql_test 1.3 { 72 PRAGMA wal_checkpoint = passive; 73 } {0 298 298} 74 do_execsql_test 1.4 { 75 PRAGMA wal_checkpoint = noop; 76 } {0 298 298} 77 78 db_save_and_close 79 db_restore_and_reopen 80 do_execsql_test 1.5 { 81 PRAGMA wal_checkpoint = noop; 82 } {0 298 0} 83 84 db close 85 sqlite3 db test.db 86 db eval { 87 PRAGMA auto_vacuum=NONE; 88 PRAGMA secure_delete=OFF; 89 } 90 do_execsql_test 1.6 { 91 PRAGMA wal_checkpoint = noop; 92 } {0 0 0} 93 94 do_catchsql_test 1.7 { 95 BEGIN; 96 DELETE FROM t1; 97 PRAGMA wal_checkpoint = noop; 98 } {1 {database table is locked}} 99 100 do_catchsql_test 1.8 { 101 COMMIT; 102 PRAGMA wal_checkpoint = noop; 103 } {0 {0 5 0}} 104 105 do_test 1.9 { 106 sqlite3_wal_checkpoint_v2 db noop 107 } {0 5 0} 108 109 do_execsql_test 1.10 { 110 PRAGMA journal_mode = delete; 111 PRAGMA wal_checkpoint = noop; 112 } {delete 0 -1 -1} 113 114 finish_test