1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-27 20:41:58 +03:00

Fix bug in the premutation testing that was causing many permutations from

begin skipped.  There are now 16 errors reported by the permutation test. (CVS 5610)

FossilOrigin-Name: 4ad096bda1fc5c7b66f71ff5b32a4085c9a40574
This commit is contained in:
drh
2008-08-25 17:23:29 +00:00
parent 502b74309a
commit 0a846f96ef
6 changed files with 77 additions and 68 deletions

View File

@ -1,5 +1,5 @@
C Pick\sup\sa\ssmall\sperformance\sincrease\sby\seliminating\sthe\spcacheRef()\sfunction.\s(CVS\s5609) C Fix\sbug\sin\sthe\spremutation\stesting\sthat\swas\scausing\smany\spermutations\sfrom\nbegin\sskipped.\s\sThere\sare\snow\s16\serrors\sreported\sby\sthe\spermutation\stest.\s(CVS\s5610)
D 2008-08-25T14:49:42 D 2008-08-25T17:23:29
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in 689e14735f862a5553bceef206d8c13e29504e44 F Makefile.in 689e14735f862a5553bceef206d8c13e29504e44
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@ -135,7 +135,7 @@ F src/os_common.h 24525d8b7bce66c374dfc1810a6c9043f3359b60
F src/os_os2.c e391fc95adc744bbdcefd4d11e3066998185a0a0 F src/os_os2.c e391fc95adc744bbdcefd4d11e3066998185a0a0
F src/os_unix.c 4665cef7639dd937893c3ea076f0e8a8f215bb32 F src/os_unix.c 4665cef7639dd937893c3ea076f0e8a8f215bb32
F src/os_win.c aefe9ee26430678a19a058a874e4e2bd91398142 F src/os_win.c aefe9ee26430678a19a058a874e4e2bd91398142
F src/pager.c a175ce0a026177ca24b48b2944670404bcec90d8 F src/pager.c 67d689efa33fbca2788d006e18dd7d1a7de22487
F src/pager.h 3b9c138d2e744b9d6e61d4c2742301e3bf464864 F src/pager.h 3b9c138d2e744b9d6e61d4c2742301e3bf464864
F src/parse.y d0f76d2cb8d6883d5600dc20beb961a6022b94b8 F src/parse.y d0f76d2cb8d6883d5600dc20beb961a6022b94b8
F src/pcache.c 4883f3714503242057643a5dddbc74065def5157 F src/pcache.c 4883f3714503242057643a5dddbc74065def5157
@ -144,8 +144,8 @@ F src/pragma.c f5b271b090af7fcedd308d7c5807a5503f7a853d
F src/prepare.c c197041e0c4770672cda75e6bfe10242f885e510 F src/prepare.c c197041e0c4770672cda75e6bfe10242f885e510
F src/printf.c 785f87120589c1db672e37c6eb1087c456e6f84d F src/printf.c 785f87120589c1db672e37c6eb1087c456e6f84d
F src/random.c 5c754319d38abdd6acd74601ee0105504adc508a F src/random.c 5c754319d38abdd6acd74601ee0105504adc508a
F src/resolve.c f279cfe052c3f91457de2512fa2510e4ea86b0cc F src/resolve.c 74725e61c9eefb597a203631d921efd9005b7a88
F src/select.c 3db954ccabee38995b16013a390f15c3b07e1265 F src/select.c 1042eafb5c703ed4fc80ab3c3cbdfdb74fbcf2b4
F src/shell.c d83b578a8ccdd3e0e7fef4388a0887ce9f810967 F src/shell.c d83b578a8ccdd3e0e7fef4388a0887ce9f810967
F src/sqlite.h.in 2373d1d70664f7fcd78e79af3c51792bb0a0753e F src/sqlite.h.in 2373d1d70664f7fcd78e79af3c51792bb0a0753e
F src/sqlite3ext.h 1e3887c9bd3ae66cb599e922824b04cd0d0f2c3e F src/sqlite3ext.h 1e3887c9bd3ae66cb599e922824b04cd0d0f2c3e
@ -445,7 +445,7 @@ F test/pager2.test 070983b89a308adaba525a2f9c1ba0592c72fa3d
F test/pager3.test 2323bf27fd5bd887b580247e5bce500ceee994b4 F test/pager3.test 2323bf27fd5bd887b580247e5bce500ceee994b4
F test/pageropt.test 3ee6578891baaca967f0bd349e4abfa736229e1a F test/pageropt.test 3ee6578891baaca967f0bd349e4abfa736229e1a
F test/pagesize.test e0a8b3fe80f8b8e808d94a00734c7a18c76c407e F test/pagesize.test e0a8b3fe80f8b8e808d94a00734c7a18c76c407e
F test/permutations.test 1f7ead8d56d62633b2dd00c26868db35f0b3dcdf F test/permutations.test 49468b8b94e66e20a43a29b805bc1811569208cf
F test/pragma.test b55931bbd5dd543e56fd942dbf4b7439619b09a6 F test/pragma.test b55931bbd5dd543e56fd942dbf4b7439619b09a6
F test/pragma2.test 5364893491b9231dd170e3459bfc2e2342658b47 F test/pragma2.test 5364893491b9231dd170e3459bfc2e2342658b47
F test/printf.test 262a5acd3158f788e9bdf7f18d718f3af32ff6ef F test/printf.test 262a5acd3158f788e9bdf7f18d718f3af32ff6ef
@ -623,7 +623,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 1dbced29de5f59ba2ebf877edcadf171540374d1 F tool/speedtest8.c 1dbced29de5f59ba2ebf877edcadf171540374d1
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
P 0d61960afd35721d6d07acd75288c20d2cd6fda1 P e3840fbf0adf824941a4b9b3cac3a869f195d6f8
R a45c0ea79cdddeaf5b79e95fe71c1625 R 536eabce05a14041e4591c9d085fb224
U danielk1977 U drh
Z d37cbd289bc865902ff5dd4aff605824 Z 6161148b36887e1910794505f591cf40

