SQLite

Check-in [1218d3703a]
Login

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

Overview
Comment:Fix a problem with wal4.test caused by changes in the previous checkin.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 1218d3703ad23d01ce0d7cbcabdc9e0d864f8717
User & Date: dan 2010-07-16 11:10:25.000
Context
2010-07-17
09:27
Do not run journal3.test with the inmemory_journal permutation. (check-in: e1d228e992 user: dan tags: trunk)
2010-07-16
11:10
Fix a problem with wal4.test caused by changes in the previous checkin. (check-in: 1218d3703a user: dan tags: trunk)
10:39
Fix a test script bug uncovered by [a121cd80c5] that was causing shared_err.test to fail. (check-in: d7b63a4c9f user: dan tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to test/wal4.test.
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32

33



34

35
36

37
38
39
40
41
42
43
44
45
46
47
48




49




50







51
52

set testdir [file dirname $argv0]
source $testdir/tester.tcl
source $testdir/malloc_common.tcl
ifcapable !wal {finish_test ; return }

do_test wal4-1.1 {
  db close
  file delete -force wal4.db wal4.db-journal wal4.db-wal wal4.db-shm
  file delete -force test.db test.db-journal test.db-wal test.db-shm
  sqlite3 db2 wal4.db
  db2 eval {
    PRAGMA journal_mode=WAL;
    CREATE TABLE t1(x);
    INSERT INTO t1 VALUES(1);
    INSERT INTO t1 VALUES(2);
    SELECT x FROM t1 ORDER BY x;
  }
} {wal 1 2}

do_test wal4-1.2 {



  file delete -force test.db test.db-journal test.db-wal

  file copy wal4.db-wal test.db-wal
  sqlite3 db test.db

  catchsql {
    SELECT * FROM t1;
  }
} {1 {no such table: t1}}

do_malloc_test wal4-2.0 -tclprep {
  db close
  file delete -force test.db test.db-journal test.db-wal
  file copy wal4.db-wal test.db-wal
  sqlite3 db test.db
} -sqlbody {
  SELECT name FROM sqlite_master




}  













finish_test







<
<
<
<
|







>

>
>
>
|
>
|
|
>
|
<
<


|
<
<
<
|
|
|
>
>
>
>
|
>
>
>
>
|
>
>
>
>
>
>
>


14
15
16
17
18
19
20




21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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
64

set testdir [file dirname $argv0]
source $testdir/tester.tcl
source $testdir/malloc_common.tcl
ifcapable !wal {finish_test ; return }

do_test wal4-1.1 {




  execsql {
    PRAGMA journal_mode=WAL;
    CREATE TABLE t1(x);
    INSERT INTO t1 VALUES(1);
    INSERT INTO t1 VALUES(2);
    SELECT x FROM t1 ORDER BY x;
  }
} {wal 1 2}

do_test wal4-1.2 {
  # Save a copy of the file-system containing the wal and wal-index files 
  # only (no database file).
  faultsim_save_and_close
  file delete -force sv_test.db
} {}

do_test wal4-1.3 {
  faultsim_restore_and_reopen
  catchsql { SELECT * FROM t1 }


} {1 {no such table: t1}}

do_faultsim_test wal4-2 -prep {



  faultsim_restore_and_reopen
} -body {
  execsql { SELECT name FROM sqlite_master }
} -test {
  # Result should be zero rows (empty db file).
  #
  faultsim_test_result {0 {}}

  # If the SELECT finished successfully, the WAL file should have been
  # deleted. In no case should the database file have been written, so
  # it should still be zero bytes in size regardless of whether or not
  # a fault was injected. Test these assertions:
  #
  if { $testrc==0 && [file exists test.db-wal] } { 
    error "Wal file was not deleted"
  }
  if { [file size test.db]!=0 } { 
    error "Db file grew to [file size test.db] bytes"
  }
}

finish_test