diff --git a/manifest b/manifest index 072c3b6bd6..baeab5c517 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Detect\serrors\sreturned\sby\sSetFilePointer\son\swindows.\s(CVS\s2681) -D 2005-09-09T10:17:34 +C Enhanced\sdisk-full\stests.\s(CVS\s2682) +D 2005-09-09T10:46:19 F Makefile.in 12784cdce5ffc8dfb707300c34e4f1eb3b8a14f1 F Makefile.linux-gcc 06be33b2a9ad4f005a5f42b22c4a19dab3cbb5c7 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028 @@ -49,7 +49,7 @@ F src/legacy.c d58ea507bce885298a2c8c3cbb0f4bff5d47830b F src/main.c bf88855445d365b497070d85e3faa0579a9edb91 F src/md5.c 7ae1c39044b95de2f62e066f47bb1deb880a1070 F src/os.h c9fd9f92f176a5ea22e0101fcc1e85d532844dd1 -F src/os_common.h 0e7f428ba0a6c40a61bc56c4e96f493231301b73 +F src/os_common.h bd6ede01998c19dbfd3c21fbfd13f4b9532dd7df F src/os_test.c 49833426101f99aee4bb5f6a44b7c4b2029fda1c F src/os_test.h 903c93554c23d88f34f667f1979e4a1cee792af3 F src/os_unix.c c86cf43b7ca9200e6fb7bc202ad2cc7da2f69367 @@ -70,7 +70,7 @@ F src/sqliteInt.h f5d20d26b71a3a3e7672c1363545df2015647361 F src/table.c 25b3ff2b39b7d87e8d4a5da0713d68dfc06cbee9 F src/tclsqlite.c ac94682f9e601dd373912c46414a5a842db2089a F src/test1.c b569b60e35f0e3ea20e5ebfaf6e522a01c08d481 -F src/test2.c 792f203be69fea88668fa221321194f0a28dfdfa +F src/test2.c 4f89ffd7aa96dfbd4b764e62bb823670231554a0 F src/test3.c f4e6a16a602091696619a1171bda25c0e3df49f7 F src/test4.c a8fd681e139e1c61f22a77d07fc3a99cb28fff3f F src/test5.c 64f08b2a50ef371a1bd68ff206829e7b1b9997f5 @@ -139,7 +139,7 @@ F test/default.test 252298e42a680146b1dd64f563b95bdf088d94fb F test/delete.test 33e1670049364fc3604217a6c2eda042a47115ab F test/delete2.test e382b6a97787197eb8b93dd4ccd37797c3725ea3 F test/delete3.test 555e84a00a99230b7d049d477a324a631126a6ab -F test/diskfull.test ba27afd587af1216f92d2bb00132cbc0e39354fc +F test/diskfull.test d828d72adfc9e2d1a194d25996718c1989152cf9 F test/enc.test 7a03417a1051fe8bc6c7641cf4c8c3f7e0066d52 F test/enc2.test 76c13b8c00beaf95b15c152e95dab51292eb1f0d F test/enc3.test f6a5f0b7b7f3a88f030d3143729b87cd5c86d837 @@ -306,7 +306,7 @@ F www/tclsqlite.tcl 3df553505b6efcad08f91e9b975deb2e6c9bb955 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513 -P 4d62e36fe3819c2a1412737c2ec8a91ddc5e1777 -R a118739b2cc7f4f314d0c747eb3290dc +P bc8c33f94ce069f7bcfc32a59d5c40e034e023b5 +R c6a7e93fc86868d935afb82bce6d24ba U drh -Z 7d3ec291209ecfbcf4f12c6286527d3d +Z c2fef43dee5a47c4ebfb5ba1092b2569 diff --git a/manifest.uuid b/manifest.uuid index c00c1f2594..d316030a2f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -bc8c33f94ce069f7bcfc32a59d5c40e034e023b5 \ No newline at end of file +0288fa5d25886f6fbef0be782f12285d62bebd68 \ No newline at end of file diff --git a/src/os_common.h b/src/os_common.h index 94311b9604..c71bf16b5d 100644 --- a/src/os_common.h +++ b/src/os_common.h @@ -82,6 +82,7 @@ static unsigned int elapse; #ifdef SQLITE_TEST int sqlite3_io_error_pending = 0; int sqlite3_diskfull_pending = 0; +int sqlite3_diskfull = 0; #define SimulateIOError(A) \ if( sqlite3_io_error_pending ) \ if( sqlite3_io_error_pending-- == 1 ){ local_ioerr(); return A; } @@ -89,8 +90,15 @@ static void local_ioerr(){ sqlite3_io_error_pending = 0; /* Really just a place to set a breakpoint */ } #define SimulateDiskfullError \ - if( sqlite3_diskfull_pending ) \ - if( sqlite3_diskfull_pending-- == 1 ){ local_ioerr(); return SQLITE_FULL; } + if( sqlite3_diskfull_pending ){ \ + if( sqlite3_diskfull_pending == 1 ){ \ + local_ioerr(); \ + sqlite3_diskfull = 1; \ + return SQLITE_FULL; \ + }else{ \ + sqlite3_diskfull_pending--; \ + } \ + } #else #define SimulateIOError(A) #define SimulateDiskfullError diff --git a/src/test2.c b/src/test2.c index 6be181a438..ac6d1ed304 100644 --- a/src/test2.c +++ b/src/test2.c @@ -13,7 +13,7 @@ ** is not included in the SQLite library. It is used for automated ** testing of the SQLite library. ** -** $Id: test2.c,v 1.31 2005/08/11 02:10:19 drh Exp $ +** $Id: test2.c,v 1.32 2005/09/09 10:46:19 drh Exp $ */ #include "sqliteInt.h" #include "os.h" @@ -561,6 +561,7 @@ static int fake_big_file( int Sqlitetest2_Init(Tcl_Interp *interp){ extern int sqlite3_io_error_pending; extern int sqlite3_diskfull_pending; + extern int sqlite3_diskfull; static struct { char *zName; Tcl_CmdProc *xProc; @@ -593,6 +594,8 @@ int Sqlitetest2_Init(Tcl_Interp *interp){ (char*)&sqlite3_io_error_pending, TCL_LINK_INT); Tcl_LinkVar(interp, "sqlite_diskfull_pending", (char*)&sqlite3_diskfull_pending, TCL_LINK_INT); + Tcl_LinkVar(interp, "sqlite_diskfull", + (char*)&sqlite3_diskfull, TCL_LINK_INT); Tcl_LinkVar(interp, "pager_pagesize", (char*)&test_pagesize, TCL_LINK_INT); return TCL_OK; diff --git a/test/diskfull.test b/test/diskfull.test index 7ac13c983f..690eb801f4 100644 --- a/test/diskfull.test +++ b/test/diskfull.test @@ -12,7 +12,7 @@ # focus of this file is testing for correct handling of disk full # errors. # -# $Id: diskfull.test,v 1.2 2005/08/11 02:10:19 drh Exp $ +# $Id: diskfull.test,v 1.3 2005/09/09 10:46:19 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -22,19 +22,54 @@ do_test diskfull-1.1 { CREATE TABLE t1(x); INSERT INTO t1 VALUES(randstr(1000,1000)); INSERT INTO t1 SELECT * FROM t1; + INSERT INTO t1 SELECT * FROM t1; + INSERT INTO t1 SELECT * FROM t1; + INSERT INTO t1 SELECT * FROM t1; + CREATE INDEX t1i1 ON t1(x); + CREATE TABLE t2 AS SELECT x AS a, x AS b FROM t1; + CREATE INDEX t2i1 ON t2(b); } } {} -do_test diskfull-1.2 { +set sqlite_diskfull_pending 0 +integrity_check diskfull-1.2 +do_test diskfull-1.3 { set sqlite_diskfull_pending 1 catchsql { INSERT INTO t1 SELECT * FROM t1; } } {1 {database or disk is full}} -do_test diskfull-1.3 { +set sqlite_diskfull_pending 0 +integrity_check diskfull-1.4 +do_test diskfull-1.5 { set sqlite_diskfull_pending 1 catchsql { DELETE FROM t1; } } {1 {database or disk is full}} +set sqlite_diskfull_pending 0 +integrity_check diskfull-1.6 + +set go 1 +set i 0 +while {$go} { + incr i + do_test diskfull-2.$i.1 { + set sqlite_diskfull_pending $i + set sqlite_diskfull 0 + set r [catchsql {VACUUM}] + if {!$sqlite_diskfull} { + set r {1 {database or disk is full}} + set go 0 + } + if {$r=="1 {disk I/O error}"} { + set r {1 {database or disk is full}} + } + set r + } {1 {database or disk is full}} + set sqlite_diskfull_pending 0 + db close + sqlite3 db test.db + integrity_check diskfull-2.$i.2 +} finish_test