Enhance the command-line completion extension to return the names of
[sqlite.git] / test / mmapwarm.test
blobb077047ebcd4d7b67b83a0f81870dddc7a5ba592
1 # 20 September 18
3 # The author disclaims copyright to this source code.  In place of
4 # a legal notice, here is a blessing:
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.
10 #***********************************************************************
13 set testdir [file dirname $argv0]
14 source $testdir/tester.tcl
17 if 0 {
18   db close
19   sqlite3_shutdown
20   proc msg {args} { puts $args }
21   test_sqlite3_log msg
22   sqlite3 db test.db
25 set testprefix mmapwarm
28 do_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<500
33   )
34   INSERT INTO t1 SELECT randomblob(400), randomblob(500) FROM s;
35   PRAGMA page_count;
36 } {507}
37 db close
39 do_test 1.1 {
40   sqlite3 db test.db
41   db eval {PRAGMA mmap_size = 1000000}
42   sqlite3_mmap_warm db
43 } {SQLITE_OK}
45 do_test 1.2 {
46   db close
47   sqlite3 db test.db
48   db eval {PRAGMA mmap_size = 1000000}
49   sqlite3_mmap_warm db "main"
50 } {SQLITE_OK}
52 do_test 1.3 {
53   sqlite3 db test.db
54   sqlite3_mmap_warm db
55 } {SQLITE_OK}
57 do_test 1.4 {
58   db close
59   sqlite3 db test.db
60   sqlite3_mmap_warm db "main"
61 } {SQLITE_OK}
63 do_test 2.0 {
64   db close
65   sqlite3 db test.db
66   db eval BEGIN
67   sqlite3_mmap_warm db "main"
68 } {SQLITE_MISUSE}
70 do_faultsim_test 3 -faults oom* -prep {
71   sqlite3 db test.db
72   sqlite3_db_config_lookaside db 0 0 0
73   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}
81 finish_test