mirror of
https://github.com/sqlite/sqlite.git
synced 2025-12-24 14:17:58 +03:00
Additional code to test the SQLITE_FULL return when the disk is full. (CVS 1994)
FossilOrigin-Name: 44e56f0bba61245d342d6e75510d6c35785efd49
This commit is contained in:
19
manifest
19
manifest
@@ -1,5 +1,5 @@
|
||||
C Fully\srelease\sexclusive\slocks\sin\sthe\sUnlock\sprimitive\sof\sUnix.\nTicket\s#913.\s(CVS\s1993)
|
||||
D 2004-10-01T03:02:48
|
||||
C Additional\scode\sto\stest\sthe\sSQLITE_FULL\sreturn\swhen\sthe\sdisk\sis\sfull.\s(CVS\s1994)
|
||||
D 2004-10-01T14:38:03
|
||||
F Makefile.in abdeb5bd9d017822691884935c320037c33f6ee6
|
||||
F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457
|
||||
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
|
||||
@@ -42,12 +42,12 @@ F src/legacy.c d58ea507bce885298a2c8c3cbb0f4bff5d47830b
|
||||
F src/main.c 2a1b9623fde3fe5e22fe726cdae4e10f33671caa
|
||||
F src/md5.c 7ae1c39044b95de2f62e066f47bb1deb880a1070
|
||||
F src/os.h 5834a404b7c8318dc1928c9fc0137a65c9c0416c
|
||||
F src/os_common.h cd7eb025fdab7dc91e0e97bf6310f1648205857f
|
||||
F src/os_common.h 0e7f428ba0a6c40a61bc56c4e96f493231301b73
|
||||
F src/os_mac.c 7367dab0c44ab0b2c4337e73ac6f6f97f171c2cb
|
||||
F src/os_mac.h 608fdf39eafa1ce25fc8cb223b8b0a073341d4da
|
||||
F src/os_test.c d9a21852d170f20adeae6f224d1beba2cb5af8aa
|
||||
F src/os_test.h 6a26a4978492e4bbdbf385554958418ff02db162
|
||||
F src/os_unix.c 8ee13cc8efb47dd3269327f1659f0aa59449e7e0
|
||||
F src/os_unix.c ca7891d1f84994559899ced37b45541a68028282
|
||||
F src/os_unix.h f3097815e041e82e24d92505e1ff61ba24172d13
|
||||
F src/os_win.c 0ab81ce1e4739e0e251b6aa3e74e1a6b75b612da
|
||||
F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b
|
||||
@@ -64,7 +64,7 @@ F src/sqliteInt.h 5c406ebc830c5129748b77539283c0e20f978887
|
||||
F src/table.c 25b3ff2b39b7d87e8d4a5da0713d68dfc06cbee9
|
||||
F src/tclsqlite.c 0302e3f42f015d132d1291f3388c06e86c24a008
|
||||
F src/test1.c 3d78e5d827bf5d037f697c233c5934d45af46cb5
|
||||
F src/test2.c 2d25e3893f7d1efeeba21958e6e66d92d5ec7762
|
||||
F src/test2.c b11fa244fff02190707dd0879987c37c75e61fc8
|
||||
F src/test3.c 5b5b0f3d11b097399c1054fff73d8f3711092301
|
||||
F src/test4.c 7c6b9fc33dd1f3f93c7f1ee6e5e6d016afa6c1df
|
||||
F src/test5.c b001fa7f1b9e2dc5c2331de62fc641b5ab2bd7a1
|
||||
@@ -112,6 +112,7 @@ F test/crashtest1.c 09c1c7d728ccf4feb9e481671e29dda5669bbcc2
|
||||
F test/date.test fd3db29bba089578b1b008e3511ea9e74840377a
|
||||
F test/delete.test ec0b455f2dcc0e189d96ee438438ba026c4e51d8
|
||||
F test/delete2.test 050a3a6e8ea0f83aed817d164b16af2a499fb452
|
||||
F test/diskfull.test e2f6cfd868713ead06dc82b84a4938e868128fc0
|
||||
F test/enc.test 2f5463af488d50aef60c6110bec6b21b5efba961
|
||||
F test/enc2.test 7a60971a62748be6b607b4b4380eb4c5e151a6ec
|
||||
F test/enc3.test 2ae80b11adf5b2c171d2e17214dabd356b9672c1
|
||||
@@ -125,7 +126,7 @@ F test/insert.test ebbab63db4ad69395a058514bccb3cdb0a029d48
|
||||
F test/insert2.test 614a29d3ed7dd0d8644a059c6d8ce742c63a734a
|
||||
F test/interrupt.test 9142ce4448605127640eda5e283952f75f67ed91
|
||||
F test/intpkey.test c8efd06db62b8b27216558ef439cc867d113cfec
|
||||
F test/ioerr.test 7d087bfd1a1a53442940e000df936e0df0c5b886
|
||||
F test/ioerr.test 3ce897ee998ee874073f3b23b0396d9ff804759c
|
||||
F test/join.test 9ef6aabaac9de51d5fc41e68d1f4355da05a84cd
|
||||
F test/join2.test c97e4c5aa65dea462145529e58212a709b4722b8
|
||||
F test/join3.test 67dc0d7c8dab3fff25796d0f3c3fd9c999aeded3
|
||||
@@ -247,7 +248,7 @@ F www/tclsqlite.tcl 560ecd6a916b320e59f2917317398f3d59b7cc25
|
||||
F www/vdbe.tcl 59288db1ac5c0616296b26dce071c36cb611dfe9
|
||||
F www/version3.tcl 092a01f5ef430d2c4acc0ae558d74c4bb89638a0
|
||||
F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4
|
||||
P 8972c004dc825f668d952e7d082a89046b9260f1
|
||||
R c18f14c1b88558caba10e1e626c64832
|
||||
P 11a37a74b101b9e37dcf1c3e57e45fbcd39a1c21
|
||||
R 5cd09489a21e3070d0d9f7d48f412e67
|
||||
U drh
|
||||
Z cf49e4565c24c55963de6fd9ac42f0ce
|
||||
Z 4aac176e6504fc7c2836065cfd34556a
|
||||
|
||||
@@ -1 +1 @@
|
||||
11a37a74b101b9e37dcf1c3e57e45fbcd39a1c21
|
||||
44e56f0bba61245d342d6e75510d6c35785efd49
|
||||
@@ -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
|
||||
|
||||
/*
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
40
test/diskfull.test
Normal file
40
test/diskfull.test
Normal file
@@ -0,0 +1,40 @@
|
||||
# 2001 October 12
|
||||
#
|
||||
# The author disclaims copyright to this source code. In place of
|
||||
# a legal notice, here is a blessing:
|
||||
#
|
||||
# May you do good and not evil.
|
||||
# May you find forgiveness for yourself and forgive others.
|
||||
# May you share freely, never taking more than you give.
|
||||
#
|
||||
#***********************************************************************
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this file is testing for correct handling of disk full
|
||||
# errors.
|
||||
#
|
||||
# $Id: diskfull.test,v 1.1 2004/10/01 14:38:03 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
|
||||
do_test diskfull-1.1 {
|
||||
execsql {
|
||||
CREATE TABLE t1(x);
|
||||
INSERT INTO t1 VALUES(randstr(1000,1000));
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
}
|
||||
} {}
|
||||
do_test diskfull-1.2 {
|
||||
set sqlite_diskfull_pending 1
|
||||
catchsql {
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
}
|
||||
} {1 {database is full}}
|
||||
do_test diskfull-1.3 {
|
||||
set sqlite_diskfull_pending 1
|
||||
catchsql {
|
||||
DELETE FROM t1;
|
||||
}
|
||||
} {1 {database is full}}
|
||||
|
||||
finish_test
|
||||
@@ -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.5 2004/06/19 00:16:31 drh Exp $
|
||||
# $Id: ioerr.test,v 1.6 2004/10/01 14:38:03 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@@ -106,16 +106,9 @@ for {set n 1} {$go} {incr n} {
|
||||
set ::sqlite_io_error_pending $n
|
||||
}] $n
|
||||
do_test ioerr-2.$n.3 {
|
||||
if {$n==41} {
|
||||
# set sqlite_os_trace 1
|
||||
breakpoint
|
||||
}
|
||||
set r [catch {db eval {
|
||||
VACUUM;
|
||||
}} msg]
|
||||
# puts "error_pending=$::sqlite_io_error_pending"
|
||||
# if {$r} {puts $msg}
|
||||
set sqlite_os_trace 0
|
||||
set ::go [expr {$::sqlite_io_error_pending<=0}]
|
||||
expr {$::sqlite_io_error_pending>0 || $r!=0}
|
||||
set ::sqlite_io_error_pending 0
|
||||
|
||||
Reference in New Issue
Block a user