View File

@ -1 +1 @@
e3840fbf0adf824941a4b9b3cac3a869f195d6f8 4ad096bda1fc5c7b66f71ff5b32a4085c9a40574

View File

@ -18,7 +18,7 @@
** file simultaneously, or one process from reading the database while ** file simultaneously, or one process from reading the database while
** another is writing. ** another is writing.
** **
** @(#) $Id: pager.c,v 1.478 2008/08/25 07:12:29 danielk1977 Exp $ ** @(#) $Id: pager.c,v 1.479 2008/08/25 17:23:29 drh Exp $
*/ */
#ifndef SQLITE_OMIT_DISKIO #ifndef SQLITE_OMIT_DISKIO
#include "sqliteInt.h" #include "sqliteInt.h"
@ -2495,29 +2495,27 @@ static int pagerStress(void *p, PgHdr *pPg){
static int hasHotJournal(Pager *pPager, int *pExists){ static int hasHotJournal(Pager *pPager, int *pExists){
sqlite3_vfs *pVfs = pPager->pVfs; sqlite3_vfs *pVfs = pPager->pVfs;
int rc = SQLITE_OK; int rc = SQLITE_OK;
int exists;
int locked;
assert( pPager!=0 );
assert( pPager->useJournal );
assert( pPager->fd->pMethods );
*pExists = 0; *pExists = 0;
if( pPager->useJournal && pPager->fd->pMethods ){ rc = sqlite3OsAccess(pVfs, pPager->zJournal, SQLITE_ACCESS_EXISTS, &exists);
int exists; if( rc==SQLITE_OK && exists ){
int locked; rc = sqlite3OsCheckReservedLock(pPager->fd, &locked);
}
rc = sqlite3OsAccess(pVfs, pPager->zJournal, SQLITE_ACCESS_EXISTS, &exists); if( rc==SQLITE_OK && exists && !locked ){
if( rc==SQLITE_OK && exists ){ int nPage;
rc = sqlite3OsCheckReservedLock(pPager->fd, &locked); rc = sqlite3PagerPagecount(pPager, &nPage);
} if( rc==SQLITE_OK ){
if( nPage==0 ){
if( rc==SQLITE_OK && exists && !locked ){ sqlite3OsDelete(pVfs, pPager->zJournal, 0);
int nPage; }else{
rc = sqlite3PagerPagecount(pPager, &nPage); *pExists = 1;
if( rc==SQLITE_OK ){
if( nPage==0 ){
sqlite3OsDelete(pVfs, pPager->zJournal, 0);
}else{
*pExists = 1;
}
} }
} }
} }
return rc; return rc;
} }

View File

@ -14,7 +14,7 @@
** resolve all identifiers by associating them with a particular ** resolve all identifiers by associating them with a particular
** table and column. ** table and column.
** **
** $Id: resolve.c,v 1.3 2008/08/25 12:14:09 drh Exp $ ** $Id: resolve.c,v 1.4 2008/08/25 17:23:29 drh Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
#include <stdlib.h> #include <stdlib.h>
@ -647,9 +647,7 @@ static int resolveCompoundOrderBy(
struct ExprList_item *pItem; struct ExprList_item *pItem;
moreToDo = 0; moreToDo = 0;
pEList = pSelect->pEList; pEList = pSelect->pEList;
if( pEList==0 ){ assert( pEList!=0 );
return 1;
}
for(i=0, pItem=pOrderBy->a; i<pOrderBy->nExpr; i++, pItem++){ for(i=0, pItem=pOrderBy->a; i<pOrderBy->nExpr; i++, pItem++){
int iCol = -1; int iCol = -1;
Expr *pE, *pDup; Expr *pE, *pDup;
@ -730,9 +728,7 @@ int sqlite3ResolveOrderGroupBy(
} }
#endif #endif
pEList = pSelect->pEList; pEList = pSelect->pEList;
if( pEList==0 ){ assert( pEList!=0 ); /* sqlite3SelectNew() guarantees this */
return 0;
}
for(i=0, pItem=pOrderBy->a; i<pOrderBy->nExpr; i++, pItem++){ for(i=0, pItem=pOrderBy->a; i<pOrderBy->nExpr; i++, pItem++){
if( pItem->iCol ){ if( pItem->iCol ){
Expr *pE; Expr *pE;
@ -749,7 +745,7 @@ int sqlite3ResolveOrderGroupBy(
sqlite3ExprDelete(db, pE); sqlite3ExprDelete(db, pE);
pE = sqlite3ExprDup(db, pEList->a[pItem->iCol-1].pExpr); pE = sqlite3ExprDup(db, pEList->a[pItem->iCol-1].pExpr);
pItem->pExpr = pE; pItem->pExpr = pE;
if( pE && pColl && flags ){ if( pE && flags ){
pE->pColl = pColl; pE->pColl = pColl;
pE->flags |= flags; pE->flags |= flags;
} }
@ -809,7 +805,7 @@ static int resolveOrderGroupBy(
/* The ORDER BY term is an integer constant. Again, set the column /* The ORDER BY term is an integer constant. Again, set the column
** number so that sqlite3ResolveOrderGroupBy() will convert the ** number so that sqlite3ResolveOrderGroupBy() will convert the
** order-by term to a copy of the result-set expression */ ** order-by term to a copy of the result-set expression */
if( iCol<1 || iCol>nResult ){ if( iCol<1 ){
resolveOutOfRangeError(pParse, zType, i+1, nResult); resolveOutOfRangeError(pParse, zType, i+1, nResult);
return 1; return 1;
} }
@ -842,7 +838,7 @@ static int resolveSelectStep(Walker *pWalker, Select *p){
sqlite3 *db; /* Database connection */ sqlite3 *db; /* Database connection */
if( p==0 ) return WRC_Continue; assert( p!=0 );
if( p->selFlags & SF_Resolved ){ if( p->selFlags & SF_Resolved ){
return WRC_Prune; return WRC_Prune;
} }
@ -890,7 +886,7 @@ static int resolveSelectStep(Walker *pWalker, Select *p){
/* Resolve names in the result set. */ /* Resolve names in the result set. */
pEList = p->pEList; pEList = p->pEList;
if( !pEList ) return WRC_Abort; assert( pEList!=0 );
for(i=0; i<pEList->nExpr; i++){ for(i=0; i<pEList->nExpr; i++){
Expr *pX = pEList->a[i].pExpr; Expr *pX = pEList->a[i].pExpr;
if( sqlite3ResolveExprNames(&sNC, pX) ){ if( sqlite3ResolveExprNames(&sNC, pX) ){
@ -1102,11 +1098,10 @@ void sqlite3ResolveSelectNames(
){ ){
Walker w; Walker w;
if( p ){ assert( p!=0 );
w.xExprCallback = resolveExprStep; w.xExprCallback = resolveExprStep;
w.xSelectCallback = resolveSelectStep; w.xSelectCallback = resolveSelectStep;
w.pParse = pParse; w.pParse = pParse;
w.u.pNC = pOuterNC; w.u.pNC = pOuterNC;
sqlite3WalkSelect(&w, p); sqlite3WalkSelect(&w, p);
}
} }

View File

@ -12,7 +12,7 @@
** This file contains C code routines that are called by the parser ** This file contains C code routines that are called by the parser
** to handle SELECT statements in SQLite. ** to handle SELECT statements in SQLite.
** **
** $Id: select.c,v 1.469 2008/08/22 16:29:51 drh Exp $ ** $Id: select.c,v 1.470 2008/08/25 17:23:29 drh Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
@ -87,8 +87,9 @@ Select *sqlite3SelectNew(
pNew->addrOpenEphm[0] = -1; pNew->addrOpenEphm[0] = -1;
pNew->addrOpenEphm[1] = -1; pNew->addrOpenEphm[1] = -1;
pNew->addrOpenEphm[2] = -1; pNew->addrOpenEphm[2] = -1;
if( pNew==&standin) { if( db->mallocFailed ) {
clearSelect(db, pNew); clearSelect(db, pNew);
if( pNew!=&standin ) sqlite3DbFree(db, pNew);
pNew = 0; pNew = 0;
} }
return pNew; return pNew;

View File

@ -9,36 +9,40 @@
# #
#*********************************************************************** #***********************************************************************
# #
# $Id: permutations.test,v 1.21 2008/08/21 15:54:01 danielk1977 Exp $ # $Id: permutations.test,v 1.22 2008/08/25 17:23:29 drh Exp $
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
source $testdir/tester.tcl source $testdir/tester.tcl
# Argument processing. # Argument processing.
# #
set ::testmode [lindex $argv 0] #puts "PERM-DEBUG: argv=$argv"
set ::testfile [lindex $argv 1] namespace eval ::perm {
set testmode [lindex $::argv 0]
set testfile [lindex $::argv 1]
}
set argv [lrange $argv 2 end] set argv [lrange $argv 2 end]
#puts "PERM-DEBUG: testmode=$::perm::testmode"
set ::permutations_presql "" set ::permutations_presql ""
set ::permutations_test_prefix "" set ::permutations_test_prefix ""
if {$::testmode eq "veryquick"} { if {$::perm::testmode eq "veryquick"} {
set ::testmode [list persistent_journal no_journal] set ::perm::testmode [list persistent_journal no_journal]
set ISQUICK 1 set ISQUICK 1
} }
if {$::testmode eq "quick"} { if {$::perm::testmode eq "quick"} {
set ::testmode [list persistent_journal no_journal autovacuum_ioerr] set ::perm::testmode [list persistent_journal no_journal autovacuum_ioerr]
set ISQUICK 1 set ISQUICK 1
} }
if {$::testmode eq "all"} { if {$::perm::testmode eq "all"} {
set ::testmode { set ::perm::testmode {
memsubsys1 memsubsys2 singlethread multithread onefile utf16 exclusive memsubsys1 memsubsys2 singlethread multithread onefile utf16 exclusive
persistent_journal persistent_journal_error no_journal no_journal_error persistent_journal persistent_journal_error no_journal no_journal_error
autovacuum_ioerr no_mutex_try autovacuum_ioerr no_mutex_try
} }
} }
if {$::testmode eq "targets"} { if {$::perm::testmode eq "targets"} {
puts "" puts ""
puts -nonewline "veryquick " puts -nonewline "veryquick "
puts "Same as persistent_journal and no_journal" puts "Same as persistent_journal and no_journal"
@ -47,6 +51,7 @@ if {$::testmode eq "targets"} {
puts -nonewline "all " puts -nonewline "all "
puts "Everything except autovacuum_crash" puts "Everything except autovacuum_crash"
} }
puts "PERM-DEBUG: testmode=$::perm::testmode"
set EXCLUDE { set EXCLUDE {
all.test in2.test onefile.test all.test in2.test onefile.test
@ -113,21 +118,30 @@ proc run_tests {name args} {
set options(-presql) "" set options(-presql) ""
set options(-description) "no description supplied (fixme)" set options(-description) "no description supplied (fixme)"
array set options $args array set options $args
#puts "PERM-DEBUG: name=$name testfile=$::perm::testfile"
#puts "PERM-DEBUG: [array get options]"
if {$::testmode eq "targets"} { if {$::perm::testmode eq "targets"} {
puts [format "% -20s %s" $name [string trim $options(-description)]] puts [format "% -20s %s" $name [string trim $options(-description)]]
return return
} }
if {$::testmode ne "" && [lsearch $::testmode $name]<0} return if {$::perm::testmode ne "" && [lsearch $::perm::testmode $name]<0} {
puts "skipping permutation test $name..."
return
}
uplevel $options(-initialize) uplevel $options(-initialize)
set ::permutations_presql $options(-presql) set ::permutations_presql $options(-presql)
foreach file $options(-include) { foreach file $options(-include) {
if {[lsearch $options(-exclude) $file] < 0 && ( if {[lsearch $options(-exclude) $file] < 0 &&
$::testfile eq "" || $::testfile eq $file || "$::testfile.test" eq $file ( $::perm::testfile eq "" ||
) } { $::perm::testfile eq $file ||
"$::perm::testfile.test" eq $file )
} {
uplevel source $::testdir/$file uplevel source $::testdir/$file
} else {
# puts "skipping file $file"
} }
} }
@ -471,7 +485,8 @@ ifcapable mem5 {
ifcapable threadsafe { ifcapable threadsafe {
run_tests "no_mutex_try" -description { run_tests "no_mutex_try" -description {
The sqlite3_mutex_try() interface always fails The sqlite3_mutex_try() interface always fails
} -initialize { } -exclude [concat $EXCLUDE mutex1.test mutex2.test] \
-initialize {
catch {db close} catch {db close}
sqlite3_shutdown sqlite3_shutdown
install_mutex_counters 1 install_mutex_counters 1
@ -530,7 +545,7 @@ run_tests "memsys6" -description {
# End of tests # End of tests
############################################################################# #############################################################################
if {$::testmode eq "targets"} { puts "" ; exit } if {$::perm::testmode eq "targets"} { puts "" ; exit }
# Restore the [sqlite3] command. # Restore the [sqlite3] command.
# #