From 586381f8db3497c24c11f96234f1879b34e74bc7 Mon Sep 17 00:00:00 2001 From: "mpcomplete@google.com" Date: Tue, 6 Jan 2009 22:39:41 +0000 Subject: Upgrade our sqlite to 3.6.1, with the local changes made by Gears. I'm checking in the full sqlite tree to make upstream merges easier. This means we'll have generated sources split out from the originals. One important change this makes is that "BEGIN" now defaults to "BEGIN IMMEDIATE" rather than "BEGIN DEFERRED". This doesn't affect us because we don't use unqualified BEGIN statements. The full CL is too big for Rietveld. I'm splitting it into 2. This one is reviewable. The other CL is just a fresh drop of: //depot/googleclient/gears/opensource/third_party/sqlite_google Review URL: http://codereview.chromium.org/15067 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7623 0039d316-1c4b-4281-b951-d872f2087c98 --- third_party/sqlite/test/pagesize.test | 182 ++++++++++++++++++++++++++++++++++ 1 file changed, 182 insertions(+) create mode 100755 third_party/sqlite/test/pagesize.test (limited to 'third_party/sqlite/test/pagesize.test') diff --git a/third_party/sqlite/test/pagesize.test b/third_party/sqlite/test/pagesize.test new file mode 100755 index 0000000..a598b9f --- /dev/null +++ b/third_party/sqlite/test/pagesize.test @@ -0,0 +1,182 @@ +# 2004 September 2 +# +# 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. +# This file implements tests for the page_size PRAGMA. +# +# $Id: pagesize.test,v 1.12 2007/04/06 21:42:22 drh Exp $ + + +set testdir [file dirname $argv0] +source $testdir/tester.tcl + +# This test script depends entirely on "PRAGMA page_size". So if this +# pragma is not available, omit the whole file. +ifcapable !pager_pragmas { + finish_test + return +} + +do_test pagesize-1.1 { + execsql {PRAGMA page_size} +} 1024 +ifcapable {explain} { + do_test pagesize-1.2 { + catch {execsql {EXPLAIN PRAGMA page_size}} + } 0 +} +do_test pagesize-1.3 { + execsql { + CREATE TABLE t1(a); + PRAGMA page_size=2048; + PRAGMA page_size; + } +} 1024 + +do_test pagesize-1.4 { + db close + file delete -force test.db + sqlite3 db test.db + execsql { + PRAGMA page_size=511; + PRAGMA page_size; + } +} 1024 +do_test pagesize-1.5 { + execsql { + PRAGMA page_size=512; + PRAGMA page_size; + } +} 512 +if {![info exists SQLITE_MAX_PAGE_SIZE] || $SQLITE_MAX_PAGE_SIZE>=8192} { + do_test pagesize-1.6 { + execsql { + PRAGMA page_size=8192; + PRAGMA page_size; + } + } 8192 + do_test pagesize-1.7 { + execsql { + PRAGMA page_size=65537; + PRAGMA page_size; + } + } 8192 + do_test pagesize-1.8 { + execsql { + PRAGMA page_size=1234; + PRAGMA page_size + } + } 8192 +} +foreach PGSZ {512 2048 4096 8192} { + if {[info exists SQLITE_MAX_PAGE_SIZE] + && $SQLITE_MAX_PAGE_SIZE<$PGSZ} continue + ifcapable memorydb { + do_test pagesize-2.$PGSZ.0 { + db close + sqlite3 db :memory: + execsql "PRAGMA page_size=$PGSZ;" + execsql {PRAGMA page_size} + } 1024 + } + do_test pagesize-2.$PGSZ.1 { + db close + file delete -force test.db + sqlite3 db test.db + execsql "PRAGMA page_size=$PGSZ" + execsql { + CREATE TABLE t1(x); + PRAGMA page_size; + } + } $PGSZ + do_test pagesize-2.$PGSZ.2 { + db close + sqlite3 db test.db + execsql { + PRAGMA page_size + } + } $PGSZ + do_test pagesize-2.$PGSZ.3 { + file size test.db + } [expr {$PGSZ*($AUTOVACUUM?3:2)}] + ifcapable {vacuum} { + do_test pagesize-2.$PGSZ.4 { + execsql {VACUUM} + } {} + } + integrity_check pagesize-2.$PGSZ.5 + do_test pagesize-2.$PGSZ.6 { + db close + sqlite3 db test.db + execsql {PRAGMA page_size} + } $PGSZ + do_test pagesize-2.$PGSZ.7 { + execsql { + INSERT INTO t1 VALUES(randstr(10,9000)); + INSERT INTO t1 VALUES(randstr(10,9000)); + INSERT INTO t1 VALUES(randstr(10,9000)); + BEGIN; + INSERT INTO t1 SELECT x||x FROM t1; + INSERT INTO t1 SELECT x||x FROM t1; + INSERT INTO t1 SELECT x||x FROM t1; + INSERT INTO t1 SELECT x||x FROM t1; + SELECT count(*) FROM t1; + } + } 48 + do_test pagesize-2.$PGSZ.8 { + execsql { + ROLLBACK; + SELECT count(*) FROM t1; + } + } 3 + integrity_check pagesize-2.$PGSZ.9 + do_test pagesize-2.$PGSZ.10 { + db close + sqlite3 db test.db + execsql {PRAGMA page_size} + } $PGSZ + do_test pagesize-2.$PGSZ.11 { + execsql { + INSERT INTO t1 SELECT x||x FROM t1; + INSERT INTO t1 SELECT x||x FROM t1; + INSERT INTO t1 SELECT x||x FROM t1; + INSERT INTO t1 SELECT x||x FROM t1; + INSERT INTO t1 SELECT x||x FROM t1; + INSERT INTO t1 SELECT x||x FROM t1; + SELECT count(*) FROM t1; + } + } 192 + do_test pagesize-2.$PGSZ.12 { + execsql { + BEGIN; + DELETE FROM t1 WHERE rowid%5!=0; + SELECT count(*) FROM t1; + } + } 38 + do_test pagesize-2.$PGSZ.13 { + execsql { + ROLLBACK; + SELECT count(*) FROM t1; + } + } 192 + integrity_check pagesize-2.$PGSZ.14 + do_test pagesize-2.$PGSZ.15 { + execsql {DELETE FROM t1 WHERE rowid%5!=0} + ifcapable {vacuum} {execsql VACUUM} + execsql {SELECT count(*) FROM t1} + } 38 + do_test pagesize-2.$PGSZ.16 { + execsql {DROP TABLE t1} + ifcapable {vacuum} {execsql VACUUM} + } {} + integrity_check pagesize-2.$PGSZ.17 +} + +finish_test -- cgit v1.1