aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/autoindex1.test3
-rw-r--r--test/backcompat.test4
-rw-r--r--test/cast.test1
-rw-r--r--test/corrupt.test2
-rw-r--r--test/corrupt2.test18
-rw-r--r--test/corrupt4.test2
-rw-r--r--test/corruptK.test4
-rw-r--r--test/crash.test2
-rw-r--r--test/distinct2.test18
-rw-r--r--test/eqp.test3
-rw-r--r--test/exclusive2.test4
-rw-r--r--test/func6.test2
-rw-r--r--test/func7.test6
-rw-r--r--test/fuzz3.test2
-rw-r--r--test/in7.test56
-rw-r--r--test/incrvacuum3.test4
-rw-r--r--test/ioerr.test2
-rw-r--r--test/ioerr5.test4
-rw-r--r--test/lock5.test4
-rw-r--r--test/memdb1.test2
-rw-r--r--test/misc3.test4
-rw-r--r--test/nan.test9
-rw-r--r--test/pendingrace.test4
-rw-r--r--test/percentile.test23
-rw-r--r--test/pushdown.test31
-rw-r--r--test/readonly.test5
-rw-r--r--test/recover.test1
-rw-r--r--test/rollback.test2
-rw-r--r--test/rowvalue4.test6
-rw-r--r--test/scanstatus2.test2
-rw-r--r--test/shell1.test2
-rw-r--r--test/shell5.test2
-rw-r--r--test/shell7.test1
-rw-r--r--test/superlock.test4
-rw-r--r--test/syscall.test2
-rw-r--r--test/tester.tcl67
-rw-r--r--test/testrunner.tcl7
-rw-r--r--test/testrunner_data.tcl2
-rw-r--r--test/tkt-2d1a5c67d.test1
-rw-r--r--test/tkt3457.test2
-rw-r--r--test/types3.test5
-rw-r--r--test/vtabH.test4
-rw-r--r--test/wal.test2
-rw-r--r--test/wal2.test6
-rw-r--r--test/wal_common.tcl4
-rw-r--r--test/walcksum.test3
-rw-r--r--test/walslow.test1
-rw-r--r--test/win32longpath.test18
-rw-r--r--test/zipfile.test7
-rw-r--r--test/zipfile2.test5
50 files changed, 206 insertions, 169 deletions
diff --git a/test/autoindex1.test b/test/autoindex1.test
index 08bd9f74e..b294a2721 100644
--- a/test/autoindex1.test
+++ b/test/autoindex1.test
@@ -185,7 +185,8 @@ do_eqp_test autoindex1-500.1 {
QUERY PLAN
|--SEARCH t501 USING INTEGER PRIMARY KEY (rowid=?)
`--LIST SUBQUERY xxxxxx
- `--SCAN t502
+ |--SCAN t502
+ `--CREATE BLOOM FILTER
}
do_eqp_test autoindex1-501 {
SELECT b FROM t501
diff --git a/test/backcompat.test b/test/backcompat.test
index 87ffc4b3e..d477d4466 100644
--- a/test/backcompat.test
+++ b/test/backcompat.test
@@ -112,7 +112,7 @@ proc read_file {zFile} {
set zData {}
if {[file exists $zFile]} {
set fd [open $zFile]
- fconfigure $fd -translation binary -encoding binary
+ fconfigure $fd -translation binary
if {[file size $zFile]<=$::sqlite_pending_byte || $zFile != "test.db"} {
set zData [read $fd]
@@ -129,7 +129,7 @@ proc read_file {zFile} {
}
proc write_file {zFile zData} {
set fd [open $zFile w]
- fconfigure $fd -translation binary -encoding binary
+ fconfigure $fd -translation binary
puts -nonewline $fd $zData
close $fd
}
diff --git a/test/cast.test b/test/cast.test
index ebfea5aa0..7f48ed80b 100644
--- a/test/cast.test
+++ b/test/cast.test
@@ -234,6 +234,7 @@ do_test cast-3.1 {
do_test cast-3.2 {
execsql {SELECT CAST(9223372036854774800 AS numeric)}
} 9223372036854774800
+breakpoint
do_realnum_test cast-3.3 {
execsql {SELECT CAST(9223372036854774800 AS real)}
} 9.22337203685477e+18
diff --git a/test/corrupt.test b/test/corrupt.test
index 62ead4d9a..ff61cc0bb 100644
--- a/test/corrupt.test
+++ b/test/corrupt.test
@@ -290,7 +290,7 @@ ifcapable oversize_cell_check {
# detecting corruption was not possible at that point, and an assert() failed.
#
set fd [open test.db r+]
- fconfigure $fd -translation binary -encoding binary
+ fconfigure $fd -translation binary
seek $fd [expr 1024+8]
puts -nonewline $fd "\x03\x14"
close $fd
diff --git a/test/corrupt2.test b/test/corrupt2.test
index 2e36cbd30..fc24cb376 100644
--- a/test/corrupt2.test
+++ b/test/corrupt2.test
@@ -69,7 +69,7 @@ do_test corrupt2-1.3 {
forcedelete corrupt.db-journal
forcecopy test.db corrupt.db
set f [open corrupt.db RDWR]
- fconfigure $f -encoding binary
+ fconfigure $f -translation binary
seek $f 16 start
puts -nonewline $f "\x00\xFF"
close $f
@@ -89,7 +89,7 @@ do_test corrupt2-1.4 {
forcedelete corrupt.db-journal
forcecopy test.db corrupt.db
set f [open corrupt.db RDWR]
- fconfigure $f -encoding binary
+ fconfigure $f -translation binary
seek $f 101 start
puts -nonewline $f "\xFF\xFF"
close $f
@@ -109,7 +109,7 @@ do_test corrupt2-1.5 {
forcedelete corrupt.db-journal
forcecopy test.db corrupt.db
set f [open corrupt.db RDWR]
- fconfigure $f -encoding binary
+ fconfigure $f -translation binary
seek $f 101 start
puts -nonewline $f "\x00\xC8"
seek $f 200 start
@@ -179,7 +179,7 @@ do_test corrupt2-3.1 {
# of the DROP TABLE operation below.
#
set fd [open corrupt.db r+]
- fconfigure $fd -encoding binary -translation binary
+ fconfigure $fd -translation binary
seek $fd [expr 1024*3 + 12]
set zCelloffset [read $fd 2]
binary scan $zCelloffset S iCelloffset
@@ -227,7 +227,7 @@ do_test corrupt2-5.1 {
# This block links a page from table t2 into the t1 table structure.
#
set fd [open corrupt.db r+]
- fconfigure $fd -encoding binary -translation binary
+ fconfigure $fd -translation binary
seek $fd [expr 1024 + 12]
set zCelloffset [read $fd 2]
binary scan $zCelloffset S iCelloffset
@@ -392,7 +392,7 @@ corruption_test -sqlprep $sqlprep -corrupt {
# 0x0D (interpreted by SQLite as "leaf page of a table B-Tree").
#
set fd [open corrupt.db r+]
- fconfigure $fd -translation binary -encoding binary
+ fconfigure $fd -translation binary
seek $fd [expr 1024*2 + 8]
set zRightChild [read $fd 4]
binary scan $zRightChild I iRightChild
@@ -410,7 +410,7 @@ corruption_test -sqlprep $sqlprep -corrupt {
# The corruption is detected as part of an OP_Prev opcode.
#
set fd [open corrupt.db r+]
- fconfigure $fd -translation binary -encoding binary
+ fconfigure $fd -translation binary
seek $fd [expr 1024*2 + 12]
set zCellOffset [read $fd 2]
binary scan $zCellOffset S iCellOffset
@@ -431,7 +431,7 @@ corruption_test -sqlprep $sqlprep -corrupt {
# 0x0A (interpreted by SQLite as "leaf page of an index B-Tree").
#
set fd [open corrupt.db r+]
- fconfigure $fd -translation binary -encoding binary
+ fconfigure $fd -translation binary
seek $fd [expr 1024*1 + 8]
set zRightChild [read $fd 4]
binary scan $zRightChild I iRightChild
@@ -459,7 +459,7 @@ corruption_test -sqlprep {
CREATE TABLE x6(a, b, c); CREATE TABLE xD(a, b, c); CREATE TABLE xJ(a, b, c);
} -corrupt {
set fd [open corrupt.db r+]
- fconfigure $fd -translation binary -encoding binary
+ fconfigure $fd -translation binary
seek $fd 108
set zRightChild [read $fd 4]
binary scan $zRightChild I iRightChild
diff --git a/test/corrupt4.test b/test/corrupt4.test
index 5b0965a83..544ac3305 100644
--- a/test/corrupt4.test
+++ b/test/corrupt4.test
@@ -122,7 +122,7 @@ proc put4byte {fd offset val} {
# the second rightmost child page number of page 1 to 1.
#
set fd [open test.db r+]
-fconfigure $fd -encoding binary -translation binary
+fconfigure $fd -translation binary
set nChild [get2byte $fd 103]
set offChild [get2byte $fd [expr 100+12+($nChild-2)*2]]
set pgnoChild [get4byte $fd $offChild]
diff --git a/test/corruptK.test b/test/corruptK.test
index 1569afe4a..0bdb3c45b 100644
--- a/test/corruptK.test
+++ b/test/corruptK.test
@@ -60,7 +60,7 @@ do_test 1.2 {
sqlite3 db test.db
set fd [db incrblob t1 x 3]
- fconfigure $fd -translation binary -encoding binary
+ fconfigure $fd -translation binary
seek $fd 30
puts -nonewline $fd "\x18"
close $fd
@@ -102,7 +102,7 @@ do_test 2.2 {
sqlite3 db test.db
set fd [db incrblob t1 x 5]
- fconfigure $fd -translation binary -encoding binary
+ fconfigure $fd -translation binary
seek $fd 22
puts -nonewline $fd "\x5d"
diff --git a/test/crash.test b/test/crash.test
index c1901daec..f63163659 100644
--- a/test/crash.test
+++ b/test/crash.test
@@ -399,7 +399,7 @@ do_test crash-7.1 {
# Change the checksum value for the master journal name.
set f [open test.db-journal a]
- fconfigure $f -encoding binary
+ fconfigure $f -translation binary
seek $f [expr [file size test.db-journal] - 12]
puts -nonewline $f "\00\00\00\00"
close $f
diff --git a/test/distinct2.test b/test/distinct2.test
index 023e2e333..980b0b1e3 100644
--- a/test/distinct2.test
+++ b/test/distinct2.test
@@ -362,4 +362,22 @@ do_execsql_test 5070 {
SELECT v4.e FROM t3 LEFT JOIN v4 ON true GROUP BY 1;
} NULL
+# 2024-06-28 dbsqlfuzz 46343912848a603e32c6072cae792eb056bac897
+# Do not call sqlite3ExprToRegister() on an expression that is already
+# a register.
+#
+do_execsql_test 5080 {
+ CREATE TABLE dual(dummy TEXT);
+ INSERT INTO dual VALUES('X');
+ SELECT 11 = (
+ SELECT b
+ FROM (
+ SELECT a AS b
+ FROM dual
+ LEFT JOIN (SELECT 22 AS a FROM dual)
+ )
+ GROUP BY b, b
+ );
+} 0
+
finish_test
diff --git a/test/eqp.test b/test/eqp.test
index cd441c271..7da78665a 100644
--- a/test/eqp.test
+++ b/test/eqp.test
@@ -311,7 +311,8 @@ det 3.3.1 {
QUERY PLAN
|--SCAN t1
`--LIST SUBQUERY xxxxxx
- `--SCAN t2
+ |--SCAN t2
+ `--CREATE BLOOM FILTER
}
det 3.3.2 {
SELECT * FROM t1 WHERE y IN (SELECT y FROM t2 WHERE t1.x!=t2.x)
diff --git a/test/exclusive2.test b/test/exclusive2.test
index 92fcd76ab..0a5d2b6eb 100644
--- a/test/exclusive2.test
+++ b/test/exclusive2.test
@@ -41,7 +41,7 @@ sqlite3_soft_heap_limit 0
proc pagerChangeCounter {filename new {fd ""}} {
if {$fd==""} {
set fd [open $filename RDWR]
- fconfigure $fd -translation binary -encoding binary
+ fconfigure $fd -translation binary
set needClose 1
} else {
set needClose 0
@@ -70,7 +70,7 @@ proc pagerChangeCounter {filename new {fd ""}} {
proc readPagerChangeCounter {filename} {
set fd [open $filename RDONLY]
- fconfigure $fd -translation binary -encoding binary
+ fconfigure $fd -translation binary
seek $fd 24
foreach {a b c d} [list 0 0 0 0] {}
diff --git a/test/func6.test b/test/func6.test
index fe90a755d..acca490f3 100644
--- a/test/func6.test
+++ b/test/func6.test
@@ -43,7 +43,7 @@ do_execsql_test func6-100 {
# string.
proc loadhex {file} {
set fd [open $file]
- fconfigure $fd -translation binary -encoding binary
+ fconfigure $fd -translation binary
set data [read $fd]
close $fd
binary encode hex $data
diff --git a/test/func7.test b/test/func7.test
index bb4f80b32..6026b557f 100644
--- a/test/func7.test
+++ b/test/func7.test
@@ -100,13 +100,13 @@ do_execsql_test func7-pg-300 {
SELECT acos(1);
} {0.0}
do_execsql_test func7-pg-301 {
- SELECT degrees(acos(0.5));
+ SELECT format('%f',degrees(acos(0.5)));
} {60.0}
do_execsql_test func7-pg-310 {
SELECT round( asin(1), 7);
} {1.5707963}
do_execsql_test func7-pg-311 {
- SELECT degrees( asin(0.5) );
+ SELECT format('%f',degrees( asin(0.5) ));
} {30.0}
do_execsql_test func7-pg-320 {
SELECT round( atan(1), 7);
@@ -139,7 +139,7 @@ do_execsql_test func7-pg-420 {
SELECT round( tan(1), 7);
} {1.5574077}
do_execsql_test func7-pg-421 {
- SELECT tan( radians(45) );
+ SELECT round(tan( radians(45) ),10);
} {1.0}
do_execsql_test func7-pg-500 {
SELECT round( sinh(1), 7);
diff --git a/test/fuzz3.test b/test/fuzz3.test
index bf778ed2b..8ac1f4d58 100644
--- a/test/fuzz3.test
+++ b/test/fuzz3.test
@@ -83,7 +83,7 @@ proc modify_database {iMod} {
set offset [expr {$iMod>>8}]
set fd [open test.db r+]
- fconfigure $fd -encoding binary -translation binary
+ fconfigure $fd -translation binary
seek $fd $offset
set old_blob [read $fd 1]
seek $fd $offset
diff --git a/test/in7.test b/test/in7.test
index 099f75c5f..29013ff59 100644
--- a/test/in7.test
+++ b/test/in7.test
@@ -137,5 +137,61 @@ do_execsql_test 2.1 {
SELECT b FROM t1 WHERE a IN (1,2,3) ORDER BY b ASC NULLS LAST;
} {one three {}}
+#-------------------------------------------------------------------------
+reset_db
+do_execsql_test 3.0 {
+ CREATE TABLE x1(a);
+ INSERT INTO x1 VALUES(1), (2), (3);
+
+ CREATE TABLE x2(b);
+ INSERT INTO x2 VALUES(4), (5), (6);
+
+ CREATE TABLE t1(u);
+ INSERT INTO t1 VALUES(1), (2), (3), (4), (5), (6);
+
+ CREATE VIEW v1 AS SELECT u FROM t1 WHERE u IN (
+ SELECT a FROM x1
+ );
+ CREATE VIEW v2 AS SELECT u FROM t1 WHERE u IN (
+ SELECT b FROM x2
+ );
+}
+
+do_execsql_test 3.1 {
+ SELECT * FROM v1
+} {
+ 1 2 3
+}
+
+do_execsql_test 3.2 {
+ SELECT * FROM v2
+} {
+ 4 5 6
+}
+
+do_execsql_test 3.3 {
+ SELECT * FROM v2
+ UNION ALL
+ SELECT * FROM v1
+} {
+ 4 5 6
+ 1 2 3
+}
+
+do_execsql_test 3.4 {
+ WITH w1 AS (
+ SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3
+ ),
+ w2 AS (
+ SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6
+ )
+ SELECT * FROM v1 WHERE u IN w1
+ UNION ALL
+ SELECT * FROM v2 WHERE u IN w2
+} {
+ 1 2 3 4 5 6
+}
+
+
finish_test
diff --git a/test/incrvacuum3.test b/test/incrvacuum3.test
index e901bfe1f..b4cbc8b0c 100644
--- a/test/incrvacuum3.test
+++ b/test/incrvacuum3.test
@@ -50,8 +50,8 @@ proc check_on_disk {} {
set sz [file size test.db]
set fd [open test.db]
set fd2 [open test2.db w]
- fconfigure $fd -encoding binary -translation binary
- fconfigure $fd2 -encoding binary -translation binary
+ fconfigure $fd -translation binary
+ fconfigure $fd2 -translation binary
if {$sz>$::sqlite_pending_byte} {
puts -nonewline $fd2 [read $fd $::sqlite_pending_byte]
seek $fd [expr $::sqlite_pending_byte+512]
diff --git a/test/ioerr.test b/test/ioerr.test
index 29a3dede8..fb54d8b38 100644
--- a/test/ioerr.test
+++ b/test/ioerr.test
@@ -225,7 +225,7 @@ if {$tcl_platform(platform)=="unix" && [atomic_batch_write test.db]==0} {
}
forcecopy test2.db-journal test.db-journal
set f [open test.db-journal a]
- fconfigure $f -encoding binary
+ fconfigure $f -translation binary
puts -nonewline $f "hello"
puts -nonewline $f "\x00\x00\x00\x05\x01\x02\x03\x04"
puts -nonewline $f "\xd9\xd5\x05\xf9\x20\xa1\x63\xd7"
diff --git a/test/ioerr5.test b/test/ioerr5.test
index a430f5340..a0a74bd95 100644
--- a/test/ioerr5.test
+++ b/test/ioerr5.test
@@ -117,7 +117,7 @@ foreach locking_mode {normal exclusive} {
# Read the contents of the database file into a Tcl variable.
#
set fd [open test.db]
- fconfigure $fd -translation binary -encoding binary
+ fconfigure $fd -translation binary
set zDatabase [read $fd]
close $fd
@@ -138,7 +138,7 @@ foreach locking_mode {normal exclusive} {
#
do_test ioerr5-1.$locking_mode-$iFail.4 {
set fd [open test.db]
- fconfigure $fd -translation binary -encoding binary
+ fconfigure $fd -translation binary
set zDatabase2 [read $fd]
close $fd
expr {$zDatabase eq $zDatabase2}
diff --git a/test/lock5.test b/test/lock5.test
index d5950118c..e0c88aedc 100644
--- a/test/lock5.test
+++ b/test/lock5.test
@@ -207,7 +207,7 @@ if {[permutation]!="inmemory_journal"} {
# not commit it.
# 3. Make a copy of the database files on disk.
# 4. Try to read from the copy using unix-dotfile VFS. This fails because
- # the dotfile still exists, so SQLite things the database is locked.
+ # the dotfile still exists, so SQLite thinks the database is locked.
# 5. Remove the dotfile.
# 6. Try to read the db again. This time, the old transaction is rolled
# back and the read permitted.
@@ -269,5 +269,3 @@ if {[permutation]!="inmemory_journal"} {
}
finish_test
-
-
diff --git a/test/memdb1.test b/test/memdb1.test
index 3a31c8e28..c0510abae 100644
--- a/test/memdb1.test
+++ b/test/memdb1.test
@@ -245,7 +245,7 @@ if {[wal_is_capable]} {
db close
set fd [open test.db]
- fconfigure $fd -translation binary -encoding binary
+ fconfigure $fd -translation binary
set data [read $fd [expr 20*1024]]
close $fd
diff --git a/test/misc3.test b/test/misc3.test
index bc1f0ff91..f64b0fe1d 100644
--- a/test/misc3.test
+++ b/test/misc3.test
@@ -88,8 +88,8 @@ do_test misc3-2.4 {
execsql {SELECT 2e-25*0.5e250}
} 1e+225
do_test misc3-2.5 {
- execsql {SELECT 2.0e-250*0.5e25}
-} 1e-225
+ execsql {SELECT format('%.15e',2.0e-250*0.5e25)}
+} {1.0000000000000e-225}
do_test misc3-2.6 {
execsql {SELECT '-2.0e-127' * '-0.5e27'}
} 1e-100
diff --git a/test/nan.test b/test/nan.test
index 615a4ad22..8d8a98ab3 100644
--- a/test/nan.test
+++ b/test/nan.test
@@ -281,6 +281,7 @@ do_test nan-4.14 {
# These tests test some really, really small floating point numbers.
#
+load_static_extension db decimal
if {$tcl_platform(platform) != "symbian"} {
# These two are not run on symbian because tcl has trouble converting
# the very small numbers back to text form (probably due to a difference
@@ -291,15 +292,15 @@ if {$tcl_platform(platform) != "symbian"} {
set small \
[string repeat 0 10000].[string repeat 0 323][string repeat 9 10000]
db eval "INSERT INTO t1 VALUES($small)"
- db eval {SELECT x, typeof(x) FROM t1}
- } {9.88131291682493e-324 real}
+ db eval {SELECT decimal_exp(x), typeof(x) FROM t1}
+ } {/9\.88131291682493\d*e-324 real/}
do_test nan-4.16 {
db eval {DELETE FROM t1}
set small \
-[string repeat 0 10000].[string repeat 0 323][string repeat 9 10000]
db eval "INSERT INTO t1 VALUES($small)"
- db eval {SELECT x, typeof(x) FROM t1}
- } {-9.88131291682493e-324 real}
+ db eval {SELECT decimal_exp(x), typeof(x) FROM t1}
+ } {/-9\.88131291682493\d*e-324 real/}
}
do_test nan-4.17 {
db eval {DELETE FROM t1}
diff --git a/test/pendingrace.test b/test/pendingrace.test
index ef42578f2..80160149a 100644
--- a/test/pendingrace.test
+++ b/test/pendingrace.test
@@ -61,12 +61,12 @@ proc my_db_restore {} {
forcecopy sv_test.db-journal test.db-journal
set fd1 [open sv_test.db r]
- fconfigure $fd1 -encoding binary -translation binary
+ fconfigure $fd1 -translation binary
set data [read $fd1]
close $fd1
set fd1 [open test.db w]
- fconfigure $fd1 -encoding binary -translation binary
+ fconfigure $fd1 -translation binary
puts -nonewline $fd1 $data
close $fd1
}
diff --git a/test/percentile.test b/test/percentile.test
index b2bd061e8..ab5b4883f 100644
--- a/test/percentile.test
+++ b/test/percentile.test
@@ -38,6 +38,23 @@ foreach {in out} {
execsql {SELECT percentile(x,$in) FROM t1}
} $out
}
+do_execsql_test percentile-1.1.median {
+ SELECT median(x) FROM t1;
+} 8.0
+
+foreach {in out} {
+ 1.0 11.0
+ 0.5 8.0
+ 0.125 4.0
+ 0.15 4.4
+ 0.2 5.2
+ 0.8 11.0
+ 0.89 11.0
+} {
+ do_test percentile-1.1b-$in {
+ execsql {SELECT percentile_cont(x,$in) FROM t1}
+ } $out
+}
# Add some NULL values.
#
@@ -109,6 +126,9 @@ do_test percentile-1.11 {
do_test percentile-1.12 {
catchsql {SELECT percentile(x,x'3530') FROM t1}
} {1 {2nd argument to percentile() is not a number between 0.0 and 100.0}}
+do_test percentile-1.12b {
+ catchsql {SELECT percentile_cont(x,x'3530') FROM t1}
+} {1 {2nd argument to percentile_cont() is not a number between 0.0 and 1.0}}
# Second argument is out of range
#
@@ -118,6 +138,9 @@ do_test percentile-1.13 {
do_test percentile-1.14 {
catchsql {SELECT percentile(x,100.0000001) FROM t1}
} {1 {2nd argument to percentile() is not a number between 0.0 and 100.0}}
+do_test percentile-1.14b {
+ catchsql {SELECT percentile_cont(x,1.0000001) FROM t1}
+} {1 {2nd argument to percentile_cont() is not a number between 0.0 and 1.0}}
# First argument is not NULL and is not NUMERIC
#
diff --git a/test/pushdown.test b/test/pushdown.test
index 5c3e8182d..271d412e7 100644
--- a/test/pushdown.test
+++ b/test/pushdown.test
@@ -275,14 +275,13 @@ do_eqp_test 6.1 {
| | `--LIST SUBQUERY xxxxxx
| | |--MATERIALIZE k
| | | `--SCAN 3 CONSTANT ROWS
- | | `--SCAN k
+ | | |--SCAN k
+ | | `--CREATE BLOOM FILTER
| `--UNION ALL
| |--SEARCH t02 USING INDEX t02x (w=? AND x=? AND y>? AND y<?)
- | `--LIST SUBQUERY xxxxxx
- | `--SCAN k
+ | `--REUSE LIST SUBQUERY xxxxxx
|--SEARCH t0
- `--LIST SUBQUERY xxxxxx
- `--SCAN k
+ `--REUSE LIST SUBQUERY xxxxxx
}
# ^^^^--- The key feature above is that the SEARCH for each subquery
# uses all three fields of the index w, x, and y. Prior to the push-down
@@ -300,18 +299,13 @@ do_eqp_test 6.2 {
| | `--LIST SUBQUERY xxxxxx
| | |--CO-ROUTINE v1
| | | `--SCAN 3 CONSTANT ROWS
- | | `--SCAN v1
+ | | |--SCAN v1
+ | | `--CREATE BLOOM FILTER
| `--UNION ALL
| |--SEARCH t02 USING INDEX t02x (w=? AND x=? AND y>? AND y<?)
- | `--LIST SUBQUERY xxxxxx
- | |--CO-ROUTINE v1
- | | `--SCAN 3 CONSTANT ROWS
- | `--SCAN v1
+ | `--REUSE LIST SUBQUERY xxxxxx
|--SEARCH t0
- `--LIST SUBQUERY xxxxxx
- |--CO-ROUTINE v1
- | `--SCAN 3 CONSTANT ROWS
- `--SCAN v1
+ `--REUSE LIST SUBQUERY xxxxxx
}
do_eqp_test 6.3 {
SELECT max(z) FROM t0 WHERE w=123 AND x IN k1 AND y BETWEEN 44 AND 55;
@@ -322,14 +316,13 @@ do_eqp_test 6.3 {
| |--LEFT-MOST SUBQUERY
| | |--SEARCH t01 USING INDEX t01x (w=? AND x=? AND y>? AND y<?)
| | `--LIST SUBQUERY xxxxxx
- | | `--SCAN k1
+ | | |--SCAN k1
+ | | `--CREATE BLOOM FILTER
| `--UNION ALL
| |--SEARCH t02 USING INDEX t02x (w=? AND x=? AND y>? AND y<?)
- | `--LIST SUBQUERY xxxxxx
- | `--SCAN k1
+ | `--REUSE LIST SUBQUERY xxxxxx
|--SEARCH t0
- `--LIST SUBQUERY xxxxxx
- `--SCAN k1
+ `--REUSE LIST SUBQUERY xxxxxx
}
finish_test
diff --git a/test/readonly.test b/test/readonly.test
index 1ccbcee28..303300e6f 100644
--- a/test/readonly.test
+++ b/test/readonly.test
@@ -15,7 +15,10 @@
set testdir [file dirname $argv0]
source $testdir/tester.tcl
-if {$tcl_platform(platform)=="windows"} finish_test
+if {$tcl_platform(platform)=="windows"} {
+ finish_test
+ return
+}
source $testdir/lock_common.tcl
source $testdir/wal_common.tcl
set ::testprefix readonly
diff --git a/test/recover.test b/test/recover.test
index 5495b7a00..268d3a55b 100644
--- a/test/recover.test
+++ b/test/recover.test
@@ -43,7 +43,6 @@ proc compare_dbs {db1 db2} {
proc recover_with_opts {opts} {
set cmd ".recover $opts"
set fd [open [list |$::CLI test.db $cmd]]
- fconfigure $fd -encoding binary
fconfigure $fd -translation binary
set sql [read $fd]
close $fd
diff --git a/test/rollback.test b/test/rollback.test
index 423bf20fc..f32ce523e 100644
--- a/test/rollback.test
+++ b/test/rollback.test
@@ -111,7 +111,7 @@ if {$tcl_platform(platform) == "unix"
]
set iOffset [expr (([file size testA.db-journal] + 511)/512)*512]
set fd [open testA.db-journal a+]
- fconfigure $fd -encoding binary -translation binary
+ fconfigure $fd -translation binary
seek $fd $iOffset
puts -nonewline $fd $zAppend
diff --git a/test/rowvalue4.test b/test/rowvalue4.test
index 784859cb1..1ef5fc292 100644
--- a/test/rowvalue4.test
+++ b/test/rowvalue4.test
@@ -236,9 +236,11 @@ do_eqp_test 5.1 {
QUERY PLAN
|--SEARCH d2 USING INDEX d2ab (a=? AND b=?)
|--LIST SUBQUERY xxxxxx
- | `--SCAN d1
+ | |--SCAN d1
+ | `--CREATE BLOOM FILTER
`--LIST SUBQUERY xxxxxx
- `--SCAN d1
+ |--SCAN d1
+ `--CREATE BLOOM FILTER
}
do_execsql_test 6.0 {
diff --git a/test/scanstatus2.test b/test/scanstatus2.test
index 7f107cd2e..c94db88f2 100644
--- a/test/scanstatus2.test
+++ b/test/scanstatus2.test
@@ -265,7 +265,7 @@ ifcapable trace {
}
proc trace {stmt sql} {
- array set A [sqlite3_stmt_scanstatus -flags complex [format %x $stmt] 0]
+ array set A [sqlite3_stmt_scanstatus -flags complex [format %llx $stmt] 0]
lappend ::trace_explain $A(zExplain)
}
db trace_v2 trace
diff --git a/test/shell1.test b/test/shell1.test
index 206fb0a4f..f355989c3 100644
--- a/test/shell1.test
+++ b/test/shell1.test
@@ -1059,7 +1059,7 @@ do_test shell1-5.0 {
continue
}
# Tcl 8.7 maps 0x80 through 0x9f into valid UTF8. So skip those tests.
- if {$i>=0x80 && $i<=0x9f} continue
+ if {$i>=0x80 && ($i<=0x9F || $tcl_version>=9.0)} continue
if {$i>=0xE0 && $tcl_platform(os)=="OpenBSD"} continue
if {$i>=0xE0 && $i<=0xEF && $tcl_platform(os)=="Linux"} continue
set hex [format %02X $i]
diff --git a/test/shell5.test b/test/shell5.test
index 8727edaaf..31d5449fd 100644
--- a/test/shell5.test
+++ b/test/shell5.test
@@ -410,7 +410,7 @@ CREATE TABLE t4(a, b);
#
do_test shell5-3.1 {
set fd [open shell5.csv w]
- fconfigure $fd -encoding binary -translation binary
+ fconfigure $fd -translation binary
puts -nonewline $fd "\"test 1\"\x1F,test 2\r\n\x1E"
puts -nonewline $fd "test 3\x1Ftest 4\n"
close $fd
diff --git a/test/shell7.test b/test/shell7.test
index dfd9e47c2..460789e54 100644
--- a/test/shell7.test
+++ b/test/shell7.test
@@ -33,7 +33,6 @@ do_execsql_test 1.0 {
foreach {tn l x} [db eval { SELECT tn, length(x) AS l, x FROM f1 }] {
forcedelete shell7_test.bin
set fd [open shell7_test.bin w]
- fconfigure $fd -encoding binary
fconfigure $fd -translation binary
puts -nonewline $fd $x
close $fd
diff --git a/test/superlock.test b/test/superlock.test
index 704b0677a..10e7caa29 100644
--- a/test/superlock.test
+++ b/test/superlock.test
@@ -166,7 +166,7 @@ do_multiclient_test tn {
proc read_content {file} {
if {[file exists $file]==0} {return ""}
set fd [open $file]
- fconfigure $fd -encoding binary -translation binary
+ fconfigure $fd -translation binary
set content [read $fd]
close $fd
return $content
@@ -174,7 +174,7 @@ proc read_content {file} {
proc write_content {file content} {
set fd [open $file w+]
- fconfigure $fd -encoding binary -translation binary
+ fconfigure $fd -translation binary
puts -nonewline $fd $content
close $fd
}
diff --git a/test/syscall.test b/test/syscall.test
index 19313a5e6..fe4a4177f 100644
--- a/test/syscall.test
+++ b/test/syscall.test
@@ -211,7 +211,7 @@ forcedelete test.db test.db2
proc create_db_file {nByte} {
set fd [open test.db w]
- fconfigure $fd -translation binary -encoding binary
+ fconfigure $fd -translation binary
puts -nonewline $fd [string range "xSQLite" 1 $nByte]
close $fd
}
diff --git a/test/tester.tcl b/test/tester.tcl
index b96bc505d..63c83187a 100644
--- a/test/tester.tcl
+++ b/test/tester.tcl
@@ -310,66 +310,6 @@ proc do_delete_file {force args} {
}
}
-if {$::tcl_platform(platform) eq "windows"} {
- proc do_remove_win32_dir {args} {
- set nRetry [getFileRetries] ;# Maximum number of retries.
- set nDelay [getFileRetryDelay] ;# Delay in ms before retrying.
-
- foreach dirName $args {
- # On windows, sometimes even a [remove_win32_dir] can fail just after
- # a directory is emptied. The cause is usually "tag-alongs" - programs
- # like anti-virus software, automatic backup tools and various explorer
- # extensions that keep a file open a little longer than we expect,
- # causing the delete to fail.
- #
- # The solution is to wait a short amount of time before retrying the
- # removal.
- #
- if {$nRetry > 0} {
- for {set i 0} {$i < $nRetry} {incr i} {
- set rc [catch {
- remove_win32_dir $dirName
- } msg]
- if {$rc == 0} break
- if {$nDelay > 0} { after $nDelay }
- }
- if {$rc} { error $msg }
- } else {
- remove_win32_dir $dirName
- }
- }
- }
-
- proc do_delete_win32_file {args} {
- set nRetry [getFileRetries] ;# Maximum number of retries.
- set nDelay [getFileRetryDelay] ;# Delay in ms before retrying.
-
- foreach fileName $args {
- # On windows, sometimes even a [delete_win32_file] can fail just after
- # a file is closed. The cause is usually "tag-alongs" - programs like
- # anti-virus software, automatic backup tools and various explorer
- # extensions that keep a file open a little longer than we expect,
- # causing the delete to fail.
- #
- # The solution is to wait a short amount of time before retrying the
- # delete.
- #
- if {$nRetry > 0} {
- for {set i 0} {$i < $nRetry} {incr i} {
- set rc [catch {
- delete_win32_file $fileName
- } msg]
- if {$rc == 0} break
- if {$nDelay > 0} { after $nDelay }
- }
- if {$rc} { error $msg }
- } else {
- delete_win32_file $fileName
- }
- }
- }
-}
-
proc execpresql {handle args} {
trace remove execution $handle enter [list execpresql $handle]
if {[info exists ::G(perm:presql)]} {
@@ -847,6 +787,9 @@ proc do_test {name cmd expected} {
}
} else {
set ok [expr {[string compare $result $expected]==0}]
+ if {!$ok} {
+ set ok [fpnum_compare $result $expected]
+ }
}
if {!$ok} {
# if {![info exists ::testprefix] || $::testprefix eq ""} {
@@ -897,7 +840,7 @@ proc catchsafecmd {db {cmd ""}} {
proc catchcmdex {db {cmd ""}} {
global CLI
set out [open cmds.txt w]
- fconfigure $out -encoding binary -translation binary
+ fconfigure $out -translation binary
puts -nonewline $out $cmd
close $out
set line "exec -keepnewline -- $CLI $db < cmds.txt"
@@ -905,7 +848,7 @@ proc catchcmdex {db {cmd ""}} {
foreach chan $chans {
catch {
set modes($chan) [fconfigure $chan]
- fconfigure $chan -encoding binary -translation binary -buffering none
+ fconfigure $chan -translation binary -buffering none
}
}
set rc [catch { eval $line } msg]
diff --git a/test/testrunner.tcl b/test/testrunner.tcl
index fd8271676..b32052873 100644
--- a/test/testrunner.tcl
+++ b/test/testrunner.tcl
@@ -399,7 +399,7 @@ if {[llength $argv]==1
}
sqlite3 mydb $TRG(dbname)
- mydb timeout 1000
+ mydb timeout 2000
mydb eval BEGIN
set cmdline [mydb one { SELECT value FROM config WHERE name='cmdline' }]
@@ -447,7 +447,7 @@ if {[llength $argv]==1
} job {
display_job [array get job]
}
- set nOmit [db one {SELECT count(*) FROM jobs WHERE state='omit'}]
+ set nOmit [mydb one {SELECT count(*) FROM jobs WHERE state='omit'}]
if {$nOmit} {
puts "$nOmit jobs omitted due to failures"
}
@@ -963,6 +963,7 @@ proc add_jobs_from_cmdline {patternlist} {
proc make_new_testset {} {
global TRG
+ trdb eval {PRAGMA journal_mode=WAL;}
r_write_db {
trdb eval $TRG(schema)
set nJob $TRG(nJob)
@@ -1117,7 +1118,7 @@ proc launch_another_job {iJob} {
set fd [open "|$TRG(runcmd) 2>@1" r]
cd $pwd
- fconfigure $fd -blocking false
+ fconfigure $fd -blocking false -translation binary
fileevent $fd readable [list script_input_ready $fd $iJob $job(jobid)]
}
diff --git a/test/testrunner_data.tcl b/test/testrunner_data.tcl
index f8f12d91a..af480fc4c 100644
--- a/test/testrunner_data.tcl
+++ b/test/testrunner_data.tcl
@@ -486,7 +486,7 @@ proc make_sh_script {srcdir opts cflags makeOpts configOpts} {
TCLDIR="$tcldir"
if [ ! -f Makefile ] ; then
- \$SRCDIR/configure --with-tcl=\$TCL $configOpts
+ \$SRCDIR/configure --with-tcl=\$TCLDIR $configOpts
fi
$myopts
diff --git a/test/tkt-2d1a5c67d.test b/test/tkt-2d1a5c67d.test
index 1f797686b..5dad78169 100644
--- a/test/tkt-2d1a5c67d.test
+++ b/test/tkt-2d1a5c67d.test
@@ -102,6 +102,7 @@ do_test 3.4 {
set blobs [list]
for {set i 1} {$i<100} {incr i} {
set b [db incrblob -readonly t3 b $i]
+ fconfigure $b -translation binary
read $b
lappend blobs $b
}
diff --git a/test/tkt3457.test b/test/tkt3457.test
index 24b4f0eac..027349463 100644
--- a/test/tkt3457.test
+++ b/test/tkt3457.test
@@ -58,7 +58,7 @@ do_test tkt3457-1.1 {
# start of the first journal-header has not been written by SQLite.
# So write it now.
set fd [open bak.db-journal a+]
- fconfigure $fd -encoding binary -translation binary
+ fconfigure $fd -translation binary
seek $fd 0
puts -nonewline $fd "\xd9\xd5\x05\xf9\x20\xa1\x63\xd7"
close $fd
diff --git a/test/types3.test b/test/types3.test
index 0ff346ce2..457ee6d68 100644
--- a/test/types3.test
+++ b/test/types3.test
@@ -18,10 +18,9 @@ source $testdir/tester.tcl
# A variable with only a string representation comes in as TEXT
do_test types3-1.1 {
- set V {}
- append V x
+ set V [format %s xxxxx]
concat [tcl_variable_type V] [execsql {SELECT typeof(:V)}]
-} {string text}
+} {text}
# A variable with an integer representation comes in as INTEGER
do_test types3-1.2 {
diff --git a/test/vtabH.test b/test/vtabH.test
index f1a046655..cf3dcafd9 100644
--- a/test/vtabH.test
+++ b/test/vtabH.test
@@ -128,10 +128,10 @@ if {$tcl_platform(platform)=="windows"} {
set drive [string range [pwd] 0 1]
set ::env(fstreeDrive) $drive
}
+reset_db
+register_fs_module db
if {$tcl_platform(platform)!="windows" || \
[regexp -nocase -- {^[A-Z]:} $drive]} {
- reset_db
- register_fs_module db
do_execsql_test 3.0 {
SELECT name FROM fsdir WHERE dir = '.' AND name = 'test.db';
SELECT name FROM fsdir WHERE dir = '.' AND name = '.'
diff --git a/test/wal.test b/test/wal.test
index 234668240..50988debe 100644
--- a/test/wal.test
+++ b/test/wal.test
@@ -1219,7 +1219,7 @@ foreach {tn pgsz works} {
set framehdr [binary format IIIIII $pg 5 22 23 $c1 $c2]
set fd [open test.db-wal w]
- fconfigure $fd -encoding binary -translation binary
+ fconfigure $fd -translation binary
puts -nonewline $fd $walhdr
puts -nonewline $fd $framehdr
puts -nonewline $fd $framebody
diff --git a/test/wal2.test b/test/wal2.test
index ae6134d8b..5e4c4ebc2 100644
--- a/test/wal2.test
+++ b/test/wal2.test
@@ -1098,7 +1098,11 @@ if {$::tcl_platform(platform) == "unix"} {
3 00600
4 00755
} {
- set effective [format %.5o [expr $permissions & ~$umask]]
+ if {$tcl_version>=9.0} {
+ set effective [format %.5d [expr $permissions & ~$umask]]
+ } else {
+ set effective [format %.5o [expr $permissions & ~$umask]]
+ }
do_test wal2-12.2.$tn.1 {
file attributes test.db -permissions $permissions
string map {o 0} [file attributes test.db -permissions]
diff --git a/test/wal_common.tcl b/test/wal_common.tcl
index 917ad598f..cdba53b5b 100644
--- a/test/wal_common.tcl
+++ b/test/wal_common.tcl
@@ -65,7 +65,6 @@ proc wal_set_walhdr {filename {intlist {}}} {
set fd [open $filename r+]
fconfigure $fd -translation binary
- fconfigure $fd -encoding binary
seek $fd 0
puts -nonewline $fd $blob
close $fd
@@ -73,7 +72,6 @@ proc wal_set_walhdr {filename {intlist {}}} {
set fd [open $filename]
fconfigure $fd -translation binary
- fconfigure $fd -encoding binary
set blob [read $fd 24]
close $fd
@@ -89,5 +87,3 @@ proc wal_fix_walindex_cksum {hdrvar} {
lset hdr 10 $c1
lset hdr 11 $c2
}
-
-
diff --git a/test/walcksum.test b/test/walcksum.test
index f3fc42711..10329ba6c 100644
--- a/test/walcksum.test
+++ b/test/walcksum.test
@@ -22,7 +22,6 @@ ifcapable !wal {finish_test ; return }
#
proc readfile {filename} {
set fd [open $filename]
- fconfigure $fd -encoding binary
fconfigure $fd -translation binary
set data [read $fd]
close $fd
@@ -59,7 +58,6 @@ proc log_checksum_write {filename iFrame endian} {
set bin [binary format II $c1 $c2]
set fd [open $filename r+]
- fconfigure $fd -encoding binary
fconfigure $fd -translation binary
seek $fd $offset
puts -nonewline $fd $bin
@@ -114,7 +112,6 @@ proc log_checksum_writemagic {filename endian} {
set val [expr {0x377f0682 | ($endian == "big" ? 1 : 0)}]
set bin [binary format I $val]
set fd [open $filename r+]
- fconfigure $fd -encoding binary
fconfigure $fd -translation binary
puts -nonewline $fd $bin
diff --git a/test/walslow.test b/test/walslow.test
index 2a52a225d..6a0f147a0 100644
--- a/test/walslow.test
+++ b/test/walslow.test
@@ -109,7 +109,6 @@ foreach incr {1 2 3 20 40 60 80 100 120 140 160 180 200 220 240 253 254 255} {
forcecopy test.db-wal test2.db-wal
set fd [open test2.db-wal r+]
- fconfigure $fd -encoding binary
fconfigure $fd -translation binary
seek $fd $iOff
diff --git a/test/win32longpath.test b/test/win32longpath.test
index 01b4af70a..c0eac8d9d 100644
--- a/test/win32longpath.test
+++ b/test/win32longpath.test
@@ -49,19 +49,19 @@ set longPath(1) \\\\?\\$path\\[pid]
set uriPath(1a) %5C%5C%3F%5C$path\\[pid]
set uriPath(1b) %5C%5C%3F%5C$rawPath/[pid]
-make_win32_dir $longPath(1)
+file mkdir $longPath(1)
set longPath(2) $longPath(1)\\[string repeat X 255]
set uriPath(2a) $uriPath(1a)\\[string repeat X 255]
set uriPath(2b) $uriPath(1b)/[string repeat X 255]
-make_win32_dir $longPath(2)
+file mkdir $longPath(2)
set longPath(3) $longPath(2)\\[string repeat Y 255]
set uriPath(3a) $uriPath(2a)\\[string repeat Y 255]
set uriPath(3b) $uriPath(2b)/[string repeat Y 255]
-make_win32_dir $longPath(3)
+file mkdir $longPath(3)
set fileName $longPath(3)\\test.db
@@ -92,7 +92,6 @@ do_test 1.4 {
} {5 6 7 8}
db3 close
-# puts " Database exists \{[exists_win32_path $fileName]\}"
sqlite3 db3 $fileName -vfs win32-longpath
@@ -115,7 +114,6 @@ do_test 1.6 {
} {5 6 7 8 9 10 11 12}
db3 close
-# puts " Database exists \{[exists_win32_path $fileName]\}"
foreach tn {1a 1b 1c 1d 1e 1f} {
sqlite3 db3 $uri($tn) -vfs win32-longpath -uri 1 -translatefilename 0
@@ -129,11 +127,9 @@ foreach tn {1a 1b 1c 1d 1e 1f} {
db3 close
}
-do_delete_win32_file $fileName
-# puts " Files remaining \{[find_win32_file $longPath(3)\\*]\}"
-
-do_remove_win32_dir $longPath(3)
-do_remove_win32_dir $longPath(2)
-do_remove_win32_dir $longPath(1)
+file delete -force $fileName
+file delete -force $longPath(3)
+file delete -force $longPath(2)
+file delete -force $longPath(1)
finish_test
diff --git a/test/zipfile.test b/test/zipfile.test
index 4d09e08b1..0f854a676 100644
--- a/test/zipfile.test
+++ b/test/zipfile.test
@@ -10,7 +10,10 @@
#***********************************************************************
#
-package require Tcl 8.6
+if {$tcl_version<8.6} {
+ puts "Requires TCL 8.6 or later"
+ return
+}
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@@ -30,7 +33,7 @@ if {[catch {load_static_extension db fileio} error]} {
proc readfile {f} {
set fd [open $f]
- fconfigure $fd -translation binary -encoding binary
+ fconfigure $fd -translation binary
set data [read $fd]
close $fd
set data
diff --git a/test/zipfile2.test b/test/zipfile2.test
index 987e4f0cf..5277cd58f 100644
--- a/test/zipfile2.test
+++ b/test/zipfile2.test
@@ -10,7 +10,10 @@
#***********************************************************************
#
-package require Tcl 8.6
+if {$tcl_version<8.6} {
+ puts "Requires TCL 8.6 or later"
+ return
+}
set testdir [file dirname $argv0]
source $testdir/tester.tcl