diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-05 17:28:19 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-05 17:28:19 +0000 |
commit | 18657a960e125336f704ea058e25c27bd3900dcb (patch) | |
tree | 17b438b680ed45a996d7b59951e6aa34023783f2 /ext/rbu/rbuA.test | |
parent | Initial commit. (diff) | |
download | sqlite3-upstream.tar.xz sqlite3-upstream.zip |
Adding upstream version 3.40.1.upstream/3.40.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'ext/rbu/rbuA.test')
-rw-r--r-- | ext/rbu/rbuA.test | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/ext/rbu/rbuA.test b/ext/rbu/rbuA.test new file mode 100644 index 0000000..642caca --- /dev/null +++ b/ext/rbu/rbuA.test @@ -0,0 +1,82 @@ +# 2014 August 30 +# +# 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 it is an error to attempt to update +# a wal mode database via RBU. +# + +if {![info exists testdir]} { + set testdir [file join [file dirname [info script]] .. .. test] +} +source $testdir/tester.tcl +set ::testprefix rbuA + +set db_sql { + CREATE TABLE t1(a PRIMARY KEY, b, c); +} +set rbu_sql { + CREATE TABLE data_t1(a, b, c, rbu_control); + INSERT INTO data_t1 VALUES(1, 2, 3, 0); + INSERT INTO data_t1 VALUES(4, 5, 6, 0); + INSERT INTO data_t1 VALUES(7, 8, 9, 0); +} + +do_test 1.0 { + db close + forcedelete test.db rbu.db + + sqlite3 db test.db + db eval $db_sql + db eval { PRAGMA journal_mode = wal } + db close + + sqlite3 db rbu.db + db eval $rbu_sql + db close + + sqlite3rbu rbu test.db rbu.db + rbu step +} {SQLITE_ERROR} +do_test 1.1 { + list [catch { rbu close } msg] $msg +} {1 {SQLITE_ERROR - cannot update wal mode database}} + +do_test 2.0 { + forcedelete test.db rbu.db + + sqlite3 db test.db + db eval $db_sql + db close + + sqlite3 db rbu.db + db eval $rbu_sql + db close + + sqlite3rbu rbu test.db rbu.db + rbu step + rbu close +} {SQLITE_OK} + +do_test 2.1 { + sqlite3 db test.db + db eval {PRAGMA journal_mode = wal} + db close + sqlite3rbu rbu test.db rbu.db + rbu step +} {SQLITE_ERROR} + +do_test 2.2 { + list [catch { rbu close } msg] $msg +} {1 {SQLITE_ERROR - cannot update wal mode database}} + + +finish_test |