diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/os_common.h | 5 | ||||
-rw-r--r-- | src/os_unix.c | 1 | ||||
-rw-r--r-- | src/test2.c | 5 |
3 files changed, 10 insertions, 1 deletions
diff --git a/src/os_common.h b/src/os_common.h index dc8f88096..94311b960 100644 --- a/src/os_common.h +++ b/src/os_common.h @@ -81,14 +81,19 @@ static unsigned int elapse; */ #ifdef SQLITE_TEST int sqlite3_io_error_pending = 0; +int sqlite3_diskfull_pending = 0; #define SimulateIOError(A) \ if( sqlite3_io_error_pending ) \ if( sqlite3_io_error_pending-- == 1 ){ local_ioerr(); return A; } 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; } #else #define SimulateIOError(A) +#define SimulateDiskfullError #endif /* diff --git a/src/os_unix.c b/src/os_unix.c index c0261e1c7..a5be702f2 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -646,6 +646,7 @@ int sqlite3OsWrite(OsFile *id, const void *pBuf, int amt){ int wrote = 0; assert( id->isOpen ); SimulateIOError(SQLITE_IOERR); + SimulateDiskfullError; TIMER_START; while( amt>0 && (wrote = write(id->h, pBuf, amt))>0 ){ amt -= wrote; diff --git a/src/test2.c b/src/test2.c index 28dc78c46..0ba0c2a7f 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.26 2004/10/01 02:00:31 drh Exp $ +** $Id: test2.c,v 1.27 2004/10/01 14:38:03 drh Exp $ */ #include "sqliteInt.h" #include "os.h" @@ -533,6 +533,7 @@ static int fake_big_file( */ int Sqlitetest2_Init(Tcl_Interp *interp){ extern int sqlite3_io_error_pending; + extern int sqlite3_diskfull_pending; static struct { char *zName; Tcl_CmdProc *xProc; @@ -560,6 +561,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_diskfull_pending", + (char*)&sqlite3_diskfull_pending, TCL_LINK_INT); Tcl_LinkVar(interp, "pager_pagesize", (char*)&test_pagesize, TCL_LINK_INT); return TCL_OK; |