SQLite

Check-in [239e53b4f2]
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
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 239e53b4f29b4faf2dbdc2aebd2332ad25b14286
User & Date: danielk1977 2006-02-14 13:48:34.000
Context
2006-02-14
14:02
Account for a malloc failure in the asynchronous writer thread in test_async.c (CVS 3096) (check-in: 2f2a8a69cb user: danielk1977 tags: trunk)
13:48
Fix bug in test_async.c version of OsFileSize(). (CVS 3095) (check-in: 239e53b4f2 user: danielk1977 tags: trunk)
13:25
Add simple io error tests for test_async.c. (CVS 3094) (check-in: 528dfb7180 user: danielk1977 tags: trunk)
Changes
Side-by-Side Diff Ignore Whitespace Patch
Changes to src/test_async.c.
360
361
362
363
364
365
366
367
368


369
370
371
372
373
374
375
360
361
362
363
364
365
366


367
368
369
370
371
372
373
374
375







-
-
+
+







  if( async.pQueueLast ){
    assert( async.pQueueFirst );
    async.pQueueLast->pNext = pWrite;
  }else{
    async.pQueueFirst = pWrite;
  }
  async.pQueueLast = pWrite;
  TRACE(("PUSH %p (%s %s)\n", pWrite, azOpcodeName[pWrite->op],
         pWrite->pFile ? pWrite->pFile->zName : "-"));
  TRACE(("PUSH %p (%s %s %d)\n", pWrite, azOpcodeName[pWrite->op],
         pWrite->pFile ? pWrite->pFile->zName : "-", pWrite->iOffset));

  if( pWrite->op==ASYNC_CLOSE ){
    async.nFile--;
    if( async.nFile==0 ){
      async.ioError = SQLITE_OK;
    }
  }
600
601
602
603
604
605
606
607

608
609
610
611
612
613
614
600
601
602
603
604
605
606

607
608
609
610
611
612
613
614







-
+







    for(p=async.pQueueFirst; p; p = p->pNext){
      if( p->pFile==(AsyncFile *)id ){
        switch( p->op ){
          case ASYNC_WRITE:
            s = MAX(p->iOffset + (i64)(p->nByte), s);
            break;
          case ASYNC_TRUNCATE:
            s = MIN(s, p->nByte);
            s = MIN(s, p->iOffset);
            break;
        }
      }
    }
    *pSize = s;
  }
  pthread_mutex_unlock(&async.queueMutex);
Changes to test/async2.test.
1
2
3
4
5
6
7
8

9
10
11
12
13
14
15
1
2
3
4
5
6
7

8
9
10
11
12
13
14
15







-
+







#
#    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: async2.test,v 1.1 2006/02/14 13:25:45 danielk1977 Exp $
# $Id: async2.test,v 1.2 2006/02/14 13:48:34 danielk1977 Exp $


if {[info commands sqlite3async_enable]==""} {
  # The async logic is not built into this system
  return
}

55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
55
56
57
58
59
60
61

62
63
64
65
66
67
68







-







  db close

  set ::sqlite_io_error_pending $n
  sqlite3async_halt idle
  sqlite3async_start
  sqlite3async_wait

  sqlite3async_enable 0
  set ::sqlite_io_error_pending 0
  sqlite3 db test.db
  set c [db eval {SELECT c FROM counter LIMIT 1}]
  switch -- $c {
    1 {
      do_test async-ioerr-1.1.$n {
        execsql {