------BEGIN PGP SIGNED MESSAGE-----
-Hash: SHA1
-
-C Fix\stwo\sasserts\sin\sthe\sbtree\slogic\sso\sthat\sthey\swork\scorrectly\seven\sfor\nmaximum-size\sindex\sentries\sfor\s32K\sand\s64K\spages.
-D 2010-08-18T21:19:04
+C Add\snew\stest\sscript\sbackcompat.test,\sfor\stesting\sdatabase/journal/wal\sfile\scompatibility\sagainst\sprevious\sversions.
+D 2010-08-19T11:05:54
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in ec08dc838fd8110fe24c92e5130bcd91cbb1ff2e
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
F test/autovacuum.test bb7c0885e6f8f1d633045de48f2b66082162766d
F test/autovacuum_ioerr2.test 598b0663074d3673a9c1bc9a16e80971313bafe6
F test/avtrans.test 0252654f4295ddda3b2cce0e894812259e655a85
+F test/backcompat.test 5bf6bd795d9a0ec3c68ba8483c35c6fdab3a85a8
F test/backup.test 200e64bd91244b73ca8094bc1e03dfc83cc94c2e
F test/backup2.test b7c69f937c912e85ac8a5dbd1e1cf290302b2d49
F test/backup_ioerr.test 1f012e692f42c0442ae652443258f70e9f20fa38
F test/lock5.test b2abb5e711bc59b0eae00f6c97a36ec9f458fada
F test/lock6.test 8df56060f396151777390982422c800d026e1722
F test/lock7.test 64006c84c1c616657e237c7ad6532b765611cf64
-F test/lock_common.tcl 57727421a6a850443944cbadfdf5a6dd9e4ac81c
+F test/lock_common.tcl 751d4d6b1d97e1e1266b4126e0a123f1e8d7346b
F test/lookaside.test 382e7bc2fab23d902c8eafb1b9ed7ababfff75a6
F test/main.test 9d7bbfcc1b52c88ba7b2ba6554068ecf9939f252
F test/make-where7.tcl 05c16b5d4f5d6512881dfec560cb793915932ef9
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
-P d46567e5d75a2b9fe96d2a7a30708b2827a0d490
-R d8d679ffa4745c8bf93b5e6b5825b960
-U drh
-Z 7f378ed449a1354042bf47ceab852b72
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v1.4.6 (GNU/Linux)
-
-iD8DBQFMbE5MoxKgR168RlERAm3gAJ9j3QLeVFJiXfvfSnsTlMhGqmvBSgCfTW3m
-v1U06YCPq+T+CyTYAg08zFE=
-=0zqd
------END PGP SIGNATURE-----
+P e127192d106bd7e036caacf01bf7725eeaa85dbe
+R 483010ace30045b3aabe4559c5204690
+U dan
+Z f27bf406a20d9eac5bd8544c4021a73e
--- /dev/null
+# 2010 August 19
+#
+# 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. The
+# focus of this file is testing that the current version of SQLite
+# is capable of reading and writing databases created by previous
+# versions, and vice-versa.
+#
+# To use this test, old versions of the testfixture process should be
+# copied into the working directory alongside the new version. The old
+# versions should be named "testfixtureXXX" (or testfixtureXXX.exe on
+# windows), where XXX can be any string.
+#
+# This test file uses the tcl code for controlling a second testfixture
+# process located in lock_common.tcl. See the commments in lock_common.tcl
+# for documentation of the available commands.
+#
+
+set testdir [file dirname $argv0]
+source $testdir/tester.tcl
+source $testdir/lock_common.tcl
+source $testdir/malloc_common.tcl
+
+# Search for binaries to test against. Any executable files that match
+# our naming convention are assumed to be testfixture binaries to test
+# against.
+#
+set binaries [list]
+set pattern "[file tail [info nameofexec]]?*"
+foreach file [glob $pattern] {
+ if {[file executable $file]} {lappend binaries $file}
+}
+if {[llength $binaries]==0} {
+ puts "WARNING: No binaries to test against. No tests have been run."
+ finish_test
+ return
+}
+proc get_version {binary} {
+ set chan [launch_testfixture $binary]
+ set v [testfixture $chan { sqlite3 -version }]
+ close $chan
+ set v
+}
+foreach bin $binaries {
+ puts "Testing against $bin - version [get_version $bin]"
+}
+
+#set binaries testfixture
+
+proc do_backcompat_test {rv binary script} {
+
+ if { $rv } {
+ proc code1 {tcl} { testfixture $::bc_chan $tcl }
+ proc code2 {tcl} { uplevel #0 $tcl }
+ } else {
+ proc code1 {tcl} { uplevel #0 $tcl }
+ proc code2 {tcl} { testfixture $::bc_chan $tcl }
+ }
+
+ proc sql1 sql { code1 [list db eval $sql] }
+ proc sql2 sql { code2 [list db eval $sql] }
+
+ file delete -force test.db
+
+ set ::bc_chan [launch_testfixture $binary]
+ code1 { sqlite3 db test.db }
+ code2 { sqlite3 db test.db }
+
+ uplevel $script
+
+ catch { code1 { db close } }
+ catch { code2 { db close } }
+ catch { close $::bc_chan }
+}
+
+array set ::incompatible [list]
+proc do_allbackcompat_test {script} {
+
+ foreach bin $::binaries {
+ set nErr [set_test_counter errors]
+ foreach dir {0 1} {
+
+ set ::bcname ".$dir.[string map {testfixture {}} $bin]."
+
+ rename do_test _do_test
+ proc do_test {nm sql res} {
+ set nm [regsub {\.} $nm $::bcname]
+ uplevel [list _do_test $nm $sql $res]
+ }
+
+ do_backcompat_test $dir $bin $script
+
+ rename do_test {}
+ rename _do_test do_test
+ }
+ if { $nErr < [set_test_counter errors] } {
+ set ::incompatible([get_version $bin]) 1
+ }
+ }
+}
+
+proc read_file {zFile} {
+ set zData {}
+ catch {
+ set fd [open $zFile]
+ fconfigure $fd -translation binary -encoding binary
+ set zData [read $fd]
+ close $fd
+ }
+ return $zData
+}
+proc write_file {zFile zData} {
+ set fd [open $zFile w]
+ fconfigure $fd -translation binary -encoding binary
+ puts -nonewline $fd $zData
+ close $fd
+}
+proc read_file_system {} {
+ set ret [list]
+ foreach f {test.db test.db-journal test.db-wal} { lappend ret [read_file $f] }
+ set ret
+}
+proc write_file_system {data} {
+ foreach f {test.db test.db-journal test.db-wal} d $data {
+ if {[string length $d] == 0} {
+ file delete -force $f
+ } else {
+ write_file $f $d
+ }
+ }
+}
+
+#-------------------------------------------------------------------------
+# Actual tests begin here.
+#
+do_allbackcompat_test {
+
+ # Test that database files are backwards compatible.
+ #
+ do_test backcompat-1.1.1 { sql1 {
+ CREATE TABLE t1(a PRIMARY KEY, b UNIQUE);
+ INSERT INTO t1 VALUES('abc', 'def');
+ } } {}
+ do_test backcompat-1.1.2 { sql2 { SELECT * FROM t1; } } {abc def}
+ do_test backcompat-1.1.3 { sql2 { INSERT INTO t1 VALUES('ghi', 'jkl'); } } {}
+ do_test backcompat-1.1.4 { sql1 { SELECT * FROM t1; } } {abc def ghi jkl}
+ do_test backcompat-1.1.5 { sql1 { PRAGMA integrity_check } } {ok}
+ do_test backcompat-1.1.6 { sql2 { PRAGMA integrity_check } } {ok}
+
+ # Test that one version can roll back a hot-journal file left in the
+ # file-system by the other version.
+ #
+ do_test backcompat-1.2.1 { sql1 {
+ PRAGMA cache_size = 10;
+ BEGIN;
+ INSERT INTO t1 VALUES(randomblob(400), randomblob(400));
+ INSERT INTO t1 SELECT randomblob(400), randomblob(400) FROM t1;
+ INSERT INTO t1 SELECT randomblob(400), randomblob(400) FROM t1;
+ INSERT INTO t1 SELECT randomblob(400), randomblob(400) FROM t1;
+ INSERT INTO t1 SELECT randomblob(400), randomblob(400) FROM t1;
+ COMMIT;
+ } } {}
+ set cksum1 [sql1 {SELECT md5sum(a), md5sum(b) FROM t1}]
+ set cksum2 [sql2 {SELECT md5sum(a), md5sum(b) FROM t1}]
+ do_test backcompat-1.2.2 [list string compare $cksum1 $cksum2] 0
+
+ do_test backcompat-1.2.3 { sql1 {
+ BEGIN;
+ UPDATE t1 SET a = randomblob(500);
+ } } {}
+ set data [read_file_system]
+ do_test backcompat-1.2.4 { sql1 { COMMIT } } {}
+
+ set same [expr {[sql2 {SELECT md5sum(a), md5sum(b) FROM t1}] == $cksum2}]
+ do_test backcompat-1.2.5 [list set {} $same] 0
+
+ write_file_system $data
+ set same [expr {[sql2 {SELECT md5sum(a), md5sum(b) FROM t1}] == $cksum2}]
+ do_test backcompat-1.2.6 [list set {} $same] 1
+
+ do_test backcompat-1.2.7 { sql2 { PRAGMA integrity_check } } {ok}
+ do_test backcompat-1.2.8 { sql2 { PRAGMA integrity_check } } {ok}
+}
+
+foreach k [lsort [array names ::incompatible]] {
+ puts "ERROR: Detected incompatibility with version $k"
+}
+
+finish_test