Get read-only SHM file tests passing on Win32.
[sqlite.git] / test / walrofault.test
blob3e66e2d920bb76d6ace9e68f58989679d3d691c6
1 # 2011 May 09
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 #***********************************************************************
12 # This file contains tests for using WAL databases in read-only mode.
15 set testdir [file dirname $argv0]
16 source $testdir/tester.tcl
17 source $testdir/malloc_common.tcl
18 set ::testprefix walro2
20 # And only if the build is WAL-capable.
22 ifcapable !wal {
23   finish_test
24   return
27 db close
28 sqlite3_shutdown
29 sqlite3_config_uri 1
30 sqlite3 db test.db
32 do_execsql_test 1.0 {
33   CREATE TABLE t1(b);
34   PRAGMA journal_mode = wal;
35   INSERT INTO t1 VALUES('hello');
36   INSERT INTO t1 VALUES('world');
37   INSERT INTO t1 VALUES('!');
38   INSERT INTO t1 VALUES('world');
39   INSERT INTO t1 VALUES('hello');
40   PRAGMA cache_size = 10;
41   BEGIN;
42     WITH s(i) AS ( SELECT 1 UNION ALL SELECT i+1 FROM s WHERE i<30 ) 
43     INSERT INTO t1(b) SELECT randomblob(800) FROM s;
44 } {wal}
45 file_control_persist_wal db 1; db close
46 faultsim_save_and_close
48 do_faultsim_test 1 -faults oom* -prep {
49   catch { db close }
50   faultsim_restore
51   sqlite3 db file:test.db?readonly_shm=1
52 } -body {
53   execsql { SELECT * FROM t1 }
54 } -test {
55   faultsim_test_result {0 {hello world ! world hello}}
60 finish_test