summaryrefslogtreecommitdiffstats
path: root/third_party/sqlite/test/shared.test
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/sqlite/test/shared.test')
-rw-r--r--third_party/sqlite/test/shared.test23
1 files changed, 21 insertions, 2 deletions
diff --git a/third_party/sqlite/test/shared.test b/third_party/sqlite/test/shared.test
index 61a28c4..9b04946 100644
--- a/third_party/sqlite/test/shared.test
+++ b/third_party/sqlite/test/shared.test
@@ -9,7 +9,7 @@
#
#***********************************************************************
#
-# $Id: shared.test,v 1.34 2008/07/12 14:52:20 drh Exp $
+# $Id: shared.test,v 1.36 2009/03/16 13:19:36 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@@ -42,6 +42,20 @@ ifcapable autovacuum {
}
}
+# if we're using proxy locks, we use 2 filedescriptors for a db
+# that is open but NOT yet locked, after a lock is taken we'll have 3,
+# normally sqlite uses 1 (proxy locking adds the conch and the local lock)
+set using_proxy 0
+foreach {name value} [array get env SQLITE_FORCE_PROXY_LOCKING] {
+ set using_proxy $value
+}
+set extrafds_prelock 0
+set extrafds_postlock 0
+if {$using_proxy>0} {
+ set extrafds_prelock 1
+ set extrafds_postlock 2
+}
+
# $av is currently 0 if this loop iteration is to test with auto-vacuum turned
# off, and 1 if it is turned on. Increment it so that (1 -> no auto-vacuum)
# and (2 -> auto-vacuum). The sole reason for this is so that it looks nicer
@@ -74,6 +88,7 @@ do_test shared-$av.1.1 {
# opened.
sqlite3 db2 test.db
set ::sqlite_open_file_count
+ expr $sqlite_open_file_count-$extrafds_postlock
} {1}
do_test shared-$av.1.2 {
# Add a table and a single row of data via the first connection.
@@ -154,6 +169,7 @@ do_test shared-$av.2.1 {
sqlite3 db3 TEST.DB
}
set ::sqlite_open_file_count
+ expr $sqlite_open_file_count-($extrafds_prelock+$extrafds_postlock)
} {2}
do_test shared-$av.2.2 {
# Start read transactions on db and db2 (the shared pager cache). Ensure
@@ -284,14 +300,17 @@ sqlite3 db test.db
sqlite3 db2 test2.db
do_test shared-$av.4.1.1 {
set sqlite_open_file_count
+ expr $sqlite_open_file_count-($extrafds_prelock*2)
} {2}
do_test shared-$av.4.1.2 {
execsql {ATTACH 'test2.db' AS test2}
set sqlite_open_file_count
+ expr $sqlite_open_file_count-($extrafds_postlock*2)
} {2}
do_test shared-$av.4.1.3 {
execsql {ATTACH 'test.db' AS test} db2
set sqlite_open_file_count
+ expr $sqlite_open_file_count-($extrafds_postlock*2)
} {2}
# Sanity check: Create a table in ./test.db via handle db, and test that handle
@@ -856,7 +875,7 @@ do_test shared-$av.11.4 {
} {0 {}}
do_test shared-$av.11.5 {
catchsql {INSERT INTO abc2 VALUES(1, 2, 3);} db2
-} {1 {database is locked}}
+} {1 {database table is locked}}
do_test shared-$av.11.6 {
catchsql {SELECT * FROM abc2}
} {0 {}}