Modify a few test scripts to avoid leaving the sqlite3Config structure in a non-default state.
FossilOrigin-Name: 562687d9f56bf4bb0f5f07f97cbbb7649c81faf8
This commit is contained in:
+3
-6
@@ -21,12 +21,7 @@ source $testdir/tester.tcl
|
||||
# These tests deal with corrupt database files
|
||||
#
|
||||
database_may_be_corrupt
|
||||
db close
|
||||
sqlite3_shutdown
|
||||
sqlite3_config_pagecache 0 0
|
||||
sqlite3_initialize
|
||||
autoinstall_test_functions
|
||||
sqlite3 db test.db
|
||||
test_set_config_pagecache 0 0
|
||||
|
||||
|
||||
expr srand(123)
|
||||
@@ -176,4 +171,6 @@ for {set ii 0} {$ii < 5000} {incr ii} {
|
||||
} $::cksum
|
||||
}
|
||||
|
||||
test_restore_config_pagecache
|
||||
finish_test
|
||||
|
||||
|
||||
+3
-1
@@ -29,9 +29,10 @@ if {[info exists ::G(perm:presql)]} {
|
||||
return
|
||||
}
|
||||
|
||||
test_set_config_pagecache 0 0
|
||||
|
||||
catch {db close}
|
||||
sqlite3_shutdown
|
||||
sqlite3_config_pagecache 0 0
|
||||
sqlite3_config_scratch 0 0
|
||||
sqlite3_initialize
|
||||
autoinstall_test_functions
|
||||
@@ -129,4 +130,5 @@ do_test lookaside-4.1 {
|
||||
sqlite3_initialize
|
||||
autoinstall_test_functions
|
||||
|
||||
test_restore_config_pagecache
|
||||
finish_test
|
||||
|
||||
+3
-5
@@ -20,11 +20,6 @@
|
||||
#
|
||||
# $Id: malloc5.test,v 1.22 2009/04/11 19:09:54 drh Exp $
|
||||
|
||||
sqlite3_shutdown
|
||||
sqlite3_config_pagecache 0 100
|
||||
sqlite3_initialize
|
||||
autoinstall_test_functions
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
source $testdir/malloc_common.tcl
|
||||
@@ -44,6 +39,8 @@ ifcapable !memorymanage {
|
||||
return
|
||||
}
|
||||
|
||||
test_set_config_pagecache 0 100
|
||||
|
||||
sqlite3_soft_heap_limit 0
|
||||
sqlite3 db test.db
|
||||
db eval {PRAGMA cache_size=1}
|
||||
@@ -415,5 +412,6 @@ do_test malloc5-6.3.6 {
|
||||
db2 close
|
||||
|
||||
sqlite3_soft_heap_limit $::soft_limit
|
||||
test_restore_config_pagecache
|
||||
finish_test
|
||||
catch {db close}
|
||||
|
||||
@@ -25,6 +25,8 @@ if {[permutation] == "memsubsys1"} {
|
||||
return
|
||||
}
|
||||
|
||||
test_set_config_pagecache 0 0
|
||||
|
||||
# This procedure constructs a new database in test.db. It fills
|
||||
# this database with many small records (enough to force multiple
|
||||
# rebalance operations in the btree-layer and to require a large
|
||||
@@ -310,10 +312,11 @@ do_test memsubsys1-8.4 {
|
||||
db close
|
||||
sqlite3_shutdown
|
||||
sqlite3_config_memstatus 1
|
||||
sqlite3_config_pagecache 0 0
|
||||
sqlite3_config_scratch 0 0
|
||||
sqlite3_config_lookaside 100 500
|
||||
sqlite3_config serialized
|
||||
sqlite3_initialize
|
||||
autoinstall_test_functions
|
||||
|
||||
test_restore_config_pagecache
|
||||
finish_test
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
|
||||
test_set_config_pagecache 0 0
|
||||
|
||||
# Set up a pcache memory pool so that we can easily track how many
|
||||
# pages are being used for cache.
|
||||
#
|
||||
@@ -78,4 +80,5 @@ sqlite3_config serialized
|
||||
sqlite3_initialize
|
||||
autoinstall_test_functions
|
||||
|
||||
test_restore_config_pagecache
|
||||
finish_test
|
||||
|
||||
@@ -417,16 +417,16 @@ test_suite "memsubsys1" -description {
|
||||
} -files [
|
||||
test_set $::allquicktests -exclude ioerr5.test malloc5.test mmap1.test
|
||||
] -initialize {
|
||||
test_set_config_pagecache 4096 24
|
||||
catch {db close}
|
||||
sqlite3_shutdown
|
||||
sqlite3_config_pagecache 4096 24
|
||||
sqlite3_config_scratch 25000 1
|
||||
sqlite3_initialize
|
||||
autoinstall_test_functions
|
||||
} -shutdown {
|
||||
test_restore_config_pagecache
|
||||
catch {db close}
|
||||
sqlite3_shutdown
|
||||
sqlite3_config_pagecache 0 0
|
||||
sqlite3_config_scratch 0 0
|
||||
sqlite3_initialize
|
||||
autoinstall_test_functions
|
||||
@@ -444,16 +444,16 @@ test_suite "memsubsys2" -description {
|
||||
} -files [
|
||||
test_set $::allquicktests -exclude ioerr5.test malloc5.test
|
||||
] -initialize {
|
||||
test_set_config_pagecache 512 5
|
||||
catch {db close}
|
||||
sqlite3_shutdown
|
||||
sqlite3_config_pagecache 512 5
|
||||
sqlite3_config_scratch 1000 1
|
||||
sqlite3_initialize
|
||||
autoinstall_test_functions
|
||||
} -shutdown {
|
||||
test_restore_config_pagecache
|
||||
catch {db close}
|
||||
sqlite3_shutdown
|
||||
sqlite3_config_pagecache 0 0
|
||||
sqlite3_config_scratch 0 0
|
||||
sqlite3_initialize
|
||||
autoinstall_test_functions
|
||||
|
||||
@@ -2041,6 +2041,45 @@ proc db_delete_and_reopen {{file test.db}} {
|
||||
sqlite3 db $file
|
||||
}
|
||||
|
||||
# Close any connections named [db], [db2] or [db3]. Then use sqlite3_config
|
||||
# to configure the size of the PAGECACHE allocation using the parameters
|
||||
# provided to this command. Save the old PAGECACHE parameters in a global
|
||||
# variable so that [test_restore_config_pagecache] can restore the previous
|
||||
# configuration.
|
||||
#
|
||||
# Before returning, reopen connection [db] on file test.db.
|
||||
#
|
||||
proc test_set_config_pagecache {sz nPg} {
|
||||
catch {db close}
|
||||
catch {db2 close}
|
||||
catch {db3 close}
|
||||
|
||||
sqlite3_shutdown
|
||||
set ::old_pagecache_config [sqlite3_config_pagecache $sz $nPg]
|
||||
sqlite3_initialize
|
||||
autoinstall_test_functions
|
||||
sqlite3 db test.db
|
||||
}
|
||||
|
||||
# Close any connections named [db], [db2] or [db3]. Then use sqlite3_config
|
||||
# to configure the size of the PAGECACHE allocation to the size saved in
|
||||
# the global variable by an earlier call to [test_set_config_pagecache].
|
||||
#
|
||||
# Before returning, reopen connection [db] on file test.db.
|
||||
#
|
||||
proc test_restore_config_pagecache {} {
|
||||
catch {db close}
|
||||
catch {db2 close}
|
||||
catch {db3 close}
|
||||
|
||||
sqlite3_shutdown
|
||||
eval sqlite3_config_pagecache $::old_pagecache_config
|
||||
unset ::old_pagecache_config
|
||||
sqlite3_initialize
|
||||
autoinstall_test_functions
|
||||
sqlite3 db test.db
|
||||
}
|
||||
|
||||
# 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)
|
||||
|
||||
@@ -23,6 +23,8 @@ ifcapable !incrblob {
|
||||
return
|
||||
}
|
||||
|
||||
test_set_config_pagecache 0 0
|
||||
|
||||
# When zeroblob() is used for the last field of a column, then the
|
||||
# content of the zeroblob is never instantiated on the VDBE stack.
|
||||
# But it does get inserted into the database correctly.
|
||||
@@ -41,6 +43,7 @@ do_test zeroblob-1.1 {
|
||||
}
|
||||
set ::sqlite3_max_blobsize
|
||||
} {10}
|
||||
|
||||
do_test zeroblob-1.1.1 {
|
||||
expr {[sqlite3_memory_highwater]<$::memused+25000}
|
||||
} {1}
|
||||
@@ -265,4 +268,5 @@ do_test zeroblob-10.1 {
|
||||
} {1 {string or blob too big}}
|
||||
|
||||
|
||||
test_restore_config_pagecache
|
||||
finish_test
|
||||
|
||||
Reference in New Issue
Block a user