Activate test cases for new journal format. (CVS 1687)

FossilOrigin-Name: 197d00d6a6a440848a0b4710157272558868221c
This commit is contained in:
danielk1977 2004-06-25 06:23:22 +00:00
parent 7657240a21
commit f187bd9d64
5 changed files with 44 additions and 34 deletions

View File

@ -1,5 +1,5 @@
C Modifications\sto\sthe\sjournal\sformat\sto\smake\sit\smore\srobust.\s(CVS\s1686)
D 2004-06-25T02:38:55
C Activate\stest\scases\sfor\snew\sjournal\sformat.\s(CVS\s1687)
D 2004-06-25T06:23:23
F Makefile.in cb7a9889c38723f72b2506c4236ff30a05ff172b
F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
@ -44,13 +44,13 @@ F src/os.h 2f5ea879b784bc82aac8022a3e8fe00b73c83d67
F src/os_common.h ba1b7306e16e2091718f2c48db0fe6c1d7a31bb8
F src/os_mac.c 3d31e26be1411acfb7961033098631b4f3486fdf
F src/os_mac.h 51d2445f47e182ed32d3bd6937f81070c6fd9bd4
F src/os_test.c ae1d1e6c5c11ca4b49cc1b9d3c6b8874774c1a5a
F src/os_test.c ef353f73a2ad85a239d7a77c4a5df2e1377f3848
F src/os_test.h 6a26a4978492e4bbdbf385554958418ff02db162
F src/os_unix.c 39e73ed02fc992a6bfc52200ea26704633412cc0
F src/os_unix.h 00c1f82b526ab2fb7ee5ddd555ea4ed68363c93a
F src/os_win.c 84549f6cc815237533c5d0eb3697352b03478d96
F src/os_win.h babd4e912967c6b09088cfe38a45e8005a07ba44
F src/pager.c e25c880b9bcc21ce049ba609c9ec97dcb506528e
F src/pager.c 6e3539f1ca18b0b2af9db8e28fd84d5f84115f5b
F src/pager.h bc58d32a9dee464f7268fb68652c130a4216e438
F src/parse.y 097438674976355a10cf177bd97326c548820b86
F src/pragma.c 0750e1c360647dbe0a991f16133b0fe5e42e5039
@ -104,7 +104,7 @@ F test/collate4.test 0e9fc08ffcf6eddf72e354a15de06688fa86db31
F test/collate5.test 1dd5f0f508c46667f9d4606c7950c414b0bdc0d5
F test/collate6.test 2a45768914f04c1447a69d1358bbede376552675
F test/conflict.test c5b849b01cfbe0a4f63a90cba6f68e2fe3a75f87
F test/crash.test 01b4a1cf195678138810f973ec9e2e6cef731d3e
F test/crash.test 14cc6a657532841fa179b6f8d4181ce680cabc4a
F test/crashtest1.c 09c1c7d728ccf4feb9e481671e29dda5669bbcc2
F test/date.test aed5030482ebc02bd8d386c6c86a29f694ab068d
F test/delete.test 4f0c86e2bebdc822d179c80697b1ceabe6bbcd07
@ -229,7 +229,7 @@ F www/tclsqlite.tcl 19191cf2a1010eaeff74c51d83fd5f5a4d899075
F www/vdbe.tcl 59288db1ac5c0616296b26dce071c36cb611dfe9
F www/version3.tcl 563ba3ac02f64da27ab17f3edbe8e56bfd0293fb
F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4
P 200cd3baf60e6cfad9fa3971834367821456ae30
R 111c7f7eea01c4703a9fa5ff151eccf9
P 504246a18daca794473b17a7874096f1ec8648ee
R f017ffd3003f05168cbc5b7d99000fb4
U danielk1977
Z e8bd1f264c045f846899848a7dd6572b
Z 29d59bf15a42f73cfe80f868d9fac7ef

View File

@ -1 +1 @@
504246a18daca794473b17a7874096f1ec8648ee
197d00d6a6a440848a0b4710157272558868221c

View File

