/ Check-in [435b57dc]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Merge in the latest changes from the trunk.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | sessions
Files: files | file ages | folders
SHA1:435b57dc2be7b071270a6cddece297758b8153aa
User & Date: drh 2011-04-06 22:33:50
Context
2011-04-06
23:39
Fix VC++ compiler warnings. check-in: 7b7c8d36 user: drh tags: sessions
22:33
Merge in the latest changes from the trunk. check-in: 435b57dc user: drh tags: sessions
22:05
Fix a performance regression: Keep two btree masks in each prepared statement; one for btrees used and another for btrees that require locks. Only try to lock the btrees identified by the second mask. check-in: 614de91a user: drh tags: trunk
2011-04-05
22:13
Merge the latest trunk changes into the sessions branch. check-in: 45f20261 user: drh tags: sessions
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/btmutex.c.

   198    198     Btree *p;
   199    199     assert( sqlite3_mutex_held(db->mutex) );
   200    200     for(i=0; i<db->nDb; i++){
   201    201       p = db->aDb[i].pBt;
   202    202       if( p ) sqlite3BtreeLeave(p);
   203    203     }
   204    204   }
          205  +
          206  +/*
          207  +** Return true if a particular Btree requires a lock.  Return FALSE if
          208  +** no lock is ever required since it is not sharable.
          209  +*/
          210  +int sqlite3BtreeSharable(Btree *p){
          211  +  return p->sharable;
          212  +}
   205    213   
   206    214   #ifndef NDEBUG
   207    215   /*
   208    216   ** Return true if the current thread holds the database connection
   209    217   ** mutex and all required BtShared mutexes.
   210    218   **
   211    219   ** This routine is used inside assert() statements only.

Changes to src/btree.c.

  2123   2123     sqlite3BtreeEnter(p);
  2124   2124     assert( pBt && pBt->pPager );
  2125   2125     rc = sqlite3PagerNosync(pBt->pPager);
  2126   2126     sqlite3BtreeLeave(p);
  2127   2127     return rc;
  2128   2128   }
  2129   2129   
  2130         -#if !defined(SQLITE_OMIT_PAGER_PRAGMAS) || !defined(SQLITE_OMIT_VACUUM)
  2131   2130   /*
  2132   2131   ** Change the default pages size and the number of reserved bytes per page.
  2133   2132   ** Or, if the page size has already been fixed, return SQLITE_READONLY 
  2134   2133   ** without changing anything.
  2135   2134   **
  2136   2135   ** The page size must be a power of 2 between 512 and 65536.  If the page
  2137   2136   ** size supplied does not meet this constraint then the page size is not
................................................................................
  2178   2177   /*
  2179   2178   ** Return the currently defined page size
  2180   2179   */
  2181   2180   int sqlite3BtreeGetPageSize(Btree *p){
  2182   2181     return p->pBt->pageSize;
  2183   2182   }
  2184   2183   
         2184  +#if !defined(SQLITE_OMIT_PAGER_PRAGMAS) || !defined(SQLITE_OMIT_VACUUM)
  2185   2185   /*
  2186   2186   ** Return the number of bytes of space at the end of every page that
  2187   2187   ** are intentually left unused.  This is the "reserved" space that is
  2188   2188   ** sometimes used by extensions.
  2189   2189   */
  2190   2190   int sqlite3BtreeGetReserve(Btree *p){
  2191   2191     int n;

Changes to src/btree.h.

   208    208     void sqlite3BtreeEnterAll(sqlite3*);
   209    209   #else
   210    210   # define sqlite3BtreeEnter(X) 
   211    211   # define sqlite3BtreeEnterAll(X)
   212    212   #endif
   213    213   
   214    214   #if !defined(SQLITE_OMIT_SHARED_CACHE) && SQLITE_THREADSAFE
          215  +  int sqlite3BtreeSharable(Btree*);
   215    216     void sqlite3BtreeLeave(Btree*);
   216    217     void sqlite3BtreeEnterCursor(BtCursor*);
   217    218     void sqlite3BtreeLeaveCursor(BtCursor*);
   218    219     void sqlite3BtreeLeaveAll(sqlite3*);
   219    220   #ifndef NDEBUG
   220    221     /* These routines are used inside assert() statements only. */
   221    222     int sqlite3BtreeHoldsMutex(Btree*);
   222    223     int sqlite3BtreeHoldsAllMutexes(sqlite3*);
   223    224     int sqlite3SchemaMutexHeld(sqlite3*,int,Schema*);
   224    225   #endif
   225    226   #else
   226    227   
          228  +# define sqlite3BtreeSharable(X) 0
   227    229   # define sqlite3BtreeLeave(X)
   228    230   # define sqlite3BtreeEnterCursor(X)
   229    231   # define sqlite3BtreeLeaveCursor(X)
   230    232   # define sqlite3BtreeLeaveAll(X)
   231    233   
   232    234   # define sqlite3BtreeHoldsMutex(X) 1
   233    235   # define sqlite3BtreeHoldsAllMutexes(X) 1
   234    236   # define sqlite3SchemaMutexHeld(X,Y,Z) 1
   235    237   #endif
   236    238   
   237    239   
   238    240   #endif /* _BTREE_H_ */

Changes to src/loadext.c.

    66     66   # define sqlite3_column_origin_name16   0
    67     67   #endif
    68     68   
    69     69   #ifdef SQLITE_OMIT_COMPLETE
    70     70   # define sqlite3_complete 0
    71     71   # define sqlite3_complete16 0
    72     72   #endif
           73  +
           74  +#ifdef SQLITE_OMIT_DECLTYPE
           75  +# define sqlite3_column_decltype16      0
           76  +# define sqlite3_column_decltype        0
           77  +#endif
    73     78   
    74     79   #ifdef SQLITE_OMIT_PROGRESS_CALLBACK
    75     80   # define sqlite3_progress_handler 0
    76     81   #endif
    77     82   
    78     83   #ifdef SQLITE_OMIT_VIRTUALTABLE
    79     84   # define sqlite3_create_module 0

Changes to src/os_unix.c.

  3394   3394         ** ftruncate() to set the file size, then write a single byte to
  3395   3395         ** the last byte in each block within the extended region. This
  3396   3396         ** is the same technique used by glibc to implement posix_fallocate()
  3397   3397         ** on systems that do not have a real fallocate() system call.
  3398   3398         */
  3399   3399         int nBlk = buf.st_blksize;  /* File-system block size */
  3400   3400         i64 iWrite;                 /* Next offset to write to */
  3401         -      int nWrite;                 /* Return value from seekAndWrite() */
  3402   3401   
  3403   3402         if( robust_ftruncate(pFile->h, nSize) ){
  3404   3403           pFile->lastErrno = errno;
  3405   3404           return unixLogError(SQLITE_IOERR_TRUNCATE, "ftruncate", pFile->zPath);
  3406   3405         }
  3407   3406         iWrite = ((buf.st_size + 2*nBlk - 1)/nBlk)*nBlk-1;
  3408         -      do {
  3409         -        nWrite = seekAndWrite(pFile, iWrite, "", 1);
         3407  +      while( iWrite<nSize ){
         3408  +        int nWrite = seekAndWrite(pFile, iWrite, "", 1);
         3409  +        if( nWrite!=1 ) return SQLITE_IOERR_WRITE;
  3410   3410           iWrite += nBlk;
  3411         -      } while( nWrite==1 && iWrite<nSize );
  3412         -      if( nWrite!=1 ) return SQLITE_IOERR_WRITE;
         3411  +      }
  3413   3412   #endif
  3414   3413       }
  3415   3414     }
  3416   3415   
  3417   3416     return SQLITE_OK;
  3418   3417   }
  3419   3418   

