Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | 3 more coverage tests for btree.c. (CVS 5370) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
96df0a5fa4bb2b3dfedf034d81704e15 |
User & Date: | danielk1977 2008-07-08 15:59:52.000 |
Context
2008-07-08
| ||
17:13 | Test another corruption case in btree.c. And an IO error related scenario. (CVS 5371) (check-in: d74fbb81ca user: danielk1977 tags: trunk) | |
15:59 | 3 more coverage tests for btree.c. (CVS 5370) (check-in: 96df0a5fa4 user: danielk1977 tags: trunk) | |
15:26 | Tests for SQLITE_LIMIT_LENGTH enforcement in sqlite3_bind. (CVS 5369) (check-in: c5e45dd664 user: drh tags: trunk) | |
Changes
Changes to test/corrupt2.test.
︙ | ︙ | |||
9 10 11 12 13 14 15 | # #*********************************************************************** # This file implements regression tests for SQLite library. # # This file implements tests to make sure SQLite does not crash or # segfault if it sees a corrupt database file. # | | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # #*********************************************************************** # This file implements regression tests for SQLite library. # # This file implements tests to make sure SQLite does not crash or # segfault if it sees a corrupt database file. # # $Id: corrupt2.test,v 1.12 2008/07/08 15:59:52 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # The following tests - corrupt2-1.* - create some databases corrupted in # specific ways and ensure that SQLite detects them as corrupt. # |
︙ | ︙ | |||
331 332 333 334 335 336 337 338 339 340 341 342 343 344 | catchsql { BEGIN EXCLUSIVE; COMMIT; } } {1 {database disk image is malformed}} } } corruption_test -sqlprep { PRAGMA page_size = 1024; CREATE TABLE t1(a INTEGER PRIMARY KEY, b); CREATE INDEX i1 ON t1(b); INSERT INTO t1 VALUES(1, randomblob(50)); INSERT INTO t1 SELECT NULL, randomblob(50) FROM t1; | > | 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 | catchsql { BEGIN EXCLUSIVE; COMMIT; } } {1 {database disk image is malformed}} } } corruption_test -sqlprep { PRAGMA page_size = 1024; CREATE TABLE t1(a INTEGER PRIMARY KEY, b); CREATE INDEX i1 ON t1(b); INSERT INTO t1 VALUES(1, randomblob(50)); INSERT INTO t1 SELECT NULL, randomblob(50) FROM t1; |
︙ | ︙ | |||
360 361 362 363 364 365 366 367 368 | puts -nonewline $fd "\x0D" close $fd } -test { do_test corrupt2-7.1 { catchsql { SELECT b FROM t1 ORDER BY b } } {1 {database disk image is malformed}} } finish_test | > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 | puts -nonewline $fd "\x0D" close $fd } -test { do_test corrupt2-7.1 { catchsql { SELECT b FROM t1 ORDER BY b } } {1 {database disk image is malformed}} } corruption_test -sqlprep { CREATE TABLE t1(a, b, c); CREATE TABLE t8(a, b, c); CREATE TABLE tE(a, b, c); CREATE TABLE t2(a, b, c); CREATE TABLE t9(a, b, c); CREATE TABLE tF(a, b, c); CREATE TABLE t3(a, b, c); CREATE TABLE tA(a, b, c); CREATE TABLE tG(a, b, c); CREATE TABLE t4(a, b, c); CREATE TABLE tB(a, b, c); CREATE TABLE tH(a, b, c); CREATE TABLE t5(a, b, c); CREATE TABLE tC(a, b, c); CREATE TABLE tI(a, b, c); CREATE TABLE t6(a, b, c); CREATE TABLE tD(a, b, c); CREATE TABLE tJ(a, b, c); CREATE TABLE x1(a, b, c); CREATE TABLE x8(a, b, c); CREATE TABLE xE(a, b, c); CREATE TABLE x2(a, b, c); CREATE TABLE x9(a, b, c); CREATE TABLE xF(a, b, c); CREATE TABLE x3(a, b, c); CREATE TABLE xA(a, b, c); CREATE TABLE xG(a, b, c); CREATE TABLE x4(a, b, c); CREATE TABLE xB(a, b, c); CREATE TABLE xH(a, b, c); CREATE TABLE x5(a, b, c); CREATE TABLE xC(a, b, c); CREATE TABLE xI(a, b, c); CREATE TABLE x6(a, b, c); CREATE TABLE xD(a, b, c); CREATE TABLE xJ(a, b, c); } -corrupt { set fd [open corrupt.db r+] fconfigure $fd -translation binary -encoding binary seek $fd 108 set zRightChild [read $fd 4] binary scan $zRightChild I iRightChild seek $fd [expr 1024*($iRightChild-1)+3] puts -nonewline $fd "\x00\x00" close $fd } -test { do_test corrupt2-8.1 { catchsql { SELECT sql FROM sqlite_master } } {1 {database disk image is malformed}} } finish_test |
Changes to test/delete2.test.
︙ | ︙ | |||
25 26 27 28 29 30 31 | # index entry was deleted first, before the table entry. And the index # delete worked. Thus an entry was deleted from the index but not from # the table. # # The solution to the problem was to detect that the table is locked # before the index entry is deleted. # | | | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | # index entry was deleted first, before the table entry. And the index # delete worked. Thus an entry was deleted from the index but not from # the table. # # The solution to the problem was to detect that the table is locked # before the index entry is deleted. # # $Id: delete2.test,v 1.8 2008/07/08 15:59:52 danielk1977 Exp $ # set testdir [file dirname $argv0] source $testdir/tester.tcl # Create a table that has an index. # |
︙ | ︙ | |||
91 92 93 94 95 96 97 98 99 | } {0 {}} integrity_check delete2-1.10 do_test delete2-1.11 { execsql { SELECT * FROM q; } } {goodbye id.2 again id.3} finish_test | > > > > > > > > > > > > > > > > > > > > | 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | } {0 {}} integrity_check delete2-1.10 do_test delete2-1.11 { execsql { SELECT * FROM q; } } {goodbye id.2 again id.3} do_test delete2-2.1 { execsql { CREATE TABLE t1(a, b); CREATE TABLE t2(c, d); INSERT INTO t1 VALUES(1, 2); INSERT INTO t2 VALUES(3, 4); INSERT INTO t2 VALUES(5, 6); } } {} do_test delete2-2.2 { set res [list] db eval { SELECT CASE WHEN c = 5 THEN b ELSE NULL END AS b, c, d FROM t1, t2 } { db eval {DELETE FROM t1} lappend res $b $c $d } set res } {{} 3 4 {} 5 6} finish_test |
Changes to test/ioerr2.test.
︙ | ︙ | |||
11 12 13 14 15 16 17 | # This file implements regression tests for SQLite library. The # focus of this file is testing for correct handling of I/O errors # such as writes failing because the disk is full. # # The tests in this file use special facilities that are only # available in the SQLite test fixture. # | | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # This file implements regression tests for SQLite library. The # focus of this file is testing for correct handling of I/O errors # such as writes failing because the disk is full. # # The tests in this file use special facilities that are only # available in the SQLite test fixture. # # $Id: ioerr2.test,v 1.8 2008/07/08 15:59:52 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl ifcapable !integrityck { finish_test return |
︙ | ︙ | |||
108 109 110 111 112 113 114 115 | set ::sqlite_io_error_pending $::N foreach {::go res} [catchsql $sql] {} check_db ioerr2-4.[expr {$bPersist+2}].$::N } } finish_test | > > > > > > > > > > > > > > > > > > > | 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | set ::sqlite_io_error_pending $::N foreach {::go res} [catchsql $sql] {} check_db ioerr2-4.[expr {$bPersist+2}].$::N } } do_test ioerr2-5 { execsql { CREATE TABLE t2 AS SELECT * FROM t1; } set ::sqlite_io_error_persist 0 set ::go 1 set rc [catch { for {set ::N 1} {$::N<200} {incr ::N} { db eval {SELECT * FROM t1 WHERE rowid IN (1, 5, 10, 15, 20)} { set ::sqlite_io_error_hit 0 set ::sqlite_io_error_pending $::N set sql {UPDATE t2 SET b = randstr(400,400)} foreach {::go res} [catchsql $sql] {} } } } msg] list $rc $msg } {1 {callback requested query abort}} finish_test |