/ Check-in [5afbcd49]
Login

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

Overview
Comment:Fix test case issues related to errors in file-controls and the PSOW flag.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 5afbcd49f92e13d1654c1486e19d7e1bb4d3b024
User & Date: dan 2012-01-13 10:04:10
Context
2012-01-13
10:51
Omit test file zerodamage.test from the inmemory_journal permutation. check-in: 0c0051b1 user: dan tags: trunk
10:04
Fix test case issues related to errors in file-controls and the PSOW flag. check-in: 5afbcd49 user: dan tags: trunk
2012-01-12
16:41
Fix issues in test cases so that they work with DEFAULT_AUTOVACUUM defined. And with a small default cache-size. check-in: a298465c user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/test_journal.c.

   658    658   }
   659    659   
   660    660   /*
   661    661   ** File control method. For custom operations on an jt-file.
   662    662   */
   663    663   static int jtFileControl(sqlite3_file *pFile, int op, void *pArg){
   664    664     jt_file *p = (jt_file *)pFile;
   665         -  return sqlite3OsFileControl(p->pReal, op, pArg);
          665  +  return p->pReal->pMethods->xFileControl(p->pReal, op, pArg);
   666    666   }
   667    667   
   668    668   /*
   669    669   ** Return the sector-size in bytes for an jt-file.
   670    670   */
   671    671   static int jtSectorSize(sqlite3_file *pFile){
   672    672     jt_file *p = (jt_file *)pFile;

Changes to test/malloc5.test.

   348    348     } db2
   349    349     execsql { SELECT * FROM abc } db
   350    350     expr [nPage db] + [nPage db2]
   351    351   } {20}
   352    352   do_test malloc5-6.3.2 {
   353    353     # Try to release 7700 bytes. This should release all the 
   354    354     # non-dirty pages held by db2.
   355         -  sqlite3_release_memory [expr 7*1100]
          355  +  sqlite3_release_memory [expr 7*1132]
   356    356     list [nPage db] [nPage db2]
   357    357   } {10 3}
   358    358   do_test malloc5-6.3.3 {
   359    359     # Try to release another 1000 bytes. This should come fromt the db
   360    360     # cache, since all three pages held by db2 are either in-use or diry.
   361    361     sqlite3_release_memory 1000
   362    362     list [nPage db] [nPage db2]
   363    363   } {9 3}
   364    364   do_test malloc5-6.3.4 {
   365    365     # Now release 9900 more (about 9 pages worth). This should expunge
   366    366     # the rest of the db cache. But the db2 cache remains intact, because
   367    367     # SQLite tries to avoid calling sync().
   368    368     if {$::tcl_platform(wordSize)==8} {
   369         -    sqlite3_release_memory 10177
          369  +    sqlite3_release_memory 10500
   370    370     } else {
   371    371       sqlite3_release_memory 9900
   372    372     }
   373    373     list [nPage db] [nPage db2]
   374    374   } {0 3}
   375    375   do_test malloc5-6.3.5 {
   376    376     # But if we are really insistent, SQLite will consent to call sync()

Changes to test/walcrash.test.

    72     72   }
    73     73   
    74     74   # walcrash-2.*
    75     75   #
    76     76   for {set i 1} {$i < $REPEATS} {incr i} {
    77     77     forcedelete test.db test.db-wal
    78     78     do_test walcrash-2.$i.1 {
    79         -    crashsql -delay 4 -file test.db-wal -seed [incr seed] {
           79  +    crashsql -delay 5 -file test.db-wal -seed [incr seed] {
    80     80         PRAGMA journal_mode = WAL;
    81     81         CREATE TABLE t1(a PRIMARY KEY, b);
    82     82         INSERT INTO t1 VALUES(1, 2);
    83     83         INSERT INTO t1 VALUES(3, 4);
    84     84         INSERT INTO t1 VALUES(5, 9);
    85     85       }
    86     86     } {1 {child process exited abnormally}}
................................................................................
   143    143   # walcrash-4.*
   144    144   #
   145    145   for {set i 1} {$i < $REPEATS} {incr i} {
   146    146     forcedelete test.db test.db-wal
   147    147     forcedelete test2.db test2.db-wal
   148    148   
   149    149     do_test walcrash-4.$i.1 {
   150         -    crashsql -delay 3 -file test.db-wal -seed [incr seed] -blocksize 4096 {
          150  +    crashsql -delay 4 -file test.db-wal -seed [incr seed] -blocksize 4096 {
   151    151         PRAGMA journal_mode = WAL;
   152    152         PRAGMA page_size = 1024;
   153    153         CREATE TABLE t1(a PRIMARY KEY, b);
   154    154         INSERT INTO t1 VALUES(1, 2);
   155    155         INSERT INTO t1 VALUES(3, 4);
   156    156       }
   157    157     } {1 {child process exited abnormally}}
................................................................................
   171    171   # walcrash-5.*
   172    172   #
   173    173   for {set i 1} {$i < $REPEATS} {incr i} {
   174    174     forcedelete test.db test.db-wal
   175    175     forcedelete test2.db test2.db-wal
   176    176   
   177    177     do_test walcrash-5.$i.1 {
   178         -    crashsql -delay 11 -file test.db-wal -seed [incr seed] -blocksize 4096 {
          178  +    crashsql -delay 13 -file test.db-wal -seed [incr seed] -blocksize 4096 {
   179    179         PRAGMA journal_mode = WAL;
   180    180         PRAGMA page_size = 1024;
   181    181         BEGIN;
   182    182           CREATE TABLE t1(x PRIMARY KEY);
   183    183           INSERT INTO t1 VALUES(randomblob(900));
   184    184           INSERT INTO t1 VALUES(randomblob(900));
   185    185           INSERT INTO t1 SELECT randomblob(900) FROM t1;           /* 4 */
................................................................................
   212    212   # walcrash-6.*
   213    213   #
   214    214   for {set i 1} {$i < $REPEATS} {incr i} {
   215    215     forcedelete test.db test.db-wal
   216    216     forcedelete test2.db test2.db-wal
   217    217   
   218    218     do_test walcrash-6.$i.1 {
   219         -    crashsql -delay 12 -file test.db-wal -seed [incr seed] -blocksize 512 {
          219  +    crashsql -delay 14 -file test.db-wal -seed [incr seed] -blocksize 512 {
   220    220         PRAGMA journal_mode = WAL;
   221    221         PRAGMA page_size = 1024;
   222    222         BEGIN;
   223    223           CREATE TABLE t1(x PRIMARY KEY);
   224    224           INSERT INTO t1 VALUES(randomblob(900));
   225    225           INSERT INTO t1 VALUES(randomblob(900));
   226    226           INSERT INTO t1 SELECT randomblob(900) FROM t1;           /* 4 */
................................................................................
   230    230         INSERT INTO t1 SELECT randomblob(900) FROM t1 LIMIT 4;   /* 16 */
   231    231         INSERT INTO t1 SELECT randomblob(900) FROM t1 LIMIT 4;   /* 20 */
   232    232         INSERT INTO t1 SELECT randomblob(900) FROM t1 LIMIT 4;   /* 24 */
   233    233         INSERT INTO t1 SELECT randomblob(900) FROM t1 LIMIT 4;   /* 28 */
   234    234         INSERT INTO t1 SELECT randomblob(900) FROM t1 LIMIT 4;   /* 32 */
   235    235   
   236    236         PRAGMA wal_checkpoint;
   237         -      INSERT INTO t1 VALUES(randomblob(900));
   238         -      INSERT INTO t1 VALUES(randomblob(900));
   239         -      INSERT INTO t1 VALUES(randomblob(900));
          237  +      INSERT INTO t1 VALUES(randomblob(9000));
          238  +      INSERT INTO t1 VALUES(randomblob(9000));
          239  +      INSERT INTO t1 VALUES(randomblob(9000));
   240    240       }
   241    241     } {1 {child process exited abnormally}}
   242    242   
   243    243     do_test walcrash-6.$i.2 {
   244    244       sqlite3 db test.db
   245    245       execsql { SELECT count(*)==34 OR count(*)==35 FROM t1 WHERE x != 1 }
   246    246     } {1}

Changes to test/walfault.test.

   119    119       PRAGMA wal_checkpoint;
   120    120     }
   121    121     set {} {}
   122    122   } -test {
   123    123     faultsim_test_result {0 {}}
   124    124   }
   125    125   
   126         -
   127    126   #--------------------------------------------------------------------------
   128    127   #
   129    128   if {[permutation] != "inmemory_journal"} {
   130    129     faultsim_delete_and_reopen
   131    130     faultsim_save_and_close
   132    131     do_faultsim_test walfault-4 -prep {
   133    132       faultsim_restore_and_reopen
................................................................................
   137    136         PRAGMA journal_mode = WAL;
   138    137         CREATE TABLE t1(a PRIMARY KEY, b);
   139    138         INSERT INTO t1 VALUES('a', 'b');
   140    139         PRAGMA wal_checkpoint;
   141    140         SELECT * FROM t1;
   142    141       }
   143    142     } -test {
   144         -    faultsim_test_result {0 {wal 0 7 7 a b}}
          143  +    # Update: The following changed from {0 {wal 0 7 7 a b}} as a result
          144  +    # of PSOW being set by default.
          145  +    faultsim_test_result {0 {wal 0 5 5 a b}}
   145    146       faultsim_integrity_check
   146    147     } 
   147    148   }
   148    149   
   149    150   #--------------------------------------------------------------------------
   150    151   #
   151    152   do_test walfault-5-pre-1 {
................................................................................
   538    539     faultsim_restore_and_reopen
   539    540   } -body {
   540    541     db eval { 
   541    542       PRAGMA wal_checkpoint = full;
   542    543       INSERT INTO abc VALUES(randomblob(1500));
   543    544     }
   544    545   } -test {
   545         -  faultsim_test_result {0 {0 10 10}}
          546  +  faultsim_test_result {0 {0 9 9}}
   546    547     faultsim_integrity_check
   547    548     set nRow [db eval {SELECT count(*) FROM abc}]
   548    549     if {!(($nRow==2 && $testrc) || $nRow==3)} { error "Bad db content" }
   549    550   }
          551  +finish_test
   550    552   
   551    553   finish_test