1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-30 19:03:16 +03:00

Added the default_cache_size and default_synchronous pragmas. Added additional

tests for pragmas.  Added a new speedtest script. (CVS 421)

FossilOrigin-Name: 161c0c5f5db66815e4345c9b5f7a600c03a67475
This commit is contained in:
drh
2002-03-06 22:01:34 +00:00
parent e684090012
commit cd61c2816f
13 changed files with 533 additions and 40 deletions

View File

@ -10,7 +10,7 @@
#***********************************************************************
# This file runs all tests.
#
# $Id: all.test,v 1.12 2002/02/18 01:17:00 drh Exp $
# $Id: all.test,v 1.13 2002/03/06 22:01:36 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -37,6 +37,11 @@ set EXCLUDE {
}
for {set Counter 0} {$Counter<$COUNT && $nErr==0} {incr Counter} {
if {$Counter%2} {
set ::SETUP_SQL {PRAGMA default_synchronous=off;}
} else {
catch {unset ::SETUP_SQL}
}
foreach testfile [lsort -dictionary [glob $testdir/*.test]] {
set tail [file tail $testfile]
if {[lsearch -exact $EXCLUDE $tail]>=0} continue

120
test/pragma.test Normal file
View File

@ -0,0 +1,120 @@
# 2002 March 6
#
# The author disclaims copyright to this source code. In place of
# a legal notice, here is a blessing:
#
# May you do good and not evil.
# May you find forgiveness for yourself and forgive others.
# May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library.
#
# This file implements tests for the PRAGMA command.
#
# $Id: pragma.test,v 1.1 2002/03/06 22:01:37 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
# Delete the preexisting database to avoid the special setup
# that the "all.test" script does.
#
db close
file delete test.db
sqlite db test.db
do_test pragma-1.1 {
execsql {
PRAGMA cache_size;
PRAGMA default_cache_size;
PRAGMA synchronous;
PRAGMA default_synchronous;
}
} {2000 2000 1 1}
do_test pragma-1.2 {
execsql {
PRAGMA cache_size=1234;
PRAGMA cache_size;
PRAGMA default_cache_size;
PRAGMA synchronous;
PRAGMA default_synchronous;
}
} {1234 2000 1 1}
do_test pragma-1.3 {
db close
sqlite db test.db
execsql {
PRAGMA cache_size;
PRAGMA default_cache_size;
PRAGMA synchronous;
PRAGMA default_synchronous;
}
} {2000 2000 1 1}
do_test pragma-1.4 {
execsql {
PRAGMA synchronous=OFF;
PRAGMA cache_size;
PRAGMA default_cache_size;
PRAGMA synchronous;
PRAGMA default_synchronous;
}
} {2000 2000 0 1}
do_test pragma-1.5 {
execsql {
PRAGMA cache_size=4321;
PRAGMA cache_size;
PRAGMA default_cache_size;
PRAGMA synchronous;
PRAGMA default_synchronous;
}
} {4321 2000 0 1}
do_test pragma-1.6 {
execsql {
PRAGMA synchronous=ON;
PRAGMA cache_size;
PRAGMA default_cache_size;
PRAGMA synchronous;
PRAGMA default_synchronous;
}
} {4321 2000 1 1}
do_test pragma-1.7 {
db close
sqlite db test.db
execsql {
PRAGMA cache_size;
PRAGMA default_cache_size;
PRAGMA synchronous;
PRAGMA default_synchronous;
}
} {2000 2000 1 1}
do_test pragma-1.8 {
execsql {
PRAGMA default_synchronous=OFF;
PRAGMA cache_size;
PRAGMA default_cache_size;
PRAGMA synchronous;
PRAGMA default_synchronous;
}
} {2000 2000 0 0}
do_test pragma-1.9 {
execsql {
PRAGMA default_cache_size=123;
PRAGMA cache_size;
PRAGMA default_cache_size;
PRAGMA synchronous;
PRAGMA default_synchronous;
}
} {123 123 0 0}
do_test pragma-1.10 {
db close
sqlite db test.db
execsql {
PRAGMA cache_size;
PRAGMA default_cache_size;
PRAGMA synchronous;
PRAGMA default_synchronous;
}
} {123 123 0 0}
finish_test

View File

@ -11,7 +11,7 @@
# This file implements some common TCL routines used for regression
# testing the SQLite library
#
# $Id: tester.tcl,v 1.21 2001/11/09 22:41:45 drh Exp $
# $Id: tester.tcl,v 1.22 2002/03/06 22:01:37 drh Exp $
# Make sure tclsqlite was compiled correctly. Abort now with an
# error message if not.
@ -46,6 +46,9 @@ catch {db close}
file delete -force test.db
file delete -force test.db-journal
sqlite db ./test.db
if {[info exists ::SETUP_SQL]} {
db eval $::SETUP_SQL
}
# Abort early if this script has been run before.
#