/ Changes On Branch see-testing
Login

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

Changes In Branch see-testing Excluding Merge-Ins

This is equivalent to a diff from f7480e33 to 92be06c1

2016-03-14
21:12
Update test scripts so that they work with SEE. (check-in: f4693ba4 user: drh tags: trunk)
20:49
Changing page size using VACUUM or backup is not allowed with a codec attached. (Closed-Leaf check-in: 92be06c1 user: drh tags: see-testing)
18:42
Merge test script fixes from trunk. (check-in: ea1d2cdd user: drh tags: see-testing)
15:43
Fix the backcompat.test script so that it works with the --testdir test option. (check-in: f7480e33 user: dan tags: trunk)
15:03
Run TCL tests in the "testdir" subdirectory. (check-in: 90e0cc7b user: drh tags: trunk)

Changes to test/autovacuum.test.

   265    265   do_test autovacuum-2.4.3 {
   266    266     execsql {
   267    267       SELECT rootpage FROM sqlite_master ORDER by rootpage
   268    268     }
   269    269   } {3 4 5 6 7 8 9 10}
   270    270   
   271    271   # Right now there are 5 free pages in the database. Consume and then free
   272         -# a 520 pages. Then create 520 tables. This ensures that at least some of the
          272  +# all 520 pages. Then create 520 tables. This ensures that at least some of the
   273    273   # desired root-pages reside on the second free-list trunk page, and that the
   274    274   # trunk itself is required at some point.
   275    275   do_test autovacuum-2.4.4 {
   276    276     execsql "
   277    277       INSERT INTO av3 VALUES ('[make_str abcde [expr 1020*520 + 500]]');
   278    278       DELETE FROM av3;
   279    279     "
   280    280   } {}
   281    281   set root_page_list [list]
   282    282   set pending_byte_page [expr ($::sqlite_pending_byte / 1024) + 1]
          283  +
          284  +# unusable_pages
          285  +# These are either the pending_byte page or the pointer map pages
          286  +#
          287  +unset -nocomplain unusable_page
          288  +if {[sqlite3 -has-codec]} {
          289  +  array set unusable_page {205 1 408 1}
          290  +} else {
          291  +  array set unusable_page {207 1 412 1}
          292  +}
          293  +set unusable_page($pending_byte_page) 1
          294  +
   283    295   for {set i 3} {$i<=532} {incr i} {
   284         -  # 207 and 412 are pointer-map pages.
   285         -  if { $i!=207 && $i!=412 && $i != $pending_byte_page} {
          296  +  if {![info exists unusable_page($i)]} {
   286    297       lappend root_page_list $i
   287    298     }
   288    299   }
   289    300   if {$i >= $pending_byte_page} {
   290    301     lappend root_page_list $i
   291    302   }
   292    303   do_test autovacuum-2.4.5 {

Changes to test/backup4.test.

    18     18   # schema cookie and change counter. Doing that could cause other clients
    19     19   # to become confused and continue using out-of-date cache data.
    20     20   #
    21     21   
    22     22   set testdir [file dirname $argv0]
    23     23   source $testdir/tester.tcl
    24     24   set testprefix backup4
           25  +
           26  +# The codec logic does not work for zero-length database files.  A database
           27  +# file must contain at least one page in order to be recognized as an
           28  +# encrypted database.
           29  +do_not_use_codec
    25     30   
    26     31   #-------------------------------------------------------------------------
    27     32   # At one point this test was failing because [db] was using an out of
    28     33   # date schema in test case 1.2.
    29     34   #
    30     35   do_execsql_test 1.0 {
    31     36     CREATE TABLE t1(x, y, UNIQUE(x, y));

Changes to test/close.test.

    12     12   # Test some specific circumstances to do with shared cache mode.
    13     13   #
    14     14   
    15     15   
    16     16   set testdir [file dirname $argv0]
    17     17   source $testdir/tester.tcl
    18     18   set ::testprefix close
           19  +
           20  +# This module bypasses the "-key" logic in tester.tcl, so it cannot run
           21  +# with the codec enabled.
           22  +do_not_use_codec
    19     23   
    20     24   do_execsql_test 1.0 {
    21     25     CREATE TABLE t1(x);
    22     26     INSERT INTO t1 VALUES('one');
    23     27     INSERT INTO t1 VALUES('two');
    24     28     INSERT INTO t1 VALUES('three');
    25     29   }

Changes to test/corrupt3.test.

    14     14   # segfault if it sees a corrupt database file.
    15     15   #
    16     16   # $Id: corrupt3.test,v 1.2 2007/04/06 21:42:22 drh Exp $
    17     17   
    18     18   set testdir [file dirname $argv0]
    19     19   source $testdir/tester.tcl
    20     20   
    21         -# Do not use a codec for tests in this file, as the database file is
    22         -# manipulated directly using tcl scripts (using the [hexio_write] command).
    23         -#
    24         -do_not_use_codec
           21  +# This module uses hard-coded offsets which do not work if the reserved_bytes
           22  +# value is nonzero.
           23  +if {[nonzero_reserved_bytes]} {finish_test; return;}
    25     24   
    26     25   # These tests deal with corrupt database files
    27     26   #
    28     27   database_may_be_corrupt
    29     28   
    30     29   # We must have the page_size pragma for these tests to work.
    31     30   #

Changes to test/corrupt4.test.

    14     14   # segfault if it sees a corrupt database file.
    15     15   #
    16     16   # $Id: corrupt4.test,v 1.1 2007/09/07 14:32:07 drh Exp $
    17     17   
    18     18   set testdir [file dirname $argv0]
    19     19   source $testdir/tester.tcl
    20     20   
    21         -# Do not use a codec for tests in this file, as the database file is
    22         -# manipulated directly using tcl scripts (using the [hexio_write] command).
    23         -#
    24         -do_not_use_codec
           21  +# This module uses hard-coded offsets which do not work if the reserved_bytes
           22  +# value is nonzero.
           23  +if {[nonzero_reserved_bytes]} {finish_test; return;}
    25     24   
    26     25   # These tests deal with corrupt database files
    27     26   #
    28     27   database_may_be_corrupt
    29     28   
    30     29   # We must have the page_size pragma for these tests to work.
    31     30   #

Changes to test/corrupt6.test.

    15     15   # on corrupt SerialTypeLen values.
    16     16   #
    17     17   # $Id: corrupt6.test,v 1.2 2008/05/19 15:37:10 shane Exp $
    18     18   
    19     19   set testdir [file dirname $argv0]
    20     20   source $testdir/tester.tcl
    21     21   
    22         -# Do not use a codec for tests in this file, as the database file is
    23         -# manipulated directly using tcl scripts (using the [hexio_write] command).
    24         -#
    25         -do_not_use_codec
           22  +# This module uses hard-coded offsets which do not work if the reserved_bytes
           23  +# value is nonzero.
           24  +if {[nonzero_reserved_bytes]} {finish_test; return;}
    26     25   
    27     26   # These tests deal with corrupt database files
    28     27   #
    29     28   database_may_be_corrupt
    30     29   
    31     30   # We must have the page_size pragma for these tests to work.
    32     31   #

Changes to test/corrupt7.test.

    15     15   # on corrupt cell offsets in a btree page.
    16     16   #
    17     17   # $Id: corrupt7.test,v 1.8 2009/08/10 10:18:08 danielk1977 Exp $
    18     18   
    19     19   set testdir [file dirname $argv0]
    20     20   source $testdir/tester.tcl
    21     21   
    22         -# Do not use a codec for tests in this file, as the database file is
    23         -# manipulated directly using tcl scripts (using the [hexio_write] command).
    24         -#
    25         -do_not_use_codec
           22  +# This module uses hard-coded offsets which do not work if the reserved_bytes
           23  +# value is nonzero.
           24  +if {[nonzero_reserved_bytes]} {finish_test; return;}
    26     25   
    27     26   # These tests deal with corrupt database files
    28     27   #
    29     28   database_may_be_corrupt
    30     29   
    31     30   # We must have the page_size pragma for these tests to work.
    32     31   #

Changes to test/corruptE.test.

    14     14   # segfault if it sees a corrupt database file.  It specifcally
    15     15   # focuses on rowid order corruption.
    16     16   #
    17     17   
    18     18   set testdir [file dirname $argv0]
    19     19   source $testdir/tester.tcl
    20     20   
    21         -# Do not use a codec for tests in this file, as the database file is
    22         -# manipulated directly using tcl scripts (using the [hexio_write] command).
    23         -#
    24         -do_not_use_codec
           21  +# This module uses hard-coded offsets which do not work if the reserved_bytes
           22  +# value is nonzero.
           23  +if {[nonzero_reserved_bytes]} {finish_test; return;}
    25     24   
    26     25   # These tests deal with corrupt database files
    27     26   #
    28     27   database_may_be_corrupt
    29     28   
    30     29   # Do not run the tests in this file if ENABLE_OVERSIZE_CELL_CHECK is on.
    31     30   #

Changes to test/corruptG.test.

    10     10   #***********************************************************************
    11     11   #
    12     12   
    13     13   set testdir [file dirname $argv0]
    14     14   source $testdir/tester.tcl
    15     15   set testprefix corruptG
    16     16   
    17         -# Do not use a codec for tests in this file, as the database file is
    18         -# manipulated directly using tcl scripts (using the [hexio_write] command).
    19         -#
    20         -do_not_use_codec
           17  +# This module uses hard-coded offsets which do not work if the reserved_bytes
           18  +# value is nonzero.
           19  +if {[nonzero_reserved_bytes]} {finish_test; return;}
    21     20   
    22     21   # These tests deal with corrupt database files
    23     22   #
    24     23   database_may_be_corrupt
    25     24   
    26     25   # Create a simple database with a single entry.  Then corrupt the
    27     26   # header-size varint on the index payload so that it maps into a

Changes to test/corruptH.test.

    10     10   #***********************************************************************
    11     11   #
    12     12   
    13     13   set testdir [file dirname $argv0]
    14     14   source $testdir/tester.tcl
    15     15   set testprefix corruptH
    16     16   
    17         -# Do not use a codec for tests in this file, as the database file is
    18         -# manipulated directly using tcl scripts (using the [hexio_write] command).
    19         -#
    20         -do_not_use_codec
           17  +# This module uses hard-coded offsets which do not work if the reserved_bytes
           18  +# value is nonzero.
           19  +if {[nonzero_reserved_bytes]} {finish_test; return;}
           20  +
    21     21   database_may_be_corrupt
    22     22   
    23     23   # The corruption migrations tested by the code in this file are not detected
    24     24   # mmap mode.
    25     25   #
    26     26   # The reason is that in mmap mode, the different queries may use different
    27     27   # PgHdr objects for the same page (same data, but different PgHdr container 

Changes to test/corruptI.test.

    15     15   set testprefix corruptI
    16     16   
    17     17   if {[permutation]=="mmap"} {
    18     18     finish_test
    19     19     return
    20     20   }
    21     21   
    22         -# Do not use a codec for tests in this file, as the database file is
    23         -# manipulated directly using tcl scripts (using the [hexio_write] command).
    24         -#
    25         -do_not_use_codec
           22  +# This module uses hard-coded offsets which do not work if the reserved_bytes
           23  +# value is nonzero.
           24  +if {[nonzero_reserved_bytes]} {finish_test; return;}
           25  +
    26     26   database_may_be_corrupt
    27     27   
    28     28   # Initialize the database.
    29     29   #
    30     30   do_execsql_test 1.1 {
    31     31     PRAGMA page_size=1024;
    32     32     PRAGMA auto_vacuum=0;

Changes to test/corruptJ.test.

    18     18   set testprefix corruptJ
    19     19   
    20     20   if {[permutation]=="mmap"} {
    21     21     finish_test
    22     22     return
    23     23   }
    24     24   
    25         -# Do not use a codec for tests in this file, as the database file is
    26         -# manipulated directly using tcl scripts (using the [hexio_write] command).
    27         -#
    28         -do_not_use_codec
           25  +# This module uses hard-coded offsets which do not work if the reserved_bytes
           26  +# value is nonzero.
           27  +if {[nonzero_reserved_bytes]} {finish_test; return;}
           28  +
    29     29   database_may_be_corrupt
    30     30   
    31     31   # Initialize the database.
    32     32   #
    33     33   do_execsql_test 1.1 {
    34     34     PRAGMA page_size=1024;
    35     35     PRAGMA auto_vacuum=0;

Changes to test/crash8.test.

    21     21   set testdir [file dirname $argv0]
    22     22   source $testdir/tester.tcl
    23     23   
    24     24   ifcapable !crashtest {
    25     25     finish_test
    26     26     return
    27     27   }
           28  +do_not_use_codec
    28     29   
    29     30   do_test crash8-1.1 {
    30     31     execsql {
    31     32       PRAGMA auto_vacuum=OFF;
    32     33       CREATE TABLE t1(a, b);
    33     34       CREATE INDEX i1 ON t1(a, b);
    34     35       INSERT INTO t1 VALUES(1, randstr(1000,1000));

Changes to test/e_uri.test.

     9      9   #
    10     10   #***********************************************************************
    11     11   #
    12     12   
    13     13   set testdir [file dirname $argv0]
    14     14   source $testdir/tester.tcl
    15     15   set testprefix e_uri
    16         -
           16  +do_not_use_codec
    17     17   db close
    18     18   
    19     19   proc parse_uri {uri} {
    20     20     testvfs tvfs2
    21     21     testvfs tvfs 
    22     22     tvfs filter xOpen
    23     23     tvfs script parse_uri_open_cb

Changes to test/e_vacuum.test.

   155    155   } {1024 1}
   156    156   do_test e_vacuum-1.3.1.2 {
   157    157     execsql { PRAGMA page_size = 2048 }
   158    158     execsql { PRAGMA auto_vacuum = NONE }
   159    159     execsql { PRAGMA page_size ; PRAGMA auto_vacuum }
   160    160   } {1024 1}
   161    161   
   162         -# EVIDENCE-OF: R-08570-19916 However, when not in write-ahead log mode,
   163         -# the page_size and/or auto_vacuum properties of an existing database
   164         -# may be changed by using the page_size and/or pragma auto_vacuum
   165         -# pragmas and then immediately VACUUMing the database.
   166         -#
   167         -do_test e_vacuum-1.3.2.1 {
   168         -  execsql { PRAGMA journal_mode = delete }
   169         -  execsql { PRAGMA page_size = 2048 }
   170         -  execsql { PRAGMA auto_vacuum = NONE }
   171         -  execsql VACUUM
   172         -  execsql { PRAGMA page_size ; PRAGMA auto_vacuum }
   173         -} {2048 0}
   174         -
   175         -# EVIDENCE-OF: R-48521-51450 When in write-ahead log mode, only the
   176         -# auto_vacuum support property can be changed using VACUUM.
   177         -#
   178         -ifcapable wal {
   179         -do_test e_vacuum-1.3.3.1 {
   180         -  execsql { PRAGMA journal_mode = wal }
   181         -  execsql { PRAGMA page_size ; PRAGMA auto_vacuum }
   182         -} {2048 0}
   183         -do_test e_vacuum-1.3.3.2 {
   184         -  execsql { PRAGMA page_size = 1024 }
   185         -  execsql { PRAGMA auto_vacuum = FULL }
   186         -  execsql VACUUM
   187         -  execsql { PRAGMA page_size ; PRAGMA auto_vacuum }
   188         -} {2048 1}
          162  +if {![nonzero_reserved_bytes]} {
          163  +  # EVIDENCE-OF: R-08570-19916 However, when not in write-ahead log mode,
          164  +  # the page_size and/or auto_vacuum properties of an existing database
          165  +  # may be changed by using the page_size and/or pragma auto_vacuum
          166  +  # pragmas and then immediately VACUUMing the database.
          167  +  #
          168  +  do_test e_vacuum-1.3.2.1 {
          169  +    execsql { PRAGMA journal_mode = delete }
          170  +    execsql { PRAGMA page_size = 2048 }
          171  +    execsql { PRAGMA auto_vacuum = NONE }
          172  +    execsql VACUUM
          173  +    execsql { PRAGMA page_size ; PRAGMA auto_vacuum }
          174  +  } {2048 0}
          175  +  
          176  +  # EVIDENCE-OF: R-48521-51450 When in write-ahead log mode, only the
          177  +  # auto_vacuum support property can be changed using VACUUM.
          178  +  #
          179  +  ifcapable wal {
          180  +    do_test e_vacuum-1.3.3.1 {
          181  +      execsql { PRAGMA journal_mode = wal }
          182  +      execsql { PRAGMA page_size ; PRAGMA auto_vacuum }
          183  +    } {2048 0}
          184  +    do_test e_vacuum-1.3.3.2 {
          185  +      execsql { PRAGMA page_size = 1024 }
          186  +      execsql { PRAGMA auto_vacuum = FULL }
          187  +      execsql VACUUM
          188  +      execsql { PRAGMA page_size ; PRAGMA auto_vacuum }
          189  +    } {2048 1}
          190  +  }
   189    191   }
   190         -
          192  +  
   191    193   # EVIDENCE-OF: R-38001-03952 VACUUM only works on the main database. It
   192    194   # is not possible to VACUUM an attached database file.
   193    195   forcedelete test.db2
   194    196   create_db { PRAGMA auto_vacuum = NONE }
   195    197   do_execsql_test e_vacuum-2.1.1 {
   196    198     ATTACH 'test.db2' AS aux;
   197    199     PRAGMA aux.page_size = 1024;

Changes to test/e_walauto.test.

    19     19   # accessing the same coherent view of the "test.db-shm" file. This doesn't
    20     20   # work on OpenBSD.
    21     21   #
    22     22   if {$tcl_platform(os) == "OpenBSD"} {
    23     23     finish_test
    24     24     return
    25     25   }
           26  +
           27  +# This module uses hard-coded offsets which do not work if the reserved_bytes
           28  +# value is nonzero.
           29  +if {[nonzero_reserved_bytes]} {finish_test; return;}
           30  +
    26     31   
    27     32   proc read_nbackfill {} {
    28     33     seek $::shmfd 96
    29     34     binary scan [read $::shmfd 4] n nBackfill
    30     35     set nBackfill
    31     36   }
    32     37   proc read_mxframe {} {

Changes to test/eqp.test.

   512    512     1 0 0 {SCAN TABLE t1 USING COVERING INDEX i1}
   513    513     2 0 0 {SCAN TABLE t2}
   514    514     2 0 0 {USE TEMP B-TREE FOR ORDER BY}
   515    515     0 0 0 {COMPOUND SUBQUERIES 1 AND 2 (EXCEPT)}
   516    516   }
   517    517   
   518    518   
   519         -#-------------------------------------------------------------------------
   520         -# The following tests - eqp-6.* - test that the example C code on 
   521         -# documentation page eqp.html works. The C code is duplicated in test1.c
   522         -# and wrapped in Tcl command [print_explain_query_plan] 
   523         -#
   524         -set boilerplate {
   525         -  proc explain_query_plan {db sql} {
   526         -    set stmt [sqlite3_prepare_v2 db $sql -1 DUMMY]
   527         -    print_explain_query_plan $stmt
   528         -    sqlite3_finalize $stmt
          519  +if {![nonzero_reserved_bytes]} {
          520  +  #-------------------------------------------------------------------------
          521  +  # The following tests - eqp-6.* - test that the example C code on 
          522  +  # documentation page eqp.html works. The C code is duplicated in test1.c
          523  +  # and wrapped in Tcl command [print_explain_query_plan] 
          524  +  #
          525  +  set boilerplate {
          526  +    proc explain_query_plan {db sql} {
          527  +      set stmt [sqlite3_prepare_v2 db $sql -1 DUMMY]
          528  +      print_explain_query_plan $stmt
          529  +      sqlite3_finalize $stmt
          530  +    }
          531  +    sqlite3 db test.db
          532  +    explain_query_plan db {%SQL%}
          533  +    db close
          534  +    exit
   529    535     }
   530         -  sqlite3 db test.db
   531         -  explain_query_plan db {%SQL%}
   532         -  db close
   533         -  exit
   534         -}
   535         -
   536         -# Do a "Print Explain Query Plan" test.
   537         -proc do_peqp_test {tn sql res} {
   538         -  set fd [open script.tcl w]
   539         -  puts $fd [string map [list %SQL% $sql] $::boilerplate]
   540         -  close $fd
   541         -
   542         -  uplevel do_test $tn [list {
   543         -    set fd [open "|[info nameofexec] script.tcl"]
   544         -    set data [read $fd]
          536  +  
          537  +  # Do a "Print Explain Query Plan" test.
          538  +  proc do_peqp_test {tn sql res} {
          539  +    set fd [open script.tcl w]
          540  +    puts $fd [string map [list %SQL% $sql] $::boilerplate]
   545    541       close $fd
   546         -    set data
   547         -  }] [list $res]
   548         -}
   549         -
   550         -do_peqp_test 6.1 {
   551         -  SELECT a, b FROM t1 EXCEPT SELECT d, 99 FROM t2 ORDER BY 1
   552         -} [string trimleft {
          542  +  
          543  +    uplevel do_test $tn [list {
          544  +      set fd [open "|[info nameofexec] script.tcl"]
          545  +      set data [read $fd]
          546  +      close $fd
          547  +      set data
          548  +    }] [list $res]
          549  +  }
          550  +  
          551  +  do_peqp_test 6.1 {
          552  +    SELECT a, b FROM t1 EXCEPT SELECT d, 99 FROM t2 ORDER BY 1
          553  +  } [string trimleft {
   553    554   1 0 0 SCAN TABLE t1 USING COVERING INDEX i2
   554    555   2 0 0 SCAN TABLE t2
   555    556   2 0 0 USE TEMP B-TREE FOR ORDER BY
   556    557   0 0 0 COMPOUND SUBQUERIES 1 AND 2 (EXCEPT)
   557    558   }]
          559  +}
   558    560   
   559    561   #-------------------------------------------------------------------------
   560    562   # The following tests - eqp-7.* - test that queries that use the OP_Count
   561    563   # optimization return something sensible with EQP.
   562    564   #
   563    565   drop_all_tables
   564    566   

Changes to test/incrblob.test.

   122    122     db close
   123    123     forcedelete test.db test.db-journal
   124    124   
   125    125     sqlite3 db test.db
   126    126     execsql "PRAGMA mmap_size = 0"
   127    127     execsql "PRAGMA auto_vacuum = $AutoVacuumMode"
   128    128   
          129  +  # Extra value added to size answers
          130  +  set ib2_extra 0
          131  +  if {$AutoVacuumMode} {incr ib2_extra}
          132  +  if {[nonzero_reserved_bytes]} {incr ib2_extra}
          133  +
   129    134     do_test incrblob-2.$AutoVacuumMode.1 {
   130    135       set ::str [string repeat abcdefghij 2900]
   131    136       execsql {
   132    137         BEGIN;
   133    138         CREATE TABLE blobs(k PRIMARY KEY, v BLOB, i INTEGER);
   134    139         DELETE FROM blobs;
   135    140         INSERT INTO blobs VALUES('one', $::str || randstr(500,500), 45);
   136    141         COMMIT;
   137    142       }
   138    143       expr [file size test.db]/1024
   139         -  } [expr 31 + $AutoVacuumMode]
          144  +  } [expr 31 + $ib2_extra]
   140    145   
   141    146     ifcapable autovacuum {
   142    147       do_test incrblob-2.$AutoVacuumMode.2 {
   143    148         execsql {
   144    149           PRAGMA auto_vacuum;
   145    150         }
   146    151       } $AutoVacuumMode
................................................................................
   159    164       close $::blob
   160    165     
   161    166       # If the database is not in auto-vacuum mode, the whole of
   162    167       # the overflow-chain must be scanned. In auto-vacuum mode,
   163    168       # sqlite uses the ptrmap pages to avoid reading the other pages.
   164    169       #
   165    170       nRead db
   166         -  } [expr $AutoVacuumMode ? 4 : 30]
          171  +  } [expr $AutoVacuumMode ? 4 : 30+$ib2_extra]
   167    172   
   168    173     do_test incrblob-2.$AutoVacuumMode.4 {
   169    174       string range [db one {SELECT v FROM blobs}] end-19 end
   170    175     } $::fragment
   171    176   
   172    177     do_test incrblob-2.$AutoVacuumMode.5 {
   173    178       # Open and close the db to make sure the page cache is empty.
................................................................................
   183    188       flush $::blob
   184    189     
   185    190       # If the database is not in auto-vacuum mode, the whole of
   186    191       # the overflow-chain must be scanned. In auto-vacuum mode,
   187    192       # sqlite uses the ptrmap pages to avoid reading the other pages.
   188    193       #
   189    194       nRead db
   190         -  } [expr $AutoVacuumMode ? 4 : 30]
          195  +  } [expr $AutoVacuumMode ? 4 : 30 + $ib2_extra]
   191    196   
   192    197     # Pages 1 (the write-counter) and 32 (the blob data) were written.
   193    198     do_test incrblob-2.$AutoVacuumMode.6 {
   194    199       close $::blob
   195    200       nWrite db
   196    201     } 2
   197    202   
................................................................................
   206    211       execsql { PRAGMA mmap_size = 0 }
   207    212   
   208    213       execsql { SELECT i FROM blobs } 
   209    214     } {45}
   210    215   
   211    216     do_test incrblob-2.$AutoVacuumMode.9 {
   212    217       nRead db
   213         -  } [expr $AutoVacuumMode ? 4 : 30]
          218  +  } [expr $AutoVacuumMode ? 4 : 30 + $ib2_extra]
   214    219   }
   215    220   sqlite3_soft_heap_limit $cmdlinearg(soft-heap-limit)
   216    221   
   217    222   #------------------------------------------------------------------------
   218    223   # incrblob-3.*: 
   219    224   #
   220    225   # Test the outcome of trying to write to a read-only blob handle.
................................................................................
   380    385   # incrblob-5.*: 
   381    386   #
   382    387   #     Test that opening a blob in an attached database works.
   383    388   #
   384    389   ifcapable attach {
   385    390     do_test incrblob-5.1 {
   386    391       forcedelete test2.db test2.db-journal
   387         -    set ::size [expr [file size [info script]]]
          392  +    set ::size [expr [file size $::cmdlinearg(INFO_SCRIPT)]]
   388    393       execsql {
   389    394         ATTACH 'test2.db' AS aux;
   390    395         CREATE TABLE aux.files(name, text);
   391    396         INSERT INTO aux.files VALUES('this one', zeroblob($::size));
   392    397       }
   393    398       set fd  [db incrblob aux files text 1]
   394    399       fconfigure $fd -translation binary
   395         -    set fd2 [open [info script]]
          400  +    set fd2 [open $::cmdlinearg(INFO_SCRIPT)]
   396    401       fconfigure $fd2 -translation binary
   397    402       puts -nonewline $fd [read $fd2]
   398    403       close $fd
   399    404       close $fd2
   400    405       set ::text [db one {select text from aux.files}]
   401    406       string length $::text
   402         -  } [file size [info script]]
          407  +  } [file size $::cmdlinearg(INFO_SCRIPT)]
   403    408     do_test incrblob-5.2 {
   404         -    set fd2 [open [info script]]
          409  +    set fd2 [open $::cmdlinearg(INFO_SCRIPT)]
   405    410       fconfigure $fd2 -translation binary
   406    411       set ::data [read $fd2]
   407    412       close $fd2
   408    413       set ::data
   409    414     } $::text
   410    415   }
   411    416   
................................................................................
   572    577       execsql {
   573    578         SELECT d FROM t1;
   574    579       }
   575    580     } {15}
   576    581   
   577    582   }
   578    583   
   579         -set fd [open [info script]]
          584  +set fd [open $::cmdlinearg(INFO_SCRIPT)]
   580    585   fconfigure $fd -translation binary
   581    586   set ::data [read $fd 14000]
   582    587   close $fd
   583    588   
   584    589   db close
   585    590   forcedelete test.db test.db-journal
   586    591   sqlite3 db test.db

Changes to test/incrblob_err.test.

    20     20     finish_test
    21     21     return
    22     22   }
    23     23   
    24     24   source $testdir/malloc_common.tcl
    25     25   
    26     26   unset -nocomplain ::fd ::data
    27         -set ::fd [open [info script]]
           27  +set ::fd [open $::cmdlinearg(INFO_SCRIPT)]
    28     28   set ::data [read $::fd]
    29     29   close $::fd
    30     30   
    31     31   do_malloc_test 1 -tclprep {
    32         -  set bytes [file size [info script]]
           32  +  set bytes [file size $::cmdlinearg(INFO_SCRIPT)]
    33     33     execsql {
    34     34       CREATE TABLE blobs(k, v BLOB);
    35     35       INSERT INTO blobs VALUES(1, zeroblob($::bytes));
    36     36     }
    37     37   } -tclbody {
    38     38     set ::blob [db incrblob blobs v 1]
    39     39     fconfigure $::blob -translation binary

Changes to test/io.test.

   420    420       # that the file is now greater than 20000 bytes in size.
   421    421       list [expr [file size test.db]>20000] [nSync]
   422    422     } {1 0}
   423    423     do_test io-3.3 {
   424    424       # The COMMIT requires a single fsync() - to the database file.
   425    425       execsql { COMMIT }
   426    426       list [file size test.db] [nSync]
   427         -  } {39936 1}
          427  +  } "[expr {[nonzero_reserved_bytes]?40960:39936}] 1"
   428    428   }
   429    429   
   430    430   #----------------------------------------------------------------------
   431    431   # Test cases io-4.* test the IOCAP_SAFE_APPEND optimization.
   432    432   #
   433    433   sqlite3_simulate_device -char safe_append
   434    434   

