80084ca8e8
Add test cases for manditory lock delays under windows. FossilOrigin-Name: 03af4c175c6ba303ec0a5be25fd42771e38f7347
58 lines
1.6 KiB
Plaintext
58 lines
1.6 KiB
Plaintext
# 2011 July 11
|
|
#
|
|
# 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 script is recovery from transient manditory locks
|
|
# that sometimes appear on database files due to anti-virus software.
|
|
#
|
|
|
|
if {$tcl_platform(platform)!="windows"} return
|
|
|
|
set testdir [file dirname $argv0]
|
|
source $testdir/tester.tcl
|
|
|
|
set testprefix win32lock
|
|
|
|
do_test win32lock-1.1 {
|
|
db eval {
|
|
PRAGMA cache_size=10;
|
|
CREATE TABLE t1(x,y);
|
|
INSERT INTO t1 VALUES(1,randomblob(100000));
|
|
INSERT INTO t1 VALUES(2,randomblob(50000));
|
|
INSERT INTO t1 VALUES(3,randomblob(25000));
|
|
INSERT INTO t1 VALUES(4,randomblob(12500));
|
|
SELECT x, length(y) FROM t1 ORDER BY rowid;
|
|
}
|
|
} {1 100000 2 50000 3 25000 4 12500}
|
|
|
|
unset -nocomplain delay1 rc msg
|
|
set delay1 50
|
|
set rc 0
|
|
set old_pending_byte [sqlite3_test_control_pending_byte 0x40000000]
|
|
while {1} {
|
|
sqlite3_sleep 10
|
|
lock_win32_file test.db 0 $::delay1
|
|
set rc [catch {db eval {SELECT x, length(y) FROM t1 ORDER BY rowid}} msg]
|
|
if {$rc} {
|
|
do_test win32lock-1.2-$delay1-fin {
|
|
set ::msg
|
|
} {disk I/O error}
|
|
break
|
|
} else {
|
|
do_test win32lock-1.2-$delay1 {
|
|
set ::msg
|
|
} {1 100000 2 50000 3 25000 4 12500}
|
|
incr delay1 50
|
|
}
|
|
}
|
|
sqlite3_test_control_pending_byte $old_pending_byte
|
|
|
|
finish_test
|