Changes to src/select.c.

   802    802     if( pParse->explain==2 ){
   803    803       Vdbe *v = pParse->pVdbe;
   804    804       char *zMsg = sqlite3MPrintf(pParse->db, "USE TEMP B-TREE FOR %s", zUsage);
   805    805       sqlite3VdbeAddOp4(v, OP_Explain, pParse->iSelectId, 0, 0, zMsg, P4_DYNAMIC);
   806    806     }
   807    807   }
   808    808   
          809  +/*
          810  +** Assign expression b to lvalue a. A second, no-op, version of this macro
          811  +** is provided when SQLITE_OMIT_EXPLAIN is defined. This allows the code
          812  +** in sqlite3Select() to assign values to structure member variables that
          813  +** only exist if SQLITE_OMIT_EXPLAIN is not defined without polluting the
          814  +** code with #ifndef directives.
          815  +*/
          816  +# define explainSetInteger(a, b) a = b
          817  +
          818  +#else
          819  +/* No-op versions of the explainXXX() functions and macros. */
          820  +# define explainTempTable(y,z)
          821  +# define explainSetInteger(y,z)
          822  +#endif
          823  +
          824  +#if !defined(SQLITE_OMIT_EXPLAIN) && !defined(SQLITE_OMIT_COMPOUND_SELECT)
   809    825   /*
   810    826   ** Unless an "EXPLAIN QUERY PLAN" command is being processed, this function
   811    827   ** is a no-op. Otherwise, it adds a single row of output to the EQP result,
   812    828   ** where the caption is of one of the two forms:
   813    829   **
   814    830   **   "COMPOSITE SUBQUERIES iSub1 and iSub2 (op)"
   815    831   **   "COMPOSITE SUBQUERIES iSub1 and iSub2 USING TEMP B-TREE (op)"
................................................................................
   833    849       char *zMsg = sqlite3MPrintf(
   834    850           pParse->db, "COMPOUND SUBQUERIES %d AND %d %s(%s)", iSub1, iSub2,
   835    851           bUseTmp?"USING TEMP B-TREE ":"", selectOpName(op)
   836    852       );
   837    853       sqlite3VdbeAddOp4(v, OP_Explain, pParse->iSelectId, 0, 0, zMsg, P4_DYNAMIC);
   838    854     }
   839    855   }
   840         -
   841         -/*
   842         -** Assign expression b to lvalue a. A second, no-op, version of this macro
   843         -** is provided when SQLITE_OMIT_EXPLAIN is defined. This allows the code
   844         -** in sqlite3Select() to assign values to structure member variables that
   845         -** only exist if SQLITE_OMIT_EXPLAIN is not defined without polluting the
   846         -** code with #ifndef directives.
   847         -*/
   848         -# define explainSetInteger(a, b) a = b
   849         -
   850    856   #else
   851    857   /* No-op versions of the explainXXX() functions and macros. */
   852         -# define explainTempTable(y,z)
   853    858   # define explainComposite(v,w,x,y,z)
   854         -# define explainSetInteger(y,z)
   855    859   #endif
   856    860   
   857    861   /*
   858    862   ** If the inner loop was generated using a non-null pOrderBy argument,
   859    863   ** then the results were placed in a sorter.  After the loop is terminated
   860    864   ** we need to run the sorter and output the results.  The following
   861    865   ** routine generates the code needed to do that.

Changes to src/sqliteLimit.h.

   114    114   */
   115    115   #ifndef SQLITE_DEFAULT_WAL_AUTOCHECKPOINT
   116    116   # define SQLITE_DEFAULT_WAL_AUTOCHECKPOINT  1000
   117    117   #endif
   118    118   
   119    119   /*
   120    120   ** The maximum number of attached databases.  This must be between 0
   121         -** and 30.  The upper bound on 30 is because a 32-bit integer bitmap
          121  +** and 62.  The upper bound on 62 is because a 64-bit integer bitmap
   122    122   ** is used internally to track attached databases.
   123    123   */
   124    124   #ifndef SQLITE_MAX_ATTACHED
   125    125   # define SQLITE_MAX_ATTACHED 10
   126    126   #endif
   127    127   
   128    128   

