/ Check-in [a7d949fb]
Login

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

Overview
Comment:Add fault-injection tests for the code on this branch.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | readonly-wal-recovery
Files: files | file ages | folders
SHA3-256: a7d949fb735f60c19e7257a1a7a12568a9c15be9cd980c018f3a0d6bf112c339
User & Date: dan 2017-11-07 09:08:43
Context
2017-11-07
15:43
On unix, if the *-shm file cannot be opened for read/write access, open it read-only and proceed as if the readonly_shm=1 URI option were specified. check-in: ba718754 user: dan tags: readonly-wal-recovery
09:08
Add fault-injection tests for the code on this branch. check-in: a7d949fb user: dan tags: readonly-wal-recovery
2017-11-06
19:49
Add further test cases for the new code on this branch. And a couple of fixes. check-in: 71af9acb user: dan tags: readonly-wal-recovery
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Added test/walrofault.test.

            1  +# 2011 May 09
            2  +#
            3  +# The author disclaims copyright to this source code.  In place of
            4  +# 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  +# This file contains tests for using WAL databases in read-only mode.
           13  +#
           14  +
           15  +set testdir [file dirname $argv0]
           16  +source $testdir/tester.tcl
           17  +source $testdir/malloc_common.tcl
           18  +set ::testprefix walro2
           19  +
           20  +# These tests are only going to work on unix.
           21  +#
           22  +if {$::tcl_platform(platform) != "unix"} {
           23  +  finish_test
           24  +  return
           25  +}
           26  +
           27  +# And only if the build is WAL-capable.
           28  +#
           29  +ifcapable !wal {
           30  +  finish_test
           31  +  return
           32  +}
           33  +
           34  +db close
           35  +sqlite3_shutdown
           36  +sqlite3_config_uri 1
           37  +sqlite3 db test.db
           38  +
           39  +do_execsql_test 1.0 {
           40  +  CREATE TABLE t1(b);
           41  +  PRAGMA journal_mode = wal;
           42  +  INSERT INTO t1 VALUES('hello');
           43  +  INSERT INTO t1 VALUES('world');
           44  +  INSERT INTO t1 VALUES('!');
           45  +  INSERT INTO t1 VALUES('world');
           46  +  INSERT INTO t1 VALUES('hello');
           47  +  PRAGMA cache_size = 10;
           48  +  BEGIN;
           49  +    WITH s(i) AS ( SELECT 1 UNION ALL SELECT i+1 FROM s WHERE i<30 ) 
           50  +    INSERT INTO t1(b) SELECT randomblob(800) FROM s;
           51  +} {wal}
           52  +faultsim_save_and_close
           53  +
           54  +do_faultsim_test 1 -faults oom* -prep {
           55  +  catch { db close }
           56  +  faultsim_restore
           57  +  sqlite3 db file:test.db?readonly_shm=1
           58  +} -body {
           59  +  execsql { SELECT * FROM t1 }
           60  +} -test {
           61  +  faultsim_test_result {0 {hello world ! world hello}}
           62  +}
           63  +
           64  +
           65  +
           66  +finish_test