]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Fix bug in the premutation testing that was causing many permutations from
authordrh <drh@noemail.net>
Mon, 25 Aug 2008 17:23:29 +0000 (17:23 +0000)
committerdrh <drh@noemail.net>
Mon, 25 Aug 2008 17:23:29 +0000 (17:23 +0000)
begin skipped.  There are now 16 errors reported by the permutation test. (CVS 5610)

FossilOrigin-Name: 4ad096bda1fc5c7b66f71ff5b32a4085c9a40574

manifest
manifest.uuid
src/pager.c
src/resolve.c
src/select.c
test/permutations.test

index 375d2ce900ed810d1b2da7a97fba34614f889c73..1fb93684af06b3f6200a2e47e949be7afca82032 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Pick\sup\sa\ssmall\sperformance\sincrease\sby\seliminating\sthe\spcacheRef()\sfunction.\s(CVS\s5609)
-D 2008-08-25T14:49:42
+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-25T17:23:29
 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
 F Makefile.in 689e14735f862a5553bceef206d8c13e29504e44
 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -135,7 +135,7 @@ F src/os_common.h 24525d8b7bce66c374dfc1810a6c9043f3359b60
 F src/os_os2.c e391fc95adc744bbdcefd4d11e3066998185a0a0
 F src/os_unix.c 4665cef7639dd937893c3ea076f0e8a8f215bb32
 F src/os_win.c aefe9ee26430678a19a058a874e4e2bd91398142
-F src/pager.c a175ce0a026177ca24b48b2944670404bcec90d8
+F src/pager.c 67d689efa33fbca2788d006e18dd7d1a7de22487
 F src/pager.h 3b9c138d2e744b9d6e61d4c2742301e3bf464864
 F src/parse.y d0f76d2cb8d6883d5600dc20beb961a6022b94b8
 F src/pcache.c 4883f3714503242057643a5dddbc74065def5157
@@ -144,8 +144,8 @@ F src/pragma.c f5b271b090af7fcedd308d7c5807a5503f7a853d
 F src/prepare.c c197041e0c4770672cda75e6bfe10242f885e510
 F src/printf.c 785f87120589c1db672e37c6eb1087c456e6f84d
 F src/random.c 5c754319d38abdd6acd74601ee0105504adc508a
-F src/resolve.c f279cfe052c3f91457de2512fa2510e4ea86b0cc
-F src/select.c 3db954ccabee38995b16013a390f15c3b07e1265
+F src/resolve.c 74725e61c9eefb597a203631d921efd9005b7a88
+F src/select.c 1042eafb5c703ed4fc80ab3c3cbdfdb74fbcf2b4
 F src/shell.c d83b578a8ccdd3e0e7fef4388a0887ce9f810967
 F src/sqlite.h.in 2373d1d70664f7fcd78e79af3c51792bb0a0753e
 F src/sqlite3ext.h 1e3887c9bd3ae66cb599e922824b04cd0d0f2c3e
@@ -445,7 +445,7 @@ F test/pager2.test 070983b89a308adaba525a2f9c1ba0592c72fa3d
 F test/pager3.test 2323bf27fd5bd887b580247e5bce500ceee994b4
 F test/pageropt.test 3ee6578891baaca967f0bd349e4abfa736229e1a
 F test/pagesize.test e0a8b3fe80f8b8e808d94a00734c7a18c76c407e
-F test/permutations.test 1f7ead8d56d62633b2dd00c26868db35f0b3dcdf
+F test/permutations.test 49468b8b94e66e20a43a29b805bc1811569208cf
 F test/pragma.test b55931bbd5dd543e56fd942dbf4b7439619b09a6
 F test/pragma2.test 5364893491b9231dd170e3459bfc2e2342658b47
 F test/printf.test 262a5acd3158f788e9bdf7f18d718f3af32ff6ef
@@ -623,7 +623,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 1dbced29de5f59ba2ebf877edcadf171540374d1
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
-P 0d61960afd35721d6d07acd75288c20d2cd6fda1
-R a45c0ea79cdddeaf5b79e95fe71c1625
-U danielk1977
-Z d37cbd289bc865902ff5dd4aff605824
+P e3840fbf0adf824941a4b9b3cac3a869f195d6f8
+R 536eabce05a14041e4591c9d085fb224
+U drh
+Z 6161148b36887e1910794505f591cf40
index ff14a6714abdf80e0871bdf92f37fa1cffbc2494..ece87fd48e9b47a7c455c433e985acdc81781324 100644 (file)
@@ -1 +1 @@
-e3840fbf0adf824941a4b9b3cac3a869f195d6f8
\ No newline at end of file
+4ad096bda1fc5c7b66f71ff5b32a4085c9a40574
\ No newline at end of file
index 1903fb1e704c0a6acc8cff714641066342ab9a9b..cd3f5742641481b358d93113b61ecc864c8f1dd2 100644 (file)
@@ -18,7 +18,7 @@
 ** file simultaneously, or one process from reading the database while
 ** 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
 #include "sqliteInt.h"