Changes to src/test_server.c.

   449    449   
   450    450       /* Signal the client that the message has been processed.
   451    451       */
   452    452       pMsg->op = MSG_Done;
   453    453       pthread_mutex_unlock(&pMsg->clientMutex);
   454    454       pthread_cond_signal(&pMsg->clientWakeup);
   455    455     }
   456         -  sqlite3_thread_cleanup();
   457    456     pthread_mutex_unlock(&g.serverMutex);
   458    457     return 0;
   459    458   }
   460    459   
   461    460   /*
   462    461   ** Start a server thread if one is not already running.  If there
   463    462   ** is aleady a server thread running, the new thread will quickly

Changes to src/vdbe.c.

  4693   4693     ** sqlite3InitCallback().
  4694   4694     */
  4695   4695   #ifdef SQLITE_DEBUG
  4696   4696     for(iDb=0; iDb<db->nDb; iDb++){
  4697   4697       assert( iDb==1 || sqlite3BtreeHoldsMutex(db->aDb[iDb].pBt) );
  4698   4698     }
  4699   4699   #endif
  4700         -  assert( p->btreeMask == ~(yDbMask)0 );
  4701         -
  4702   4700   
  4703   4701     iDb = pOp->p1;
  4704   4702     assert( iDb>=0 && iDb<db->nDb );
  4705   4703     assert( DbHasProperty(db, iDb, DB_SchemaLoaded) );
  4706   4704     /* Used to be a conditional */ {
  4707   4705       zMaster = SCHEMA_TABLE(iDb);
  4708   4706       initData.db = db;

Changes to src/vdbeInt.h.

   299    299     u8 minWriteFileFormat;  /* Minimum file format for writable database files */
   300    300     u8 inVtabMethod;        /* See comments above */
   301    301     u8 usesStmtJournal;     /* True if uses a statement journal */
   302    302     u8 readOnly;            /* True for read-only statements */
   303    303     u8 isPrepareV2;         /* True if prepared with prepare_v2() */
   304    304     int nChange;            /* Number of db changes made since last reset */
   305    305     yDbMask btreeMask;      /* Bitmask of db->aDb[] entries referenced */
          306  +  yDbMask lockMask;       /* Subset of btreeMask that requires a lock */
   306    307     int iStatement;         /* Statement number (or 0 if has not opened stmt) */
   307    308     int aCounter[3];        /* Counters used by sqlite3_stmt_status() */
   308    309   #ifndef SQLITE_OMIT_TRACE
   309    310     i64 startTime;          /* Time when query started - used for profiling */
   310    311   #endif
   311    312     i64 nFkConstraint;      /* Number of imm. FK constraints this VM */
   312    313     i64 nStmtDefCons;       /* Number of def. constraints when stmt started */

Changes to src/vdbeaux.c.

   157    157     pOp->p3 = p3;
   158    158     pOp->p4.p = 0;
   159    159     pOp->p4type = P4_NOTUSED;
   160    160     p->expired = 0;
   161    161     if( op==OP_ParseSchema ){
   162    162       /* Any program that uses the OP_ParseSchema opcode needs to lock
   163    163       ** all btrees. */
   164         -    p->btreeMask = ~(yDbMask)0;
          164  +    int j;
          165  +    for(j=0; j<p->db->nDb; j++) sqlite3VdbeUsesBtree(p, j);
   165    166     }
   166    167   #ifdef SQLITE_DEBUG
   167    168     pOp->zComment = 0;
   168    169     if( sqlite3VdbeAddopTrace ) sqlite3VdbePrintOp(0, i, &p->aOp[i]);
   169    170   #endif
   170    171   #ifdef VDBE_PROFILE
   171    172     pOp->cycles = 0;
................................................................................
   955    956   ** attached databases that they will be using.  A mask of these databases
   956    957   ** is maintained in p->btreeMask and is used for locking and other purposes.
   957    958   */
   958    959   void sqlite3VdbeUsesBtree(Vdbe *p, int i){
   959    960     assert( i>=0 && i<p->db->nDb && i<(int)sizeof(yDbMask)*8 );
   960    961     assert( i<(int)sizeof(p->btreeMask)*8 );
   961    962     p->btreeMask |= ((yDbMask)1)<<i;
          963  +  if( i!=1 && sqlite3BtreeSharable(p->db->aDb[i].pBt) ){
          964  +    p->lockMask |= ((yDbMask)1)<<i;
          965  +  }
   962    966   }
   963    967   
   964    968   #if !defined(SQLITE_OMIT_SHARED_CACHE) && SQLITE_THREADSAFE>0
   965    969   /*
   966    970   ** If SQLite is compiled to support shared-cache mode and to be threadsafe,
   967    971   ** this routine obtains the mutex associated with each BtShared structure
   968    972   ** that may be accessed by the VM passed as an argument. In doing so it also
................................................................................
   982    986   ** corresponding to btrees that use shared cache.  Then the runtime of
   983    987   ** this routine is N*N.  But as N is rarely more than 1, this should not
   984    988   ** be a problem.
   985    989   */
   986    990   void sqlite3VdbeEnter(Vdbe *p){
   987    991     int i;
   988    992     yDbMask mask;
   989         -  sqlite3 *db = p->db;
   990         -  Db *aDb = db->aDb;
   991         -  int nDb = db->nDb;
          993  +  sqlite3 *db;
          994  +  Db *aDb;
          995  +  int nDb;
          996  +  if( p->lockMask==0 ) return;  /* The common case */
          997  +  db = p->db;
          998  +  aDb = db->aDb;
          999  +  nDb = db->nDb;
   992   1000     for(i=0, mask=1; i<nDb; i++, mask += mask){
   993         -    if( i!=1 && (mask & p->btreeMask)!=0 && ALWAYS(aDb[i].pBt!=0) ){
         1001  +    if( i!=1 && (mask & p->lockMask)!=0 && ALWAYS(aDb[i].pBt!=0) ){
   994   1002         sqlite3BtreeEnter(aDb[i].pBt);
   995   1003       }
   996   1004     }
   997   1005   }
   998   1006   #endif
   999   1007   
  1000   1008   #if !defined(SQLITE_OMIT_SHARED_CACHE) && SQLITE_THREADSAFE>0
  1001   1009   /*
  1002   1010   ** Unlock all of the btrees previously locked by a call to sqlite3VdbeEnter().
  1003   1011   */
  1004   1012   void sqlite3VdbeLeave(Vdbe *p){
  1005   1013     int i;
  1006   1014     yDbMask mask;
  1007         -  sqlite3 *db = p->db;
  1008         -  Db *aDb = db->aDb;
  1009         -  int nDb = db->nDb;
  1010         -
         1015  +  sqlite3 *db;
         1016  +  Db *aDb;
         1017  +  int nDb;
         1018  +  if( p->lockMask==0 ) return;  /* The common case */
         1019  +  db = p->db;
         1020  +  aDb = db->aDb;
         1021  +  nDb = db->nDb;
  1011   1022     for(i=0, mask=1; i<nDb; i++, mask += mask){
  1012         -    if( i!=1 && (mask & p->btreeMask)!=0 && ALWAYS(aDb[i].pBt!=0) ){
         1023  +    if( i!=1 && (mask & p->lockMask)!=0 && ALWAYS(aDb[i].pBt!=0) ){
  1013   1024         sqlite3BtreeLeave(aDb[i].pBt);
  1014   1025       }
  1015   1026     }
  1016   1027   }
  1017   1028   #endif
  1018   1029   
  1019   1030   #if defined(VDBE_PROFILE) || defined(SQLITE_DEBUG)

Added test/attach4.test.

            1  +# 200 July 1
            2  +#
            3  +# The author disclaims copyright to this source code.  In place of
            4  +# a legal notice, here is a blessing:
            5  +#
            6  +#    May you do good and not evil.
            7  +#    May you find forgiveness for yourself and forgive others.
            8  +#    May you share freely, never taking more than you give.
            9  +#
           10  +#***********************************************************************
           11  +# This file implements regression tests for SQLite library.  The
           12  +# focus of this script is attaching many database files to a single
           13  +# connection.
           14  +#
           15  +
           16  +set testdir [file dirname $argv0]
           17  +source $testdir/tester.tcl
           18  +
           19  +set testprefix attach4
           20  +
           21  +ifcapable !attach {
           22  +  finish_test
           23  +  return
           24  +}
           25  +
           26  +puts "Testing with SQLITE_MAX_ATTACHED=$SQLITE_MAX_ATTACHED"
           27  +
           28  +set files {main test.db}
           29  +for {set ii 0} {$ii < $SQLITE_MAX_ATTACHED} {incr ii} {
           30  +  lappend files aux$ii "test.db$ii"
           31  +}
           32  +
           33  +do_test 1.1 {
           34  +  sqlite3_limit db SQLITE_LIMIT_ATTACHED -1
           35  +} $SQLITE_MAX_ATTACHED
           36  +
           37  +do_test 1.2.1 {
           38  +  db close
           39  +  foreach {name f} $files { forcedelete $f }
           40  +  sqlite3 db test.db
           41  +  
           42  +  foreach {name f} $files {
           43  +    if {$name == "main"} continue
           44  +    execsql "ATTACH '$f' AS $name"
           45  +  }
           46  +
           47  +  db eval {PRAGMA database_list} {
           48  +    lappend L $name [file tail $file]
           49  +  }
           50  +  set L
           51  +} $files
           52  +
           53  +do_catchsql_test 1.2.2 {
           54  +  ATTACH 'x.db' AS next;
           55  +} [list 1 "too many attached databases - max $SQLITE_MAX_ATTACHED"]
           56  +
           57  +do_test 1.3 {
           58  +  execsql BEGIN;
           59  +  foreach {name f} $files {
           60  +    execsql "CREATE TABLE $name.tbl(x)"
           61  +    execsql "INSERT INTO $name.tbl VALUES('$f')"
           62  +  }
           63  +  execsql COMMIT;
           64  +} {}
           65  +
           66  +do_test 1.4 {
           67  +  set L [list]
           68  +  foreach {name f} $files {
           69  +    lappend L $name [execsql "SELECT x FROM $name.tbl"]
           70  +  }
           71  +  set L
           72  +} $files
           73  +
           74  +set L [list]
           75  +set S ""
           76  +foreach {name f} $files {
           77  +  lappend L wal
           78  +  append S "
           79  +    PRAGMA $name.journal_mode = WAL;
           80  +    UPDATE $name.tbl SET x = '$name';
           81  +  "
           82  +}
           83  +do_execsql_test 1.5 $S $L
           84  +
           85  +do_test 1.6 {
           86  +  set L [list]
           87  +  foreach {name f} $files {
           88  +    lappend L [execsql "SELECT x FROM $name.tbl"] $f
           89  +  }
           90  +  set L
           91  +} $files
           92  +
           93  +do_test 1.7 {
           94  +  execsql BEGIN;
           95  +  foreach {name f} $files {
           96  +    execsql "UPDATE $name.tbl SET x = '$f'"
           97  +  }
           98  +  execsql COMMIT;
           99  +} {}
          100  +
          101  +do_test 1.8 {
          102  +  set L [list]
          103  +  foreach {name f} $files {
          104  +    lappend L $name [execsql "SELECT x FROM $name.tbl"]
          105  +  }
          106  +  set L
          107  +} $files
          108  +
          109  +db close
          110  +foreach {name f} $files { forcedelete $f }
          111  +
          112  +finish_test

Changes to test/releasetest.tcl.

    56     56     ########################################################
    57     57   }
    58     58   
    59     59   array set ::Configs {
    60     60     "Default" {
    61     61       -O2
    62     62     }
           63  +  "Ftrapv" {
           64  +    -O2 -ftrapv
           65  +    -DSQLITE_MAX_ATTACHED=55
           66  +    -DSQLITE_TCL_DEFAULT_FULLMUTEX=1
           67  +  }
    63     68     "Unlock-Notify" {
    64     69       -O2
    65     70       -DSQLITE_ENABLE_UNLOCK_NOTIFY
    66     71       -DSQLITE_THREADSAFE
    67     72       -DSQLITE_TCL_DEFAULT_FULLMUTEX=1
    68     73     }
    69     74     "Secure-Delete" {
................................................................................
   140    145       -DSQLITE_MAX_LENGTH=2147483645
   141    146       -DSQLITE_MAX_VARIABLE_NUMBER=500000
   142    147       -DSQLITE_DEBUG=1 
   143    148       -DSQLITE_PREFER_PROXY_LOCKING=1
   144    149     }
   145    150     "Extra-Robustness" {
   146    151       -DSQLITE_ENABLE_OVERSIZE_CELL_CHECK=1
          152  +    -DSQLITE_MAX_ATTACHED=62
   147    153     }
   148    154   }
   149    155   
   150    156   array set ::Platforms {
   151    157     Linux-x86_64 {
   152    158       "Secure-Delete"           test
   153    159       "Unlock-Notify"           "QUICKTEST_INCLUDE=notify2.test test"
   154    160       "Update-Delete-Limit"     test
   155    161       "Debug-One"               test
   156    162       "Extra-Robustness"        test
   157    163       "Device-Two"              test
          164  +    "Ftrapv"                  test
   158    165       "Default"                 "threadtest test"
   159    166       "Device-One"              fulltest
   160    167     }
   161    168     Linux-i686 {
   162    169       "Unlock-Notify"           "QUICKTEST_INCLUDE=notify2.test test"
   163    170       "Device-One"              test
   164    171       "Device-Two"              test

Changes to test/syscall.test.

   235    235   forcedelete test.db test.db2
   236    236   
   237    237   do_test 8.1 {
   238    238     sqlite3 db test.db
   239    239     file_control_chunksize_test db main 4096
   240    240     file size test.db
   241    241   } {0}
   242         -
   243    242   foreach {tn hint size} {
   244    243     1  1000    4096 
   245    244     2  1000    4096 
   246    245     3  3000    4096 
   247    246     4  4096    4096 
   248    247     5  4197    8192 
   249    248   } {
   250    249     do_test 8.2.$tn {
          250  +    file_control_sizehint_test db main $hint
          251  +    file size test.db
          252  +  } $size
          253  +}
          254  +
          255  +do_test 8.3 {
          256  +  db close
          257  +  forcedelete test.db test.db2
          258  +  sqlite3 db test.db
          259  +  file_control_chunksize_test db main 16
          260  +  file size test.db
          261  +} {0}
          262  +foreach {tn hint size} {
          263  +  1  5       16 
          264  +  2  13      16 
          265  +  3  45      48 
          266  +  4  48      48 
          267  +  5  49      64 
          268  +} {
          269  +  do_test 8.4.$tn {
   251    270       file_control_sizehint_test db main $hint
   252    271       file size test.db
   253    272     } $size
   254    273   }
   255    274   
   256    275   test_syscall reset
   257    276   finish_test

Changes to test/wal.test.

  1526   1526       CREATE TABLE t1(x);
  1527   1527       INSERT INTO t1 VALUES(randomblob(5000));
  1528   1528       INSERT INTO t1 SELECT * FROM t1;
  1529   1529       INSERT INTO t1 SELECT * FROM t1;
  1530   1530       INSERT INTO t1 SELECT * FROM t1;
  1531   1531       INSERT INTO t1 SELECT * FROM t1;
  1532   1532     } {wal}
  1533         -  do_execsql_test 24.2 { 
  1534         -    DELETE FROM t1;
  1535         -    PRAGMA wal_checkpoint;
  1536         -  } {0 109 109}
  1537         -  do_test 24.3 {
         1533  +  do_test 24.2 { 
         1534  +    execsql {
         1535  +      DELETE FROM t1;
         1536  +      PRAGMA wal_checkpoint;
         1537  +    }
  1538   1538       db close
  1539   1539       sqlite3 db test.db
  1540   1540       file exists test.db-wal
  1541   1541     } 0
  1542         -  do_test 24.4 {
         1542  +  do_test 24.3 {
  1543   1543       file size test.db
  1544   1544     } [expr 84 * 1024]
  1545         -  do_test 24.5 {
         1545  +  do_test 24.4 {
  1546   1546       execsql { 
  1547   1547         PRAGMA incremental_vacuum;
  1548   1548         PRAGMA wal_checkpoint;
  1549   1549       }
  1550   1550       file size test.db
  1551   1551     } [expr 3 * 1024]
  1552         -  do_test 24.6 {
         1552  +  do_test 24.5 {
  1553   1553       file size test.db-wal
  1554   1554     } 2128
  1555   1555   }
  1556   1556   
  1557   1557   db close
  1558   1558   sqlite3_shutdown
  1559   1559   test_sqlite3_log
  1560   1560   sqlite3_initialize
  1561   1561   
  1562   1562   finish_test

Changes to tool/omittest.tcl.

     4      4   # Documentation for this script. This may be output to stderr
     5      5   # if the script is invoked incorrectly.
     6      6   set ::USAGE_MESSAGE {
     7      7   This Tcl script is used to test the various compile time options 
     8      8   available for omitting code (the SQLITE_OMIT_xxx options). It
     9      9   should be invoked as follows:
    10     10   
    11         -    <script> ?-makefile PATH-TO-MAKEFILE? ?-skip_run?
           11  +    <script> ?test-symbol? ?-makefile PATH-TO-MAKEFILE? ?-skip_run?
    12     12   
    13     13   The default value for ::MAKEFILE is "../Makefile.linux.gcc".
    14     14   
    15     15   If -skip_run option is given then only the compile part is attempted.
    16     16   
    17     17   This script builds the testfixture program and runs the SQLite test suite
    18     18   once with each SQLITE_OMIT_ option defined and then once with all options
................................................................................
   116    116   # This proc processes the command line options passed to this script.
   117    117   # Currently the only option supported is "-makefile", default
   118    118   # "../Makefile.linux-gcc". Set the ::MAKEFILE variable to the value of this
   119    119   # option.
   120    120   #
   121    121   proc process_options {argv} {
   122    122     if {$::tcl_platform(platform)=="windows" || $::tcl_platform(platform)=="os2"} {
   123         -      set ::MAKEFILE ./Makefile                         ;# Default value
          123  +    set ::MAKEFILE ./Makefile               ;# Default value
   124    124     } else {
   125         -      set ::MAKEFILE ./Makefile.linux-gcc               ;# Default value
          125  +    set ::MAKEFILE ./Makefile.linux-gcc     ;# Default value
   126    126     }
   127         -  set ::SKIP_RUN 0                                      ;# Default to attempt test
          127  +  set ::SKIP_RUN 0                          ;# Default to attempt test
   128    128   
   129    129     for {set i 0} {$i < [llength $argv]} {incr i} {
   130    130       switch -- [lindex $argv $i] {
   131    131         -makefile {
   132    132           incr i
   133    133           set ::MAKEFILE [lindex $argv $i]
   134    134         }
   135    135     
   136    136         -skip_run {
   137         -        incr i
   138    137           set ::SKIP_RUN 1
   139    138         }
   140    139   
   141    140         default {
   142         -        puts stderr [string trim $::USAGE_MESSAGE]
   143         -        exit -1
          141  +        if {[info exists ::SYMBOL]} {
          142  +          puts stderr [string trim $::USAGE_MESSAGE]
          143  +          exit -1
          144  +        }
          145  +        set ::SYMBOL [lindex $argv $i]
   144    146         }
   145    147       }
   146    148       set ::MAKEFILE [file normalize $::MAKEFILE]
   147    149     }
   148    150   }
   149    151   
   150    152   # Main routine.
................................................................................
   237    239       SQLITE_ENABLE_UNLOCK_NOTIFY \
   238    240       SQLITE_ENABLE_UPDATE_DELETE_LIMIT \
   239    241     ]
   240    242   
   241    243     # Process any command line options.
   242    244     process_options $argv
   243    245   
   244         -  # First try a test with all OMIT symbols except SQLITE_OMIT_FLOATING_POINT 
   245         -  # and SQLITE_OMIT_PRAGMA defined. The former doesn't work (causes segfaults)
   246         -  # and the latter is currently incompatible with the test suite (this should
   247         -  # be fixed, but it will be a lot of work).
   248         -  set allsyms [list]
   249         -  foreach s $::OMIT_SYMBOLS {
   250         -    if {$s!="SQLITE_OMIT_FLOATING_POINT" && $s!="SQLITE_OMIT_PRAGMA"} {
   251         -      lappend allsyms $s
          246  +  if {[info exists ::SYMBOL] } {
          247  +    set sym $::SYMBOL
          248  +
          249  +    if {[lsearch $::OMIT_SYMBOLS $sym]<0 && [lsearch $::ENABLE_SYMBOLS $sym]<0} {
          250  +      puts stderr "No such symbol: $sym"
          251  +      exit -1
   252    252       }
   253         -  }
   254         -  run_quick_test test_OMIT_EVERYTHING $allsyms
   255    253   
   256         -  # Now try one quick.test with each of the OMIT symbols defined. Included
   257         -  # are the OMIT_FLOATING_POINT and OMIT_PRAGMA symbols, even though we
   258         -  # know they will fail. It's good to be reminded of this from time to time.
   259         -  foreach sym $::OMIT_SYMBOLS {
   260    254       set dirname "test_[string range $sym 7 end]"
   261    255       run_quick_test $dirname $sym
   262         -  }
   263         -
   264         -  # Try the ENABLE/DISABLE symbols one at a time.  
   265         -  # We don't do them all at once since some are conflicting.
   266         -  foreach sym $::ENABLE_SYMBOLS {
   267         -    set dirname "test_[string range $sym 7 end]"
   268         -    run_quick_test $dirname $sym
          256  +  } else {
          257  +    # First try a test with all OMIT symbols except SQLITE_OMIT_FLOATING_POINT 
          258  +    # and SQLITE_OMIT_PRAGMA defined. The former doesn't work (causes segfaults)
          259  +    # and the latter is currently incompatible with the test suite (this should
          260  +    # be fixed, but it will be a lot of work).
          261  +    set allsyms [list]
          262  +    foreach s $::OMIT_SYMBOLS {
          263  +      if {$s!="SQLITE_OMIT_FLOATING_POINT" && $s!="SQLITE_OMIT_PRAGMA"} {
          264  +        lappend allsyms $s
          265  +      }
          266  +    }
          267  +    run_quick_test test_OMIT_EVERYTHING $allsyms
          268  +  
          269  +    # Now try one quick.test with each of the OMIT symbols defined. Included
          270  +    # are the OMIT_FLOATING_POINT and OMIT_PRAGMA symbols, even though we
          271  +    # know they will fail. It's good to be reminded of this from time to time.
          272  +    foreach sym $::OMIT_SYMBOLS {
          273  +      set dirname "test_[string range $sym 7 end]"
          274  +      run_quick_test $dirname $sym
          275  +    }
          276  +  
          277  +    # Try the ENABLE/DISABLE symbols one at a time.  
          278  +    # We don't do them all at once since some are conflicting.
          279  +    foreach sym $::ENABLE_SYMBOLS {
          280  +      set dirname "test_[string range $sym 7 end]"
          281  +      run_quick_test $dirname $sym
          282  +    }
   269    283     }
   270    284   }
   271    285   
   272    286   main $argv