Changes to test/memsubsys1.test.

   251    251     expr {$pg_used<24}
   252    252   } 1
   253    253   do_test memsubsys1-7.4 {
   254    254     set pg_ovfl [lindex [sqlite3_status SQLITE_STATUS_PAGECACHE_OVERFLOW 0] 2]
   255    255   } 0
   256    256   do_test memsubsys1-7.5 {
   257    257     set maxreq [lindex [sqlite3_status SQLITE_STATUS_MALLOC_SIZE 0] 2]
   258         -  expr {$maxreq<4100}
          258  +  expr {$maxreq<4100 + 4200*[nonzero_reserved_bytes]}
   259    259   } 1
   260    260   do_test memsubsys1-7.6 {
   261    261     set s_used [lindex [sqlite3_status SQLITE_STATUS_SCRATCH_USED 0] 2]
   262    262   } 1
   263    263   do_test memsubsys1-7.7 {
   264    264     set s_ovfl [lindex [sqlite3_status SQLITE_STATUS_SCRATCH_OVERFLOW 0] 2]
   265    265   } 0

Changes to test/mmap1.test.

    84     84         sql1 "SELECT count(*) FROM t1; PRAGMA integrity_check ; PRAGMA page_count"
    85     85       } {32 ok 77}
    86     86   
    87     87       # Have connection 2 shrink the file. Check connection 1 can still read it.
    88     88       sql2 { DELETE FROM t1 WHERE rowid%2; }
    89     89       do_test $t.$tn.2 {
    90     90         sql1 "SELECT count(*) FROM t1; PRAGMA integrity_check ; PRAGMA page_count"
    91         -    } {16 ok 42}
           91  +    } "16 ok [expr {42+[nonzero_reserved_bytes]}]"
    92     92   
    93     93       # Have connection 2 grow the file. Check connection 1 can still read it.
    94     94       sql2 { INSERT INTO t1 SELECT rblob(500), rblob(500) FROM t1 }
    95     95       do_test $t.$tn.3 {
    96     96         sql1 "SELECT count(*) FROM t1; PRAGMA integrity_check ; PRAGMA page_count"
    97     97       } {32 ok 79}
    98     98   
