| OLD | NEW |
| 1 # 2007 May 10 | 1 # 2007 May 10 |
| 2 # | 2 # |
| 3 # The author disclaims copyright to this source code. In place of | 3 # The author disclaims copyright to this source code. In place of |
| 4 # a legal notice, here is a blessing: | 4 # a legal notice, here is a blessing: |
| 5 # | 5 # |
| 6 # May you do good and not evil. | 6 # May you do good and not evil. |
| 7 # May you find forgiveness for yourself and forgive others. | 7 # May you find forgiveness for yourself and forgive others. |
| 8 # May you share freely, never taking more than you give. | 8 # May you share freely, never taking more than you give. |
| 9 # | 9 # |
| 10 #*********************************************************************** | 10 #*********************************************************************** |
| 11 # This file implements regression tests for SQLite library. The focus | 11 # This file implements regression tests for SQLite library. The focus |
| 12 # of this file is checking the libraries response to subtly corrupting | 12 # of this file is checking the libraries response to subtly corrupting |
| 13 # the database file by changing the values of pseudo-randomly selected | 13 # the database file by changing the values of pseudo-randomly selected |
| 14 # bytes. | 14 # bytes. |
| 15 # | 15 # |
| 16 # $Id: fuzz3.test,v 1.3 2009/01/05 17:19:03 drh Exp $ | 16 # $Id: fuzz3.test,v 1.3 2009/01/05 17:19:03 drh Exp $ |
| 17 | 17 |
| 18 set testdir [file dirname $argv0] | 18 set testdir [file dirname $argv0] |
| 19 source $testdir/tester.tcl | 19 source $testdir/tester.tcl |
| 20 | 20 |
| 21 # These tests deal with corrupt database files | 21 # These tests deal with corrupt database files |
| 22 # | 22 # |
| 23 database_may_be_corrupt | 23 database_may_be_corrupt |
| 24 test_set_config_pagecache 0 0 |
| 25 |
| 24 | 26 |
| 25 expr srand(123) | 27 expr srand(123) |
| 26 | 28 |
| 27 proc rstring {n} { | 29 proc rstring {n} { |
| 28 set str s | 30 set str s |
| 29 while {[string length $str] < $n} { | 31 while {[string length $str] < $n} { |
| 30 append str [expr rand()] | 32 append str [expr rand()] |
| 31 } | 33 } |
| 32 return [string range $str 0 $n] | 34 return [string range $str 0 $n] |
| 33 } | 35 } |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 # Restore the original database file content. Test that the correct | 164 # Restore the original database file content. Test that the correct |
| 163 # checksum is now returned. | 165 # checksum is now returned. |
| 164 # | 166 # |
| 165 purge_pcache | 167 purge_pcache |
| 166 modify_database $iOld | 168 modify_database $iOld |
| 167 do_test fuzz3-$ii.$iNew.[incr iTest] { | 169 do_test fuzz3-$ii.$iNew.[incr iTest] { |
| 168 db_checksum | 170 db_checksum |
| 169 } $::cksum | 171 } $::cksum |
| 170 } | 172 } |
| 171 | 173 |
| 174 test_restore_config_pagecache |
| 172 finish_test | 175 finish_test |
| 176 |
| OLD | NEW |