Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fix problems in test scripts. Add new test cases to improve test coverage. (CVS 5521) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
b65f493c7519e8a5ee632a395b57d452 |
User & Date: | drh 2008-08-01 18:47:02.000 |
Context
2008-08-01
| ||
20:10 | Bring test coverage up to 99%. (CVS 5522) (check-in: 2cd6bae809 user: drh tags: trunk) | |
18:47 | Fix problems in test scripts. Add new test cases to improve test coverage. (CVS 5521) (check-in: b65f493c75 user: drh tags: trunk) | |
17:51 | Also test that setting sqlite3_vtab.zErrMsg works from within the xRename method. (CVS 5520) (check-in: 4f4a9ccae7 user: danielk1977 tags: trunk) | |
Changes
Changes to src/main.c.
︙ | ︙ | |||
10 11 12 13 14 15 16 | ** ************************************************************************* ** Main file for the SQLite library. The routines in this file ** implement the programmer interface to the library. Routines in ** other files are for internal use by SQLite and should not be ** accessed by users of the library. ** | | | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ** ************************************************************************* ** Main file for the SQLite library. The routines in this file ** implement the programmer interface to the library. Routines in ** other files are for internal use by SQLite and should not be ** accessed by users of the library. ** ** $Id: main.c,v 1.485 2008/08/01 18:47:02 drh Exp $ */ #include "sqliteInt.h" #include <ctype.h> #ifdef SQLITE_ENABLE_FTS3 # include "fts3.h" #endif |
︙ | ︙ | |||
302 303 304 305 306 307 308 309 310 311 | } if( sz<0 ) sz = 0; if( cnt<0 ) cnt = 0; sz = (sz+7)&~7; sqlite3BeginBenignMalloc(); pStart = sqlite3Malloc( sz*cnt ); sqlite3EndBenignMalloc(); if( pStart ){ int i; LookasideSlot *p; | > > > > < < < > | > | 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 | } if( sz<0 ) sz = 0; if( cnt<0 ) cnt = 0; sz = (sz+7)&~7; 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; p = (LookasideSlot*)pStart; for(i=cnt-1; i>=0; i--){ p->pNext = db->lookaside.pFree; db->lookaside.pFree = p; p = (LookasideSlot*)&((u8*)p)[sz]; } db->lookaside.pEnd = p; db->lookaside.bEnabled = 1; }else{ db->lookaside.pEnd = 0; db->lookaside.bEnabled = 0; } return SQLITE_OK; } /* ** Configuration settings for an individual database connection */ |
︙ | ︙ |
Changes to src/select.c.
︙ | ︙ | |||
8 9 10 11 12 13 14 | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains C code routines that are called by the parser ** to handle SELECT statements in SQLite. ** | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains C code routines that are called by the parser ** to handle SELECT statements in SQLite. ** ** $Id: select.c,v 1.461 2008/08/01 18:47:02 drh Exp $ */ #include "sqliteInt.h" /* ** Delete all the content of a Select structure but do not deallocate ** the select structure itself. |
︙ | ︙ | |||
2013 2014 2015 2016 2017 2018 2019 | rc = sqlite3Select(pParse, pPrior, &uniondest, 0, 0, 0); if( rc ){ goto multi_select_end; } /* Code the current SELECT statement */ | | | > | | | 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 | rc = sqlite3Select(pParse, pPrior, &uniondest, 0, 0, 0); if( rc ){ goto multi_select_end; } /* Code the current SELECT statement */ if( p->op==TK_EXCEPT ){ op = SRT_Except; }else{ assert( p->op==TK_UNION ); op = SRT_Union; } p->pPrior = 0; p->disallowOrderBy = 0; pLimit = p->pLimit; p->pLimit = 0; pOffset = p->pOffset; p->pOffset = 0; |
︙ | ︙ |
Changes to test/altermalloc.test.
︙ | ︙ | |||
8 9 10 11 12 13 14 | # May you share freely, never taking more than you give. # #************************************************************************* # This file implements regression tests for SQLite library. The # focus of this script is testing the ALTER TABLE statement and # specifically out-of-memory conditions within that command. # | | > > | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | # May you share freely, never taking more than you give. # #************************************************************************* # This file implements regression tests for SQLite library. The # focus of this script is testing the ALTER TABLE statement and # specifically out-of-memory conditions within that command. # # $Id: altermalloc.test,v 1.8 2008/08/01 18:47:02 drh Exp $ # set testdir [file dirname $argv0] source $testdir/tester.tcl # If SQLITE_OMIT_ALTERTABLE is defined, omit this file. ifcapable !altertable||!memdebug { finish_test return } source $testdir/malloc_common.tcl do_malloc_test altermalloc-1 -tclprep { db close } -tclbody { 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); ALTER TABLE t1 ADD COLUMN b INTEGER DEFAULT NULL; ALTER TABLE t1 ADD COLUMN c TEXT DEFAULT 'default-text'; ALTER TABLE t1 RENAME TO t2; } # Test malloc() failure on an ALTER TABLE on a virtual table. # 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 { CREATE TABLE t1(a, b VARCHAR, c INTEGER); CREATE VIRTUAL TABLE t1echo USING echo(t1); } db2 close |
︙ | ︙ |
Changes to test/analyze.test.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # 2005 July 22 # # 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 ANALYZE command. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # 2005 July 22 # # 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 ANALYZE command. # # $Id: analyze.test,v 1.8 2008/08/01 18:47:02 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # There is nothing to test if ANALYZE is disable for this build. # ifcapable {!analyze} { |
︙ | ︙ | |||
256 257 258 259 260 261 262 263 264 265 266 267 268 269 | execsql { PRAGMA writable_schema=on; DELETE FROM sqlite_stat1; INSERT INTO sqlite_stat1 VALUES('t4','t4i1','nonsense'); INSERT INTO sqlite_stat1 VALUES('t4','t4i2','120897349817238741092873198273409187234918720394817209384710928374109827172901827349871928741910'); PRAGMA writable_schema=off; } db close sqlite3 db test.db execsql { SELECT * FROM t4 WHERE x=1234; } } {} | > > > > > > > > > > | 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 | execsql { PRAGMA writable_schema=on; DELETE FROM sqlite_stat1; INSERT INTO sqlite_stat1 VALUES('t4','t4i1','nonsense'); INSERT INTO sqlite_stat1 VALUES('t4','t4i2','120897349817238741092873198273409187234918720394817209384710928374109827172901827349871928741910'); PRAGMA writable_schema=off; } db close sqlite3 db test.db execsql { 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; } } {} |
︙ | ︙ |
Changes to test/lookaside.test.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # 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. # #*********************************************************************** # # Tests for the lookaside memory allocator. # | | > > > > > > > | > | | > | | > | | > | | > | | > | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | # 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. # #*********************************************************************** # # Tests for the lookaside memory allocator. # # $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 { catch {sqlite3_config_error db} } {0} do_test lookaside-1.2 { sqlite3_db_config_lookaside db 20 20 } {0} do_test lookaside-1.3 { sqlite3_db_status db SQLITE_DBSTATUS_LOOKASIDE_USED 0 } {0 0 0} do_test lookaside-1.4 { db eval {CREATE TABLE t1(x);} 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 { 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 { 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 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 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 } {0 0 0} do_test lookaside-2.1 { sqlite3_db_config_lookaside db 100 1000 } {0} do_test lookaside-2.2 { db eval {CREATE TABLE t2(x);} 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 do_test lookaside-2.4 { db cache flush sqlite3_db_config_lookaside db 50 50 } {0} ;# SQLITE_OK |
︙ | ︙ |
Changes to test/mallocG.test.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # 2007 Aug 29 # # 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. # | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | # 2007 Aug 29 # # 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: mallocG.test,v 1.5 2008/08/01 18:47:02 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl source $testdir/malloc_common.tcl # Only run these tests if memory debugging is turned on. # if {!$MEMDEBUG} { puts "Skipping mallocG tests: not compiled with -DSQLITE_MEMDEBUG..." finish_test return } # Malloc failures while opening a database connection. # do_malloc_test mallocG-1 -tclbody { db close sqlite3 db test.db } do_malloc_test mallocG-2 -sqlprep { CREATE TABLE t1(x, y); CREATE TABLE t2(x INTEGER PRIMARY KEY); |
︙ | ︙ |
Added test/mallocH.test.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 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 |
Changes to test/malloc_common.tcl.
︙ | ︙ | |||
8 9 10 11 12 13 14 | # May you share freely, never taking more than you give. # #*********************************************************************** # # This file contains common code used by many different malloc tests # within the test suite. # | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | # May you share freely, never taking more than you give. # #*********************************************************************** # # This file contains common code used by many different malloc tests # within the test suite. # # $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. # ifcapable builtin_test { set MEMDEBUG 1 } else { set MEMDEBUG 0 |
︙ | ︙ | |||
94 95 96 97 98 99 100 101 102 103 104 105 106 107 | if {[info exists ::mallocopts(-testdb)]} { file copy $::mallocopts(-testdb) test.db } catch { sqlite3 db test.db } if {[info commands db] ne ""} { sqlite3_extended_result_codes db 1 } # Execute any -tclprep and -sqlprep scripts. # if {[info exists ::mallocopts(-tclprep)]} { eval $::mallocopts(-tclprep) } if {[info exists ::mallocopts(-sqlprep)]} { | > | 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | if {[info exists ::mallocopts(-testdb)]} { file copy $::mallocopts(-testdb) test.db } catch { sqlite3 db test.db } if {[info commands db] ne ""} { sqlite3_extended_result_codes db 1 } sqlite3_db_config_lookaside db 0 0 # Execute any -tclprep and -sqlprep scripts. # if {[info exists ::mallocopts(-tclprep)]} { eval $::mallocopts(-tclprep) } if {[info exists ::mallocopts(-sqlprep)]} { |
︙ | ︙ |
Changes to test/permutations.test.
1 2 3 4 5 6 7 8 9 10 11 | # 2008 June 21 # # 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. # #*********************************************************************** # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | # 2008 June 21 # # 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. # #*********************************************************************** # # $Id: permutations.test,v 1.20 2008/08/01 18:47:02 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Argument processing. # set ::testmode [lindex $argv 0] |
︙ | ︙ | |||
62 63 64 65 66 67 68 69 70 71 72 73 74 75 | crash6.test malloc.test speed4.test crash7.test memleak.test sqllimits1.test crash.test memsubsys1.test thread001.test exclusive3.test memsubsys2.test thread002.test fts3.test misc7.test utf16.test fuzz_malloc.test misuse.test veryquick.test fuzz.test mutex2.test vtab_err.test } set ALLTESTS [list] foreach filename [glob $testdir/*.test] { set filename [file tail $filename] if {[lsearch $EXCLUDE $filename] < 0} { lappend ALLTESTS $filename } } | > | 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | crash6.test malloc.test speed4.test crash7.test memleak.test sqllimits1.test crash.test memsubsys1.test thread001.test exclusive3.test memsubsys2.test thread002.test 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] { set filename [file tail $filename] if {[lsearch $EXCLUDE $filename] < 0} { lappend ALLTESTS $filename } } |
︙ | ︙ |