Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Add a different form of I/O tests. So far has failed to expose new bugs. (CVS 3802) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
9e1295428f476dba21c28149c7983f66 |
User & Date: | danielk1977 2007-04-02 16:46:23.000 |
Context
2007-04-02
| ||
17:54 | Fix a union initializer so that it works with the Borland compiler. (CVS 3803) (check-in: a067f78bf6 user: drh tags: trunk) | |
16:46 | Add a different form of I/O tests. So far has failed to expose new bugs. (CVS 3802) (check-in: 9e1295428f user: danielk1977 tags: trunk) | |
16:45 | If preprocessor macro OS_OTHER is defined, then ignore OS_UNIX, OS_WIN, and OS_OS2. This makes it easier to add proprietary backends.. (CVS 3801) (check-in: 4fdafd3f58 user: drh tags: trunk) | |
Changes
Added test/ioerr2.test.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | # 2007 April 2 # # 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 I/O errors # such as writes failing because the disk is full. # # The tests in this file use special facilities that are only # available in the SQLite test fixture. # # $Id: ioerr2.test,v 1.1 2007/04/02 16:46:23 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl do_test ioerr2-1.1 { execsql { PRAGMA cache_size = 10; PRAGMA default_cache_size = 10; CREATE TABLE t1(a, b, PRIMARY KEY(a, b)); INSERT INTO t1 VALUES(randstr(400,400),randstr(400,400)); INSERT INTO t1 SELECT randstr(400,400), randstr(400,400) FROM t1; -- 2 INSERT INTO t1 SELECT randstr(400,400), randstr(400,400) FROM t1; -- 4 INSERT INTO t1 SELECT randstr(400,400), randstr(400,400) FROM t1; -- 8 INSERT INTO t1 SELECT randstr(400,400), randstr(400,400) FROM t1; -- 16 INSERT INTO t1 SELECT randstr(400,400), randstr(400,400) FROM t1; -- 32 } } {} set ::cksum [execsql {SELECT md5sum(a, b) FROM t1}] proc check_db {testname} { # Make sure no I/O errors are simulated in this proc. set ::sqlite_io_error_hit 0 set ::sqlite_io_error_persist 0 set ::sqlite_io_error_pending 0 # Run an integrity-check. If "disk I/O error" is returned, the # pager must be in error state. In this case open a new database # connection. Otherwise, try a ROLLBACK, in case a transaction # is still active. set rc [catch {execsql {PRAGMA integrity_check}} msg] if {$rc && $msg eq "disk I/O error"} { db close sqlite3 db test.db } else { if {$rc} {error $msg} catch {execsql ROLLBACK} } # Check that the database checksum is still $::cksum, and that # the integrity-check passes. set ck [execsql {SELECT md5sum(a, b) FROM t1}] do_test ${testname}.cksum [list set ck $ck] $::cksum integrity_check ${testname}.integrity } check_db ioerr2-2 set sql { PRAGMA cache_size = 10; PRAGMA default_cache_size = 10; BEGIN; DELETE FROM t1 WHERE (oid%7)==0; INSERT INTO t1 SELECT randstr(400,400), randstr(400,400) WHERE (random()%7)==0; UPDATE t1 SET a = randstr(400,400), b = randstr(400,400) WHERE (random()%7)==0; ROLLBACK; } foreach bPersist [list 0 1] { set ::go 1 for {set ::N 1} {$::go} {incr ::N} { set ::sqlite_io_error_hit 0 set ::sqlite_io_error_persist $bPersist set ::sqlite_io_error_pending $::N foreach {::go res} [catchsql $sql] {} check_db ioerr2-3.$bPersist.$::N } } finish_test |