SQLite

Check-in [1dd834a3d6]
Login

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

Overview
Comment:Changes to test scripts so that (make test) works when OMIT_INCRBLOB is defined. (CVS 6904)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 1dd834a3d61496dfa138c36676a5fa6afaa4c817
User & Date: danielk1977 2009-07-18 08:30:45.000
Context
2009-07-18
11:52
When the asynchronous IO backend opens a file with the EXCLUSIVE flag set, make sure only a single file-descriptor is opened (not one for reading and one for writing). This change fixes #3978. (CVS 6905) (check-in: 630e669b97 user: danielk1977 tags: trunk)
08:30
Changes to test scripts so that (make test) works when OMIT_INCRBLOB is defined. (CVS 6904) (check-in: 1dd834a3d6 user: danielk1977 tags: trunk)
2009-07-17
17:25
Fix a subtle problem that can occur when a transaction is automatically rolled back, and afterwards a VM that had opened a statement transaction within the abandoned transaction is finalized. Fixes an assert() that was failing in rtree3.test. (CVS 6903) (check-in: 910df46e0f user: danielk1977 tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to test/memsubsys1.test.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# 2008 June 18
#
# 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 contains tests of the memory allocation subsystem
#
# $Id: memsubsys1.test,v 1.15 2009/04/11 14:46:43 drh Exp $

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

# This procedure constructs a new database in test.db.  It fills
# this database with many small records (enough to force multiple













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# 2008 June 18
#
# 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 contains tests of the memory allocation subsystem
#
# $Id: memsubsys1.test,v 1.16 2009/07/18 08:30:45 danielk1977 Exp $

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

# This procedure constructs a new database in test.db.  It fills
# this database with many small records (enough to force multiple
266
267
268
269
270
271
272



273
274
275
276
277
278
279
  set pg_used [lindex [sqlite3_status SQLITE_STATUS_SCRATCH_USED 0] 2]
} 0
do_test memsubsys1-8.2 {
  set s_ovfl [lindex [sqlite3_status SQLITE_STATUS_SCRATCH_OVERFLOW 0] 2]
} 0
do_test memsubsys1-8.3 {
  sqlite3 db :memory:



  db eval {
    CREATE TABLE t1(x);
    INSERT INTO t1 VALUES(zeroblob(400));
    INSERT INTO t1 VALUES(zeroblob(400));
    INSERT INTO t1 SELECT * FROM t1;
    INSERT INTO t1 SELECT * FROM t1;
    INSERT INTO t1 SELECT * FROM t1;







>
>
>







266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
  set pg_used [lindex [sqlite3_status SQLITE_STATUS_SCRATCH_USED 0] 2]
} 0
do_test memsubsys1-8.2 {
  set s_ovfl [lindex [sqlite3_status SQLITE_STATUS_SCRATCH_OVERFLOW 0] 2]
} 0
do_test memsubsys1-8.3 {
  sqlite3 db :memory:
  ifcapable !incrblob {
    db function zeroblob [list string repeat [binary format c 0]]
  }
  db eval {
    CREATE TABLE t1(x);
    INSERT INTO t1 VALUES(zeroblob(400));
    INSERT INTO t1 VALUES(zeroblob(400));
    INSERT INTO t1 SELECT * FROM t1;
    INSERT INTO t1 SELECT * FROM t1;
    INSERT INTO t1 SELECT * FROM t1;
Changes to test/pcache2.test.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# 2008 September 15
#
# 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 is focused on testing the pcache module.
#
# $Id: pcache2.test,v 1.3 2008/11/13 16:21:50 danielk1977 Exp $

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


# Set up a pcache memory pool so that we can easily track how many
# pages are being used for cache.













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# 2008 September 15
#
# 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 is focused on testing the pcache module.
#
# $Id: pcache2.test,v 1.4 2009/07/18 08:30:45 danielk1977 Exp $

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


# Set up a pcache memory pool so that we can easily track how many
# pages are being used for cache.
41
42
43
44
45
46
47




48
49
50
51
52
53
54
} {2}
do_test pcache2-1.3 {
  file delete -force test2.db test2.db-journal
  sqlite3 db2 test2.db
  db2 eval {PRAGMA cache_size=50}
  lindex [sqlite3_status SQLITE_STATUS_PAGECACHE_USED 0] 1
} {4}





# Make lots of changes on the first connection.  Verify that the
# page cache usage does not grow to consume the page space set aside
# for the second connection.
#
do_test pcache2-1.4 {
  db eval {







>
>
>
>







41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
} {2}
do_test pcache2-1.3 {
  file delete -force test2.db test2.db-journal
  sqlite3 db2 test2.db
  db2 eval {PRAGMA cache_size=50}
  lindex [sqlite3_status SQLITE_STATUS_PAGECACHE_USED 0] 1
} {4}

ifcapable !incrblob {
  db function zeroblob [list string repeat [binary format c 0]]
}

# Make lots of changes on the first connection.  Verify that the
# page cache usage does not grow to consume the page space set aside
# for the second connection.
#
do_test pcache2-1.4 {
  db eval {
Changes to test/savepoint.test.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# 2008 December 15
#
# 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.
#
#***********************************************************************
#
# $Id: savepoint.test,v 1.12 2009/02/04 10:09:04 danielk1977 Exp $

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


#----------------------------------------------------------------------
# The following tests - savepoint-1.* - test that the SAVEPOINT, RELEASE











|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# 2008 December 15
#
# 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.
#
#***********************************************************************
#
# $Id: savepoint.test,v 1.13 2009/07/18 08:30:45 danielk1977 Exp $

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


#----------------------------------------------------------------------
# The following tests - savepoint-1.* - test that the SAVEPOINT, RELEASE
265
266
267
268
269
270
271

272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331

332
333
334
335
336
337
338
  execsql COMMIT
} {}

#------------------------------------------------------------------------
# Test some logic errors to do with the savepoint feature.
# 


do_test savepoint-5.1.1 {
  execsql {
    CREATE TABLE blobs(x);
    INSERT INTO blobs VALUES('a twentyeight character blob');
  }
  set fd [db incrblob blobs x 1]
  puts -nonewline $fd "hello"
  catchsql {SAVEPOINT abc}
} {1 {cannot open savepoint - SQL statements in progress}}
do_test savepoint-5.1.2 {
  close $fd
  catchsql {SAVEPOINT abc}
} {0 {}}

do_test savepoint-5.2 {
  execsql  {RELEASE abc}
  catchsql {RELEASE abc}
} {1 {no such savepoint: abc}}

do_test savepoint-5.3.1 {
  execsql  {SAVEPOINT abc}
  catchsql {ROLLBACK TO def}
} {1 {no such savepoint: def}}
do_test savepoint-5.3.2 {
  execsql  {SAVEPOINT def}
  set fd [db incrblob -readonly blobs x 1]
  catchsql {ROLLBACK TO def}
} {1 {cannot rollback savepoint - SQL statements in progress}}
do_test savepoint-5.3.3 {
  catchsql  {RELEASE def}
} {0 {}}
do_test savepoint-5.3.4 {
  close $fd
  execsql  {savepoint def}
  set fd [db incrblob blobs x 1]
  catchsql {release def}
} {1 {cannot release savepoint - SQL statements in progress}}
do_test savepoint-5.3.5 {
  close $fd
  execsql {release abc}
} {}

do_test savepoint-5.4.1 {
  execsql {
    SAVEPOINT main;
    INSERT INTO blobs VALUES('another blob');
  }
} {}
do_test savepoint-5.4.2 {
  sqlite3 db2 test.db
  execsql { BEGIN ; SELECT * FROM blobs } db2
  catchsql { RELEASE main }
} {1 {database is locked}}
do_test savepoint-5.4.3 {
  db2 close
  catchsql { RELEASE main }
} {0 {}}
do_test savepoint-5.4.4 {
  execsql { SELECT x FROM blobs WHERE rowid = 2 }
} {{another blob}}


#-------------------------------------------------------------------------
# The following tests, savepoint-6.*, test an incr-vacuum inside of a
# couple of nested savepoints.
#
ifcapable {autovacuum && pragma} {
  db close







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







265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
  execsql COMMIT
} {}

#------------------------------------------------------------------------
# Test some logic errors to do with the savepoint feature.
# 

ifcapable incrblob {
  do_test savepoint-5.1.1 {
    execsql {
      CREATE TABLE blobs(x);
      INSERT INTO blobs VALUES('a twentyeight character blob');
    }
    set fd [db incrblob blobs x 1]
    puts -nonewline $fd "hello"
    catchsql {SAVEPOINT abc}
  } {1 {cannot open savepoint - SQL statements in progress}}
  do_test savepoint-5.1.2 {
    close $fd
    catchsql {SAVEPOINT abc}
  } {0 {}}
  
  do_test savepoint-5.2 {
    execsql  {RELEASE abc}
    catchsql {RELEASE abc}
  } {1 {no such savepoint: abc}}
  
  do_test savepoint-5.3.1 {
    execsql  {SAVEPOINT abc}
    catchsql {ROLLBACK TO def}
  } {1 {no such savepoint: def}}
  do_test savepoint-5.3.2 {
    execsql  {SAVEPOINT def}
    set fd [db incrblob -readonly blobs x 1]
    catchsql {ROLLBACK TO def}
  } {1 {cannot rollback savepoint - SQL statements in progress}}
  do_test savepoint-5.3.3 {
    catchsql  {RELEASE def}
  } {0 {}}
  do_test savepoint-5.3.4 {
    close $fd
    execsql  {savepoint def}
    set fd [db incrblob blobs x 1]
    catchsql {release def}
  } {1 {cannot release savepoint - SQL statements in progress}}
  do_test savepoint-5.3.5 {
    close $fd
    execsql {release abc}
  } {}
  
  do_test savepoint-5.4.1 {
    execsql {
      SAVEPOINT main;
      INSERT INTO blobs VALUES('another blob');
    }
  } {}
  do_test savepoint-5.4.2 {
    sqlite3 db2 test.db
    execsql { BEGIN ; SELECT * FROM blobs } db2
    catchsql { RELEASE main }
  } {1 {database is locked}}
  do_test savepoint-5.4.3 {
    db2 close
    catchsql { RELEASE main }
  } {0 {}}
  do_test savepoint-5.4.4 {
    execsql { SELECT x FROM blobs WHERE rowid = 2 }
  } {{another blob}}
}

#-------------------------------------------------------------------------
# The following tests, savepoint-6.*, test an incr-vacuum inside of a
# couple of nested savepoints.
#
ifcapable {autovacuum && pragma} {
  db close