OLD | NEW |
1 # 2008 July 11 | 1 # 2008 July 11 |
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 #*********************************************************************** |
(...skipping 19 matching lines...) Expand all Loading... |
30 expr {[file size test.db]>=1024} | 30 expr {[file size test.db]>=1024} |
31 } {1} | 31 } {1} |
32 integrity_check corruptA-1.2 | 32 integrity_check corruptA-1.2 |
33 | 33 |
34 # Corrupt the file header in various ways and make sure the corruption | 34 # Corrupt the file header in various ways and make sure the corruption |
35 # is detected when opening the database file. | 35 # is detected when opening the database file. |
36 # | 36 # |
37 db close | 37 db close |
38 file copy -force test.db test.db-template | 38 file copy -force test.db test.db-template |
39 | 39 |
| 40 set unreadable_version 02 |
| 41 ifcapable wal { set unreadable_version 03 } |
40 do_test corruptA-2.1 { | 42 do_test corruptA-2.1 { |
41 file copy -force test.db-template test.db | 43 file copy -force test.db-template test.db |
42 hexio_write test.db 19 02 ;# the read format number | 44 hexio_write test.db 19 $unreadable_version ;# the read format number |
43 sqlite3 db test.db | 45 sqlite3 db test.db |
44 catchsql {SELECT * FROM t1} | 46 catchsql {SELECT * FROM t1} |
45 } {1 {file is encrypted or is not a database}} | 47 } {1 {file is encrypted or is not a database}} |
46 | 48 |
47 do_test corruptA-2.2 { | 49 do_test corruptA-2.2 { |
48 db close | 50 db close |
49 file copy -force test.db-template test.db | 51 file copy -force test.db-template test.db |
50 hexio_write test.db 21 41 ;# max embedded payload fraction | 52 hexio_write test.db 21 41 ;# max embedded payload fraction |
51 sqlite3 db test.db | 53 sqlite3 db test.db |
52 catchsql {SELECT * FROM t1} | 54 catchsql {SELECT * FROM t1} |
(...skipping 10 matching lines...) Expand all Loading... |
63 do_test corruptA-2.4 { | 65 do_test corruptA-2.4 { |
64 db close | 66 db close |
65 file copy -force test.db-template test.db | 67 file copy -force test.db-template test.db |
66 hexio_write test.db 23 21 ;# min leaf payload fraction | 68 hexio_write test.db 23 21 ;# min leaf payload fraction |
67 sqlite3 db test.db | 69 sqlite3 db test.db |
68 catchsql {SELECT * FROM t1} | 70 catchsql {SELECT * FROM t1} |
69 } {1 {file is encrypted or is not a database}} | 71 } {1 {file is encrypted or is not a database}} |
70 | 72 |
71 | 73 |
72 finish_test | 74 finish_test |
OLD | NEW |