Fix problems in test scripts. Add new test cases to improve test coverage. (CVS 5521)

FossilOrigin-Name: b65f493c7519e8a5ee632a395b57d45269741dda
This commit is contained in:
drh 2008-08-01 18:47:01 +00:00
parent 987a00e8b5
commit 4cfb22f798
11 changed files with 127 additions and 44 deletions

View File

@ -1,5 +1,5 @@
C Also\stest\sthat\ssetting\ssqlite3_vtab.zErrMsg\sworks\sfrom\swithin\sthe\sxRename\smethod.\s(CVS\s5520)
D 2008-08-01T17:51:47
C Fix\sproblems\sin\stest\sscripts.\s\sAdd\snew\stest\scases\sto\simprove\stest\scoverage.\s(CVS\s5521)
D 2008-08-01T18:47:02
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in bbb62eecc851379aef5a48a1bf8787eb13e6ec06
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@ -115,7 +115,7 @@ F src/insert.c 89cd9af52a5ea6fb7d0cfc9c3b935d6406c360c4
F src/journal.c cffd2cd214e58c0e99c3ff632b3bee6c7cbb260e
F src/legacy.c 3635cc6a5889918086b3501de8287cbbecb55917
F src/loadext.c 9ab55455f59dce0ae6388952216a1505ce7f9d13
F src/main.c fb1645201b4a05a13cc227e1a1338c57088e3be7
F src/main.c 730c6f40379e2258718ee2e591a4ae091d4e26c6
F src/malloc.c f0ad28008351cac2337ef502a3fdc8ffd3e5d9a9
F src/md5.c 008216bbb5d34c6fbab5357aa68575ad8a31516a
F src/mem1.c 3a7fe31d8290baa3bb203af72f7dfd6323966bcd
@ -142,7 +142,7 @@ F src/pragma.c 6e207b4f69901089758c02c02e0bf86ed12a4d8f
F src/prepare.c d2d53aec81517f8666450aa5fd1a041a3b72320e
F src/printf.c 2e984b2507291a7e16d89dc9bb60582904f6247d
F src/random.c 5c754319d38abdd6acd74601ee0105504adc508a
F src/select.c ef18af5624fc3189014e6b617a36562394740f91
F src/select.c 95fb28783ef1342be8c6ee278c539309e29c010e
F src/shell.c 4b835fe734304ac22a3385868cd3790c1e4f7aa1
F src/sqlite.h.in 30af3a002a0b672aaae8f4a5deb0a2e9a4b699af
F src/sqlite3ext.h 1e3887c9bd3ae66cb599e922824b04cd0d0f2c3e
@ -199,8 +199,8 @@ F test/all.test 89e09ed0074083ac6f208dc3243429e8f89efb69
F test/alter.test 6353aae6839e486c9b7d8f73b1f4a1e98e57332c
F test/alter2.test dd55146e812622c8fc51fd2216bcd8dca8880752
F test/alter3.test 25b95a136708f22b87184fa6a4309eea03d65153
F test/altermalloc.test 29d4a8400277efb4ba8ffe90804c6dc2fdfbf063
F test/analyze.test 0bc15f67015ec7fddbae12081a25d82747967c1f
F test/altermalloc.test b97c213c410f7c6af4590d52d2c79f7a74df36fe
F test/analyze.test a881c145565de9ae1d37aaf385d9a0bbcbb98391
F test/async.test aecaa46ed0618a3c338f3651ca4f10fbb4021044
F test/async2.test 8998e089b0fbb3d84cdd51c25a78833486d721af
F test/async3.test 9ffa0977a78cc6351862a1583be2b1eecd41736d
@ -393,7 +393,7 @@ F test/lock2.test 018b846f6f3b3b695fad07e317b7988442b556f4
F test/lock3.test 615111293cf32aa2ed16d01c6611737651c96fb9
F test/lock4.test 09d97d52cae18fadfe631552af9880dac6b3ae90
F test/lock5.test f4eeb0400cf65c37f733cb3c74401136f8c46acd
F test/lookaside.test 7480f4eb87c9883e0db47b97b57e23ee565f4248
F test/lookaside.test cd7f89dc05d8b5d1c3d56df2241b5edfbdd87218
F test/main.test 8d77c161757ef7d96eaff0413daa7120c3b316fe
F test/malloc.test 69f5bb5a13b24edb1322fc1f42894f9d2f6446b1
F test/malloc3.test 094f8195fe8e409bd4da0f1d769f7745faec62c8
@ -410,8 +410,9 @@ F test/mallocC.test 05c0bde2e41cdbdef26b9c17b8e48c935b46f611
F test/mallocD.test f78c295e8e18ea3029e65ca08278690e00c22100
F test/mallocE.test db1ed69d7eded1b080952e2a7c37f364ad241b08
F test/mallocF.test 2d5c590ebc2fc7f0dcebdf5aa8498b9aed69107e
F test/mallocG.test 9d472075e155c888706d8bb2f0d5c6fd643d793c
F test/malloc_common.tcl 17d60dfefc1598d1a7fe6da6511933536caea1d7
F test/mallocG.test 4584d0d8ddb8009f16ca0c8bab1fa37f6358efa2
F test/mallocH.test 10df29d6d8ee429e30cfa51f1583fb96956d9ae1
F test/malloc_common.tcl 753eb1ff3481f6cddb65cff33b9ef9f72c5ccdf7
F test/manydb.test 8de36b8d33aab5ef295b11d9e95310aeded31af8
F test/memdb.test a67bda4ff90a38f2b19f6c7f95aa7289e051d893
F test/memleak.test d2d2a1ff7105d32dc3fdf691458cf6cba58c7217
@ -439,7 +440,7 @@ F test/pager2.test c025f91b75fe65e85febda64d9416428b8a5cab5
F test/pager3.test 2323bf27fd5bd887b580247e5bce500ceee994b4
F test/pageropt.test 6df72c441db0a037b7ec6990d16311c24fbea77b
F test/pagesize.test e0a8b3fe80f8b8e808d94a00734c7a18c76c407e
F test/permutations.test 0d2b34a203f63f4c8063e7849deb7ae6252c7411
F test/permutations.test 4ad59e4489255b025aac0cc661789d35a83d87ec
F test/pragma.test 2c675ed9a288094ed62bf55b35fbc749e25670fb
F test/pragma2.test 5364893491b9231dd170e3459bfc2e2342658b47
F test/printf.test 262a5acd3158f788e9bdf7f18d718f3af32ff6ef
@ -615,7 +616,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 1dbced29de5f59ba2ebf877edcadf171540374d1
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
P 007359b770f225877880b11f4c5d97bb548e38ca
R f0d8797192a7ea8466c2e723f27015ad
U danielk1977
Z 096b5dd0921e6fbf5cb91dacb681b73e
P 4f4a9ccae7d25b9856d1203f6b289d552c2b425e
R 18c217d4a8c206615c26839f44ff5969
U drh
Z 42613daae14dfac0693542545b969121

