0
0
mirror of https://github.com/sqlite/sqlite.git synced 2024-11-25 08:59:33 +01:00
sqlite/ext/rbu/rbupass.test
dan a3d4d7a0ae Avoid running rbu tests under permutation "journaltest", which does not support wal. Fix some other test script problems.
FossilOrigin-Name: 92f018698a87ed32acc31d83f7246dbb7295867bd6a801b7984a16f97a5c7786
2023-02-04 21:25:17 +00:00

82 lines
1.6 KiB
Plaintext

# 2023 January 13
#
# The author disclaims copyright to this source code. In place of
# a legal notice, here is a blessing:
#
# May you do good and not evil.
# May you find forgiveness for yourself and forgive others.
# May you share freely, never taking more than you give.
#
#***********************************************************************
#
source [file join [file dirname [info script]] rbu_common.tcl]
if_no_rbu_support { finish_test ; return }
set ::testprefix rbupass
if {[info commands register_demovfs]==""} {
finish_test
return
}
db close
register_demovfs
sqlite3rbu_create_vfs myvfs demo
sqlite3 db file:test.db?vfs=myvfs -uri 1
do_execsql_test 1.0 {
CREATE TABLE t1(a INTEGER PRIMARY KEY, b);
INSERT INTO t1 VALUES(1, 2);
SELECT * FROM t1;
} {1 2}
if {[permutation]!="inmemory_journal"} {
do_execsql_test 1.1 {
PRAGMA journal_mode = wal;
} {delete}
}
do_execsql_test 1.2 {
SELECT * FROM t1;
} {1 2}
do_test 1.3 {
forcedelete rbu.db
sqlite3 rbu rbu.db
rbu eval {
CREATE TABLE data_t1(a, b, rbu_control);
INSERT INTO data_t1 VALUES(2, 4, 0);
}
rbu close
} {}
do_test 1.4 {
sqlite3rbu rbu test.db rbu.db
} {rbu}
do_test 1.5 {
rbu step
} {SQLITE_CANTOPEN}
do_test 1.6 {
list [catch { rbu close } msg] $msg
} {1 {SQLITE_CANTOPEN - unable to open database file}}
do_test 1.7 {
sqlite3rbu_vacuum rbu test.db
} {rbu}
do_test 1.8 {
rbu step
catch { rbu close }
} {1}
do_execsql_test 1.9 {
SELECT * FROM t1;
} {1 2}
db close
sqlite3rbu_destroy_vfs myvfs
unregister_demovfs
sqlite3_shutdown
finish_test