Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Add test case for [fc62af4523]. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
cccd32c692057beb08a994102c6a1012 |
User & Date: | dan 2010-06-17 10:24:28.000 |
Context
2010-06-17
| ||
10:42 | Do not delete the journal file in "PRAGMA journal_mode" commands. This fixes [fc62af4523]. (check-in: 1ec74591a9 user: dan tags: trunk) | |
10:24 | Add test case for [fc62af4523]. (check-in: cccd32c692 user: dan tags: trunk) | |
02:13 | Bug fix: Only trust the database size number at offset 28 if the change counter at offset 24 matches the version number counter at offset 92. This prevents corruption in the case of two applications writing to the database where one is an older version of SQLite and the other is a newer version. (check-in: f80c3f922a user: drh tags: trunk) | |
Changes
Added test/tkt-fc62af4523.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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | # 2010 June 16 # # 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. Specifically, # it tests that ticket [fc62af4523] has been resolved. # set testdir [file dirname $argv0] source $testdir/tester.tcl source $testdir/lock_common.tcl source $testdir/malloc_common.tcl do_test tkt-fc62af4523.1 { execsql { PRAGMA cache_size = 10; PRAGMA journal_mode = persist; CREATE TABLE t1(a UNIQUE, b UNIQUE); INSERT INTO t1 SELECT randomblob(200), randomblob(300); INSERT INTO t1 SELECT randomblob(200), randomblob(300) FROM t1; -- 2 INSERT INTO t1 SELECT randomblob(200), randomblob(300) FROM t1; -- 4 INSERT INTO t1 SELECT randomblob(200), randomblob(300) FROM t1; -- 8 INSERT INTO t1 SELECT randomblob(200), randomblob(300) FROM t1; -- 16 INSERT INTO t1 SELECT randomblob(200), randomblob(300) FROM t1; -- 32 INSERT INTO t1 SELECT randomblob(200), randomblob(300) FROM t1; -- 64 } execsql { PRAGMA integrity_check; SELECT count(*) FROM t1; } } {ok 64} # Launch an external process. Have it write (but not commit) a large # transaction to the database. # set ::chan [launch_testfixture] proc buddy {code} { testfixture $::chan $code } do_test tkt-fc62af4523.2 { testfixture $::chan { sqlite3 db test.db db eval { PRAGMA cache_size = 10; BEGIN; UPDATE t1 SET b = randomblob(400); UPDATE t1 SET a = randomblob(200); } } file exists test.db-journal } {1} # Now do "PRAGMA journal_mode = DELETE" in this process. At one point # this was causing SQLite to delete the journal file from the file-system, # even though the external process is currently using it. # do_test tkt-fc62af4523.3 { execsql { PRAGMA journal_mode = DELETE } } {delete} do_test tkt-fc62af4523.4 { file exists test.db-journal } {1} # Cause the external process to crash. Since it has already written # uncommitted data into the database file, the next reader will have # to do a hot-journal rollback to recover the database. # # Or, if this test is run in a version with the bug present, the journal # file has already been deleted. In this case we are left with a corrupt # database file and no hot-journal to fix it with. # do_test tkt-fc62af4523.5 { testfixture $::chan sqlite_abort } {ERROR: Child process hung up} after 200 do_test tkt-fc62af4523.6 { execsql { PRAGMA integrity_check; SELECT count(*) FROM t1; } } {ok 64} catch { close $::chan } finish_test |