summaryrefslogtreecommitdiffstats
path: root/third_party/sqlite/src/test/incrblob.test
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/sqlite/src/test/incrblob.test')
-rw-r--r--third_party/sqlite/src/test/incrblob.test188
1 files changed, 106 insertions, 82 deletions
diff --git a/third_party/sqlite/src/test/incrblob.test b/third_party/sqlite/src/test/incrblob.test
index 7d8d8e3..e0b2787 100644
--- a/third_party/sqlite/src/test/incrblob.test
+++ b/third_party/sqlite/src/test/incrblob.test
@@ -208,7 +208,7 @@ foreach AutoVacuumMode [list 0 1] {
nRead db
} [expr $AutoVacuumMode ? 4 : 30]
}
-sqlite3_soft_heap_limit $soft_limit
+sqlite3_soft_heap_limit $cmdlinearg(soft-heap-limit)
#------------------------------------------------------------------------
# incrblob-3.*:
@@ -309,7 +309,7 @@ do_test incrblob-4.7 {
list $rc $msg
} {1 {cannot open value of type null}}
-do_test incrblob-4.8 {
+do_test incrblob-4.8.1 {
execsql {
INSERT INTO blobs(k, v, i) VALUES(X'010203040506070809', 'hello', 'world');
}
@@ -318,6 +318,22 @@ do_test incrblob-4.8 {
} msg ]
list $rc $msg
} {1 {cannot open indexed column for writing}}
+do_test incrblob-4.8.2 {
+ execsql {
+ CREATE TABLE t3(a INTEGER PRIMARY KEY, b);
+ INSERT INTO t3 VALUES(1, 2);
+ }
+ set rc [catch {
+ set ::blob [db incrblob -readonly t3 a 1]
+ } msg ]
+ list $rc $msg
+} {1 {cannot open value of type null}}
+do_test incrblob-4.8.3 {
+ set rc [catch {
+ set ::blob [db incrblob -readonly t3 rowid 1]
+ } msg ]
+ list $rc $msg
+} {1 {no such column: "rowid"}}
do_test incrblob-4.9.1 {
set rc [catch {
@@ -404,87 +420,95 @@ unset -nocomplain ::text
# after the transaction is commited and the blob channel
# closed.
#
-sqlite3_soft_heap_limit 0
-do_test incrblob-6.1 {
- sqlite3 db2 test.db
- execsql {
- BEGIN;
- INSERT INTO blobs(k, v, i) VALUES('a', 'different', 'connection');
- } db2
-} {}
-do_test incrblob-6.2 {
- execsql {
- SELECT rowid FROM blobs
- }
-} {1 2 3}
-do_test incrblob-6.3 {
- set rc [catch {
- db incrblob blobs v 1
- } msg]
- list $rc $msg
-} {1 {database is locked}}
-do_test incrblob-6.4 {
- set rc [catch {
- db incrblob blobs v 3
- } msg]
- list $rc $msg
-} {1 {database is locked}}
-do_test incrblob-6.5 {
- set ::blob [db incrblob -readonly blobs v 3]
- read $::blob
-} {hello}
-do_test incrblob-6.6 {
- close $::blob
-} {}
-
-do_test incrblob-6.7 {
- set ::blob [db2 incrblob blobs i 4]
- gets $::blob
-} {connection}
-do_test incrblob-6.8 {
- tell $::blob
-} {10}
-do_test incrblob-6.9 {
- seek $::blob 0
- puts -nonewline $::blob "invocation"
- flush $::blob
-} {}
-
-# At this point rollback should be illegal (because
-# there is an open blob channel). But commit is also illegal because
-# the open blob is read-write.
+# This test does not work with the "memsubsys1" configuration.
+# Permutation memsubsys1 configures a very small static allocation
+# for use as page-cache memory. This causes SQLite to upgrade
+# to an exclusive lock when writing earlier than usual, which
+# makes some of these tests fail.
#
-do_test incrblob-6.10 {
- catchsql {
- ROLLBACK;
- } db2
-} {1 {cannot rollback transaction - SQL statements in progress}}
-do_test incrblob-6.11 {
- catchsql {
- COMMIT;
- } db2
-} {1 {cannot commit transaction - SQL statements in progress}}
-
-do_test incrblob-6.12 {
- execsql {
- SELECT * FROM blobs WHERE rowid = 4;
- }
-} {}
-do_test incrblob-6.13 {
- close $::blob
-} {}
-do_test incrblob-6.14 {
- catchsql {
- COMMIT;
- } db2
-} {0 {}}
-do_test incrblob-6.15 {
- execsql {
- SELECT * FROM blobs WHERE rowid = 4;
- }
-} {a different invocation}
-db2 close
-sqlite3_soft_heap_limit $soft_limit
+sqlite3_soft_heap_limit 0
+if {[permutation] != "memsubsys1"} {
+ do_test incrblob-6.1 {
+ sqlite3 db2 test.db
+ execsql {
+ BEGIN;
+ INSERT INTO blobs(k, v, i) VALUES('a', 'different', 'connection');
+ } db2
+ } {}
+ do_test incrblob-6.2 {
+ execsql {
+ SELECT rowid FROM blobs
+ }
+ } {1 2 3}
+ do_test incrblob-6.3 {
+ set rc [catch {
+ db incrblob blobs v 1
+ } msg]
+ list $rc $msg
+ } {1 {database is locked}}
+ do_test incrblob-6.4 {
+ set rc [catch {
+ db incrblob blobs v 3
+ } msg]
+ list $rc $msg
+ } {1 {database is locked}}
+ do_test incrblob-6.5 {
+ set ::blob [db incrblob -readonly blobs v 3]
+ read $::blob
+ } {hello}
+ do_test incrblob-6.6 {
+ close $::blob
+ } {}
+
+ do_test incrblob-6.7 {
+ set ::blob [db2 incrblob blobs i 4]
+ gets $::blob
+ } {connection}
+ do_test incrblob-6.8 {
+ tell $::blob
+ } {10}
+ do_test incrblob-6.9 {
+ seek $::blob 0
+ puts -nonewline $::blob "invocation"
+ flush $::blob
+ } {}
+
+ # At this point rollback should be illegal (because
+ # there is an open blob channel). But commit is also illegal because
+ # the open blob is read-write.
+ #
+ do_test incrblob-6.10 {
+ catchsql {
+ ROLLBACK;
+ } db2
+ } {1 {cannot rollback transaction - SQL statements in progress}}
+ do_test incrblob-6.11 {
+ catchsql {
+ COMMIT;
+ } db2
+ } {1 {cannot commit transaction - SQL statements in progress}}
+
+ do_test incrblob-6.12 {
+ execsql {
+ SELECT * FROM blobs WHERE rowid = 4;
+ }
+ } {}
+ do_test incrblob-6.13 {
+ close $::blob
+ } {}
+ do_test incrblob-6.14 {
+ catchsql {
+ COMMIT;
+ } db2
+ } {0 {}}
+ do_test incrblob-6.15 {
+ execsql {
+ SELECT * FROM blobs WHERE rowid = 4;
+ }
+ } {a different invocation}
+ db2 close
+}
+sqlite3_soft_heap_limit $cmdlinearg(soft-heap-limit)
#-----------------------------------------------------------------------
# The following tests verify the behaviour of the incremental IO