................................................................................
   100    100       sql2 { INSERT INTO t1 SELECT rblob(500), rblob(500) FROM t1 }
   101    101       do_test $t.$tn.4 {
   102    102         sql1 "SELECT count(*) FROM t1; PRAGMA integrity_check ; PRAGMA page_count"
   103    103       } {64 ok 149}
   104    104   
   105    105       # Check that the number of pages read by connection 1 indicates that the
   106    106       # "PRAGMA mmap_size" command worked.
   107         -    do_test $t.$tn.5 { nRead db } $nRead
          107  +    if {[nonzero_reserved_bytes]==0} {
          108  +      do_test $t.$tn.5 { nRead db } $nRead
          109  +    }
   108    110     }
   109    111   }
   110    112   
   111    113   set ::rcnt 0
   112    114   proc rblob {n} {
   113    115     set ::rcnt [expr (($::rcnt << 3) + $::rcnt + 456) & 0xFFFFFFFF]
   114    116     set str [format %.8x [expr $::rcnt ^ 0xbdf20da3]]

Changes to test/mmap3.test.

    15     15   ifcapable !mmap||!vtab {
    16     16     finish_test
    17     17     return
    18     18   }
    19     19   source $testdir/lock_common.tcl
    20     20   set testprefix mmap3
    21     21   
           22  +# A codec shuts down memory-mapped I/O
           23  +if {[nonzero_reserved_bytes]} {finish_test; return;}
           24  +
    22     25   do_test mmap3-1.0 {
    23     26     load_static_extension db wholenumber
    24     27     db eval {
    25     28       PRAGMA mmap_size=100000;
    26     29       CREATE TABLE t1(x, y);
    27     30       CREATE VIRTUAL TABLE nums USING wholenumber;
    28     31       INSERT INTO t1 SELECT value, randomblob(value) FROM nums

Changes to test/nan.test.

   147    147   # SQLite always converts NaN into NULL so it is not possible to write
   148    148   # a NaN value into the database file using SQLite.  The following series
   149    149   # of tests writes a normal floating point value (0.5) into the database,
   150    150   # then writes directly into the database file to change the 0.5 into NaN.
   151    151   # Then it reads the value of the database to verify it is converted into
   152    152   # NULL.
   153    153   #
   154         -do_test nan-3.1 {
   155         -  db eval {
   156         -    DELETE FROM t1;
   157         -    INSERT INTO t1 VALUES(0.5);
   158         -    PRAGMA auto_vacuum=OFF;
   159         -    PRAGMA page_size=1024;
   160         -    VACUUM;
   161         -  }
   162         -  hexio_read test.db 2040 8
   163         -} {3FE0000000000000}
   164         -do_test nan-3.2 {
   165         -  db eval {
   166         -    SELECT x, typeof(x) FROM t1
   167         -  }
   168         -} {0.5 real}
   169         -do_test nan-3.3 {
   170         -  db close
   171         -  hexio_write test.db 2040 FFF8000000000000
   172         -  sqlite3 db test.db
   173         -  db eval {SELECT x, typeof(x) FROM t1}
   174         -} {{} null}
   175         -do_test nan-3.4 {
   176         -  db close
   177         -  hexio_write test.db 2040 7FF8000000000000
   178         -  sqlite3 db test.db
   179         -  db eval {SELECT x, typeof(x) FROM t1}
   180         -} {{} null}
   181         -do_test nan-3.5 {
   182         -  db close
   183         -  hexio_write test.db 2040 FFFFFFFFFFFFFFFF
   184         -  sqlite3 db test.db
   185         -  db eval {SELECT x, typeof(x) FROM t1}
   186         -} {{} null}
   187         -do_test nan-3.6 {
   188         -  db close
   189         -  hexio_write test.db 2040 7FFFFFFFFFFFFFFF
   190         -  sqlite3 db test.db
   191         -  db eval {SELECT x, typeof(x) FROM t1}
   192         -} {{} null}
          154  +if {![nonzero_reserved_bytes]} {
          155  +  do_test nan-3.1 {
          156  +    db eval {
          157  +      DELETE FROM t1;
          158  +      INSERT INTO t1 VALUES(0.5);
          159  +      PRAGMA auto_vacuum=OFF;
          160  +      PRAGMA page_size=1024;
          161  +      VACUUM;
          162  +    }
          163  +    hexio_read test.db 2040 8
          164  +  } {3FE0000000000000}
          165  +  do_test nan-3.2 {
          166  +    db eval {
          167  +      SELECT x, typeof(x) FROM t1
          168  +    }
          169  +  } {0.5 real}
          170  +  do_test nan-3.3 {
          171  +    db close
          172  +    hexio_write test.db 2040 FFF8000000000000
          173  +    sqlite3 db test.db
          174  +    db eval {SELECT x, typeof(x) FROM t1}
          175  +  } {{} null}
          176  +  do_test nan-3.4 {
          177  +    db close
          178  +    hexio_write test.db 2040 7FF8000000000000
          179  +    sqlite3 db test.db
          180  +    db eval {SELECT x, typeof(x) FROM t1}
          181  +  } {{} null}
          182  +  do_test nan-3.5 {
          183  +    db close
          184  +    hexio_write test.db 2040 FFFFFFFFFFFFFFFF
          185  +    sqlite3 db test.db
          186  +    db eval {SELECT x, typeof(x) FROM t1}
          187  +  } {{} null}
          188  +  do_test nan-3.6 {
          189  +    db close
          190  +    hexio_write test.db 2040 7FFFFFFFFFFFFFFF
          191  +    sqlite3 db test.db
          192  +    db eval {SELECT x, typeof(x) FROM t1}
          193  +  } {{} null}
          194  +}
   193    195   
   194    196   # Verify that the sqlite3AtoF routine is able to handle extreme
   195    197   # numbers.
   196    198   #
   197    199   do_test nan-4.1 {
   198    200     db eval {DELETE FROM t1}
   199    201     db eval "INSERT INTO t1 VALUES([string repeat 9 307].0)"

Changes to test/pager1.test.

  1392   1392     testvfs tv -default 1
  1393   1393     tv sectorsize 4096
  1394   1394     faultsim_delete_and_reopen
  1395   1395   
  1396   1396     execsql { PRAGMA page_size = 1024 }
  1397   1397     for {set ii 0} {$ii < 4} {incr ii} { execsql "CREATE TABLE t${ii}(a, b)" }
  1398   1398   } {}
  1399         -do_test pager1-9.3.2 {
  1400         -  sqlite3 db2 test.db2
  1401         -
  1402         -  execsql {
  1403         -    PRAGMA page_size = 4096;
  1404         -    PRAGMA synchronous = OFF;
  1405         -    CREATE TABLE t1(a, b);
  1406         -    CREATE TABLE t2(a, b);
  1407         -  } db2
  1408         -
  1409         -  sqlite3_backup B db2 main db main
  1410         -  B step 30
  1411         -  list [B step 10000] [B finish]
  1412         -} {SQLITE_DONE SQLITE_OK}
  1413         -do_test pager1-9.3.3 {
  1414         -  db2 close
  1415         -  db close
  1416         -  tv delete
  1417         -  file size test.db2
  1418         -} [file size test.db]
         1399  +if {[nonzero_reserved_bytes]} {
         1400  +  # backup with a page size changes is not possible with the codec
         1401  +  #
         1402  +  do_test pager1-9.3.2codec {
         1403  +    sqlite3 db2 test.db2
         1404  +    execsql {
         1405  +      PRAGMA page_size = 4096;
         1406  +      PRAGMA synchronous = OFF;
         1407  +      CREATE TABLE t1(a, b);
         1408  +      CREATE TABLE t2(a, b);
         1409  +    } db2
         1410  +    sqlite3_backup B db2 main db main
         1411  +    B step 30
         1412  +    list [B step 10000] [B finish]
         1413  +  } {SQLITE_READONLY SQLITE_READONLY}
         1414  +  do_test pager1-9.3.3codec {
         1415  +    db2 close
         1416  +    db close
         1417  +    tv delete
         1418  +    file size test.db2
         1419  +  } [file size test.db2]
         1420  +} else {
         1421  +  do_test pager1-9.3.2 {
         1422  +    sqlite3 db2 test.db2
         1423  +    execsql {
         1424  +      PRAGMA page_size = 4096;
         1425  +      PRAGMA synchronous = OFF;
         1426  +      CREATE TABLE t1(a, b);
         1427  +      CREATE TABLE t2(a, b);
         1428  +    } db2
         1429  +    sqlite3_backup B db2 main db main
         1430  +    B step 30
         1431  +    list [B step 10000] [B finish]
         1432  +  } {SQLITE_DONE SQLITE_OK}
         1433  +  do_test pager1-9.3.3 {
         1434  +    db2 close
         1435  +    db close
         1436  +    tv delete
         1437  +    file size test.db2
         1438  +  } [file size test.db]
         1439  +}
  1419   1440   
  1420   1441   do_test pager1-9.4.1 {
  1421   1442     faultsim_delete_and_reopen
  1422   1443     sqlite3 db2 test.db2
  1423   1444     execsql {
  1424   1445       PRAGMA page_size = 4096;
  1425   1446       CREATE TABLE t1(a, b);
................................................................................
  2443   2464       PRAGMA auto_vacuum = full;
  2444   2465       PRAGMA locking_mode=exclusive;
  2445   2466       CREATE TABLE t1(a, b);
  2446   2467       INSERT INTO t1 VALUES(1, 2);
  2447   2468     }
  2448   2469     file size test.db
  2449   2470   } [expr 1024*3]
  2450         -do_test pager1-29.2 {
  2451         -  execsql {
  2452         -    PRAGMA page_size = 4096;
  2453         -    VACUUM;
  2454         -  }
  2455         -  file size test.db
  2456         -} [expr 4096*3]
         2471  +if {[nonzero_reserved_bytes]} {
         2472  +  # VACUUM with size changes is not possible with the codec.
         2473  +  do_test pager1-29.2 {
         2474  +    catchsql {
         2475  +      PRAGMA page_size = 4096;
         2476  +      VACUUM;
         2477  +    }
         2478  +  } {1 {attempt to write a readonly database}}
         2479  +} else {
         2480  +  do_test pager1-29.2 {
         2481  +    execsql {
         2482  +      PRAGMA page_size = 4096;
         2483  +      VACUUM;
         2484  +    }
         2485  +    file size test.db
         2486  +  } [expr 4096*3]
         2487  +}
  2457   2488   
  2458   2489   #-------------------------------------------------------------------------
  2459   2490   # Test that if an empty database file (size 0 bytes) is opened in 
  2460   2491   # exclusive-locking mode, any journal file is deleted from the file-system
  2461   2492   # without being rolled back. And that the RESERVED lock obtained while
  2462   2493   # doing this is not released.
  2463   2494   #

Changes to test/pageropt.test.

    12     12   # The focus of the tests in this file are to verify that the
    13     13   # pager optimizations implemented in version 3.3.14 work.
    14     14   #
    15     15   # $Id: pageropt.test,v 1.5 2008/08/20 14:49:25 danielk1977 Exp $
    16     16   
    17     17   set testdir [file dirname $argv0]
    18     18   source $testdir/tester.tcl
           19  +do_not_use_codec
    19     20   
    20     21   ifcapable {!pager_pragmas||secure_delete||direct_read} {
    21     22     finish_test
    22     23     return
    23     24   }
    24     25   
    25     26   # Run the SQL statement supplied by the argument and return

Changes to test/pragma.test.

  1737   1737     catchsql {PRAGMA data_store_directory}
  1738   1738   } {0 {}}
  1739   1739   
  1740   1740   forcedelete data_dir
  1741   1741   } ;# endif windows
  1742   1742   
  1743   1743   database_may_be_corrupt
         1744  +if {![nonzero_reserved_bytes]} {
  1744   1745   
  1745         -do_test 21.1 {
  1746         -  # Create a corrupt database in testerr.db. And a non-corrupt at test.db.
  1747         -  #
  1748         -  db close
  1749         -  forcedelete test.db
  1750         -  sqlite3 db test.db
  1751         -  execsql { 
  1752         -    PRAGMA page_size = 1024;
  1753         -    PRAGMA auto_vacuum = 0;
  1754         -    CREATE TABLE t1(a PRIMARY KEY, b);
  1755         -    INSERT INTO t1 VALUES(1, 1);
  1756         -  }
  1757         -  for {set i 0} {$i < 10} {incr i} {
  1758         -    execsql { INSERT INTO t1 SELECT a + (1 << $i), b + (1 << $i) FROM t1 }
  1759         -  }
  1760         -  db close
  1761         -  forcecopy test.db testerr.db
  1762         -  hexio_write testerr.db 15000 [string repeat 55 100]
  1763         -} {100}
  1764         -
  1765         -set mainerr {*** in database main ***
         1746  +  do_test 21.1 {
         1747  +    # Create a corrupt database in testerr.db. And a non-corrupt at test.db.
         1748  +    #
         1749  +    db close
         1750  +    forcedelete test.db
         1751  +    sqlite3 db test.db
         1752  +    execsql { 
         1753  +      PRAGMA page_size = 1024;
         1754  +      PRAGMA auto_vacuum = 0;
         1755  +      CREATE TABLE t1(a PRIMARY KEY, b);
         1756  +      INSERT INTO t1 VALUES(1, 1);
         1757  +    }
         1758  +    for {set i 0} {$i < 10} {incr i} {
         1759  +      execsql { INSERT INTO t1 SELECT a + (1 << $i), b + (1 << $i) FROM t1 }
         1760  +    }
         1761  +    db close
         1762  +    forcecopy test.db testerr.db
         1763  +    hexio_write testerr.db 15000 [string repeat 55 100]
         1764  +  } {100}
         1765  +  
         1766  +  set mainerr {*** in database main ***
         1767  +Multiple uses for byte 672 of page 15}
         1768  +  set auxerr {*** in database aux ***
  1766   1769   Multiple uses for byte 672 of page 15}
  1767         -set auxerr {*** in database aux ***
  1768         -Multiple uses for byte 672 of page 15}
  1769         -
  1770         -set mainerr {/{\*\*\* in database main \*\*\*
         1770  +  
         1771  +  set mainerr {/{\*\*\* in database main \*\*\*
  1771   1772   Multiple uses for byte 672 of page 15}.*/}
  1772         -set auxerr {/{\*\*\* in database aux \*\*\*
         1773  +  set auxerr {/{\*\*\* in database aux \*\*\*
  1773   1774   Multiple uses for byte 672 of page 15}.*/}
  1774         -
  1775         -do_test 22.2 {
  1776         -  catch { db close }
  1777         -  sqlite3 db testerr.db
  1778         -  execsql { PRAGMA integrity_check }
  1779         -} $mainerr
  1780         -
  1781         -do_test 22.3.1 {
  1782         -  catch { db close }
  1783         -  sqlite3 db test.db
  1784         -  execsql { 
  1785         -    ATTACH 'testerr.db' AS 'aux';
  1786         -    PRAGMA integrity_check;
  1787         -  }
  1788         -} $auxerr
  1789         -do_test 22.3.2 {
  1790         -  execsql { PRAGMA main.integrity_check; }
  1791         -} {ok}
  1792         -do_test 22.3.3 {
  1793         -  execsql { PRAGMA aux.integrity_check; }
  1794         -} $auxerr
  1795         -
  1796         -do_test 22.4.1 {
  1797         -  catch { db close }
  1798         -  sqlite3 db testerr.db
  1799         -  execsql { 
  1800         -    ATTACH 'test.db' AS 'aux';
  1801         -    PRAGMA integrity_check;
  1802         -  }
  1803         -} $mainerr
  1804         -do_test 22.4.2 {
  1805         -  execsql { PRAGMA main.integrity_check; }
  1806         -} $mainerr
  1807         -do_test 22.4.3 {
  1808         -  execsql { PRAGMA aux.integrity_check; }
  1809         -} {ok}
  1810         -
         1775  +  
         1776  +  do_test 22.2 {
         1777  +    catch { db close }
         1778  +    sqlite3 db testerr.db
         1779  +    execsql { PRAGMA integrity_check }
         1780  +  } $mainerr
         1781  +  
         1782  +  do_test 22.3.1 {
         1783  +    catch { db close }
         1784  +    sqlite3 db test.db
         1785  +    execsql { 
         1786  +      ATTACH 'testerr.db' AS 'aux';
         1787  +      PRAGMA integrity_check;
         1788  +    }
         1789  +  } $auxerr
         1790  +  do_test 22.3.2 {
         1791  +    execsql { PRAGMA main.integrity_check; }
         1792  +  } {ok}
         1793  +  do_test 22.3.3 {
         1794  +    execsql { PRAGMA aux.integrity_check; }
         1795  +  } $auxerr
         1796  +  
         1797  +  do_test 22.4.1 {
         1798  +    catch { db close }
         1799  +    sqlite3 db testerr.db
         1800  +    execsql { 
         1801  +      ATTACH 'test.db' AS 'aux';
         1802  +      PRAGMA integrity_check;
         1803  +    }
         1804  +  } $mainerr
         1805  +  do_test 22.4.2 {
         1806  +    execsql { PRAGMA main.integrity_check; }
         1807  +  } $mainerr
         1808  +  do_test 22.4.3 {
         1809  +    execsql { PRAGMA aux.integrity_check; }
         1810  +  } {ok}
         1811  +}
         1812  +  
  1811   1813   db close
  1812   1814   forcedelete test.db test.db-wal test.db-journal
  1813   1815   sqlite3 db test.db
  1814   1816   sqlite3 db2 test.db
  1815   1817   do_test 23.1 {
  1816   1818     db eval {
  1817   1819       CREATE TABLE t1(a INTEGER PRIMARY KEY,b,c,d);

Changes to test/pragma3.test.

    11     11   # This file implements regression tests for SQLite library.
    12     12   #
    13     13   # This file implements tests for PRAGMA data_version command.
    14     14   #
    15     15   
    16     16   set testdir [file dirname $argv0]
    17     17   source $testdir/tester.tcl
           18  +do_not_use_codec
    18     19   
    19     20   do_execsql_test pragma3-100 {
    20     21     PRAGMA data_version;
    21     22   } {1}
    22     23   do_execsql_test pragma3-101 {
    23     24     PRAGMA temp.data_version;
    24     25   } {1}

Changes to test/stat.test.

    17     17   set testprefix stat
    18     18   
    19     19   ifcapable !vtab||!compound {
    20     20     finish_test
    21     21     return
    22     22   }
    23     23   
           24  +# This module uses hard-coded results that depend on exact measurements of
           25  +# pages sizes at the byte level, and hence will not work if the reserved_bytes
           26  +# value is nonzero.
           27  +if {[nonzero_reserved_bytes]} {finish_test; return;}
    24     28   
    25     29   set ::asc 1
    26     30   proc a_string {n} { string range [string repeat [incr ::asc]. $n] 1 $n }
    27     31   db func a_string a_string
    28     32   
    29     33   register_dbstat_vtab db
    30     34   do_execsql_test stat-0.0 {

Changes to test/superlock.test.

    11     11   #
    12     12   
    13     13   set testdir [file dirname $argv0]
    14     14   source $testdir/tester.tcl
    15     15   source $testdir/lock_common.tcl
    16     16   
    17     17   set testprefix superlock
           18  +do_not_use_codec
    18     19   
    19     20   # Test organization:
    20     21   #
    21     22   #   1.*: Test superlock on a rollback database. Test that once the db is
    22     23   #        superlocked, it is not possible for a second client to read from
    23     24   #        it.
    24     25   #
................................................................................
   234    235   do_catchsql_test 6.7 { SELECT * FROM t1 } {1 {no such table: t1}}
   235    236   do_catchsql_test 6.8 { SELECT * FROM t2 } {0 {a b}}
   236    237   
   237    238   db_swap test.db2 test.db
   238    239   do_catchsql_test 6.9 { SELECT * FROM t1 } {0 {1 2 3 4}}
   239    240   do_catchsql_test 6.10 { SELECT * FROM t2 } {1 {no such table: t2}}
   240    241   
   241         -do_execsql_test  6.11 { 
   242         -  PRAGMA journal_mode = delete;
   243         -  PRAGMA page_size = 512;
   244         -  VACUUM;
   245         -  PRAGMA journal_mode = wal;
   246         -  INSERT INTO t1 VALUES(5, 6);
   247         -} {delete wal}
          242  +if {[nonzero_reserved_bytes]} {
          243  +  # Vacuum with a size change is not allowed with the codec
          244  +  do_execsql_test  6.11codec { 
          245  +    PRAGMA journal_mode = delete;
          246  +    VACUUM;
          247  +    PRAGMA journal_mode = wal;
          248  +    INSERT INTO t1 VALUES(5, 6);
          249  +  } {delete wal}
          250  +} else {
          251  +  do_execsql_test  6.11 { 
          252  +    PRAGMA journal_mode = delete;
          253  +    PRAGMA page_size = 512;
          254  +    VACUUM;
          255  +    PRAGMA journal_mode = wal;
          256  +    INSERT INTO t1 VALUES(5, 6);
          257  +  } {delete wal}
          258  +}
   248    259   
   249    260   db_swap test.db2 test.db
   250    261   do_catchsql_test 6.12 { SELECT * FROM t1 } {1 {no such table: t1}}
   251    262   do_catchsql_test 6.13 { SELECT * FROM t2 } {0 {a b}}
   252    263   
   253    264   db_swap test.db2 test.db
   254    265   do_catchsql_test 6.14 { SELECT * FROM t1 } {0 {1 2 3 4 5 6}}
   255    266   do_catchsql_test 6.15 { SELECT * FROM t2 } {1 {no such table: t2}}
   256    267   
   257    268   finish_test

Changes to test/tclsqlite.test.

    18     18   # $Id: tclsqlite.test,v 1.73 2009/03/16 13:19:36 danielk1977 Exp $
    19     19   
    20     20   set testdir [file dirname $argv0]
    21     21   source $testdir/tester.tcl
    22     22   
    23     23   # Check the error messages generated by tclsqlite
    24     24   #
           25  +set r "sqlite_orig HANDLE FILENAME ?-vfs VFSNAME? ?-readonly BOOLEAN? ?-create BOOLEAN? ?-nomutex BOOLEAN? ?-fullmutex BOOLEAN? ?-uri BOOLEAN?"
    25     26   if {[sqlite3 -has-codec]} {
    26         -  set r "sqlite_orig HANDLE FILENAME ?-key CODEC-KEY?"
    27         -} else {
    28         -  set r "sqlite_orig HANDLE FILENAME ?-vfs VFSNAME? ?-readonly BOOLEAN? ?-create BOOLEAN? ?-nomutex BOOLEAN? ?-fullmutex BOOLEAN? ?-uri BOOLEAN?"
           27  +  append r " ?-key CODECKEY?"
    29     28   }
    30     29   do_test tcl-1.1 {
    31     30     set v [catch {sqlite3 bogus} msg]
    32     31     regsub {really_sqlite3} $msg {sqlite3} msg
    33     32     lappend v $msg
    34     33   } [list 1 "wrong # args: should be \"$r\""]
    35     34   do_test tcl-1.2 {

Changes to test/tester.tcl.

   369    369   # This command should be called after loading tester.tcl from within
   370    370   # all test scripts that are incompatible with encryption codecs.
   371    371   #
   372    372   proc do_not_use_codec {} {
   373    373     set ::do_not_use_codec 1
   374    374     reset_db
   375    375   }
          376  +
          377  +# Return true if the "reserved_bytes" integer on database files is non-zero.
          378  +#
          379  +proc nonzero_reserved_bytes {} {
          380  +  return [sqlite3 -has-codec]
          381  +}
   376    382   
   377    383   # Print a HELP message and exit
   378    384   #
   379    385   proc print_help_and_quit {} {
   380    386     puts {Options:
   381    387     --pause                  Wait for user input before continuing
   382    388     --soft-heap-limit=N      Set the soft-heap-limit to N
................................................................................
   517    523         default {
   518    524           lappend leftover [file normalize $a]
   519    525         }
   520    526       }
   521    527     }
   522    528     set testdir [file normalize $testdir]
   523    529     set cmdlinearg(TESTFIXTURE_HOME) [pwd]
          530  +  set cmdlinearg(INFO_SCRIPT) [file normalize [info script]]
   524    531     set argv0 [file normalize $argv0]
   525    532     if {$cmdlinearg(testdir)!=""} {
   526    533       file mkdir $cmdlinearg(testdir)
   527    534       cd $cmdlinearg(testdir)
   528    535     }
   529    536     set argv $leftover
   530    537   

Changes to test/tkt4018.test.

    12     12   #
    13     13   # This file implements tests to verify that ticket #4018 has been
    14     14   # fixed.  
    15     15   #
    16     16   
    17     17   set testdir [file dirname $argv0]
    18     18   source $testdir/tester.tcl
           19  +do_not_use_codec
    19     20   
    20     21   proc testsql {sql} {
    21     22     set fd [open tf_main.tcl w]
    22     23     puts $fd [subst -nocommands {
    23     24       sqlite3_test_control_pending_byte 0x0010000
    24     25       sqlite3 db test.db
    25     26       set rc [catch { db eval {$sql} } msg]

Changes to test/wal.test.

  1374   1374   do_test wal-21.3 {
  1375   1375     execsql { PRAGMA integrity_check }
  1376   1376   } {ok}
  1377   1377   
  1378   1378   #-------------------------------------------------------------------------
  1379   1379   # Test reading and writing of databases with different page-sizes.
  1380   1380   #
         1381  +incr ::do_not_use_codec
  1381   1382   foreach pgsz {512 1024 2048 4096 8192 16384 32768 65536} {
  1382   1383     do_multiclient_test tn [string map [list %PGSZ% $pgsz] {
  1383   1384       do_test wal-22.%PGSZ%.$tn.1 {
  1384   1385         sql1 {
  1385   1386           PRAGMA main.page_size = %PGSZ%;
  1386   1387           PRAGMA auto_vacuum = 0;
  1387   1388           PRAGMA journal_mode = WAL;
................................................................................
  1394   1395       do_test wal-22.%PGSZ%.$tn.2 { sql2 { PRAGMA integrity_check } } {ok}
  1395   1396       do_test wal-22.%PGSZ%.$tn.3 {
  1396   1397         sql1 {PRAGMA wal_checkpoint}
  1397   1398         expr {[file size test.db] % %PGSZ%}
  1398   1399       } {0}
  1399   1400     }]
  1400   1401   }
         1402  +incr ::do_not_use_codec -1
  1401   1403   
  1402   1404   #-------------------------------------------------------------------------
  1403   1405   # Test that when 1 or more pages are recovered from a WAL file, 
  1404   1406   # sqlite3_log() is invoked to report this to the user.
  1405   1407   #
  1406   1408   ifcapable curdir {
  1407   1409     set walfile [file nativename [file join [get_pwd] test.db-wal]]

Changes to test/wal5.test.

    14     14   #
    15     15   
    16     16   set testdir [file dirname $argv0]
    17     17   source $testdir/tester.tcl
    18     18   source $testdir/lock_common.tcl
    19     19   source $testdir/wal_common.tcl
    20     20   ifcapable !wal {finish_test ; return }
           21  +do_not_use_codec
    21     22   
    22     23   set testprefix wal5
    23     24   
    24     25   proc db_page_count  {{file test.db}} { expr [file size $file] / 1024 }
    25     26   proc wal_page_count {{file test.db}} { wal_frame_count ${file}-wal 1024 }
    26     27   
    27     28   

Changes to test/wal8.test.

    23     23   # first read transaction is executed), and the "PRAGMA page_size = XXX"
    24     24   # is a no-op.
    25     25   #
    26     26   set testdir [file dirname $argv0]
    27     27   source $testdir/tester.tcl
    28     28   set ::testprefix wal8
    29     29   ifcapable !wal {finish_test ; return }
           30  +do_not_use_codec
    30     31   
    31     32   db close
    32     33   forcedelete test.db test.db-wal
    33     34   
    34     35   sqlite3 db test.db
    35     36   sqlite3 db2 test.db
    36     37   

Changes to test/walbak.test.

   123    123         INSERT INTO t1 SELECT randomblob(500), randomblob(500) FROM t1; /* 16 */
   124    124         INSERT INTO t1 SELECT randomblob(500), randomblob(500) FROM t1; /* 32 */
   125    125         INSERT INTO t1 SELECT randomblob(500), randomblob(500) FROM t1; /* 64 */
   126    126       COMMIT;
   127    127     }
   128    128   } {}
   129    129   do_test walbak-2.2 {
          130  +  forcedelete abc.db
   130    131     db backup abc.db
   131    132     sqlite3 db2 abc.db
   132    133     string compare [sig db] [sig db2]
   133    134   } {0}
   134    135   
   135    136   do_test walbak-2.3 {
   136    137     sqlite3_backup B db2 main db main
................................................................................
   235    236         PRAGMA page_size = 2048;
   236    237         PRAGMA journal_mode = PERSIST;
   237    238         CREATE TABLE xx(x);
   238    239       }
   239    240     }
   240    241   
   241    242   } {
          243  +  if {$tn==4 && [sqlite3 -has-codec]} continue
   242    244     foreach f [glob -nocomplain test.db*] { forcedelete $f }
   243    245   
   244    246     eval $setup
   245    247   
   246    248     do_test walbak-3.$tn.1 {
   247    249       execsql {
   248    250         CREATE TABLE t1(a, b);

Changes to test/walro.test.

   208    208         INSERT INTO t2 SELECT x||y, y||x FROM t2;
   209    209         INSERT INTO t2 SELECT x||y, y||x FROM t2;
   210    210         INSERT INTO t2 SELECT x||y, y||x FROM t2;
   211    211         INSERT INTO t2 SELECT x||y, y||x FROM t2;
   212    212         INSERT INTO t2 SELECT x||y, y||x FROM t2;
   213    213       }
   214    214       file size test.db-wal
   215         -  } {147800}
          215  +  } [expr {[nonzero_reserved_bytes]?148848:147800}]
   216    216     do_test 1.4.4.2 {
   217    217       csql1 { SELECT * FROM t1 }
   218    218     } {0 {a b c d e f g h i j k l 1 2 3 4 5 6}}
   219    219     do_test 1.4.4.3 {
   220    220       csql2 COMMIT
   221    221       csql1 { SELECT count(*) FROM t2 }
   222    222     } {0 512}