summaryrefslogtreecommitdiffstats
path: root/third_party/sqlite/test/vacuum3.test
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/sqlite/test/vacuum3.test')
-rw-r--r--third_party/sqlite/test/vacuum3.test65
1 files changed, 44 insertions, 21 deletions
diff --git a/third_party/sqlite/test/vacuum3.test b/third_party/sqlite/test/vacuum3.test
index fb97a60..f6b75d7 100644
--- a/third_party/sqlite/test/vacuum3.test
+++ b/third_party/sqlite/test/vacuum3.test
@@ -12,7 +12,7 @@
# focus of this file is changing the database page size using a
# VACUUM statement.
#
-# $Id: vacuum3.test,v 1.7 2008/08/02 03:50:40 drh Exp $
+# $Id: vacuum3.test,v 1.9 2008/08/26 21:07:27 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@@ -235,10 +235,25 @@ do_test vacuum3-4.6 {
execsql { SELECT * FROM abc } db2
} {1 2 3 4 5 6}
+# Unable to change the page-size of an in-memory using vacuum.
db2 close
+sqlite3 db2 :memory:
+do_test vacuum3-5.1 {
+ db2 eval {
+ CREATE TABLE t1(x);
+ INSERT INTO t1 VALUES(1234);
+ PRAGMA page_size=4096;
+ VACUUM;
+ SELECT * FROM t1;
+ }
+} {1234}
+do_test vacuum3-5.2 {
+ db2 eval {
+ PRAGMA page_size
+ }
+} {1024}
-do_ioerr_test vacuum3-ioerr-1 -cksum true -sqlprep {
- PRAGMA page_size = 1024;
+set create_database_sql {
BEGIN;
CREATE TABLE t1(a, b, c);
INSERT INTO t1 VALUES(1, randstr(50,50), randstr(50,50));
@@ -254,32 +269,40 @@ do_ioerr_test vacuum3-ioerr-1 -cksum true -sqlprep {
CREATE TABLE t3 AS SELECT * FROM t1;
COMMIT;
DROP TABLE t2;
-} -sqlbody {
+}
+
+do_ioerr_test vacuum3-ioerr-1 -cksum true -sqlprep "
+ PRAGMA page_size = 1024;
+ $create_database_sql
+" -sqlbody {
PRAGMA page_size = 4096;
VACUUM;
}
-do_ioerr_test vacuum3-ioerr-2 -cksum true -sqlprep {
+do_ioerr_test vacuum3-ioerr-2 -cksum true -sqlprep "
PRAGMA page_size = 2048;
- BEGIN;
- CREATE TABLE t1(a, b, c);
- INSERT INTO t1 VALUES(1, randstr(50,50), randstr(50,50));
- INSERT INTO t1 SELECT a+2, b||'-'||rowid, c||'-'||rowid FROM t1;
- INSERT INTO t1 SELECT a+4, b||'-'||rowid, c||'-'||rowid FROM t1;
- INSERT INTO t1 SELECT a+8, b||'-'||rowid, c||'-'||rowid FROM t1;
- INSERT INTO t1 SELECT a+16, b||'-'||rowid, c||'-'||rowid FROM t1;
- INSERT INTO t1 SELECT a+32, b||'-'||rowid, c||'-'||rowid FROM t1;
- INSERT INTO t1 SELECT a+64, b||'-'||rowid, c||'-'||rowid FROM t1;
- INSERT INTO t1 SELECT a+128, b||'-'||rowid, c||'-'||rowid FROM t1;
- INSERT INTO t1 VALUES(1, randstr(600,600), randstr(600,600));
- CREATE TABLE t2 AS SELECT * FROM t1;
- CREATE TABLE t3 AS SELECT * FROM t1;
- COMMIT;
- DROP TABLE t2;
-} -sqlbody {
+ $create_database_sql
+" -sqlbody {
PRAGMA page_size = 512;
VACUUM;
}
+ifcapable autovacuum {
+ do_ioerr_test vacuum3-ioerr-3 -cksum true -sqlprep "
+ PRAGMA auto_vacuum = 0;
+ $create_database_sql
+ " -sqlbody {
+ PRAGMA auto_vacuum = 1;
+ VACUUM;
+ }
+ do_ioerr_test vacuum3-ioerr-4 -cksum true -sqlprep "
+ PRAGMA auto_vacuum = 1;
+ $create_database_sql
+ " -sqlbody {
+ PRAGMA auto_vacuum = 0;
+ VACUUM;
+ }
+}
+
source $testdir/malloc_common.tcl
if {$MEMDEBUG} {
do_malloc_test vacuum3-malloc-1 -sqlprep {