SQLite

Check-in [6a5630806c]
Login

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

Overview
Comment:Updates to WAL TCL test scripts to support running on Windows.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 6a5630806c87b0f4e5632c37c357f98effd9608a
User & Date: shaneh 2010-05-11 02:46:17.000
Original Comment: Updates for to WAL TCL test scripts to support running on Windows.
Context
2010-05-11
12:19
Changes so that WAL and exclusive-locking mode work together. (check-in: 71e7b1cf9f user: dan tags: trunk)
02:49
Initial port of WAL VFS support from os_unix.c to os_win.c. (check-in: 111ad59f21 user: shaneh tags: wal-win32)
02:46
Updates to WAL TCL test scripts to support running on Windows. (check-in: 6a5630806c user: shaneh tags: trunk)
2010-05-10
19:51
Fix an off-by-one error while constructing the name of the mmap file for the wal-index under os_unix.c. (check-in: 6e3735f72c user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to test/wal.test.
1281
1282
1283
1284
1285
1286
1287
1288
1289

1290
1291
1292
1293
1294
1295
1296
  set blob
}

proc logcksum {ckv1 ckv2 blob} {
  upvar $ckv1 c1
  upvar $ckv2 c2

  binary scan $blob iu* values
  foreach v $values {

    incr c1 $v
    incr c2 $c1
  }

  set c1 [expr ($c1 + ($c1>>24))&0xFFFFFFFF]
  set c2 [expr ($c2 + ($c2>>24))&0xFFFFFFFF]
}







|

>







1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
  set blob
}

proc logcksum {ckv1 ckv2 blob} {
  upvar $ckv1 c1
  upvar $ckv2 c2

  binary scan $blob i* values
  foreach v $values {
    set v [expr {$v & 0xFFFFFFFF}]
    incr c1 $v
    incr c2 $c1
  }

  set c1 [expr ($c1 + ($c1>>24))&0xFFFFFFFF]
  set c2 [expr ($c2 + ($c2>>24))&0xFFFFFFFF]
}
1423
1424
1425
1426
1427
1428
1429

1430
1431
1432
1433
1434
1435
1436
#   3. Using connection 1, checkpoint the database. Make sure all
#      the data is present and the database is not corrupt.
#
# At one point, SQLite was failing to grow the mapping of the wal-index
# file in step 3 and the checkpoint was corrupting the database file.
#
do_test wal-20.1 {

  file delete -force test.db test.db-wal test.db-journal
  sqlite3 db test.db
  execsql {
    PRAGMA journal_mode = WAL;
    CREATE TABLE t1(x);
    INSERT INTO t1 VALUES(randomblob(900));
    SELECT count(*) FROM t1;







>







1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
#   3. Using connection 1, checkpoint the database. Make sure all
#      the data is present and the database is not corrupt.
#
# At one point, SQLite was failing to grow the mapping of the wal-index
# file in step 3 and the checkpoint was corrupting the database file.
#
do_test wal-20.1 {
  catch {db close}
  file delete -force test.db test.db-wal test.db-journal
  sqlite3 db test.db
  execsql {
    PRAGMA journal_mode = WAL;
    CREATE TABLE t1(x);
    INSERT INTO t1 VALUES(randomblob(900));
    SELECT count(*) FROM t1;
Changes to test/walfault.test.
57
58
59
60
61
62
63

64
65
66
67
68
69
70
  PRAGMA journal_mode = WAL;
  CREATE TABLE abc(a PRIMARY KEY);
  INSERT INTO abc VALUES(randomblob(1500));
} -sqlbody {
  DELETE FROM abc;
  PRAGMA wal_checkpoint;
}


# A [testvfs] callback for the VFS created by [do_shmfault_test]. This
# callback injects SQLITE_IOERR faults into methods for which an entry
# in array ::shmfault_ioerr_methods is defined. For example, to enable
# errors in xShmOpen:
#
#   set ::shmfault_ioerr_methods(xShmOpen) 1







>







57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
  PRAGMA journal_mode = WAL;
  CREATE TABLE abc(a PRIMARY KEY);
  INSERT INTO abc VALUES(randomblob(1500));
} -sqlbody {
  DELETE FROM abc;
  PRAGMA wal_checkpoint;
}
catch {db close}

# A [testvfs] callback for the VFS created by [do_shmfault_test]. This
# callback injects SQLITE_IOERR faults into methods for which an entry
# in array ::shmfault_ioerr_methods is defined. For example, to enable
# errors in xShmOpen:
#
#   set ::shmfault_ioerr_methods(xShmOpen) 1
Changes to test/walmode.test.
39
40
41
42
43
44
45







46
47

48
49
50
51
52
53
54
55
  set sqlite_sync_count 0
  execsql { PRAGMA page_size = 1024 }
  execsql { PRAGMA journal_mode = wal }
} {wal}
do_test walmode-1.2 {
  file size test.db
} {1024}







do_test walmode-1.3 {
  set sqlite_sync_count

} {4}
do_test walmode-1.4 {
  file exists test.db-wal
} {0}
do_test walmode-1.5 {
  execsql { CREATE TABLE t1(a, b) }
  file size test.db
} {1024}







>
>
>
>
>
>
>


>
|







39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
  set sqlite_sync_count 0
  execsql { PRAGMA page_size = 1024 }
  execsql { PRAGMA journal_mode = wal }
} {wal}
do_test walmode-1.2 {
  file size test.db
} {1024}

set expected_sync_count 3
if {$::tcl_platform(platform)!="windows"} {
  ifcapable dirsync {
    incr expected_sync_count
  }
}
do_test walmode-1.3 {
  set sqlite_sync_count
} $expected_sync_count

do_test walmode-1.4 {
  file exists test.db-wal
} {0}
do_test walmode-1.5 {
  execsql { CREATE TABLE t1(a, b) }
  file size test.db
} {1024}