@ -190,7 +190,7 @@ static int cacheBlock(OsTestFile *pFile, int blk){
return SQLITE_OK;
}
/* #define TRACE_WRITECACHE */
/* #define TRACE_WRITECACHE */
/*
** Write the cache of pFile to disk. If crash is non-zero, randomly
@ -212,7 +212,7 @@ static int writeCache2(OsTestFile *pFile, int crash){
char random;
sqlite3Randomness(1, &random);
if( random & 0x01 ){
if( 0 && random & 0x02 ){
if( random & 0x02 ){
trash = 1;
#ifdef TRACE_WRITECACHE
printf("Trashing block %d of %s\n", i, pFile->zName);
@ -265,7 +265,7 @@ static int writeCache(OsTestFile *pFile){
if( c ){
OsTestFile *p;
#ifdef TRACE_WRITECACHE
printf("Crash during sync of %s\n", pFile->zName);
printf("\nCrash during sync of %s\n", pFile->zName);
#endif
for(p=pAllFiles; p; p=p->pNext){
writeCache2(p, 1);

View File

@ -18,7 +18,7 @@
** file simultaneously, or one process from reading the database while
** another is writing.
**
** @(#) $Id: pager.c,v 1.138 2004/06/25 02:38:55 danielk1977 Exp $
** @(#) $Id: pager.c,v 1.139 2004/06/25 06:23:23 danielk1977 Exp $
*/
#include "os.h" /* Must be first to enable large file support */
#include "sqliteInt.h"
@ -2046,6 +2046,7 @@ int sqlite3pager_get(Pager *pPager, Pgno pgno, void **ppPage){
** trashed when the nRec field is updated).
*/
pPager->nRec = 0;
assert( pPager->journalOff > 0 );
rc = writeJournalHdr(pPager);
if( rc!=0 ){
sqlite3pager_rollback(pPager);

View File

@ -10,13 +10,13 @@
#***********************************************************************
# This file implements regression tests for SQLite library.
#
# $Id: crash.test,v 1.3 2004/06/23 10:43:15 danielk1977 Exp $
# $Id: crash.test,v 1.4 2004/06/25 06:23:23 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
set repeats 100
# set repeats 5
# set repeats 10
# This proc execs a seperate process that crashes midway through executing
# the SQL script $sql on database test.db.
@ -37,14 +37,15 @@ proc crashsql {crashdelay crashfile sql} {
set f [open crash.tcl w]
puts $f "sqlite3_crashparams $crashdelay $cfile"
puts $f "sqlite3 db test.db"
puts $f "db eval {pragma full_synchronous = 1}"
puts $f "db eval {pragma synchronous = full}"
puts $f "db eval {pragma cache_size = 10}"
puts $f "db eval {"
puts $f "$sql"
puts $f "}"
close $f
set r [catch {
exec [file join . crashtest] crash.tcl
exec [file join . crashtest] crash.tcl >@stdout
} msg]
lappend r $msg
}
@ -58,11 +59,6 @@ proc signature2 {} {
return [db eval {SELECT count(*), md5sum(a), md5sum(b), md5sum(c) FROM abc2}]
}
# Use a small pager-cache for these tests.
do_test crash-0.1 {
execsql { pragma default_cache_size = 10 }
} {}
#--------------------------------------------------------------------------
# Simple crash test:
#
@ -73,11 +69,14 @@ do_test crash-0.1 {
# crash-1.4: Run a 'DELETE FROM abc WHERE a = 1' that crashes during
# the first database-sync.
# crash-1.5: Ensure the database is in the same state as after crash-1.1.
# crash-1.6: Run a 'DELETE FROM abc WHERE a = 1' that crashes during
# the second journal-sync.
# crash-1.7: Ensure the database is in the same state as after crash-1.1.
#
# Tests 1.6 through 1.9 are the same as 1.2 through 1.5, except the crash
# is requested on the second sync of each file. This doesn't happen in
# such a small test case, so these tests are just to verify that the
# test infrastructure operates as expected.
# Tests 1.8 through 1.11 test for crashes on the third journal sync and
# second database sync. Neither of these is required in such a small test
# case, so these tests are just to verify that the test infrastructure
# operates as expected.
#
do_test crash-1.1 {
execsql {
@ -93,9 +92,6 @@ do_test crash-1.2 {
DELETE FROM abc WHERE a = 1;
}
} {1 {child process exited abnormally}}
# exit
do_test crash-1.3 {
signature
} $::sig
@ -111,18 +107,29 @@ do_test crash-1.6 {
crashsql 2 test.db-journal {
DELETE FROM abc WHERE a = 1;
}
} {0 {}}
} {1 {child process exited abnormally}}
do_test crash-1.7 {
catchsql {
SELECT * FROM abc;
}
} {0 {4 5 6}}
} {0 {1 2 3 4 5 6}}
do_test crash-1.8 {
crashsql 3 test.db-journal {
DELETE FROM abc WHERE a = 1;
}
} {0 {}}
do_test crash-1.9 {
catchsql {
SELECT * FROM abc;
}
} {0 {4 5 6}}
do_test crash-1.10 {
crashsql 2 test.db {
DELETE FROM abc WHERE a = 4;
}
} {0 {}}
do_test crash-1.9 {
do_test crash-1.11 {
catchsql {
SELECT * FROM abc;
}
@ -226,7 +233,10 @@ do_test crash-4.0 {
file delete -force test2.db
file delete -force test2.db-journal
sqlite3 db2 test2.db
execsql {pragma default_cache_size = 10} db2
execsql {
pragma default_cache_size = 10;
pragma default_synchronous = full;
} db2
db2 close
execsql {
ATTACH 'test2.db' AS aux;
@ -302,5 +312,4 @@ for {set i 1} {$i < 5} {incr i} {
} $sig2
}
finish_test