diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/incrvacuum3.test | 21 | ||||
-rw-r--r-- | test/tkt-7a31705a7e6.test | 26 |
2 files changed, 45 insertions, 2 deletions
diff --git a/test/incrvacuum3.test b/test/incrvacuum3.test index ed2d47139..f01dc100b 100644 --- a/test/incrvacuum3.test +++ b/test/incrvacuum3.test @@ -34,9 +34,8 @@ ifcapable {!autovacuum || !pragma} { proc check_on_disk {} { - # Copy the files for database "test.db" to "test2.db". + # Copy the wal and journal files for database "test.db" to "test2.db". forcedelete test2.db test2.db-journal test2.db-wal - forcecopy test.db test2.db if {[file exists test.db-journal]} { forcecopy test.db-journal test2.db-journal } @@ -44,6 +43,24 @@ proc check_on_disk {} { forcecopy test.db-wal test2.db-wal } + # Now copy the database file itself. Do this using open/read/puts + # instead of the [file copy] command in order to avoid attempting + # to read the 512 bytes begining at offset $sqlite_pending_byte. + # + set sz [file size test.db] + set fd [open test.db] + set fd2 [open test2.db w] + fconfigure $fd -encoding binary -translation binary + fconfigure $fd2 -encoding binary -translation binary + if {$sz>$::sqlite_pending_byte} { + puts -nonewline $fd2 [read $fd $::sqlite_pending_byte] + seek $fd [expr $::sqlite_pending_byte+512] + seek $fd2 [expr $::sqlite_pending_byte+512] + } + puts -nonewline $fd2 [read $fd] + close $fd2 + close $fd + # Open "test2.db" and check it is Ok. sqlite3 dbcheck test2.db set ret [dbcheck eval { PRAGMA integrity_check }] diff --git a/test/tkt-7a31705a7e6.test b/test/tkt-7a31705a7e6.test new file mode 100644 index 000000000..64701220a --- /dev/null +++ b/test/tkt-7a31705a7e6.test @@ -0,0 +1,26 @@ +# 2013 February 26 +# +# 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 implements regression tests for SQLite library. Specifically, +# it tests that ticket [7a31705a7e6c95d514e6f20a6900f436bbc9fed8] in the +# name resolver has been fixed. +# + +set testdir [file dirname $argv0] +source $testdir/tester.tcl + +do_execsql_test tkt-7a31705a7e6-1.1 { + CREATE TABLE t1 (a INTEGER PRIMARY KEY); + CREATE TABLE t2 (a INTEGER PRIMARY KEY, b INTEGER); + CREATE TABLE t2x (b INTEGER PRIMARY KEY); + SELECT t1.a FROM ((t1 JOIN t2 ON t1.a=t2.a) AS x JOIN t2x ON x.b=t2x.b) as y; +} {} + |