From 9ffe5d7247f235e92914dbde270629c2d3af217a Mon Sep 17 00:00:00 2001 From: danielk1977 Date: Tue, 8 Jul 2008 15:59:51 +0000 Subject: [PATCH] 3 more coverage tests for btree.c. (CVS 5370) FossilOrigin-Name: 96df0a5fa4bb2b3dfedf034d81704e152cdc63a9 --- manifest | 18 +++++++++--------- manifest.uuid | 2 +- test/corrupt2.test | 31 ++++++++++++++++++++++++++++++- test/delete2.test | 22 +++++++++++++++++++++- test/ioerr2.test | 21 ++++++++++++++++++++- 5 files changed, 81 insertions(+), 13 deletions(-) diff --git a/manifest b/manifest index 3150697601..25040de411 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Tests\sfor\sSQLITE_LIMIT_LENGTH\senforcement\sin\ssqlite3_bind.\s(CVS\s5369) -D 2008-07-08T15:26:50 +C 3\smore\scoverage\stests\sfor\sbtree.c.\s(CVS\s5370) +D 2008-07-08T15:59:52 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.in 325dfac0a0dd1cb4d975f1ace6453157892e6042 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -242,7 +242,7 @@ F test/collateA.test b8218ab90d1fa5c59dcf156efabb1b2599c580d6 F test/colmeta.test 087c42997754b8c648819832241daf724f813322 F test/conflict.test bb29b052c60a1f7eb6382be77902061d1f305318 F test/corrupt.test af069d971853dbe12af936910bfa49d92f7b16e9 -F test/corrupt2.test e4b03d9d4831cf0840a0f473281ab251b2f165f0 +F test/corrupt2.test 26810e0019a16004b1a7619930801ef1c31531e4 F test/corrupt3.test 263e8bb04e2728df832fddf6973cf54c91db0c32 F test/corrupt4.test acdb01afaedf529004b70e55de1a6f5a05ae7fff F test/corrupt5.test 7796d5bdfe155ed824cee9dff371f49da237cfe0 @@ -261,7 +261,7 @@ F test/cse.test 4b8a49decaefccb835ecc67249277be491713f6c F test/date.test 4ea54e26feea7c24dfc7fad1b2b87da21ff12380 F test/default.test 252298e42a680146b1dd64f563b95bdf088d94fb F test/delete.test f171c1011395a8dd63169438fe1d8cc625eb7442 -F test/delete2.test c06be3806ba804bc8c6f134476816080280b40e3 +F test/delete2.test 3a03f2cca1f9a67ec469915cb8babd6485db43fa F test/delete3.test 555e84a00a99230b7d049d477a324a631126a6ab F test/descidx1.test a13d443571e045b61b1b2b759df8dcffa092c968 F test/descidx2.test 1310ed1326cdfed4ea2c55169631579f082d174f @@ -357,7 +357,7 @@ F test/interrupt.test 42e7cf98646fd9cb4a3b131a93ed3c50b9e149f1 F test/intpkey.test 537669fd535f62632ca64828e435b9e54e8d677f F test/io.test 833a1746518ec3005aa7792f9bcb8f01923ff544 F test/ioerr.test 7ff1f418eae013dd848583c7f8a8cae938532f55 -F test/ioerr2.test b9c9a0491a812707762a7c002876553be54d9969 +F test/ioerr2.test 5598405c48842c6c0187daad9eb49eff2c54f80d F test/ioerr3.test d3cec5e1a11ad6d27527d0d38573fbff14c71bdd F test/ioerr4.test fc6eddfec2efc2f1ed217b9eae4c1c1d3516ce86 F test/ioerr5.test f44e30b4780b879bcceb2601aabae40d8a0a0b56 @@ -600,7 +600,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 1dbced29de5f59ba2ebf877edcadf171540374d1 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e -P ee93150878436ce6e992ea8a1d348fb58b03b5e2 -R 343c2b9caa04aca6e55a06cabd00ab34 -U drh -Z 82b75a9fbd14cf199dacb621e828ce81 +P c5e45dd664198e5b4fc44b316bd4adbc9a6c296b +R 17c4ddff498e4bc2ee18143f2ad0e55f +U danielk1977 +Z a2bfd51b9ad8acbdccd1bedc318ea395 diff --git a/manifest.uuid b/manifest.uuid index ee78d6eaa9..a9d623ac0a 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -c5e45dd664198e5b4fc44b316bd4adbc9a6c296b \ No newline at end of file +96df0a5fa4bb2b3dfedf034d81704e152cdc63a9 \ No newline at end of file diff --git a/test/corrupt2.test b/test/corrupt2.test index eecb562c72..08fb635153 100644 --- a/test/corrupt2.test +++ b/test/corrupt2.test @@ -13,7 +13,7 @@ # 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.11 2008/07/08 14:31:15 danielk1977 Exp $ +# $Id: corrupt2.test,v 1.12 2008/07/08 15:59:52 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -336,6 +336,7 @@ ifcapable autovacuum { } } + corruption_test -sqlprep { PRAGMA page_size = 1024; CREATE TABLE t1(a INTEGER PRIMARY KEY, b); @@ -365,4 +366,32 @@ corruption_test -sqlprep { } {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 diff --git a/test/delete2.test b/test/delete2.test index 659cc56735..1668a3a9ae 100644 --- a/test/delete2.test +++ b/test/delete2.test @@ -29,7 +29,7 @@ # The solution to the problem was to detect that the table is locked # before the index entry is deleted. # -# $Id: delete2.test,v 1.7 2006/08/16 16:42:48 drh Exp $ +# $Id: delete2.test,v 1.8 2008/07/08 15:59:52 danielk1977 Exp $ # set testdir [file dirname $argv0] @@ -96,4 +96,24 @@ do_test delete2-1.11 { } } {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 diff --git a/test/ioerr2.test b/test/ioerr2.test index 567e5fcbec..05b78cd7a7 100644 --- a/test/ioerr2.test +++ b/test/ioerr2.test @@ -15,7 +15,7 @@ # The tests in this file use special facilities that are only # available in the SQLite test fixture. # -# $Id: ioerr2.test,v 1.7 2008/03/07 19:51:15 drh Exp $ +# $Id: ioerr2.test,v 1.8 2008/07/08 15:59:52 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -112,4 +112,23 @@ foreach bPersist [list 0 1] { } } +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 -- 2.47.3