SQLite

Check-in [f83b07ace3]
Login

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

Overview
Comment:Fix some test cases in walfault.test. Extend one test case to restore code coverage. Add wal5.test to the "coverage-wal" permutation.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: f83b07ace340c9dd3e0cbe3cd3c106db003b0bd4
User & Date: dan 2011-02-07 16:24:39.731
Context
2011-02-07
23:56
Cleanup to the OP_Checkpoint opcode. (check-in: f611a5a879 user: drh tags: trunk)
16:24
Fix some test cases in walfault.test. Extend one test case to restore code coverage. Add wal5.test to the "coverage-wal" permutation. (check-in: f83b07ace3 user: dan tags: trunk)
15:12
Change blocking-checkpoint tests so that they run once using "PRAGMA wal_checkpoint" and once using calls to sqlite3_wal_checkpoint_v2(). Also fix edge cases surrounding the output variables set by wal_checkpoint_v2(). (check-in: 5a4b6652cf user: dan tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to test/permutations.test.
194
195
196
197
198
199
200

201
202
203
204
205
206
207
#
test_suite "coverage-wal" -description {
  Coverage tests for file wal.c.
} -files {
  wal.test       wal2.test     wal3.test       walmode.test    
  walbak.test    walhook.test  walcrash2.test  walcksum.test
  walfault.test  walbig.test   walnoshm.test

} 

test_suite "coverage-pager" -description {
  Coverage tests for file pager.c.
} -files {
  pager1.test    pager2.test  pagerfault.test  pagerfault2.test
  walfault.test  walbak.test  journal2.test    tkt-9d68c883.test







>







194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
#
test_suite "coverage-wal" -description {
  Coverage tests for file wal.c.
} -files {
  wal.test       wal2.test     wal3.test       walmode.test    
  walbak.test    walhook.test  walcrash2.test  walcksum.test
  walfault.test  walbig.test   walnoshm.test
  wal5.test
} 

test_suite "coverage-pager" -description {
  Coverage tests for file pager.c.
} -files {
  pager1.test    pager2.test  pagerfault.test  pagerfault2.test
  walfault.test  walbak.test  journal2.test    tkt-9d68c883.test
Changes to test/walfault.test.
114
115
116
117
118
119
120

121
122
123
124
125
126
127
do_faultsim_test walfault-3 -prep {
  faultsim_restore_and_reopen
} -body {
  db eval {
    DELETE FROM abc;
    PRAGMA wal_checkpoint;
  }

} -test {
  faultsim_test_result {0 {}}
}


#--------------------------------------------------------------------------
#







>







114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
do_faultsim_test walfault-3 -prep {
  faultsim_restore_and_reopen
} -body {
  db eval {
    DELETE FROM abc;
    PRAGMA wal_checkpoint;
  }
  set {} {}
} -test {
  faultsim_test_result {0 {}}
}


#--------------------------------------------------------------------------
#
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
      PRAGMA journal_mode = WAL;
      CREATE TABLE t1(a PRIMARY KEY, b);
      INSERT INTO t1 VALUES('a', 'b');
      PRAGMA wal_checkpoint;
      SELECT * FROM t1;
    }
  } -test {
    faultsim_test_result {0 {wal a b}}
    faultsim_integrity_check
  } 
}

#--------------------------------------------------------------------------
#
do_test walfault-5-pre-1 {







|







136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
      PRAGMA journal_mode = WAL;
      CREATE TABLE t1(a PRIMARY KEY, b);
      INSERT INTO t1 VALUES('a', 'b');
      PRAGMA wal_checkpoint;
      SELECT * FROM t1;
    }
  } -test {
    faultsim_test_result {0 {wal 0 7 7 a b}}
    faultsim_integrity_check
  } 
}

#--------------------------------------------------------------------------
#
do_test walfault-5-pre-1 {
405
406
407
408
409
410
411

412
413
414
415
416
417
418
  catch { db2 close }
  faultsim_restore_and_reopen
  shmfault filter xShmMap
} -body {
  db eval { SELECT count(*) FROM abc }
  sqlite3 db2 test.db -vfs shmfault
  db2 eval { PRAGMA wal_checkpoint }

} -test {
  faultsim_test_result {0 {}}
}

#-------------------------------------------------------------------------
# Test the handling of the various IO/OOM/SHM errors that may occur during 
# a log recovery operation undertaken as part of a call to 







>







406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
  catch { db2 close }
  faultsim_restore_and_reopen
  shmfault filter xShmMap
} -body {
  db eval { SELECT count(*) FROM abc }
  sqlite3 db2 test.db -vfs shmfault
  db2 eval { PRAGMA wal_checkpoint }
  set {} {}
} -test {
  faultsim_test_result {0 {}}
}

#-------------------------------------------------------------------------
# Test the handling of the various IO/OOM/SHM errors that may occur during 
# a log recovery operation undertaken as part of a call to 
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
  }
  faultsim_save_and_close
} {}
do_faultsim_test walfault-14 -prep {
  faultsim_restore_and_reopen
} -body {
  db eval { 
    PRAGMA wal_checkpoint;
    INSERT INTO abc VALUES(randomblob(1500));
  }
} -test {
  faultsim_test_result {0 {}}
  faultsim_integrity_check
  set nRow [db eval {SELECT count(*) FROM abc}]
  if {!(($nRow==2 && $testrc) || $nRow==3)} { error "Bad db content" }
}

finish_test







|



|






532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
  }
  faultsim_save_and_close
} {}
do_faultsim_test walfault-14 -prep {
  faultsim_restore_and_reopen
} -body {
  db eval { 
    PRAGMA wal_checkpoint = full;
    INSERT INTO abc VALUES(randomblob(1500));
  }
} -test {
  faultsim_test_result {0 {0 10 10}}
  faultsim_integrity_check
  set nRow [db eval {SELECT count(*) FROM abc}]
  if {!(($nRow==2 && $testrc) || $nRow==3)} { error "Bad db content" }
}

finish_test