aboutsummaryrefslogtreecommitdiff
path: root/test/tester.tcl
diff options
context:
space:
mode:
Diffstat (limited to 'test/tester.tcl')
-rw-r--r--test/tester.tcl42
1 files changed, 41 insertions, 1 deletions
diff --git a/test/tester.tcl b/test/tester.tcl
index 47a71debe..dc0c73eab 100644
--- a/test/tester.tcl
+++ b/test/tester.tcl
@@ -374,6 +374,12 @@ proc do_not_use_codec {} {
reset_db
}
+# Return true if the "reserved_bytes" integer on database files is non-zero.
+#
+proc nonzero_reserved_bytes {} {
+ return [sqlite3 -has-codec]
+}
+
# Print a HELP message and exit
#
proc print_help_and_quit {} {
@@ -411,6 +417,8 @@ if {[info exists cmdlinearg]==0} {
# --match=$pattern
# --verbose=$val
# --output=$filename
+ # -q Reduce output
+ # --testdir=$dir Run tests in subdirectory $dir
# --help
#
set cmdlinearg(soft-heap-limit) 0
@@ -425,6 +433,7 @@ if {[info exists cmdlinearg]==0} {
set cmdlinearg(match) ""
set cmdlinearg(verbose) ""
set cmdlinearg(output) ""
+ set cmdlinearg(testdir) "testdir"
set leftover [list]
foreach a $argv {
@@ -454,6 +463,7 @@ if {[info exists cmdlinearg]==0} {
}
{^-+binarylog=.+$} {
foreach {dummy cmdlinearg(binarylog)} [split $a =] break
+ set cmdlinearg(binarylog) [file normalize $cmdlinearg(binarylog)]
}
{^-+soak=.+$} {
foreach {dummy cmdlinearg(soak)} [split $a =] break
@@ -486,6 +496,7 @@ if {[info exists cmdlinearg]==0} {
{^-+output=.+$} {
foreach {dummy cmdlinearg(output)} [split $a =] break
+ set cmdlinearg(output) [file normalize $cmdlinearg(output)]
if {$cmdlinearg(verbose)==""} {
set cmdlinearg(verbose) 2
}
@@ -498,6 +509,9 @@ if {[info exists cmdlinearg]==0} {
error "option --verbose= must be set to a boolean or to \"file\""
}
}
+ {^-+testdir=.*$} {
+ foreach {dummy cmdlinearg(testdir)} [split $a =] break
+ }
{.*help.*} {
print_help_and_quit
}
@@ -507,10 +521,18 @@ if {[info exists cmdlinearg]==0} {
}
default {
- lappend leftover $a
+ lappend leftover [file normalize $a]
}
}
}
+ set testdir [file normalize $testdir]
+ set cmdlinearg(TESTFIXTURE_HOME) [pwd]
+ set cmdlinearg(INFO_SCRIPT) [file normalize [info script]]
+ set argv0 [file normalize $argv0]
+ if {$cmdlinearg(testdir)!=""} {
+ file mkdir $cmdlinearg(testdir)
+ cd $cmdlinearg(testdir)
+ }
set argv $leftover
# Install the malloc layer used to inject OOM errors. And the 'automatic'
@@ -2120,6 +2142,24 @@ proc test_restore_config_pagecache {} {
sqlite3 db test.db
}
+# Find the name of the 'shell' executable (e.g. "sqlite3.exe") to use for
+# the tests in shell[1-5].test. If no such executable can be found, invoke
+# [finish_test ; return] in the callers context.
+#
+proc test_find_cli {} {
+ if {$::tcl_platform(platform)=="windows"} {
+ set ret "sqlite3.exe"
+ } else {
+ set ret "sqlite3"
+ }
+ set ret [file normalize [file join $::cmdlinearg(TESTFIXTURE_HOME) $ret]]
+ if {![file executable $ret]} {
+ finish_test
+ return -code return
+ }
+ return $ret
+}
+
# If the library is compiled with the SQLITE_DEFAULT_AUTOVACUUM macro set
# to non-zero, then set the global variable $AUTOVACUUM to 1.
set AUTOVACUUM $sqlite_options(default_autovacuum)