]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Infrastructure to make simulated I/O errors persistent instead of
authordrh <drh@noemail.net>
Thu, 15 Mar 2007 12:17:42 +0000 (12:17 +0000)
committerdrh <drh@noemail.net>
Thu, 15 Mar 2007 12:17:42 +0000 (12:17 +0000)
transient. (CVS 3689)

FossilOrigin-Name: 1a53f531ecd51938fab37a59b7088d89d8f8569d

manifest
manifest.uuid
src/os_common.h
src/test2.c
test/ioerr.test
test/tester.tcl

index 1beb96bb69ea04c739aadd49ff9c87b6bd574da2..2a265ab8187ef1e2d702f205a12d0cf7679fd1a9 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Catch\san\sIO\serror\scode\sthat\swas\sbeing\signored\sin\sOP_RowData.\s(CVS\s3688)
-D 2007-03-15T12:05:36
+C Infrastructure\sto\smake\ssimulated\sI/O\serrors\spersistent\sinstead\sof\ntransient.\s(CVS\s3689)
+D 2007-03-15T12:17:43
 F Makefile.in 1fe3d0b46e40fd684e1e61f8e8056cefed16de9f
 F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935
 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@@ -77,7 +77,7 @@ F src/main.c af8922e0205cf618392de2836c9efad71786d0d6
 F src/md5.c c5fdfa5c2593eaee2e32a5ce6c6927c986eaf217
 F src/os.c 59f05de8c5777c34876607114a2fbe55ae578235
 F src/os.h 17fc73165cb7436aa79492d2dff754baec74fcb9
-F src/os_common.h 545426356f0868a6765e70cb59e319d3acad0ed6
+F src/os_common.h 4ee94e3ba305cf92488fa7e54e5c98fb03fa7ddc
 F src/os_os2.c 8ee8207fe218a1acf3a31d59753e165e5c23bb95
 F src/os_os2.h e5f17dd69333632bbc3112881ea407c37d245eb3
 F src/os_test.c 49833426101f99aee4bb5f6a44b7c4b2029fda1c
@@ -102,7 +102,7 @@ F src/sqliteInt.h 6e3ac7a1a8f51e24ce4784236aa957e9bd11217f
 F src/table.c 6d0da66dde26ee75614ed8f584a1996467088d06
 F src/tclsqlite.c cd2b3b86ab07c0e0779f6c6e71e72c6c7dc1e704
 F src/test1.c b4ff8f82f84d2ccdf07a2db5acae7b47c12f60d7
-F src/test2.c ca74a1d8aeb7d9606e8f6b762c5daf85c1a3f92b
+F src/test2.c 59085c04e22a22bed9f1078ab318adc34c1229f3
 F src/test3.c ed494a126221c4b9f66f8f0445554ad749764709
 F src/test4.c 8b784cd82de158a2317cb4ac4bc86f91ad315e25
 F src/test5.c 7162f8526affb771c4ed256826eee7bb9eca265f
@@ -232,7 +232,7 @@ F test/insert3.test 09a532d5b6f3a788d91be0d4d368462f522685d1
 F test/insert4.test 0bb119fea2868afdcf78e4e3e3bfed27bbdb2430
 F test/interrupt.test c38b7f7c17914f0cd6a119beed5d03bc3f47f9eb
 F test/intpkey.test af4fd826c4784ec5c93b444de07adea0254d0d30
-F test/ioerr.test 565f1a47c6af6bb75dc0ff633213cec63470c19c
+F test/ioerr.test 053da63476d1b6a32ec61ac21c0391e614cb1d1a
 F test/join.test af0443185378b64878750aa1cf4b83c216f246b4
 F test/join2.test f2171c265e57ee298a27e57e7051d22962f9f324
 F test/join3.test 6f0c774ff1ba0489e6c88a3e77b9d3528fb4fda0
@@ -305,7 +305,7 @@ F test/table.test feea6a3eb08cf166f570255eea5447e42ef82498
 F test/tableapi.test 036575a98dcce7c92e9f39056839bbad8a715412
 F test/tclsqlite.test 51334389283c74bcbe28645a73159b17e239e9f3
 F test/temptable.test c36f3e5a94507abb64f7ba23deeb4e1a8a8c3821
-F test/tester.tcl 47670c2d74f466c5b22fca23f9d28cfcc7686452
+F test/tester.tcl 552d2eb0f293bcda0bc3f9bb6004196fd7d23d0f
 F test/thread1.test 776c9e459b75ba905193b351926ac4019b049f35
 F test/thread2.test 6d7b30102d600f51b4055ee3a5a19228799049fb
 F test/threadtest1.c 6029d9c5567db28e6dc908a0c63099c3ba6c383b
@@ -436,7 +436,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
 F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
-P 5af61402f65bddc4040a20470f267c9404cba631
-R 6cd3a8e09af220e173fcb00ca76f0725
-U danielk1977
-Z 1aff0a673a648ebfe30344b08f0f95d7
+P 760ebf8076b9cedb614bdc88c72d871c30cc7b94
+R a54dd85814a4f198d27a7b3bc55243a7
+U drh
+Z da48ce4b728b6695aadd7e57b610d24b
index a6ced44bf8987474a78f4bdc515b35f410c4795a..f6719e57364d5d6990467906e783d5ffdc4d433a 100644 (file)
@@ -1 +1 @@
-760ebf8076b9cedb614bdc88c72d871c30cc7b94
\ No newline at end of file
+1a53f531ecd51938fab37a59b7088d89d8f8569d
\ No newline at end of file
index 863e3cde2b727f851210d5d96c58fd8a734fdb29..3d379e070e1ffb085358c0f6b0bda8464aee5257 100644 (file)
@@ -90,13 +90,16 @@ static unsigned int elapse;
 #ifdef SQLITE_TEST
 int sqlite3_io_error_hit = 0;
 int sqlite3_io_error_pending = 0;
