SQLite

Check-in [808e16a7dd]
Login

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

Overview
Comment:Update to test files to support builds with OMIT macros defined. (CVS 2289)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 808e16a7dda048c214df24170da282087042ee3a
User & Date: danielk1977 2005-01-29 09:14:05.000
Context
2005-01-30
09:17
Have the optimization introduced in (2170) deal with OP_NullRow as well as OP_Column and OP_Recno. Fix for #1086. (CVS 2290) (check-in: 356d31e03f user: danielk1977 tags: trunk)
2005-01-29
09:14
Update to test files to support builds with OMIT macros defined. (CVS 2289) (check-in: 808e16a7dd user: danielk1977 tags: trunk)
09:00
Fix a test bug causing a segfault in bind.test. (CVS 2288) (check-in: a8b921d45e user: danielk1977 tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to test/autovacuum_ioerr2.test.
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# This file implements regression tests for SQLite library.  The
# focus of this file is testing for correct handling of I/O errors
# such as writes failing because the disk is full.
# 
# The tests in this file use special facilities that are only
# available in the SQLite test fixture.
#
# $Id: autovacuum_ioerr2.test,v 1.4 2005/01/22 03:39:39 danielk1977 Exp $

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

# If this build of the library does not support auto-vacuum, omit this
# whole file.
ifcapable {!autovacuum} {







|







11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# This file implements regression tests for SQLite library.  The
# focus of this file is testing for correct handling of I/O errors
# such as writes failing because the disk is full.
# 
# The tests in this file use special facilities that are only
# available in the SQLite test fixture.
#
# $Id: autovacuum_ioerr2.test,v 1.5 2005/01/29 09:14:05 danielk1977 Exp $

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

# If this build of the library does not support auto-vacuum, omit this
# whole file.
ifcapable {!autovacuum} {
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114

115
116
117
118
  INSERT INTO abc2 VALUES(10);
  DROP TABLE abc;
  COMMIT;
  DROP TABLE abc2;
}

file delete -force backup.db

do_ioerr_test autovacuum-ioerr2-4 -tclprep {
  if {![file exists backup.db]} {
    sqlite3 dbb backup.db 
    execsql {
      PRAGMA auto_vacuum = 1;
      BEGIN;
      CREATE TABLE abc(a);
      INSERT INTO abc VALUES(randstr(1100,1100)); -- Page 4 is overflow
      INSERT INTO abc VALUES(randstr(1100,1100)); -- Page 5 is overflow
    } dbb
    for {set i 0} {$i<2500} {incr i} {
      execsql {
        INSERT INTO abc VALUES(randstr(100,100)); 
      } dbb
    }
    execsql {
      COMMIT;
      PRAGMA cache_size = 10;
    } dbb
    dbb close
  }
  db close
  file delete -force test.db
  file delete -force test.db-journal
  copy_file backup.db test.db
  set ::DB [sqlite3 db test.db]
  execsql {
    PRAGMA cache_size = 10;
  }
} -sqlbody {
  BEGIN;
  DELETE FROM abc WHERE oid < 3;
  UPDATE abc SET a = randstr(100,100) WHERE oid > 2300;
  UPDATE abc SET a = randstr(1100,1100) WHERE oid = 
      (select max(oid) from abc);
  COMMIT;

}

finish_test








>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
>




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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
  INSERT INTO abc2 VALUES(10);
  DROP TABLE abc;
  COMMIT;
  DROP TABLE abc2;
}

file delete -force backup.db
ifcapable subquery {
  do_ioerr_test autovacuum-ioerr2-4 -tclprep {
    if {![file exists backup.db]} {
      sqlite3 dbb backup.db 
      execsql {
        PRAGMA auto_vacuum = 1;
        BEGIN;
        CREATE TABLE abc(a);
        INSERT INTO abc VALUES(randstr(1100,1100)); -- Page 4 is overflow
        INSERT INTO abc VALUES(randstr(1100,1100)); -- Page 5 is overflow
      } dbb
      for {set i 0} {$i<2500} {incr i} {
        execsql {
          INSERT INTO abc VALUES(randstr(100,100)); 
        } dbb
      }
      execsql {
        COMMIT;
        PRAGMA cache_size = 10;
      } dbb
      dbb close
    }
    db close
    file delete -force test.db
    file delete -force test.db-journal
    copy_file backup.db test.db
    set ::DB [sqlite3 db test.db]
    execsql {
      PRAGMA cache_size = 10;
    }
  } -sqlbody {
    BEGIN;
    DELETE FROM abc WHERE oid < 3;
    UPDATE abc SET a = randstr(100,100) WHERE oid > 2300;
    UPDATE abc SET a = randstr(1100,1100) WHERE oid = 
        (select max(oid) from abc);
    COMMIT;
  }
}

finish_test

Changes to test/ioerr.test.
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# This file implements regression tests for SQLite library.  The
# focus of this file is testing for correct handling of I/O errors
# such as writes failing because the disk is full.
# 
# The tests in this file use special facilities that are only
# available in the SQLite test fixture.
#
# $Id: ioerr.test,v 1.18 2005/01/29 08:36:45 danielk1977 Exp $

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

# If SQLITE_DEFAULT_AUTOVACUUM is set to true, then a simulated IO error
# on the 8th IO operation in the SQL script below doesn't report an error.
#







|







11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# This file implements regression tests for SQLite library.  The
# focus of this file is testing for correct handling of I/O errors
# such as writes failing because the disk is full.
# 
# The tests in this file use special facilities that are only
# available in the SQLite test fixture.
#
# $Id: ioerr.test,v 1.19 2005/01/29 09:14:05 danielk1977 Exp $

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

# If SQLITE_DEFAULT_AUTOVACUUM is set to true, then a simulated IO error
# on the 8th IO operation in the SQL script below doesn't report an error.
#
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
# The first IO call is excluded from the test. This call attempts to read
# the file-header of the temporary database used by VACUUM. Since the
# database doesn't exist at that point, the IO error is not detected.
# 
# Additionally, if auto-vacuum is enabled, the 12th IO error is not 
# detected. Same reason as the 8th in the test case above.
# 

do_ioerr_test ioerr-2 -cksum true -sqlprep { 
  BEGIN; 
  CREATE TABLE t1(a, b, c); 
  INSERT INTO t1 VALUES(1, randstr(50,50), randstr(50,50)); 
  INSERT INTO t1 SELECT a+2, b||'-'||rowid, c||'-'||rowid FROM t1; 
  INSERT INTO t1 SELECT a+4, b||'-'||rowid, c||'-'||rowid FROM t1;
  INSERT INTO t1 SELECT a+8, b||'-'||rowid, c||'-'||rowid FROM t1;
  INSERT INTO t1 SELECT a+16, b||'-'||rowid, c||'-'||rowid FROM t1;
  INSERT INTO t1 SELECT a+32, b||'-'||rowid, c||'-'||rowid FROM t1;
  INSERT INTO t1 SELECT a+64, b||'-'||rowid, c||'-'||rowid FROM t1;
  INSERT INTO t1 SELECT a+128, b||'-'||rowid, c||'-'||rowid FROM t1;
  INSERT INTO t1 VALUES(1, randstr(600,600), randstr(600,600));
  CREATE TABLE t2 AS SELECT * FROM t1;
  CREATE TABLE t3 AS SELECT * FROM t1;
  COMMIT;
  DROP TABLE t2;
} -sqlbody {
  VACUUM;
} -exclude [list \
    1 [expr [string match [execsql {pragma auto_vacuum}] 1]?12:-1]]


do_ioerr_test ioerr-3 -tclprep {
  execsql {
    PRAGMA cache_size = 10;
    BEGIN;
    CREATE TABLE abc(a);
    INSERT INTO abc VALUES(randstr(1500,1500)); -- Page 4 is overflow







>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
>







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
# The first IO call is excluded from the test. This call attempts to read
# the file-header of the temporary database used by VACUUM. Since the
# database doesn't exist at that point, the IO error is not detected.
# 
# Additionally, if auto-vacuum is enabled, the 12th IO error is not 
# detected. Same reason as the 8th in the test case above.
# 
ifcapable vacuum {
  do_ioerr_test ioerr-2 -cksum true -sqlprep { 
    BEGIN; 
    CREATE TABLE t1(a, b, c); 
    INSERT INTO t1 VALUES(1, randstr(50,50), randstr(50,50)); 
    INSERT INTO t1 SELECT a+2, b||'-'||rowid, c||'-'||rowid FROM t1; 
    INSERT INTO t1 SELECT a+4, b||'-'||rowid, c||'-'||rowid FROM t1;
    INSERT INTO t1 SELECT a+8, b||'-'||rowid, c||'-'||rowid FROM t1;
    INSERT INTO t1 SELECT a+16, b||'-'||rowid, c||'-'||rowid FROM t1;
    INSERT INTO t1 SELECT a+32, b||'-'||rowid, c||'-'||rowid FROM t1;
    INSERT INTO t1 SELECT a+64, b||'-'||rowid, c||'-'||rowid FROM t1;
    INSERT INTO t1 SELECT a+128, b||'-'||rowid, c||'-'||rowid FROM t1;
    INSERT INTO t1 VALUES(1, randstr(600,600), randstr(600,600));
    CREATE TABLE t2 AS SELECT * FROM t1;
    CREATE TABLE t3 AS SELECT * FROM t1;
    COMMIT;
    DROP TABLE t2;
  } -sqlbody {
    VACUUM;
  } -exclude [list \
      1 [expr [string match [execsql {pragma auto_vacuum}] 1]?12:-1]]
}

do_ioerr_test ioerr-3 -tclprep {
  execsql {
    PRAGMA cache_size = 10;
    BEGIN;
    CREATE TABLE abc(a);
    INSERT INTO abc VALUES(randstr(1500,1500)); -- Page 4 is overflow