/ Check-in [239e53b4]
Login

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

Overview
Comment:Fix bug in test_async.c version of OsFileSize(). (CVS 3095)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:239e53b4f29b4faf2dbdc2aebd2332ad25b14286
User & Date: danielk1977 2006-02-14 13:48:34
Context
2006-02-14
14:02
Account for a malloc failure in the asynchronous writer thread in test_async.c (CVS 3096) check-in: 2f2a8a69 user: danielk1977 tags: trunk
13:48
Fix bug in test_async.c version of OsFileSize(). (CVS 3095) check-in: 239e53b4 user: danielk1977 tags: trunk
13:25
Add simple io error tests for test_async.c. (CVS 3094) check-in: 528dfb71 user: danielk1977 tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/test_async.c.

   360    360     if( async.pQueueLast ){
   361    361       assert( async.pQueueFirst );
   362    362       async.pQueueLast->pNext = pWrite;
   363    363     }else{
   364    364       async.pQueueFirst = pWrite;
   365    365     }
   366    366     async.pQueueLast = pWrite;
   367         -  TRACE(("PUSH %p (%s %s)\n", pWrite, azOpcodeName[pWrite->op],
   368         -         pWrite->pFile ? pWrite->pFile->zName : "-"));
          367  +  TRACE(("PUSH %p (%s %s %d)\n", pWrite, azOpcodeName[pWrite->op],
          368  +         pWrite->pFile ? pWrite->pFile->zName : "-", pWrite->iOffset));
   369    369   
   370    370     if( pWrite->op==ASYNC_CLOSE ){
   371    371       async.nFile--;
   372    372       if( async.nFile==0 ){
   373    373         async.ioError = SQLITE_OK;
   374    374       }
   375    375     }
................................................................................
   600    600       for(p=async.pQueueFirst; p; p = p->pNext){
   601    601         if( p->pFile==(AsyncFile *)id ){
   602    602           switch( p->op ){
   603    603             case ASYNC_WRITE:
   604    604               s = MAX(p->iOffset + (i64)(p->nByte), s);
   605    605               break;
   606    606             case ASYNC_TRUNCATE:
   607         -            s = MIN(s, p->nByte);
          607  +            s = MIN(s, p->iOffset);
   608    608               break;
   609    609           }
   610    610         }
   611    611       }
   612    612       *pSize = s;
   613    613     }
   614    614     pthread_mutex_unlock(&async.queueMutex);

Changes to test/async2.test.

     1      1   #
     2      2   #    May you do good and not evil.
     3      3   #    May you find forgiveness for yourself and forgive others.
     4      4   #    May you share freely, never taking more than you give.
     5      5   #
     6      6   #***********************************************************************
     7      7   #
     8         -# $Id: async2.test,v 1.1 2006/02/14 13:25:45 danielk1977 Exp $
            8  +# $Id: async2.test,v 1.2 2006/02/14 13:48:34 danielk1977 Exp $
     9      9   
    10     10   
    11     11   if {[info commands sqlite3async_enable]==""} {
    12     12     # The async logic is not built into this system
    13     13     return
    14     14   }
    15     15   
................................................................................
    55     55     db close
    56     56   
    57     57     set ::sqlite_io_error_pending $n
    58     58     sqlite3async_halt idle
    59     59     sqlite3async_start
    60     60     sqlite3async_wait
    61     61   
    62         -  sqlite3async_enable 0
    63     62     set ::sqlite_io_error_pending 0
    64     63     sqlite3 db test.db
    65     64     set c [db eval {SELECT c FROM counter LIMIT 1}]
    66     65     switch -- $c {
    67     66       1 {
    68     67         do_test async-ioerr-1.1.$n {
    69     68           execsql {