OLD | NEW |
(Empty) | |
| 1 # 2014 August 30 |
| 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 # |
| 12 # This file contains tests for the RBU module. More specifically, it |
| 13 # contains tests to ensure that it is an error to attempt to update |
| 14 # a wal mode database via RBU. |
| 15 # |
| 16 |
| 17 if {![info exists testdir]} { |
| 18 set testdir [file join [file dirname [info script]] .. .. test] |
| 19 } |
| 20 source $testdir/tester.tcl |
| 21 set ::testprefix rbuA |
| 22 |
| 23 set db_sql { |
| 24 CREATE TABLE t1(a PRIMARY KEY, b, c); |
| 25 } |
| 26 set rbu_sql { |
| 27 CREATE TABLE data_t1(a, b, c, rbu_control); |
| 28 INSERT INTO data_t1 VALUES(1, 2, 3, 0); |
| 29 INSERT INTO data_t1 VALUES(4, 5, 6, 0); |
| 30 INSERT INTO data_t1 VALUES(7, 8, 9, 0); |
| 31 } |
| 32 |
| 33 do_test 1.0 { |
| 34 db close |
| 35 forcedelete test.db rbu.db |
| 36 |
| 37 sqlite3 db test.db |
| 38 db eval $db_sql |
| 39 db eval { PRAGMA journal_mode = wal } |
| 40 db close |
| 41 |
| 42 sqlite3 db rbu.db |
| 43 db eval $rbu_sql |
| 44 db close |
| 45 |
| 46 sqlite3rbu rbu test.db rbu.db |
| 47 rbu step |
| 48 } {SQLITE_ERROR} |
| 49 do_test 1.1 { |
| 50 list [catch { rbu close } msg] $msg |
| 51 } {1 {SQLITE_ERROR - cannot update wal mode database}} |
| 52 |
| 53 do_test 2.0 { |
| 54 forcedelete test.db rbu.db |
| 55 |
| 56 sqlite3 db test.db |
| 57 db eval $db_sql |
| 58 db close |
| 59 |
| 60 sqlite3 db rbu.db |
| 61 db eval $rbu_sql |
| 62 db close |
| 63 |
| 64 sqlite3rbu rbu test.db rbu.db |
| 65 rbu step |
| 66 rbu close |
| 67 } {SQLITE_OK} |
| 68 |
| 69 do_test 2.1 { |
| 70 sqlite3 db test.db |
| 71 db eval {PRAGMA journal_mode = wal} |
| 72 db close |
| 73 breakpoint |
| 74 sqlite3rbu rbu test.db rbu.db |
| 75 rbu step |
| 76 } {SQLITE_ERROR} |
| 77 |
| 78 do_test 2.2 { |
| 79 list [catch { rbu close } msg] $msg |
| 80 } {1 {SQLITE_ERROR - cannot update wal mode database}} |
| 81 |
| 82 |
| 83 finish_test |
| 84 |
OLD | NEW |