Work around an AFP file system byte-range locking error caused by opening and closing a second file descriptor on the database file as RDWR which clears the exclusive byte-range lock and results in an fcntl error when the AFP locking code attempts to clear it afterwards. This error is caused by the test harness and isn't a flaw in the sqlite or its implementation of AFP file locking. (CVS 4172)
FossilOrigin-Name: b2ba3e81fb1015d6f979a490e00a45fb7d5e1a9a
This commit is contained in:
+29
-12
@@ -10,7 +10,7 @@
|
||||
#***********************************************************************
|
||||
# This file implements regression tests for SQLite library.
|
||||
#
|
||||
# $Id: exclusive2.test,v 1.6 2007/06/16 14:43:52 danielk1977 Exp $
|
||||
# $Id: exclusive2.test,v 1.7 2007/07/20 20:25:38 aswift Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@@ -45,11 +45,28 @@ proc pagerChangeCounter {filename {new ""}} {
|
||||
return $ret
|
||||
}
|
||||
|
||||
proc readPagerChangeCounter {filename} {
|
||||
set fd [open $filename RDONLY]
|
||||
fconfigure $fd -translation binary -encoding binary
|
||||
|
||||
seek $fd 24
|
||||
foreach {a b c d} [list 0 0 0 0] {}
|
||||
binary scan [read $fd 4] cccc a b c d
|
||||
set ret [expr ($a&0x000000FF)<<24]
|
||||
incr ret [expr ($b&0x000000FF)<<16]
|
||||
incr ret [expr ($c&0x000000FF)<<8]
|
||||
incr ret [expr ($d&0x000000FF)<<0]
|
||||
|
||||
close $fd
|
||||
return $ret
|
||||
}
|
||||
|
||||
|
||||
proc t1sig {{db db}} {
|
||||
execsql {SELECT count(*), md5sum(a) FROM t1} $db
|
||||
}
|
||||
do_test exclusive2-1.0 {
|
||||
pagerChangeCounter test.db
|
||||
readPagerChangeCounter test.db
|
||||
} {0}
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
@@ -98,7 +115,7 @@ do_test exclusive2-1.2.1 {
|
||||
} {1}
|
||||
do_test exclusive2-1.2 {
|
||||
set ::sig [t1sig]
|
||||
pagerChangeCounter test.db
|
||||
readPagerChangeCounter test.db
|
||||
} {1}
|
||||
do_test exclusive2-1.3 {
|
||||
t1sig
|
||||
@@ -114,7 +131,7 @@ do_test exclusive2-1.5 {
|
||||
expr {[t1sig db2] eq $::sig}
|
||||
} 0
|
||||
do_test exclusive2-1.6 {
|
||||
pagerChangeCounter test.db
|
||||
readPagerChangeCounter test.db
|
||||
} {2}
|
||||
do_test exclusive2-1.7 {
|
||||
pagerChangeCounter test.db 1
|
||||
@@ -177,7 +194,7 @@ do_test exclusive2-2.2.1 {
|
||||
} {1}
|
||||
do_test exclusive2-2.2 {
|
||||
set ::sig [t1sig]
|
||||
pagerChangeCounter test.db
|
||||
readPagerChangeCounter test.db
|
||||
} {3}
|
||||
do_test exclusive2-2.3 {
|
||||
t1sig
|
||||
@@ -229,45 +246,45 @@ do_test exclusive2-3.0 {
|
||||
INSERT INTO t1 VALUES(randstr(10, 400));
|
||||
COMMIT;
|
||||
}
|
||||
pagerChangeCounter test.db
|
||||
readPagerChangeCounter test.db
|
||||
} {1}
|
||||
do_test exclusive2-3.1 {
|
||||
execsql {
|
||||
INSERT INTO t1 VALUES(randstr(10, 400));
|
||||
}
|
||||
pagerChangeCounter test.db
|
||||
readPagerChangeCounter test.db
|
||||
} {2}
|
||||
do_test exclusive2-3.2 {
|
||||
execsql {
|
||||
INSERT INTO t1 VALUES(randstr(10, 400));
|
||||
}
|
||||
pagerChangeCounter test.db
|
||||
readPagerChangeCounter test.db
|
||||
} {3}
|
||||
do_test exclusive2-3.3 {
|
||||
execsql {
|
||||
PRAGMA locking_mode = exclusive;
|
||||
INSERT INTO t1 VALUES(randstr(10, 400));
|
||||
}
|
||||
pagerChangeCounter test.db
|
||||
readPagerChangeCounter test.db
|
||||
} {4}
|
||||
do_test exclusive2-3.4 {
|
||||
execsql {
|
||||
INSERT INTO t1 VALUES(randstr(10, 400));
|
||||
}
|
||||
pagerChangeCounter test.db
|
||||
readPagerChangeCounter test.db
|
||||
} {4}
|
||||
do_test exclusive2-3.5 {
|
||||
execsql {
|
||||
PRAGMA locking_mode = normal;
|
||||
INSERT INTO t1 VALUES(randstr(10, 400));
|
||||
}
|
||||
pagerChangeCounter test.db
|
||||
readPagerChangeCounter test.db
|
||||
} {4}
|
||||
do_test exclusive2-3.6 {
|
||||
execsql {
|
||||
INSERT INTO t1 VALUES(randstr(10, 400));
|
||||
}
|
||||
pagerChangeCounter test.db
|
||||
readPagerChangeCounter test.db
|
||||
} {5}
|
||||
|
||||
finish_test
|
||||
|
||||
Reference in New Issue
Block a user