SQLite

Check-in [8c3c0c24c8]
Login

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

Overview
Comment:Fix memdb.test so that it works when OMIT_AUTOVACUUM is defined. (CVS 6649)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 8c3c0c24c82606df41653dbf7324bf9f166c933a
User & Date: danielk1977 2009-05-18 16:04:38.000
Context
2009-05-19
03:21
Update the showdb.c utility so that it works with databases larger than 4GiB. (CVS 6656) (check-in: 9675b62236 user: drh tags: trunk)
2009-05-18
16:04
Fix memdb.test so that it works when OMIT_AUTOVACUUM is defined. (CVS 6649) (check-in: 8c3c0c24c8 user: danielk1977 tags: trunk)
15:46
Changes to select.c in support of full coverage testing. (CVS 6647) (check-in: e225f365bd user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to test/memdb.test.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# 2001 September 15
#
# The author disclaims copyright to this source code.  In place of
# a legal notice, here is a blessing:
#
#    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.
#
#***********************************************************************
# This file implements regression tests for SQLite library.  The
# focus of this script is in-memory database backend.
#
# $Id: memdb.test,v 1.18 2009/03/18 10:33:02 danielk1977 Exp $


set testdir [file dirname $argv0]
source $testdir/tester.tcl

ifcapable memorydb {














|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# 2001 September 15
#
# The author disclaims copyright to this source code.  In place of
# a legal notice, here is a blessing:
#
#    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.
#
#***********************************************************************
# This file implements regression tests for SQLite library.  The
# focus of this script is in-memory database backend.
#
# $Id: memdb.test,v 1.19 2009/05/18 16:04:38 danielk1977 Exp $


set testdir [file dirname $argv0]
source $testdir/tester.tcl

ifcapable memorydb {

409
410
411
412
413
414
415

416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
    DELETE FROM t1;
    SELECT count(*) FROM t1;
  }
} 0

# Test that auto-vacuum works with in-memory databases.
# 

do_test memdb-9.1 {
  db close
  sqlite3 db test.db
  db cache size 0
  execsql {
    PRAGMA auto_vacuum = full;
    CREATE TABLE t1(a);
    INSERT INTO t1 VALUES(randstr(1000,1000));
    INSERT INTO t1 VALUES(randstr(1000,1000));
    INSERT INTO t1 VALUES(randstr(1000,1000));
  }
  set memused [lindex [sqlite3_status SQLITE_STATUS_MEMORY_USED 0] 1]
  set pgovfl [lindex [sqlite3_status SQLITE_STATUS_PAGECACHE_OVERFLOW 0] 1]
  execsql { DELETE FROM t1 }
  set memused2 [lindex [sqlite3_status SQLITE_STATUS_MEMORY_USED 0] 1]
  expr {($memused2 + 2048 < $memused) || $pgovfl==0}
} {1}


} ;# ifcapable memorydb

finish_test







>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|




409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
    DELETE FROM t1;
    SELECT count(*) FROM t1;
  }
} 0

# Test that auto-vacuum works with in-memory databases.
# 
ifcapable autovacuum {
  do_test memdb-9.1 {
    db close
    sqlite3 db test.db
    db cache size 0
    execsql {
      PRAGMA auto_vacuum = full;
      CREATE TABLE t1(a);
      INSERT INTO t1 VALUES(randstr(1000,1000));
      INSERT INTO t1 VALUES(randstr(1000,1000));
      INSERT INTO t1 VALUES(randstr(1000,1000));
    }
    set memused [lindex [sqlite3_status SQLITE_STATUS_MEMORY_USED 0] 1]
    set pgovfl [lindex [sqlite3_status SQLITE_STATUS_PAGECACHE_OVERFLOW 0] 1]
    execsql { DELETE FROM t1 }
    set memused2 [lindex [sqlite3_status SQLITE_STATUS_MEMORY_USED 0] 1]
    expr {($memused2 + 2048 < $memused) || $pgovfl==0}
  } {1}
}

} ;# ifcapable memorydb

finish_test