CoolFace
Modelpublic

AryaWu/sqlite

sourceHugging Faceupdated 9mo agoView on Hugging Face
0likes
mmapwarm.test82 linesDownload Raw Back to test
1# 20 September 182#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.tcl15 16 17if 0 {18  db close19  sqlite3_shutdown20  proc msg {args} { puts $args }21  test_sqlite3_log msg22  sqlite3 db test.db23}24 25set testprefix mmapwarm26 27 28do_execsql_test 1.0 {29  PRAGMA auto_vacuum = 0;30  CREATE TABLE t1(x, y);31  WITH s(i) AS (32    SELECT 1 UNION ALL SELECT i+1 FROM s WHERE i<50033  )34  INSERT INTO t1 SELECT randomblob(400), randomblob(500) FROM s;35  PRAGMA page_count;36} {507}37db close38 39do_test 1.1 {40  sqlite3 db test.db41  db eval {PRAGMA mmap_size = 1000000}42  sqlite3_mmap_warm db43} {SQLITE_OK}44 45do_test 1.2 {46  db close47  sqlite3 db test.db48  db eval {PRAGMA mmap_size = 1000000}49  sqlite3_mmap_warm db "main"50} {SQLITE_OK}51 52do_test 1.3 {53  sqlite3 db test.db54  sqlite3_mmap_warm db55} {SQLITE_OK}56 57do_test 1.4 {58  db close59  sqlite3 db test.db60  sqlite3_mmap_warm db "main"61} {SQLITE_OK}62 63do_test 2.0 {64  db close65  sqlite3 db test.db66  db eval BEGIN67  sqlite3_mmap_warm db "main"68} {SQLITE_MISUSE}69 70do_faultsim_test 3 -faults oom* -prep {71  sqlite3 db test.db72  sqlite3_db_config_lookaside db 0 0 073  db eval { PRAGMA mmap_size = 1000000 }74  db eval { SELECT * FROM sqlite_master }75} -body {76  sqlite3_mmap_warm db "main"77} -test {78  faultsim_test_result {0 SQLITE_OK} {0 SQLITE_NOMEM}79}80 81finish_test82