CoolFace
Modelpublic

AryaWu/sqlite

sourceHugging Faceupdated 9mo agoView on Hugging Face
0likes
pagerfault3.test64 linesDownload Raw Back to test
1# 2011 January 282#3# The author disclaims copyright to this source code.  In place of4# a legal notice, here is a blessing:5#6#    May you do good and not evil.7#    May you find forgiveness for yourself and forgive others.8#    May you share freely, never taking more than you give.9#10#***********************************************************************11#12 13set testdir [file dirname $argv0]14source $testdir/tester.tcl15source $testdir/lock_common.tcl16source $testdir/malloc_common.tcl17 18if {[permutation] == "inmemory_journal"} {19  finish_test20  return21}22 23# Create a database with page-size 2048 bytes that uses 2 pages. Populate24# it so that if the page-size is changed to 1024 bytes and the db vacuumed, 25# the new db size is 3 pages.26#27do_test pagerfault3-pre1 {28  execsql {29    PRAGMA auto_vacuum = 0;30    PRAGMA page_size = 2048;31    CREATE TABLE t1(x);32    INSERT INTO t1 VALUES(randomblob(1200));33    PRAGMA page_count;34  }35} {2}36do_test pagerfault3-pre2 {37  faultsim_save_and_close38  faultsim_restore_and_reopen39  execsql { 40    PRAGMA page_size = 1024;41    VACUUM;42    PRAGMA page_count;43  }44} {3}45 46# Now do the page-size change and VACUUM with IO error injection. When47# an IO error is injected into the final xSync() of the commit, the pager48# will have to extend the db file from 3072 to 4096 byts when rolling49# back the hot-journal file. This is a special case in pager_truncate().50#51do_faultsim_test pagerfault3-1 -faults ioerr-transient -prep {52  faultsim_restore_and_reopen53} -body {54  execsql { 55    PRAGMA page_size = 1024;56    VACUUM;57  }58} -test {59  faultsim_test_result {0 {}} 60  faultsim_integrity_check61}62 63finish_test64