@@ -2495,29 +2495,27 @@ static int pagerStress(void *p, PgHdr *pPg){
 static int hasHotJournal(Pager *pPager, int *pExists){
   sqlite3_vfs *pVfs = pPager->pVfs;
   int rc = SQLITE_OK;
+  int exists;
+  int locked;
+  assert( pPager!=0 );
+  assert( pPager->useJournal );
+  assert( pPager->fd->pMethods );
   *pExists = 0;
-  if( pPager->useJournal && pPager->fd->pMethods ){
-    int exists;
-    int locked;
-
-    rc = sqlite3OsAccess(pVfs, pPager->zJournal, SQLITE_ACCESS_EXISTS, &exists);
-    if( rc==SQLITE_OK && exists ){
-      rc = sqlite3OsCheckReservedLock(pPager->fd, &locked);
-    }
-
-    if( rc==SQLITE_OK && exists && !locked ){
-      int nPage;
-      rc = sqlite3PagerPagecount(pPager, &nPage);
-      if( rc==SQLITE_OK ){
-        if( nPage==0 ){
-          sqlite3OsDelete(pVfs, pPager->zJournal, 0);
-        }else{
-          *pExists = 1;
-        }
+  rc = sqlite3OsAccess(pVfs, pPager->zJournal, SQLITE_ACCESS_EXISTS, &exists);
+  if( rc==SQLITE_OK && exists ){
+    rc = sqlite3OsCheckReservedLock(pPager->fd, &locked);
+  }
+  if( rc==SQLITE_OK && exists && !locked ){
+    int nPage;
+    rc = sqlite3PagerPagecount(pPager, &nPage);
+    if( rc==SQLITE_OK ){
+     if( nPage==0 ){
+        sqlite3OsDelete(pVfs, pPager->zJournal, 0);
+      }else{
+        *pExists = 1;
       }
     }
   }
-
   return rc;
 }
 
index b9d53609326ac2a2ff1129f211fc1ecd09bb360d..439fc745fc2872a9f6f000e3432b28123c8b0b96 100644 (file)
@@ -14,7 +14,7 @@
 ** resolve all identifiers by associating them with a particular
 ** 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 <stdlib.h>
@@ -647,9 +647,7 @@ static int resolveCompoundOrderBy(
     struct ExprList_item *pItem;
     moreToDo = 0;
     pEList = pSelect->pEList;
-    if( pEList==0 ){
-      return 1;
-    }
+    assert( pEList!=0 );
     for(i=0, pItem=pOrderBy->a; i<pOrderBy->nExpr; i++, pItem++){
       int iCol = -1;
       Expr *pE, *pDup;
@@ -730,9 +728,7 @@ int sqlite3ResolveOrderGroupBy(
   }
 #endif
   pEList = pSelect->pEList;
-  if( pEList==0 ){
-    return 0;
-  }
+  assert( pEList!=0 );  /* sqlite3SelectNew() guarantees this */
   for(i=0, pItem=pOrderBy->a; i<pOrderBy->nExpr; i++, pItem++){
     if( pItem->iCol ){
       Expr *pE;
@@ -749,7 +745,7 @@ int sqlite3ResolveOrderGroupBy(
       sqlite3ExprDelete(db, pE);
       pE = sqlite3ExprDup(db, pEList->a[pItem->iCol-1].pExpr);
       pItem->pExpr = pE;
-      if( pE && pColl && flags ){
+      if( pE && flags ){
         pE->pColl = pColl;
         pE->flags |= flags;
       }
@@ -809,7 +805,7 @@ static int resolveOrderGroupBy(
       /* The ORDER BY term is an integer constant.  Again, set the column
       ** number so that sqlite3ResolveOrderGroupBy() will convert the
       ** 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);
         return 1;
       }
@@ -842,7 +838,7 @@ static int resolveSelectStep(Walker *pWalker, Select *p){
   sqlite3 *db;            /* Database connection */
   
 
-  if( p==0 ) return WRC_Continue;
+  assert( p!=0 );
   if( p->selFlags & SF_Resolved ){
     return WRC_Prune;
   }
@@ -890,7 +886,7 @@ static int resolveSelectStep(Walker *pWalker, Select *p){
   
     /* Resolve names in the result set. */
     pEList = p->pEList;
-    if( !pEList ) return WRC_Abort;
+    assert( pEList!=0 );
     for(i=0; i<pEList->nExpr; i++){
       Expr *pX = pEList->a[i].pExpr;
       if( sqlite3ResolveExprNames(&sNC, pX) ){
@@ -1102,11 +1098,10 @@ void sqlite3ResolveSelectNames(
 ){
   Walker w;
 
-  if( p ){
-    w.xExprCallback = resolveExprStep;
-    w.xSelectCallback = resolveSelectStep;
-    w.pParse = pParse;
-    w.u.pNC = pOuterNC;
-    sqlite3WalkSelect(&w, p);
-  }
+  assert( p!=0 );
+  w.xExprCallback = resolveExprStep;
+  w.xSelectCallback = resolveSelectStep;
+  w.pParse = pParse;
+  w.u.pNC = pOuterNC;
+  sqlite3WalkSelect(&w, p);
 }
index 3af289df17700fc0e154b6b27e2696b1d2530e17..8cd5325b3ad035275387b66211eaaa051554bce3 100644 (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.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"
 
@@ -87,8 +87,9 @@ Select *sqlite3SelectNew(
   pNew->addrOpenEphm[0] = -1;
   pNew->addrOpenEphm[1] = -1;
   pNew->addrOpenEphm[2] = -1;
-  if( pNew==&standin) {
+  if( db->mallocFailed ) {
     clearSelect(db, pNew);
+    if( pNew!=&standin ) sqlite3DbFree(db, pNew);
     pNew = 0;
   }
   return pNew;
index f8cc0b0a3741a226ff789c9cea19c18cb15d7044..78110c880522429c6eaed95df454a2a9e4ab50f3 100644 (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]
 source $testdir/tester.tcl
 
 # Argument processing.
 #
-set ::testmode [lindex $argv 0]
-set ::testfile [lindex $argv 1]
+#puts "PERM-DEBUG: argv=$argv"
+namespace eval ::perm {
+  set testmode [lindex $::argv 0]
+  set testfile [lindex $::argv 1]
+}
 set argv [lrange $argv 2 end]
+#puts "PERM-DEBUG: testmode=$::perm::testmode"
 
 set ::permutations_presql ""
 set ::permutations_test_prefix ""
 
-if {$::testmode eq "veryquick"} {
-  set ::testmode [list persistent_journal no_journal]
+if {$::perm::testmode eq "veryquick"} {
+  set ::perm::testmode [list persistent_journal no_journal]
   set ISQUICK 1
 }
-if {$::testmode eq "quick"} {
-  set ::testmode [list persistent_journal no_journal autovacuum_ioerr]
+if {$::perm::testmode eq "quick"} {
+  set ::perm::testmode [list persistent_journal no_journal autovacuum_ioerr]
   set ISQUICK 1
 }
-if {$::testmode eq "all"} {
-  set ::testmode {
+if {$::perm::testmode eq "all"} {
+  set ::perm::testmode {
     memsubsys1 memsubsys2 singlethread multithread onefile utf16 exclusive
     persistent_journal persistent_journal_error no_journal no_journal_error
     autovacuum_ioerr no_mutex_try
   }
 }
-if {$::testmode eq "targets"} { 
+if {$::perm::testmode eq "targets"} { 
   puts ""
   puts -nonewline "veryquick            "
   puts "Same as persistent_journal and no_journal"
@@ -47,6 +51,7 @@ if {$::testmode eq "targets"} {
   puts -nonewline "all                  "
   puts "Everything except autovacuum_crash"
 }
+puts "PERM-DEBUG: testmode=$::perm::testmode"
 
 set EXCLUDE {
   all.test                  in2.test                  onefile.test
@@ -113,21 +118,30 @@ proc run_tests {name args} {
   set options(-presql) ""
   set options(-description) "no description supplied (fixme)"
   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)]]
     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)
   set ::permutations_presql $options(-presql)
 
   foreach file $options(-include) {
-    if {[lsearch $options(-exclude) $file] < 0 && (
-      $::testfile eq "" || $::testfile eq $file || "$::testfile.test" eq $file
-    ) } {
+    if {[lsearch $options(-exclude) $file] < 0 &&
+       ( $::perm::testfile eq "" ||
+         $::perm::testfile eq $file ||
+        "$::perm::testfile.test" eq $file )
+    } {
       uplevel source $::testdir/$file
+    } else {
+      # puts "skipping file $file"
     }
   }
 
@@ -471,7 +485,8 @@ ifcapable mem5 {
 ifcapable threadsafe {
   run_tests "no_mutex_try" -description {
      The sqlite3_mutex_try() interface always fails
-  } -initialize {
+  } -exclude [concat $EXCLUDE mutex1.test mutex2.test] \
+  -initialize {
     catch {db close}
     sqlite3_shutdown
     install_mutex_counters 1
@@ -530,7 +545,7 @@ run_tests "memsys6" -description {
 # End of tests
 #############################################################################
 
-if {$::testmode eq "targets"} { puts "" ; exit }
+if {$::perm::testmode eq "targets"} { puts "" ; exit }
 
 # Restore the [sqlite3] command.
 #