SQLite

Check-in [db9b1fa597]
Login

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

Overview
Comment:Add a test for the problem fixed by [bf44d73d3e].
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: db9b1fa5973d79e29885817d5aedc3a886c2589a
User & Date: dan 2012-10-17 16:20:36.056
Context
2012-10-17
20:15
Initialize variables used as outputs of custom tokenizer method calls in fts4. (check-in: 514505a84b user: dan tags: trunk)
16:20
Add a test for the problem fixed by [bf44d73d3e]. (check-in: db9b1fa597 user: dan tags: trunk)
15:28
Change the way the tcl crash-test code works to avoid triggering an assert() in os_unix.c. (check-in: b8b7b8f9e9 user: dan tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/test6.c.
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
        u8 *zGarbage;
        int iFirst = (int)(pWrite->iOffset/g.iSectorSize);
        int iLast = (int)((pWrite->iOffset+pWrite->nBuf-1)/g.iSectorSize);

        assert(pWrite->zBuf);

#ifdef TRACE_CRASHTEST
        printf("Trashing %d sectors @ sector %d (%s)\n", 
            1+iLast-iFirst, iFirst, pWrite->pFile->zName
        );
#endif

        zGarbage = crash_malloc(g.iSectorSize);
        if( zGarbage ){
          sqlite3_int64 i;
          for(i=iFirst; rc==SQLITE_OK && i<=iLast; i++){







|
|







308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
        u8 *zGarbage;
        int iFirst = (int)(pWrite->iOffset/g.iSectorSize);
        int iLast = (int)((pWrite->iOffset+pWrite->nBuf-1)/g.iSectorSize);

        assert(pWrite->zBuf);

#ifdef TRACE_CRASHTEST
        printf("Trashing %d sectors @ %d (sector %d) (%s)\n", 
            1+iLast-iFirst, pWrite->iOffset, iFirst, pWrite->pFile->zName
        );
#endif

        zGarbage = crash_malloc(g.iSectorSize);
        if( zGarbage ){
          sqlite3_int64 i;
          for(i=iFirst; rc==SQLITE_OK && i<=iLast; i++){
Changes to test/crash7.test.
9
10
11
12
13
14
15

16
17
18
19
20
21
22
#
#***********************************************************************
#
# $Id: crash7.test,v 1.1 2008/04/03 14:36:26 danielk1977 Exp $

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


ifcapable !crashtest {
  finish_test
  return
}

proc signature {} {







>







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#
#***********************************************************************
#
# $Id: crash7.test,v 1.1 2008/04/03 14:36:26 danielk1977 Exp $

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

ifcapable !crashtest {
  finish_test
  return
}

proc signature {} {
74
75
76
77
78
79
80
81

































82
       "
    } {1 {child process exited abnormally}}
  
    sqlite3 db test.db
    integrity_check crash7-1.$ii.integrity
  } 
}


































finish_test








>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
       "
    } {1 {child process exited abnormally}}
  
    sqlite3 db test.db
    integrity_check crash7-1.$ii.integrity
  } 
}

db close
forcedelete test.db
sqlite3 db test.db
do_execsql_test 2.0 {
  CREATE TABLE t1(a, b, UNIQUE(a, b));
  INSERT INTO t1 VALUES(randomblob(100), randomblob(100));
  INSERT INTO t1 SELECT randomblob(100), randomblob(100) FROM t1;
  INSERT INTO t1 SELECT randomblob(100), randomblob(100) FROM t1;
  INSERT INTO t1 SELECT randomblob(100), randomblob(100) FROM t1;
  INSERT INTO t1 SELECT randomblob(100), randomblob(100) FROM t1;
  INSERT INTO t1 SELECT randomblob(100), randomblob(100) FROM t1;
  INSERT INTO t1 SELECT randomblob(100), randomblob(100) FROM t1;
  INSERT INTO t1 SELECT randomblob(100), randomblob(100) FROM t1;
  INSERT INTO t1 SELECT randomblob(100), randomblob(100) FROM t1;
  INSERT INTO t1 SELECT randomblob(100), randomblob(100) FROM t1;
  INSERT INTO t1 SELECT randomblob(100), randomblob(100) FROM t1;
  INSERT INTO t1 SELECT randomblob(100), randomblob(100) FROM t1;
  INSERT INTO t1 SELECT randomblob(100), randomblob(100) FROM t1;
  INSERT INTO t1 SELECT randomblob(100), randomblob(100) FROM t1;
  INSERT INTO t1 SELECT randomblob(100), randomblob(100) FROM t1;
  DELETE FROM t1 WHERE rowid%2;
}
db_save_and_close

for {set i 0} {$i < 20} {incr i} {
  db_restore_and_reopen
  do_test 2.[expr $i+1].1 {
    crashsql -file test.db -seed $i {VACUUM}
  } {1 {child process exited abnormally}}
  do_execsql_test 2.[expr $i+1].2 { PRAGMA integrity_check } {ok}
}


finish_test