forked from Mirrors/freeswitch
165f180162
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3735 d0543943-73ff-0310-b7d9-9358b9ac24b2
76 lines
1.9 KiB
Plaintext
76 lines
1.9 KiB
Plaintext
# 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.3 2005/09/09 10:46:19 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;
|
|
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);
|
|
}
|
|
} {}
|
|
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}}
|
|
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
|