/ Check-in [c3ab1a7e]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

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

Overview
Comment:Add a new I/O error test: ioerr4. (CVS 5097)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: c3ab1a7e2e40eb8f51f1b11bf0591e251d69882b
User & Date: drh 2008-05-07 13:28:38
Context
2008-05-07
14:49
If an error occurs within xAccess(), it should return -1. Remove an assert() that was preventing it from doing so. (CVS 5098) check-in: 3fbcef46 user: danielk1977 tags: trunk
13:28
Add a new I/O error test: ioerr4. (CVS 5097) check-in: c3ab1a7e user: drh tags: trunk
12:45
Fix a null-pointer dereference that can occur following a DISKFULL error while running VACUUM. (CVS 5096) check-in: 438d77a7 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Added test/ioerr4.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
85
86
87
88
89
90
91
92
93
94
95
96
# 2007 December 19
#
# 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 for correct handling of I/O errors
# during incremental vacuum with a shared cache.
#
# $Id: ioerr4.test,v 1.1 2008/05/07 13:28:38 drh Exp $

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

# This test requires both shared cache and incremental vacuum.
#
ifcapable {!shared_cache || !autovacuum} {
  finish_test
  return
}

# Enable shared cache mode and incremental vacuum.
#
do_test ioerr4-1.1 {
  db close
  sqlite3_enable_shared_cache 1
} {0}
do_test ioerr4-1.2 {
  file delete -force test.db test.db-journal
  sqlite3 db test.db
  sqlite3 db2 test.db
  db eval {
    PRAGMA auto_vacuum=INCREMENTAL;
    CREATE TABLE a(i INTEGER, b BLOB);
  }
  db2 eval {
    SELECT name FROM sqlite_master
  }
} {a}
do_test ioerr4-1.3 {
  db eval {
    PRAGMA auto_vacuum;
  }
} {2}

# Insert and delete many records in order to put lots of pages
# on the freelist.
#
do_test ioerr4-1.4 {
  db eval {
    INSERT INTO a VALUES(1, zeroblob(2000));
    INSERT INTO a VALUES(2, zeroblob(2000));
    INSERT INTO a SELECT i+2, zeroblob(2000) FROM a;
    INSERT INTO a SELECT i+4, zeroblob(2000) FROM a;
    INSERT INTO a SELECT i+8, zeroblob(2000) FROM a;
    INSERT INTO a SELECT i+16, zeroblob(2000) FROM a;
    SELECT count(*) FROM a;
  }
} {32}
do_test ioerr4-1.5 {
  db eval {
    PRAGMA freelist_count
  }
} {0}
do_test ioerr4-1.6 {
  db eval {
    DELETE FROM a;
    PRAGMA freelist_count;
  }
} {64}

# Set up for an I/O error on incremental vacuum
# with two connections on shared cache.
#
db close
db2 close
file copy -force test.db test.db-bu
do_ioerr_test ioerr4-2 -tclprep {
  catch {db2 close}
  db close
  file delete -force test.db test.db-journal
  file copy -force test.db-bu test.db
  sqlite3_enable_shared_cache 1
  set ::DB [sqlite3 db test.db; sqlite3_connection_pointer db]
  db eval {PRAGMA auto_vacuum=INCREMENTAL}
  sqlite3 db2 test.db
} -tclbody {
  db eval {PRAGMA incremental_vacuum(5)}
}

finish_test