+int sqlite3_io_error_persist = 0;
 int sqlite3_diskfull_pending = 0;
 int sqlite3_diskfull = 0;
 #define SimulateIOError(CODE)  \
    if( sqlite3_io_error_pending ) \
-     if( sqlite3_io_error_pending-- == 1 ){ local_ioerr(); CODE; }
+     if( sqlite3_io_error_pending-- == 1 \
+         || (sqlite3_io_error_persist && sqlite3_io_error_hit) ) \
+                { local_ioerr(); CODE; }
 static void local_ioerr(){
-  sqlite3_io_error_hit = 1;  /* Really just a place to set a breakpoint */
+  sqlite3_io_error_hit = 1;
 }
 #define SimulateDiskfullError(CODE) \
    if( sqlite3_diskfull_pending ){ \
index bb0cc18435bb9a498357e7eb827ac7037131e431..d9acb2b79166e480e4ad0f9525e4383d543742ae 100644 (file)
@@ -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.39 2006/01/06 14:32:20 drh Exp $
+** $Id: test2.c,v 1.40 2007/03/15 12:17:43 drh Exp $
 */
 #include "sqliteInt.h"
 #include "os.h"
@@ -558,6 +558,7 @@ static int fake_big_file(
 ** Register commands with the TCL interpreter.
 */
 int Sqlitetest2_Init(Tcl_Interp *interp){
+  extern int sqlite3_io_error_persist;
   extern int sqlite3_io_error_pending;
   extern int sqlite3_io_error_hit;
   extern int sqlite3_diskfull_pending;
@@ -592,6 +593,8 @@ int Sqlitetest2_Init(Tcl_Interp *interp){
   }
   Tcl_LinkVar(interp, "sqlite_io_error_pending",
      (char*)&sqlite3_io_error_pending, TCL_LINK_INT);
+  Tcl_LinkVar(interp, "sqlite_io_error_persist",
+     (char*)&sqlite3_io_error_persist, TCL_LINK_INT);
   Tcl_LinkVar(interp, "sqlite_io_error_hit",
      (char*)&sqlite3_io_error_hit, TCL_LINK_INT);
   Tcl_LinkVar(interp, "sqlite_diskfull_pending",
index e9df0321d885be2f956e599f4f39a87cfae9e1d4..c9513ab65a1d32cf00630b816e38324b78a10647 100644 (file)
@@ -15,7 +15,7 @@
 # The tests in this file use special facilities that are only
 # available in the SQLite test fixture.
 #
-# $Id: ioerr.test,v 1.29 2007/01/04 14:58:14 drh Exp $
+# $Id: ioerr.test,v 1.30 2007/03/15 12:17:43 drh Exp $
 
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
@@ -46,9 +46,6 @@ do_ioerr_test ioerr-1 -erc 1 -sqlprep {
   DELETE FROM t1 WHERE a<100;
 } -exclude [expr [string match [execsql {pragma auto_vacuum}] 1] ? 4 : 0]
 
-finish_test
-return
-
 # Test for IO errors during a VACUUM. 
 #
 # The first IO call is excluded from the test. This call attempts to read
@@ -260,4 +257,13 @@ do_ioerr_test ioerr-10 -tclprep {
   }
 }
 
+# Assertion fault bug reported by alex dimitrov.
+#
+do_ioerr_test ioerr-11 -erc 1 -sqlprep {
+   CREATE TABLE A(Id INTEGER, Name TEXT);
+   INSERT INTO A(Id, Name) VALUES(1, 'Name');
+} -sqlbody {
+   UPDATE A SET Id = 2, Name = 'Name2' WHERE Id = 1;
+}
+
 finish_test
index b8d4a1ad709935949c38ef42a885f8ca4883b40f..9d2f684d73eb63597f8b0ef565ff1dca4fbe29a5 100644 (file)
@@ -11,7 +11,7 @@
 # This file implements some common TCL routines used for regression
 # testing the SQLite library
 #
-# $Id: tester.tcl,v 1.72 2007/01/04 14:58:14 drh Exp $
+# $Id: tester.tcl,v 1.73 2007/03/15 12:17:43 drh Exp $
 
 # Make sure tclsqlite3 was compiled correctly.  Abort now with an
 # error message if not.
@@ -342,6 +342,7 @@ proc crashsql {crashdelay crashfile sql} {
 #     -sqlbody          TCL script to run with IO error simulation.
 #     -exclude          List of 'N' values not to test.
 #     -erc              Use extended result codes
+#     -persist          Make simulated I/O errors persistent
 #     -start            Value of 'N' to begin with (default 1)
 #
 #     -cksum            Boolean. If true, test that the database does
@@ -353,6 +354,7 @@ proc do_ioerr_test {testname args} {
   set ::ioerropts(-cksum) 0
   set ::ioerropts(-erc) 0
   set ::ioerropts(-count) 100000000
+  set ::ioerropts(-persist) 1
   array set ::ioerropts $args
 
   set ::go 1
@@ -392,6 +394,7 @@ proc do_ioerr_test {testname args} {
   
     # Set the Nth IO error to fail.
     do_test $testname.$n.2 [subst {
+      set ::sqlite_io_error_persist $::ioerropts(-persist)
       set ::sqlite_io_error_pending $n
     }] $n