/ Check-in [4ea134a8]
Login

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

Overview
Comment:Add a test case to verify that bug [313723c356] has been fixed.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 4ea134a84c264b55cdb6f6f8e740b252278ce792
User & Date: dan 2010-09-20 08:47:01
Context
2010-09-20
14:05
Add further tests to e_insert.test. check-in: eb3d0d8b user: dan tags: trunk
08:47
Add a test case to verify that bug [313723c356] has been fixed. check-in: 4ea134a8 user: dan tags: trunk
2010-09-18
19:36
Make sure the pager cache is cleared if there is any difficulty starting a new read transaction in WAL mode. Ticket [313723c356483eff2a4c4bdd2c]. check-in: e14ef0e8 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Added test/tkt-313723c356.test.



















































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# 2010 September 20
#
# The author disclaims copyright to this source code.  In place of
# a legal notice, here is a blessing:
#
#    May you do good and not evil.
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library.
#
# This file implements tests to verify that ticket [313723c356] has been
# fixed.  
#

set testdir [file dirname $argv0]
source $testdir/tester.tcl
source $testdir/malloc_common.tcl

ifcapable !wal { finish_test ; return }

do_execsql_test tkt-313723c356.1 {
  PRAGMA page_size = 1024;
  PRAGMA journal_mode = WAL;
  CREATE TABLE t1(a, b);
  CREATE INDEX i1 ON t1(a, b);
  INSERT INTO t1 VALUES(randomblob(400), randomblob(400));
  INSERT INTO t1 SELECT randomblob(400), randomblob(400) FROM t1;
  INSERT INTO t1 SELECT randomblob(400), randomblob(400) FROM t1;
  INSERT INTO t1 SELECT randomblob(400), randomblob(400) FROM t1;
  INSERT INTO t1 SELECT randomblob(400), randomblob(400) FROM t1;
} {wal}
faultsim_save_and_close

do_faultsim_test tkt-313723c356.2 -faults shmerr* -prep {
  faultsim_restore_and_reopen
  sqlite3 db2 test.db
  db eval  { SELECT * FROM t1 }
  db2 eval { UPDATE t1 SET a = randomblob(399) }
  db2 close
} -body {
  # At this point, the cache contains all of table t1 and none of index i1. The
  # cache is out of date. When the bug existed and the right xShmLock() fails
  # in the following statement, the internal cache of the WAL header was
  # being updated, but the contents of the page-cache not flushed. This causes
  # the integrity-check in the "-test" code to fail, as it is comparing the
  # cached (out-of-date) version of table t1 with the on disk (up-to-date)
  # version of index i1.
  #
  execsql { SELECT min(rowid) FROM t1 }
} -test {
  faultsim_test_result {0 1}
  faultsim_integrity_check
}

finish_test