/ Check-in [50e86b03]
Login

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

Overview
Comment:In the corrupt2.test script, change uses of (open ... a) to (open ... RDWR) to work around inconsistencies in behavior across various platforms. (CVS 3645)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 50e86b0368ae0268e7f07e44a746e13ad86a3b8b
User & Date: drh 2007-02-14 12:32:13
Context
2007-02-17
14:28
make the readline checks more flexible and handle cross-compiling logic (CVS 3646) check-in: 4626c84b user: vapier tags: trunk
2007-02-14
12:32
In the corrupt2.test script, change uses of (open ... a) to (open ... RDWR) to work around inconsistencies in behavior across various platforms. (CVS 3645) check-in: 50e86b03 user: drh tags: trunk
09:19
Use OP_VColumn instead of OP_Column when querying virtual tables for values to save in aggregate context records. #2230. (CVS 3644) check-in: cb78f7cb user: danielk1977 tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to test/corrupt2.test.

     9      9   #
    10     10   #***********************************************************************
    11     11   # This file implements regression tests for SQLite library.
    12     12   #
    13     13   # This file implements tests to make sure SQLite does not crash or
    14     14   # segfault if it sees a corrupt database file.
    15     15   #
    16         -# $Id: corrupt2.test,v 1.2 2005/01/22 03:39:39 danielk1977 Exp $
           16  +# $Id: corrupt2.test,v 1.3 2007/02/14 12:32:13 drh Exp $
    17     17   
    18     18   set testdir [file dirname $argv0]
    19     19   source $testdir/tester.tcl
    20     20   
    21     21   # The following tests - corrupt2-1.* - create some databases corrupted in
    22     22   # specific ways and ensure that SQLite detects them as corrupt.
    23     23   #
................................................................................
    29     29   
    30     30   do_test corrupt2-1.2 {
    31     31   
    32     32     # Corrupt the 16 byte magic string at the start of the file
    33     33     file delete -force corrupt.db
    34     34     file delete -force corrupt.db-journal
    35     35     copy_file test.db corrupt.db
    36         -  set f [open corrupt.db a]
           36  +  set f [open corrupt.db RDWR]
    37     37     seek $f 8 start
    38     38     puts $f blah
    39     39     close $f
    40     40   
    41     41     sqlite3 db2 corrupt.db
    42     42     catchsql {
    43     43       SELECT * FROM sqlite_master;
................................................................................
    47     47   do_test corrupt2-1.3 {
    48     48     db2 close
    49     49   
    50     50     # Corrupt the page-size (bytes 16 and 17 of page 1).
    51     51     file delete -force corrupt.db
    52     52     file delete -force corrupt.db-journal
    53     53     copy_file test.db corrupt.db
    54         -  set f [open corrupt.db a]
           54  +  set f [open corrupt.db RDWR]
    55     55     fconfigure $f -encoding binary
    56     56     seek $f 16 start
    57     57     puts -nonewline $f "\x00\xFF"
    58     58     close $f
    59     59   
    60     60     sqlite3 db2 corrupt.db
    61     61     catchsql {
................................................................................
    66     66   do_test corrupt2-1.4 {
    67     67     db2 close
    68     68   
    69     69     # Corrupt the free-block list on page 1.
    70     70     file delete -force corrupt.db
    71     71     file delete -force corrupt.db-journal
    72     72     copy_file test.db corrupt.db
    73         -  set f [open corrupt.db a]
           73  +  set f [open corrupt.db RDWR]
    74     74     fconfigure $f -encoding binary
    75     75     seek $f 101 start
    76     76     puts -nonewline $f "\xFF\xFF"
    77     77     close $f
    78     78   
    79     79     sqlite3 db2 corrupt.db
    80     80     catchsql {
................................................................................
    85     85   do_test corrupt2-1.5 {
    86     86     db2 close
    87     87   
    88     88     # Corrupt the free-block list on page 1.
    89     89     file delete -force corrupt.db
    90     90     file delete -force corrupt.db-journal
    91     91     copy_file test.db corrupt.db
    92         -  set f [open corrupt.db a]
           92  +  set f [open corrupt.db RDWR]
    93     93     fconfigure $f -encoding binary
    94     94     seek $f 101 start
    95     95     puts -nonewline $f "\x00\xC8"
    96     96     seek $f 200 start
    97     97     puts -nonewline $f "\x00\x00"
    98     98     puts -nonewline $f "\x10\x00"
    99     99     close $f
................................................................................
   102    102     catchsql {
   103    103       SELECT * FROM sqlite_master;
   104    104     } db2
   105    105   } {1 {database disk image is malformed}}
   106    106   db2 close
   107    107   
   108    108   finish_test
   109         -