mirror of
https://github.com/sqlite/sqlite.git
synced 2024-11-25 00:49:41 +01:00
a3d4d7a0ae
FossilOrigin-Name: 92f018698a87ed32acc31d83f7246dbb7295867bd6a801b7984a16f97a5c7786
65 lines
1.4 KiB
Plaintext
65 lines
1.4 KiB
Plaintext
# 2019 Jan 3
|
|
#
|
|
# 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.
|
|
#
|
|
#***********************************************************************
|
|
#
|
|
# This file contains tests for the RBU module. More specifically, it
|
|
# contains tests to ensure that the sqlite3rbu_vacuum() API works as
|
|
# expected.
|
|
#
|
|
|
|
source [file join [file dirname [info script]] rbu_common.tcl]
|
|
if_no_rbu_support { finish_test ; return }
|
|
set testprefix rbuvacuum3
|
|
|
|
do_execsql_test 1.0 {
|
|
CREATE TABLE t1(a PRIMARY KEY, b, c);
|
|
CREATE INDEX i1b ON t1(b);
|
|
CREATE INDEX i1c ON t1(c);
|
|
|
|
WITH s(i) AS (
|
|
VALUES(1) UNION ALL SELECT i+1 FROM s WHERE i<100
|
|
)
|
|
INSERT INTO t1 SELECT i, randomblob(100), randomblob(100) FROM s;
|
|
}
|
|
|
|
forcedelete state.db
|
|
do_test 1.1 {
|
|
sqlite3rbu_vacuum rbu test.db state.db
|
|
while {1} {
|
|
set rc [rbu step]
|
|
if {$rc!="SQLITE_OK"} break
|
|
rbu savestate
|
|
}
|
|
rbu close
|
|
} {SQLITE_DONE}
|
|
|
|
do_test 1.2 {
|
|
sqlite3rbu_vacuum rbu test.db state.db
|
|
while {1} {
|
|
set rc [rbu step]
|
|
if {$rc!="SQLITE_OK"} break
|
|
rbu savestate
|
|
}
|
|
rbu close
|
|
} {SQLITE_DONE}
|
|
|
|
do_test 1.3 {
|
|
while {1} {
|
|
sqlite3rbu_vacuum rbu test.db state.db
|
|
set rc [rbu step]
|
|
if {$rc!="SQLITE_OK"} break
|
|
rbu savestate
|
|
rbu close
|
|
}
|
|
rbu close
|
|
} {SQLITE_DONE}
|
|
|
|
finish_test
|