Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Add a test to walcksum.test to stress the checksum calculation. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
778d0c1768f73057be912793631e0cf0 |
User & Date: | dan 2010-05-28 11:16:28.000 |
Original User & Date: | dan 2010-05-28 04:16:28.000 |
Context
2010-05-29
| ||
06:18 | Minor changes to checksum related test cases. (check-in: 60c22bde52 user: dan tags: trunk) | |
2010-05-28
| ||
11:16 | Add a test to walcksum.test to stress the checksum calculation. (check-in: 778d0c1768 user: dan tags: trunk) | |
2010-05-26
| ||
17:31 | Make sure the wal-index mapping is always large enough to cover the entire active area of the wal-index. (check-in: 42705babba user: drh tags: trunk) | |
Changes
Changes to test/walcksum.test.
︙ | ︙ | |||
280 281 282 283 284 285 286 287 288 289 290 291 292 293 | } db2 } {ok 1 2 3 5 8 13 21 34 55 89} catch { db close } catch { db2 close } } do_test walcksum-2.1 { file delete -force test.db test.db-wal test.db-journal sqlite3 db test.db execsql { PRAGMA synchronous = NORMAL; PRAGMA page_size = 1024; PRAGMA journal_mode = WAL; | > > > > > > | 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 | } db2 } {ok 1 2 3 5 8 13 21 34 55 89} catch { db close } catch { db2 close } } #------------------------------------------------------------------------- # Test case walcksum-2.* tests that if a statement transaction is rolled # back after frames are written to the WAL, and then (after writing some # more) the outer transaction is committed, the WAL file is still correctly # formatted (and can be recovered by a second process if required). # do_test walcksum-2.1 { file delete -force test.db test.db-wal test.db-journal sqlite3 db test.db execsql { PRAGMA synchronous = NORMAL; PRAGMA page_size = 1024; PRAGMA journal_mode = WAL; |
︙ | ︙ | |||
321 322 323 324 325 326 327 328 | PRAGMA integrity_check; SELECT count(*) FROM t1; } db2 } {ok 256} catch { db close } catch { db2 close } finish_test | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 | PRAGMA integrity_check; SELECT count(*) FROM t1; } db2 } {ok 256} catch { db close } catch { db2 close } #------------------------------------------------------------------------- # Test case walcksum-3.* tests that the checksum calculation detects single # byte changes to frame or frame-header data and considers the frame # invalid as a result. # do_test walcksum-3.1 { file delete -force test.db test.db-wal test.db-journal sqlite3 db test.db execsql { PRAGMA synchronous = NORMAL; PRAGMA page_size = 1024; CREATE TABLE t1(a, b); INSERT INTO t1 VALUES(1, randomblob(300)); INSERT INTO t1 VALUES(2, randomblob(300)); PRAGMA journal_mode = WAL; INSERT INTO t1 VALUES(3, randomblob(300)); } file size test.db-wal } [log_file_size 1 1024] do_test walcksum-3.2 { file copy -force test.db-wal test2.db-wal file copy -force test.db test2.db sqlite3 db2 test2.db execsql { SELECT a FROM t1 } db2 } {1 2 3} db2 close file copy -force test.db test2.db for {set incr 1} {$incr <= 255} {incr incr 21} { do_test walcksum-3.3.$incr { set FAIL 0 for {set iOff 0} {$iOff < [log_file_size 1 1024]} {incr iOff} { file copy -force test.db-wal test2.db-wal set fd [open test2.db-wal r+] fconfigure $fd -encoding binary fconfigure $fd -translation binary seek $fd $iOff binary scan [read $fd 1] c x seek $fd $iOff puts -nonewline $fd [binary format c [expr {$x+$incr}]] close $fd sqlite3 db2 test2.db if { [execsql { SELECT a FROM t1 } db2] != "1 2" } {set FAIL 1} db2 close } set FAIL } {0} } finish_test |