From 7bb481fda9ecb134804b49c2ce77ca28f7eea583 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Fri, 30 Mar 2012 20:42:12 -0400 Subject: Imported Upstream version 2.0.3 --- test/crash7.test | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 test/crash7.test (limited to 'test/crash7.test') diff --git a/test/crash7.test b/test/crash7.test new file mode 100644 index 0000000..4554a2a --- /dev/null +++ b/test/crash7.test @@ -0,0 +1,82 @@ +# 2008 March 20 +# +# 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. +# +#*********************************************************************** +# +# $Id: crash7.test,v 1.1 2008/04/03 14:36:26 danielk1977 Exp $ + +set testdir [file dirname $argv0] +source $testdir/tester.tcl + +ifcapable !crashtest { + finish_test + return +} + +proc signature {} { + return [db eval {SELECT count(*), md5sum(a), md5sum(b), md5sum(c) FROM abc}] +} + +foreach f [list test.db test.db-journal] { + for {set ii 1} {$ii < 64} {incr ii} { + db close + delete_file test.db + sqlite3 db test.db + + set from_size [expr 1024 << ($ii&3)] + set to_size [expr 1024 << (($ii>>2)&3)] + + execsql " + PRAGMA page_size = $from_size; + BEGIN; + CREATE TABLE abc(a PRIMARY KEY, b, c); + INSERT INTO abc VALUES(randomblob(100), randomblob(200), randomblob(1000)); + INSERT INTO abc + SELECT randomblob(1000), randomblob(200), randomblob(100) + FROM abc; + INSERT INTO abc + SELECT randomblob(100), randomblob(200), randomblob(1000) + FROM abc; + INSERT INTO abc + SELECT randomblob(100), randomblob(200), randomblob(1000) + FROM abc; + INSERT INTO abc + SELECT randomblob(100), randomblob(200), randomblob(1000) + FROM abc; + INSERT INTO abc + SELECT randomblob(100), randomblob(200), randomblob(1000) + FROM abc WHERE [expr $ii&16]; + INSERT INTO abc + SELECT randomblob(25), randomblob(45), randomblob(9456) + FROM abc WHERE [expr $ii&32]; + INSERT INTO abc + SELECT randomblob(100), randomblob(200), randomblob(1000) + FROM abc WHERE [expr $ii&8]; + INSERT INTO abc + SELECT randomblob(25), randomblob(45), randomblob(9456) + FROM abc WHERE [expr $ii&4]; + COMMIT; + " + + set sig [signature] + db close + + do_test crash7-1.$ii.crash { + crashsql -file $f " + PRAGMA page_size = $to_size; + VACUUM; + " + } {1 {child process exited abnormally}} + + sqlite3 db test.db + integrity_check crash7-1.$ii.integrity + } +} + +finish_test -- cgit v1.2.3