/ Check-in [b0f8203d]
Login

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

Overview
Comment:Add crash2.test, for robustness testing with variable disk block size. (CVS 3696)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:b0f8203dbbf1036418a2dcc480f352f761826194
User & Date: danielk1977 2007-03-17 10:28:05
Context
2007-03-17
13:27
First cut at an implementation of the REPLACE() function. We might yet make this a compile-time option or move it into a separate source file. (CVS 3697) check-in: c2fe746e user: drh tags: trunk
10:28
Add crash2.test, for robustness testing with variable disk block size. (CVS 3696) check-in: b0f8203d user: danielk1977 tags: trunk
10:26
Modifications to crash-test infrastructure. (CVS 3695) check-in: c4be8d99 user: danielk1977 tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Added test/crash2.test.

            1  +# 2001 September 15
            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  +# This file implements regression tests for SQLite library.
           12  +#
           13  +# The focus of this file is testing the ability of the database to
           14  +# uses its rollback journal to recover intact (no database corruption)
           15  +# from a power failure during the middle of a COMMIT. Even more
           16  +# specifically, the tests in this file verify this functionality
           17  +# for storage mediums with various sector sizes.
           18  +#
           19  +# $Id: crash2.test,v 1.1 2007/03/17 10:28:05 danielk1977 Exp $
           20  +
           21  +set testdir [file dirname $argv0]
           22  +source $testdir/tester.tcl
           23  +
           24  +ifcapable !crashtest {
           25  +  finish_test
           26  +  return
           27  +}
           28  +
           29  +# This test is designed to check that the crash-test infrastructure
           30  +# can create files that do not consist of an integer number of
           31  +# simulated disk blocks (i.e. 3KB file using 2KB disk blocks).
           32  +#
           33  +do_test crash2-1.1 {
           34  +  crashsql -delay 500 -file test.db -blocksize 2048 {
           35  +    BEGIN;
           36  +    CREATE TABLE abc AS SELECT 1 AS a, 2 AS b, 3 AS c;
           37  +    CREATE TABLE def AS SELECT 1 AS d, 2 AS e, 3 AS f;
           38  +    COMMIT;
           39  +  }
           40  +  file size test.db
           41  +} {3072}
           42  +
           43  +for {set ii 0} {$ii < 5} {incr ii} {
           44  +
           45  +  # Simple test using the database created above: Create a new
           46  +  # table so that page 1 and page 4 are modified. Using a
           47  +  # block-size of 2048 and page-size of 1024, this means
           48  +  # pages 2 and 3 must also be saved in the journal to avoid
           49  +  # risking corruption.
           50  +  #
           51  +  # The loop is so that this test can be run with a couple
           52  +  # of different seeds for the random number generator.
           53  +  #
           54  +  do_test crash2-1.2.$ii {
           55  +    crashsql -file test.db -blocksize 2048 "
           56  +      [string repeat {SELECT random();} $ii]
           57  +      CREATE TABLE hij(h, i, j);
           58  +    "
           59  +    db eval {PRAGMA integrity_check}
           60  +  } {ok}
           61  +}
           62  +
           63  +finish_test
           64  +