SQLite

Check-in [b94d39e4d9]
Login

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

Overview
Comment:Get tests working with SQLITE_OMIT_AUTOVACUUM=1. (CVS 3918)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: b94d39e4d903bc34a9d0bbedd971677abc0ddfc0
User & Date: drh 2007-05-04 14:36:22.000
Context
2007-05-04
16:14
Optional parameter in the INCREMENTAL VACUUM statement specifies how many pages to vacuum from the database. (CVS 3919) (check-in: ed713f9ccb user: drh tags: trunk)
14:36
Get tests working with SQLITE_OMIT_AUTOVACUUM=1. (CVS 3918) (check-in: b94d39e4d9 user: drh tags: trunk)
14:14
Make "incremental" a fallback token so that you can set "auto_vacuum=incremental" without having to quote the "incremental". (CVS 3917) (check-in: 9d7a2e2bb4 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to test/createtab.test.
8
9
10
11
12
13
14
15
16
17
18






19
20
21
22
23
24
25
26
27
28
29
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library.  The
# focus of this file is testing that it is OK to create new tables
# and indices while creating existing tables and indices.
#
# $Id: createtab.test,v 1.1 2007/05/02 17:54:56 drh Exp $

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







# Run these tests for all possible values of autovacuum.
#
for {set av 0} {$av<=2} {incr av} {
  db close
  file delete -force test.db test.db-journal
  sqlite3 db test.db

  # Create a table that spans multiple pages.  It is important
  # that part of the database be in pages beyond the root page.
  #







|



>
>
>
>
>
>



|







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library.  The
# focus of this file is testing that it is OK to create new tables
# and indices while creating existing tables and indices.
#
# $Id: createtab.test,v 1.2 2007/05/04 14:36:22 drh Exp $

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

ifcapable autovacuum {
  set upperBound 2
} else {
  set upperBound 0
}

# Run these tests for all possible values of autovacuum.
#
for {set av 0} {$av<=$upperBound} {incr av} {
  db close
  file delete -force test.db test.db-journal
  sqlite3 db test.db

  # Create a table that spans multiple pages.  It is important
  # that part of the database be in pages beyond the root page.
  #
Changes to test/format4.test.
18
19
20
21
22
23
24

25
26
27




28
29
30
31
32
33
34
source $testdir/tester.tcl

db eval {PRAGMA legacy_file_format=OFF}

# The size of the database depends on whether or not autovacuum
# is enabled.
#

if {[db one {PRAGMA auto_vacuum}]} {
  set small 3072
  set large 5120




} else {
  set small 2048
  set large 4096
}

do_test format4-1.1 {
  execsql {







>
|
|
|
>
>
>
>







18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
source $testdir/tester.tcl

db eval {PRAGMA legacy_file_format=OFF}

# The size of the database depends on whether or not autovacuum
# is enabled.
#
ifcapable autovacuum {
  if {[db one {PRAGMA auto_vacuum}]} {
    set small 3072
    set large 5120
  } else {
    set small 2048
    set large 4096
  }
} else {
  set small 2048
  set large 4096
}

do_test format4-1.1 {
  execsql {
Changes to test/incrblob.test.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# 2007 May 1
#
# 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.
#
#***********************************************************************
#
# $Id: incrblob.test,v 1.6 2007/05/03 18:14:10 danielk1977 Exp $
#

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

do_test incrblob-1.1 {
  execsql {











|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# 2007 May 1
#
# 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.
#
#***********************************************************************
#
# $Id: incrblob.test,v 1.7 2007/05/04 14:36:22 drh Exp $
#

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

do_test incrblob-1.1 {
  execsql {
96
97
98
99
100
101
102






103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121

122
123
124
125
126

127
128
129
130
131
132
133
proc nWrite {db} {
  set bt [btree_from_db $db]
  array set stats [btree_pager_stats $bt]
  return $stats(write)
}

foreach AutoVacuumMode [list 0 1] {







  db close
  file delete -force test.db test.db-journal

  sqlite3 db test.db
  execsql "PRAGMA auto_vacuum = $AutoVacuumMode"

  do_test incrblob-2.$AutoVacuumMode.1 {
    set ::str [string repeat abcdefghij 2900]
    execsql {
      BEGIN;
      CREATE TABLE blobs(k PRIMARY KEY, v BLOB, i INTEGER);
      DELETE FROM blobs;
      INSERT INTO blobs VALUES('one', $::str || randstr(500,500), 45);
      COMMIT;
    }
    expr [file size test.db]/1024
  } [expr 31 + $AutoVacuumMode]


  do_test incrblob-2.$AutoVacuumMode.2 {
    execsql {
      PRAGMA auto_vacuum;
    }
  } $AutoVacuumMode


  do_test incrblob-2.$AutoVacuumMode.3 {
    # Open and close the db to make sure the page cache is empty.
    db close
    sqlite3 db test.db
  
    # Read the last 20 bytes of the blob via a blob handle.







>
>
>
>
>
>



















>
|
|
|
|
|
>







96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
proc nWrite {db} {
  set bt [btree_from_db $db]
  array set stats [btree_pager_stats $bt]
  return $stats(write)
}

foreach AutoVacuumMode [list 0 1] {

  if {$AutoVacuumMode>0} {
    ifcapable !autovacuum {
      break
    }
  }

  db close
  file delete -force test.db test.db-journal

  sqlite3 db test.db
  execsql "PRAGMA auto_vacuum = $AutoVacuumMode"

  do_test incrblob-2.$AutoVacuumMode.1 {
    set ::str [string repeat abcdefghij 2900]
    execsql {
      BEGIN;
      CREATE TABLE blobs(k PRIMARY KEY, v BLOB, i INTEGER);
      DELETE FROM blobs;
      INSERT INTO blobs VALUES('one', $::str || randstr(500,500), 45);
      COMMIT;
    }
    expr [file size test.db]/1024
  } [expr 31 + $AutoVacuumMode]

  ifcapable autovacuum {
    do_test incrblob-2.$AutoVacuumMode.2 {
      execsql {
        PRAGMA auto_vacuum;
      }
    } $AutoVacuumMode
  }

  do_test incrblob-2.$AutoVacuumMode.3 {
    # Open and close the db to make sure the page cache is empty.
    db close
    sqlite3 db test.db
  
    # Read the last 20 bytes of the blob via a blob handle.
Changes to test/tkt1512.test.
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# This file implements tests to verify that ticket #1512 is
# fixed.  
#

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

ifcapable !vacuum {
  finish_test
  return
}
if {[db one {PRAGMA auto_vacuum}]} {
  finish_test
  return
}







|







13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# This file implements tests to verify that ticket #1512 is
# fixed.  
#

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

ifcapable {!vacuum || !autovacuum} {
  finish_test
  return
}
if {[db one {PRAGMA auto_vacuum}]} {
  finish_test
  return
}