/ Check-in [f6baa7e1]
Login

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

Overview
Comment:Add test file wal2snapshot.test that should have been added as part of an earlier commit.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | wal2
Files: files | file ages | folders
SHA3-256:f6baa7e1163ed5f61375b0554337030fec23e8a9f60c6412e1b5d626961e93f9
User & Date: dan 2018-12-06 16:54:44
Wiki:wal2
Context
2018-12-11
13:44
Merge latest trunk changes into this branch. check-in: d8dd98a3 user: dan tags: wal2
2018-12-06
16:54
Add test file wal2snapshot.test that should have been added as part of an earlier commit. check-in: f6baa7e1 user: dan tags: wal2
2018-12-05
17:31
Fix a test script problem on this branch. check-in: 285d1c59 user: dan tags: wal2
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Added test/wal2snapshot.test.









































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# 2018 December 5
#
# The author disclaims copyright to this source code.  In place of
# a legal notice, here is a blessing:
#
#    May you do good and not evil.
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library.  The
# focus of this file is testing the operation of the library in
# "PRAGMA journal_mode=WAL2" mode.
#

set testdir [file dirname $argv0]
source $testdir/tester.tcl

set testprefix wal2snapshot
ifcapable !wal {finish_test ; return }
ifcapable !snapshot {finish_test; return}

foreach {tn mode} {1 wal 2 wal2} {
  reset_db
  do_execsql_test $tn.1 "PRAGMA journal_mode = $mode" $mode

  do_execsql_test $tn.2 {
    CREATE TABLE t1(a, b);
    INSERT INTO t1 VALUES(1, 2);
    INSERT INTO t1 VALUES(3, 4);
    BEGIN;
  }

  # Check that sqlite3_snapshot_get() is an error for a wal2 db.
  #
  if {$tn==1} {
    do_test 1.3 {
      set S [sqlite3_snapshot_get db main]
      sqlite3_snapshot_free $S
    } {}
  } else {
    do_test 2.3 {
      list [catch { sqlite3_snapshot_get db main } msg] $msg
    } {1 SQLITE_ERROR}
  }
  
  # Check that sqlite3_snapshot_recover() is an error for a wal2 db.
  #
  do_execsql_test $tn.4 COMMIT
  if {$tn==1} {
    do_test 1.5 {
      sqlite3_snapshot_recover db main
    } {}
  } else {
    do_test 2.5 {
      list [catch { sqlite3_snapshot_recover db main } msg] $msg
    } {1 SQLITE_ERROR}
  }
 
  # Check that sqlite3_snapshot_open() is an error for a wal2 db.
  #
  if {$tn==1} {
    do_test 1.6 {
      execsql BEGIN
      set SNAPSHOT [sqlite3_snapshot_get_blob db main]
      sqlite3_snapshot_open_blob db main $SNAPSHOT
      execsql COMMIT
    } {}
  } else {
    do_test 2.6 {
      execsql BEGIN
      set res [
        list [catch { sqlite3_snapshot_open_blob db main $SNAPSHOT } msg] $msg
      ]
      execsql COMMIT
      set res
    } {1 SQLITE_ERROR}
  }
}


finish_test