View File

@ -1 +1 @@
4f4a9ccae7d25b9856d1203f6b289d552c2b425e
b65f493c7519e8a5ee632a395b57d45269741dda

View File

@ -14,7 +14,7 @@
** other files are for internal use by SQLite and should not be
** accessed by users of the library.
**
** $Id: main.c,v 1.484 2008/08/01 16:31:14 drh Exp $
** $Id: main.c,v 1.485 2008/08/01 18:47:02 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
@ -306,12 +306,13 @@ static int setupLookaside(sqlite3 *db, int sz, int cnt){
sqlite3BeginBenignMalloc();
pStart = sqlite3Malloc( sz*cnt );
sqlite3EndBenignMalloc();
sqlite3_free(db->lookaside.pStart);
db->lookaside.pStart = pStart;
db->lookaside.pFree = 0;
db->lookaside.sz = sz;
if( pStart ){
int i;
LookasideSlot *p;
sqlite3_free(db->lookaside.pStart);
db->lookaside.pFree = 0;
db->lookaside.pStart = pStart;
p = (LookasideSlot*)pStart;
for(i=cnt-1; i>=0; i--){
p->pNext = db->lookaside.pFree;
@ -320,7 +321,9 @@ static int setupLookaside(sqlite3 *db, int sz, int cnt){
}
db->lookaside.pEnd = p;
db->lookaside.bEnabled = 1;
db->lookaside.sz = sz;
}else{
db->lookaside.pEnd = 0;
db->lookaside.bEnabled = 0;
}
return SQLITE_OK;
}

View File

@ -12,7 +12,7 @@
** This file contains C code routines that are called by the parser
** to handle SELECT statements in SQLite.
**
** $Id: select.c,v 1.460 2008/07/28 19:34:53 drh Exp $
** $Id: select.c,v 1.461 2008/08/01 18:47:02 drh Exp $
*/
#include "sqliteInt.h"
@ -2017,10 +2017,11 @@ static int multiSelect(
/* Code the current SELECT statement
*/
switch( p->op ){
case TK_EXCEPT: op = SRT_Except; break;
case TK_UNION: op = SRT_Union; break;
case TK_ALL: op = SRT_Table; break;
if( p->op==TK_EXCEPT ){
op = SRT_Except;
}else{
assert( p->op==TK_UNION );
op = SRT_Union;
}
p->pPrior = 0;
p->disallowOrderBy = 0;

View File

@ -12,7 +12,7 @@
# focus of this script is testing the ALTER TABLE statement and
# specifically out-of-memory conditions within that command.
#
# $Id: altermalloc.test,v 1.7 2007/10/03 08:46:45 danielk1977 Exp $
# $Id: altermalloc.test,v 1.8 2008/08/01 18:47:02 drh Exp $
#
set testdir [file dirname $argv0]
@ -32,6 +32,7 @@ do_malloc_test altermalloc-1 -tclprep {
if {[catch {sqlite3 db test.db}]} {
error "out of memory"
}
sqlite3_db_config_lookaside db 0 0
sqlite3_extended_result_codes db 1
} -sqlbody {
CREATE TABLE t1(a int);
@ -45,6 +46,7 @@ do_malloc_test altermalloc-1 -tclprep {
ifcapable vtab {
do_malloc_test altermalloc-vtab -tclprep {
sqlite3 db2 test.db
sqlite3_db_config_lookaside db2 0 0
sqlite3_extended_result_codes db2 1
register_echo_module [sqlite3_connection_pointer db2]
db2 eval {

View File

@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library.
# This file implements tests for the ANALYZE command.
#
# $Id: analyze.test,v 1.7 2008/04/11 17:11:27 danielk1977 Exp $
# $Id: analyze.test,v 1.8 2008/08/01 18:47:02 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -266,6 +266,16 @@ do_test analyze-4.2 {
SELECT * FROM t4 WHERE x=1234;
}
} {}
do_test analyze-4.3 {
execsql {
INSERT INTO sqlite_stat1 VALUES('t4','xyzzy','0 1 2 3');
}
db close
sqlite3 db test.db
execsql {
SELECT * FROM t4 WHERE x=1234;
}
} {}
# This test corrupts the database file so it must be the last test
# in the series.

View File

@ -11,11 +11,18 @@
#
# Tests for the lookaside memory allocator.
#
# $Id: lookaside.test,v 1.1 2008/08/01 16:31:14 drh Exp $
# $Id: lookaside.test,v 1.2 2008/08/01 18:47:02 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
catch {db close}
sqlite3_shutdown
sqlite3_config_pagecache 0 0
sqlite3_config_scratch 0 0
sqlite3_initialize
sqlite3 db test.db
# Make sure sqlite3_db_config() and sqlite3_db_status are working.
#
do_test lookaside-1.1 {
@ -29,22 +36,27 @@ do_test lookaside-1.3 {
} {0 0 0}
do_test lookaside-1.4 {
db eval {CREATE TABLE t1(x);}
sqlite3_db_status db SQLITE_DBSTATUS_LOOKASIDE_USED 0
} {0 7 20}
foreach {x y z} [sqlite3_db_status db SQLITE_DBSTATUS_LOOKASIDE_USED 0] break
expr {$x==0 && $y<$z && $z==20}
} {1}
do_test lookaside-1.5 {
sqlite3_db_status db SQLITE_DBSTATUS_LOOKASIDE_USED 1
} {0 7 20}
foreach {x y z} [sqlite3_db_status db SQLITE_DBSTATUS_LOOKASIDE_USED 1] break
expr {$x==0 && $y<$z && $z==20}
} {1}
do_test lookaside-1.6 {
sqlite3_db_status db SQLITE_DBSTATUS_LOOKASIDE_USED 0
} {0 7 7}
foreach {x y z} [sqlite3_db_status db SQLITE_DBSTATUS_LOOKASIDE_USED 0] break
expr {$x==0 && $y==$z && $y<20}
} {1}
do_test lookaside-1.7 {
db cache flush
sqlite3_db_status db SQLITE_DBSTATUS_LOOKASIDE_USED 0
} {0 0 7}
foreach {x y z} [sqlite3_db_status db SQLITE_DBSTATUS_LOOKASIDE_USED 0] break
expr {$x==0 && $y==0 && $z<20}
} {1}
do_test lookaside-1.8 {
db cache flush
sqlite3_db_status db SQLITE_DBSTATUS_LOOKASIDE_USED 1
} {0 0 7}
foreach {x y z} [sqlite3_db_status db SQLITE_DBSTATUS_LOOKASIDE_USED 1] break
expr {$x==0 && $y==0 && $z<20}
} {1}
do_test lookaside-1.9 {
db cache flush
sqlite3_db_status db SQLITE_DBSTATUS_LOOKASIDE_USED 0
@ -55,8 +67,9 @@ do_test lookaside-2.1 {
} {0}
do_test lookaside-2.2 {
db eval {CREATE TABLE t2(x);}
sqlite3_db_status db SQLITE_DBSTATUS_LOOKASIDE_USED 0
} {0 10 48}
foreach {x y z} [sqlite3_db_status db SQLITE_DBSTATUS_LOOKASIDE_USED 0] break
expr {$x==0 && $y<$z && $z>10 && $z<100}
} {1}
do_test lookaside-2.3 {
sqlite3_db_config_lookaside db 50 50
} {5} ;# SQLITE_BUSY

View File

@ -11,7 +11,7 @@
#
# This test script checks malloc failures in various obscure operations.
#
# $Id: mallocG.test,v 1.4 2008/07/07 19:52:11 drh Exp $
# $Id: mallocG.test,v 1.5 2008/08/01 18:47:02 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -27,7 +27,7 @@ if {!$MEMDEBUG} {
# Malloc failures while opening a database connection.
#
do_malloc_test malloeG-1 -tclbody {
do_malloc_test mallocG-1 -tclbody {
db close
sqlite3 db test.db
}

51
test/mallocH.test Normal file
View File

@ -0,0 +1,51 @@
# 2008 August 01
#
# 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 test script checks malloc failures in various obscure operations.
#
# $Id: mallocH.test,v 1.1 2008/08/01 18:47:02 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
source $testdir/malloc_common.tcl
# Malloc failures in journaling of in-memory databases.
#
do_malloc_test mallocH-1 -tclprep {
db close
sqlite3 db :memory:
db eval {
CREATE TABLE t1(x UNIQUE, y);
INSERT INTO t1 VALUES(1,2);
}
} -sqlbody {
INSERT INTO t1 SELECT x+1, y+100 FROM t1;
}
# Malloc failures while parsing a CASE expression.
#
do_malloc_test mallocH-2 -sqlbody {
SELECT CASE WHEN 1 THEN 1 END;
}
# Malloc failures while parsing a EXISTS(SELECT ...)
#
do_malloc_test mallocH-3 -sqlbody {
SELECT 3+EXISTS(SELECT * FROM sqlite_master);
}
# Malloc failures within the replace() function.
#
do_malloc_test mallocH-3 -sqlbody {
SELECT replace('ababa','a','xyzzy');
}
finish_test

View File

@ -12,7 +12,7 @@
# This file contains common code used by many different malloc tests
# within the test suite.
#
# $Id: malloc_common.tcl,v 1.19 2008/07/23 20:28:14 drh Exp $
# $Id: malloc_common.tcl,v 1.20 2008/08/01 18:47:02 drh Exp $
# If we did not compile with malloc testing enabled, then do nothing.
#
@ -98,6 +98,7 @@ proc do_malloc_test {tn args} {
if {[info commands db] ne ""} {
sqlite3_extended_result_codes db 1
}
sqlite3_db_config_lookaside db 0 0
# Execute any -tclprep and -sqlprep scripts.
#

View File

@ -9,7 +9,7 @@
#
#***********************************************************************
#
# $Id: permutations.test,v 1.19 2008/08/01 15:06:30 drh Exp $
# $Id: permutations.test,v 1.20 2008/08/01 18:47:02 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -66,6 +66,7 @@ set EXCLUDE {
fts3.test misc7.test utf16.test
fuzz_malloc.test misuse.test veryquick.test
fuzz.test mutex2.test vtab_err.test
lookaside.test
}
set ALLTESTS [list]
foreach filename [glob $testdir/*.test] {