Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fixes to the test suite (no code changes) so that quick.test runs with OMIT_ATTACH builds. #2706. (CVS 4480) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
07c00fffe50e8380748f7ae02328531a |
User & Date: | danielk1977 2007-10-09 08:29:32.000 |
Context
2007-10-09
| ||
15:20 | Fix a typo in the wince driver. Ticket #2710. See also ticket #2702. (CVS 4481) (check-in: beb91af706 user: drh tags: trunk) | |
08:29 | Fixes to the test suite (no code changes) so that quick.test runs with OMIT_ATTACH builds. #2706. (CVS 4480) (check-in: 07c00fffe5 user: danielk1977 tags: trunk) | |
2007-10-08
| ||
15:06 | More untested changes for wince contributed by users. Ticket #2702. (CVS 4479) (check-in: ccd709e179 user: drh tags: trunk) | |
Changes
Changes to test/alter.test.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # 2004 November 10 # # 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 script is testing the ALTER TABLE statement. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # 2004 November 10 # # 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 script is testing the ALTER TABLE statement. # # $Id: alter.test,v 1.26 2007/10/09 08:29:32 danielk1977 Exp $ # set testdir [file dirname $argv0] source $testdir/tester.tcl # If SQLITE_OMIT_ALTERTABLE is defined, omit this file. ifcapable !altertable { |
︙ | ︙ | |||
199 200 201 202 203 204 205 206 207 208 209 210 211 212 | index i3 <t2> \ index {sqlite_autoindex_<t2>_1} <t2> \ index {sqlite_autoindex_<t2>_2} <t2> \ ] # Check that ALTER TABLE works on attached databases. # do_test alter-1.8.1 { file delete -force test2.db file delete -force test2.db-journal execsql { ATTACH 'test2.db' AS aux; } } {} | > | 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | index i3 <t2> \ index {sqlite_autoindex_<t2>_1} <t2> \ index {sqlite_autoindex_<t2>_2} <t2> \ ] # Check that ALTER TABLE works on attached databases. # ifcapable attach { do_test alter-1.8.1 { file delete -force test2.db file delete -force test2.db-journal execsql { ATTACH 'test2.db' AS aux; } } {} |
︙ | ︙ | |||
243 244 245 246 247 248 249 250 251 252 253 254 255 256 | } {main main main} do_test alter-1.8.7 { execsql { ALTER TABLE aux.t4 RENAME TO t5; SELECT * FROM aux.t5 WHERE b = 'aux'; } } {aux aux aux} do_test alter-1.9.1 { execsql { CREATE TABLE tbl1 (a, b, c); INSERT INTO tbl1 VALUES(1, 2, 3); } } {} | > | 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 | } {main main main} do_test alter-1.8.7 { execsql { ALTER TABLE aux.t4 RENAME TO t5; SELECT * FROM aux.t5 WHERE b = 'aux'; } } {aux aux aux} } do_test alter-1.9.1 { execsql { CREATE TABLE tbl1 (a, b, c); INSERT INTO tbl1 VALUES(1, 2, 3); } } {} |
︙ | ︙ | |||
392 393 394 395 396 397 398 399 400 401 402 403 404 405 | set ::TRIGGER } {trig3 4 5 6} # Make sure "ON" cannot be used as a database, table or column name without # quoting. Otherwise the sqlite_alter_trigger() function might not work. file delete -force test3.db file delete -force test3.db-journal do_test alter-3.2.1 { catchsql { ATTACH 'test3.db' AS ON; } } {1 {near "ON": syntax error}} do_test alter-3.2.2 { catchsql { | > | 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 | set ::TRIGGER } {trig3 4 5 6} # Make sure "ON" cannot be used as a database, table or column name without # quoting. Otherwise the sqlite_alter_trigger() function might not work. file delete -force test3.db file delete -force test3.db-journal ifcapable attach { do_test alter-3.2.1 { catchsql { ATTACH 'test3.db' AS ON; } } {1 {near "ON": syntax error}} do_test alter-3.2.2 { catchsql { |
︙ | ︙ | |||
422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 | } } {1 {near "ON": syntax error}} do_test alter-3.2.5 { catchsql { CREATE TABLE 'ON'.'ON'(a, b, c); } } {0 {}} do_test alter-3.2.6 { catchsql { CREATE TABLE t10(a, ON, c); } } {1 {near "ON": syntax error}} do_test alter-3.2.7 { catchsql { CREATE TABLE t10(a, 'ON', c); } } {0 {}} do_test alter-3.2.8 { catchsql { CREATE TRIGGER trig4 AFTER INSERT ON ON BEGIN SELECT 1; END; } } {1 {near "ON": syntax error}} do_test alter-3.2.9 { catchsql { CREATE TRIGGER 'on'.trig4 AFTER INSERT ON 'ON' BEGIN SELECT 1; END; } } {0 {}} do_test alter-3.2.10 { execsql { DROP TABLE t10; } } {} do_test alter-3.3.1 { | > > > | 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 | } } {1 {near "ON": syntax error}} do_test alter-3.2.5 { catchsql { CREATE TABLE 'ON'.'ON'(a, b, c); } } {0 {}} } do_test alter-3.2.6 { catchsql { CREATE TABLE t10(a, ON, c); } } {1 {near "ON": syntax error}} do_test alter-3.2.7 { catchsql { CREATE TABLE t10(a, 'ON', c); } } {0 {}} do_test alter-3.2.8 { catchsql { CREATE TRIGGER trig4 AFTER INSERT ON ON BEGIN SELECT 1; END; } } {1 {near "ON": syntax error}} ifcapable attach { do_test alter-3.2.9 { catchsql { CREATE TRIGGER 'on'.trig4 AFTER INSERT ON 'ON' BEGIN SELECT 1; END; } } {0 {}} } do_test alter-3.2.10 { execsql { DROP TABLE t10; } } {} do_test alter-3.3.1 { |
︙ | ︙ |
Changes to test/alter2.test.
︙ | ︙ | |||
9 10 11 12 13 14 15 | # #************************************************************************* # This file implements regression tests for SQLite library. The # focus of this script is testing that SQLite can handle a subtle # file format change that may be used in the future to implement # "ALTER TABLE ... ADD COLUMN". # | | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # #************************************************************************* # This file implements regression tests for SQLite library. The # focus of this script is testing that SQLite can handle a subtle # file format change that may be used in the future to implement # "ALTER TABLE ... ADD COLUMN". # # $Id: alter2.test,v 1.10 2007/10/09 08:29:32 danielk1977 Exp $ # set testdir [file dirname $argv0] source $testdir/tester.tcl # We have to have pragmas in order to do this test ifcapable {!pragma} return |
︙ | ︙ | |||
283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 | do_test alter2-6.1 { db close set_file_format 2 sqlite3 db test.db set ::DB [sqlite3_connection_pointer db] get_file_format } {2} do_test alter2-6.2 { file delete -force test2.db-journal file delete -force test2.db execsql { ATTACH 'test2.db' AS aux; CREATE TABLE aux.t1(a, b); } get_file_format test2.db } $default_file_format do_test alter2-6.3 { execsql { CREATE TABLE t1(a, b); } get_file_format } {2} | > > | 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 | do_test alter2-6.1 { db close set_file_format 2 sqlite3 db test.db set ::DB [sqlite3_connection_pointer db] get_file_format } {2} ifcapable attach { do_test alter2-6.2 { file delete -force test2.db-journal file delete -force test2.db execsql { ATTACH 'test2.db' AS aux; CREATE TABLE aux.t1(a, b); } get_file_format test2.db } $default_file_format } do_test alter2-6.3 { execsql { CREATE TABLE t1(a, b); } get_file_format } {2} |
︙ | ︙ |
Changes to test/alter3.test.
︙ | ︙ | |||
9 10 11 12 13 14 15 | # #************************************************************************* # This file implements regression tests for SQLite library. The # focus of this script is testing that SQLite can handle a subtle # file format change that may be used in the future to implement # "ALTER TABLE ... ADD COLUMN". # | | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # #************************************************************************* # This file implements regression tests for SQLite library. The # focus of this script is testing that SQLite can handle a subtle # file format change that may be used in the future to implement # "ALTER TABLE ... ADD COLUMN". # # $Id: alter3.test,v 1.10 2007/10/09 08:29:32 danielk1977 Exp $ # set testdir [file dirname $argv0] source $testdir/tester.tcl # If SQLITE_OMIT_ALTERTABLE is defined, omit this file. |
︙ | ︙ | |||
232 233 234 235 236 237 238 239 240 241 242 243 244 245 | } do_test alter3-4.99 { execsql { DROP TABLE t1; } } {} do_test alter3-5.1 { file delete -force test2.db file delete -force test2.db-journal execsql { CREATE TABLE t1(a, b); INSERT INTO t1 VALUES(1, 'one'); INSERT INTO t1 VALUES(2, 'two'); | > | 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 | } do_test alter3-4.99 { execsql { DROP TABLE t1; } } {} ifcapable attach { do_test alter3-5.1 { file delete -force test2.db file delete -force test2.db-journal execsql { CREATE TABLE t1(a, b); INSERT INTO t1 VALUES(1, 'one'); INSERT INTO t1 VALUES(2, 'two'); |
︙ | ︙ | |||
297 298 299 300 301 302 303 304 305 306 307 308 309 310 | } {1 one 2 two} do_test alter3-5.99 { execsql { DROP TABLE aux.t1; DROP TABLE t1; } } {} #---------------------------------------------------------------- # Test that the table schema is correctly reloaded when a column # is added to a table. # ifcapable trigger&&tempdb { do_test alter3-6.1 { | > | 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 | } {1 one 2 two} do_test alter3-5.99 { execsql { DROP TABLE aux.t1; DROP TABLE t1; } } {} } #---------------------------------------------------------------- # Test that the table schema is correctly reloaded when a column # is added to a table. # ifcapable trigger&&tempdb { do_test alter3-6.1 { |
︙ | ︙ |
Changes to test/attach.test.
︙ | ︙ | |||
8 9 10 11 12 13 14 | # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this script is testing the ATTACH and DETACH commands # and related functionality. # | | > > > > > | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this script is testing the ATTACH and DETACH commands # and related functionality. # # $Id: attach.test,v 1.47 2007/10/09 08:29:32 danielk1977 Exp $ # set testdir [file dirname $argv0] source $testdir/tester.tcl ifcapable !attach { finish_test return } for {set i 2} {$i<=15} {incr i} { file delete -force test$i.db file delete -force test$i.db-journal } set btree_trace 0 |
︙ | ︙ |
Changes to test/attach2.test.
︙ | ︙ | |||
8 9 10 11 12 13 14 | # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this script is testing the ATTACH and DETACH commands # and related functionality. # | | > > > > > | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this script is testing the ATTACH and DETACH commands # and related functionality. # # $Id: attach2.test,v 1.37 2007/10/09 08:29:32 danielk1977 Exp $ # set testdir [file dirname $argv0] source $testdir/tester.tcl ifcapable !attach { finish_test return } # Ticket #354 # # Databases test.db and test2.db contain identical schemas. Make # sure we can attach test2.db from test.db. # do_test attach2-1.1 { |
︙ | ︙ |
Changes to test/attach3.test.
︙ | ︙ | |||
8 9 10 11 12 13 14 | # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this script is testing the ATTACH and DETACH commands # and schema changes to attached databases. # | | < > > > > > | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this script is testing the ATTACH and DETACH commands # and schema changes to attached databases. # # $Id: attach3.test,v 1.18 2007/10/09 08:29:32 danielk1977 Exp $ # set testdir [file dirname $argv0] source $testdir/tester.tcl ifcapable !attach { finish_test return } # Create tables t1 and t2 in the main database execsql { CREATE TABLE t1(a, b); CREATE TABLE t2(c, d); } |
︙ | ︙ |
Changes to test/attachmalloc.test.
︙ | ︙ | |||
8 9 10 11 12 13 14 | # May you share freely, never taking more than you give. # #************************************************************************* # This file implements regression tests for SQLite library. The # focus of this script is testing the ATTACH statement and # specifically out-of-memory conditions within that command. # | | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | # May you share freely, never taking more than you give. # #************************************************************************* # This file implements regression tests for SQLite library. The # focus of this script is testing the ATTACH statement and # specifically out-of-memory conditions within that command. # # $Id: attachmalloc.test,v 1.7 2007/10/09 08:29:32 danielk1977 Exp $ # set testdir [file dirname $argv0] source $testdir/tester.tcl ifcapable !memdebug||!attach { finish_test return } source $testdir/malloc_common.tcl do_malloc_test attachmalloc-1 -tclprep { |
︙ | ︙ |
Changes to test/auth.test.
︙ | ︙ | |||
8 9 10 11 12 13 14 | # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this script is testing the sqlite3_set_authorizer() API # and related functionality. # | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this script is testing the sqlite3_set_authorizer() API # and related functionality. # # $Id: auth.test,v 1.38 2007/10/09 08:29:32 danielk1977 Exp $ # set testdir [file dirname $argv0] source $testdir/tester.tcl # disable this test if the SQLITE_OMIT_AUTHORIZATION macro is # defined during compilation. |
︙ | ︙ | |||
301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 | if {$code=="SQLITE_READ" && $arg1=="t2" && $arg2=="b"} { return SQLITE_DENY } return SQLITE_OK } catchsql {SELECT * FROM t2} } {1 {access to t2.b is prohibited}} do_test auth-1.35.2 { execsql {ATTACH DATABASE 'test.db' AS two} catchsql {SELECT * FROM two.t2} } {1 {access to two.t2.b is prohibited}} execsql {DETACH DATABASE two} do_test auth-1.36 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_READ" && $arg1=="t2" && $arg2=="b"} { return SQLITE_IGNORE } return SQLITE_OK } | > > | 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 | if {$code=="SQLITE_READ" && $arg1=="t2" && $arg2=="b"} { return SQLITE_DENY } return SQLITE_OK } catchsql {SELECT * FROM t2} } {1 {access to t2.b is prohibited}} ifcapable attach { do_test auth-1.35.2 { execsql {ATTACH DATABASE 'test.db' AS two} catchsql {SELECT * FROM two.t2} } {1 {access to two.t2.b is prohibited}} execsql {DETACH DATABASE two} } do_test auth-1.36 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_READ" && $arg1=="t2" && $arg2=="b"} { return SQLITE_IGNORE } return SQLITE_OK } |
︙ | ︙ | |||
1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 | } {0 {}} do_test auth-1.250 { execsql {SELECT * FROM t2} } {11 2 33 7 8 9} # ticket #340 - authorization for ATTACH and DETACH. # do_test auth-1.251 { db authorizer ::auth proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_ATTACH"} { set ::authargs [list $arg1 $arg2 $arg3 $arg4] } return SQLITE_OK | > | 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 | } {0 {}} do_test auth-1.250 { execsql {SELECT * FROM t2} } {11 2 33 7 8 9} # ticket #340 - authorization for ATTACH and DETACH. # ifcapable attach { do_test auth-1.251 { db authorizer ::auth proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_ATTACH"} { set ::authargs [list $arg1 $arg2 $arg3 $arg4] } return SQLITE_OK |
︙ | ︙ | |||
1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 | } else { db authorizer {} db eval { DETACH DATABASE test1; } } ifcapable altertable { db authorizer {} catchsql {ALTER TABLE t1x RENAME TO t1} db authorizer ::auth do_test auth-1.272 { proc auth {code arg1 arg2 arg3 arg4} { | > | 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 | } else { db authorizer {} db eval { DETACH DATABASE test1; } } } ifcapable altertable { db authorizer {} catchsql {ALTER TABLE t1x RENAME TO t1} db authorizer ::auth do_test auth-1.272 { proc auth {code arg1 arg2 arg3 arg4} { |
︙ | ︙ |
Changes to test/autoinc.test.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # 2004 November 12 # # 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 script is testing the AUTOINCREMENT features. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # 2004 November 12 # # 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 script is testing the AUTOINCREMENT features. # # $Id: autoinc.test,v 1.10 2007/10/09 08:29:32 danielk1977 Exp $ # set testdir [file dirname $argv0] source $testdir/tester.tcl # If the library is not compiled with autoincrement support then # skip all tests in this file. |
︙ | ︙ | |||
412 413 414 415 416 417 418 | SELECT 2, * FROM temp.sqlite_sequence; } } {} } # Make sure AUTOINCREMENT works on ATTACH-ed tables. # | | | 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 | SELECT 2, * FROM temp.sqlite_sequence; } } {} } # Make sure AUTOINCREMENT works on ATTACH-ed tables. # ifcapable tempdb&&attach { do_test autoinc-5.1 { file delete -force test2.db file delete -force test2.db-journal sqlite3 db2 test2.db execsql { CREATE TABLE t4(m INTEGER PRIMARY KEY AUTOINCREMENT, n); CREATE TABLE t5(o, p INTEGER PRIMARY KEY AUTOINCREMENT); |
︙ | ︙ |
Changes to test/crash.test.
︙ | ︙ | |||
13 14 15 16 17 18 19 | # The focus of this file is testing the ability of the database to # uses its rollback journal to recover intact (no database corruption) # from a power failure during the middle of a COMMIT. The OS interface # modules are overloaded using the modified I/O routines found in test6.c. # These routines allow us to simulate the kind of file damage that # occurs after a power failure. # | | | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | # The focus of this file is testing the ability of the database to # uses its rollback journal to recover intact (no database corruption) # from a power failure during the middle of a COMMIT. The OS interface # modules are overloaded using the modified I/O routines found in test6.c. # These routines allow us to simulate the kind of file damage that # occurs after a power failure. # # $Id: crash.test,v 1.26 2007/10/09 08:29:32 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl ifcapable !crashtest { finish_test return |
︙ | ︙ | |||
205 206 207 208 209 210 211 212 213 214 215 216 217 218 | # crash-4.1.*: Test recovery when crash occurs during sync() of the # main database journal file. # crash-4.2.*: Test recovery when crash occurs during sync() of an # attached database journal file. # crash-4.3.*: Test recovery when crash occurs during sync() of the master # journal file. # do_test crash-4.0 { file delete -force test2.db file delete -force test2.db-journal execsql { ATTACH 'test2.db' AS aux; PRAGMA aux.default_cache_size = 10; CREATE TABLE aux.abc2 AS SELECT 2*a as a, 2*b as b, 2*c as c FROM abc; | > | 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 | # crash-4.1.*: Test recovery when crash occurs during sync() of the # main database journal file. # crash-4.2.*: Test recovery when crash occurs during sync() of an # attached database journal file. # crash-4.3.*: Test recovery when crash occurs during sync() of the master # journal file. # ifcapable attach { do_test crash-4.0 { file delete -force test2.db file delete -force test2.db-journal execsql { ATTACH 'test2.db' AS aux; PRAGMA aux.default_cache_size = 10; CREATE TABLE aux.abc2 AS SELECT 2*a as a, 2*b as b, 2*c as c FROM abc; |
︙ | ︙ | |||
298 299 300 301 302 303 304 305 306 307 308 309 310 311 | do_test crash-4.3.$i.2 { signature } $sig do_test crash-4.3.$i.3 { signature2 } $sig2 } #-------------------------------------------------------------------------- # The following test cases - crash-5.* - exposes a bug that existed in the # sqlite3pager_movepage() API used by auto-vacuum databases. # database when a crash occurs during a multi-file transaction. See comments # in test crash-5.3 for details. # | > | 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 | do_test crash-4.3.$i.2 { signature } $sig do_test crash-4.3.$i.3 { signature2 } $sig2 } } #-------------------------------------------------------------------------- # The following test cases - crash-5.* - exposes a bug that existed in the # sqlite3pager_movepage() API used by auto-vacuum databases. # database when a crash occurs during a multi-file transaction. See comments # in test crash-5.3 for details. # |
︙ | ︙ |
Changes to test/enc2.test.
︙ | ︙ | |||
9 10 11 12 13 14 15 | # #*********************************************************************** # This file implements regression tests for SQLite library. The focus of # this file is testing the SQLite routines used for converting between the # various suported unicode encodings (UTF-8, UTF-16, UTF-16le and # UTF-16be). # | | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # #*********************************************************************** # This file implements regression tests for SQLite library. The focus of # this file is testing the SQLite routines used for converting between the # various suported unicode encodings (UTF-8, UTF-16, UTF-16le and # UTF-16be). # # $Id: enc2.test,v 1.29 2007/10/09 08:29:32 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # If UTF16 support is disabled, ignore the tests in this file # ifcapable {!utf16} { |
︙ | ︙ | |||
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 | run_test_script enc2-$i $enc db close incr i } # Test that it is an error to try to attach a database with a different # encoding to the main database. do_test enc2-4.1 { file delete -force test.db sqlite3 db test.db db eval "PRAGMA encoding = 'UTF-8'" db eval "CREATE TABLE abc(a, b, c);" } {} do_test enc2-4.2 { file delete -force test2.db sqlite3 db2 test2.db db2 eval "PRAGMA encoding = 'UTF-16'" db2 eval "CREATE TABLE abc(a, b, c);" } {} do_test enc2-4.3 { catchsql { ATTACH 'test2.db' as aux; } } {1 {attached databases must use the same text encoding as main database}} | > < > | 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | run_test_script enc2-$i $enc db close incr i } # Test that it is an error to try to attach a database with a different # encoding to the main database. ifcapable attach { do_test enc2-4.1 { file delete -force test.db sqlite3 db test.db db eval "PRAGMA encoding = 'UTF-8'" db eval "CREATE TABLE abc(a, b, c);" } {} do_test enc2-4.2 { file delete -force test2.db sqlite3 db2 test2.db db2 eval "PRAGMA encoding = 'UTF-16'" db2 eval "CREATE TABLE abc(a, b, c);" } {} do_test enc2-4.3 { catchsql { ATTACH 'test2.db' as aux; } } {1 {attached databases must use the same text encoding as main database}} db2 close db close } # The following tests - enc2-5.* - test that SQLite selects the correct # collation sequence when more than one is available. set ::values [list one two three four five] set ::test_collate_enc INVALID proc test_collate {enc lhs rhs} { |
︙ | ︙ |
Changes to test/exclusive.test.
︙ | ︙ | |||
8 9 10 11 12 13 14 | # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The focus # of these tests is exclusive access mode (i.e. the thing activated by # "PRAGMA locking_mode = EXCLUSIVE"). # | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The focus # of these tests is exclusive access mode (i.e. the thing activated by # "PRAGMA locking_mode = EXCLUSIVE"). # # $Id: exclusive.test,v 1.7 2007/10/09 08:29:32 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl ifcapable {!pager_pragmas} { finish_test return |
︙ | ︙ | |||
80 81 82 83 84 85 86 87 88 89 90 91 92 93 | do_test exclusive-1.6 { execsql { pragma locking_mode; pragma main.locking_mode; pragma temp.locking_mode; } } [list normal normal $temp_mode] do_test exclusive-1.7 { execsql { pragma locking_mode = exclusive; ATTACH 'test2.db' as aux; } execsql { pragma main.locking_mode; | > | 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | do_test exclusive-1.6 { execsql { pragma locking_mode; pragma main.locking_mode; pragma temp.locking_mode; } } [list normal normal $temp_mode] ifcapable attach { do_test exclusive-1.7 { execsql { pragma locking_mode = exclusive; ATTACH 'test2.db' as aux; } execsql { pragma main.locking_mode; |
︙ | ︙ | |||
156 157 158 159 160 161 162 163 164 165 166 167 168 169 | do_test exclusive-1.99 { execsql { DETACH aux; DETACH aux2; DETACH aux3; } } {} #---------------------------------------------------------------------- # Test cases exclusive-2.X verify that connections in exclusive # locking_mode do not relinquish locks. # do_test exclusive-2.0 { execsql { | > | 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | do_test exclusive-1.99 { execsql { DETACH aux; DETACH aux2; DETACH aux3; } } {} } #---------------------------------------------------------------------- # Test cases exclusive-2.X verify that connections in exclusive # locking_mode do not relinquish locks. # do_test exclusive-2.0 { execsql { |
︙ | ︙ |
Changes to test/hook.test.
︙ | ︙ | |||
13 14 15 16 17 18 19 | # # The focus of the tests in this file is the following interface: # # sqlite_commit_hook (tests hook-1..hook-3 inclusive) # sqlite_update_hook (tests hook-4-*) # sqlite_rollback_hook (tests hook-5.*) # | | | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | # # The focus of the tests in this file is the following interface: # # sqlite_commit_hook (tests hook-1..hook-3 inclusive) # sqlite_update_hook (tests hook-4-*) # sqlite_rollback_hook (tests hook-5.*) # # $Id: hook.test,v 1.12 2007/10/09 08:29:32 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl do_test hook-1.2 { db commit_hook } {} |
︙ | ︙ | |||
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 | INSERT INTO t1 VALUES(1, 'one'); INSERT INTO t1 VALUES(2, 'two'); } } # Update-hook + ATTACH set ::update_hook {} do_test hook-4.2.3 { file delete -force test2.db execsql { ATTACH 'test2.db' AS aux; CREATE TABLE aux.t3(a INTEGER PRIMARY KEY, b); INSERT INTO aux.t3 SELECT * FROM t1; UPDATE t3 SET b = 'two or so' WHERE a = 2; DELETE FROM t3 WHERE 1; -- Avoid the truncate optimization (for now) } set ::update_hook } [list \ INSERT aux t3 1 \ INSERT aux t3 2 \ UPDATE aux t3 2 \ DELETE aux t3 1 \ DELETE aux t3 2 \ ] ifcapable trigger { execsql { DROP TRIGGER t1_trigger; } } | > > | 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | INSERT INTO t1 VALUES(1, 'one'); INSERT INTO t1 VALUES(2, 'two'); } } # Update-hook + ATTACH set ::update_hook {} ifcapable attach { do_test hook-4.2.3 { file delete -force test2.db execsql { ATTACH 'test2.db' AS aux; CREATE TABLE aux.t3(a INTEGER PRIMARY KEY, b); INSERT INTO aux.t3 SELECT * FROM t1; UPDATE t3 SET b = 'two or so' WHERE a = 2; DELETE FROM t3 WHERE 1; -- Avoid the truncate optimization (for now) } set ::update_hook } [list \ INSERT aux t3 1 \ INSERT aux t3 2 \ UPDATE aux t3 2 \ DELETE aux t3 1 \ DELETE aux t3 2 \ ] } ifcapable trigger { execsql { DROP TRIGGER t1_trigger; } } |
︙ | ︙ | |||
217 218 219 220 221 222 223 | UPDATE main t1 1 \ UPDATE main t1 2 \ UPDATE main t1 3 \ DELETE main t1 2 \ DELETE main t1 3 \ ] set ::update_hook {} | | | 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 | UPDATE main t1 1 \ UPDATE main t1 2 \ UPDATE main t1 3 \ DELETE main t1 2 \ DELETE main t1 3 \ ] set ::update_hook {} ifcapable compound&&attach { do_test hook-4.3.2 { execsql { SELECT * FROM t1 UNION SELECT * FROM t3; SELECT * FROM t1 UNION ALL SELECT * FROM t3; SELECT * FROM t1 INTERSECT SELECT * FROM t3; SELECT * FROM t1 EXCEPT SELECT * FROM t3; SELECT * FROM t1 ORDER BY b; |
︙ | ︙ |
Changes to test/incrblob.test.
1 2 3 4 5 6 7 8 9 10 11 | # 2007 May 1 # # 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. # #*********************************************************************** # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | # 2007 May 1 # # 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: incrblob.test,v 1.17 2007/10/09 08:29:32 danielk1977 Exp $ # set testdir [file dirname $argv0] source $testdir/tester.tcl ifcapable {!autovacuum || !pragma || !incrblob} { finish_test |
︙ | ︙ | |||
337 338 339 340 341 342 343 344 345 346 347 348 349 350 | } {} #------------------------------------------------------------------------ # incrblob-5.*: # # Test that opening a blob in an attached database works. # do_test incrblob-5.1 { file delete -force test2.db test2.db-journal set ::size [expr [file size [info script]]] execsql { ATTACH 'test2.db' AS aux; CREATE TABLE aux.files(name, text); INSERT INTO aux.files VALUES('this one', zeroblob($::size)); | > | 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 | } {} #------------------------------------------------------------------------ # incrblob-5.*: # # Test that opening a blob in an attached database works. # ifcapable attach { do_test incrblob-5.1 { file delete -force test2.db test2.db-journal set ::size [expr [file size [info script]]] execsql { ATTACH 'test2.db' AS aux; CREATE TABLE aux.files(name, text); INSERT INTO aux.files VALUES('this one', zeroblob($::size)); |
︙ | ︙ | |||
362 363 364 365 366 367 368 | do_test incrblob-5.2 { set fd2 [open [info script]] fconfigure $fd2 -translation binary set ::data [read $fd2] close $fd2 set ::data } $::text | | > | | | 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 | do_test incrblob-5.2 { set fd2 [open [info script]] fconfigure $fd2 -translation binary set ::data [read $fd2] close $fd2 set ::data } $::text } # free memory unset -nocomplain ::data unset -nocomplain ::text #------------------------------------------------------------------------ # incrblob-6.*: # # Test that opening a blob for write-access is impossible if # another connection has the database RESERVED lock. # |
︙ | ︙ |
Changes to test/incrvacuum2.test.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # 2007 May 04 # # 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 incremental vacuum feature. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # 2007 May 04 # # 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 incremental vacuum feature. # # $Id: incrvacuum2.test,v 1.4 2007/10/09 08:29:32 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 || !pragma} { |
︙ | ︙ | |||
72 73 74 75 76 77 78 79 80 81 82 83 84 85 | PRAGMA incremental_vacuum(1000); } file size test.db } {3072} # Make sure incremental vacuum works on attached databases. # do_test incrvacuum2-2.1 { file delete -force test2.db test2.db-journal execsql { ATTACH DATABASE 'test2.db' AS aux; PRAGMA aux.auto_vacuum=incremental; CREATE TABLE aux.t2(x); INSERT INTO t2 VALUES(zeroblob(30000)); | > | 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | PRAGMA incremental_vacuum(1000); } file size test.db } {3072} # Make sure incremental vacuum works on attached databases. # ifcapable attach { do_test incrvacuum2-2.1 { file delete -force test2.db test2.db-journal execsql { ATTACH DATABASE 'test2.db' AS aux; PRAGMA aux.auto_vacuum=incremental; CREATE TABLE aux.t2(x); INSERT INTO t2 VALUES(zeroblob(30000)); |
︙ | ︙ | |||
115 116 117 118 119 120 121 122 123 124 125 | } {27648 3072} do_test incrvacuum2-2.6 { execsql { PRAGMA incremental_vacuum(1) } list [file size test.db] [file size test2.db] } {26624 3072} finish_test | > | 116 117 118 119 120 121 122 123 124 125 126 127 | } {27648 3072} do_test incrvacuum2-2.6 { execsql { PRAGMA incremental_vacuum(1) } list [file size test.db] [file size test2.db] } {26624 3072} } finish_test |
Changes to test/insert4.test.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # 2007 January 24 # # 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 INSERT transfer optimization. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # 2007 January 24 # # 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 INSERT transfer optimization. # # $Id: insert4.test,v 1.8 2007/10/09 08:29:32 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl ifcapable !view||!subquery { finish_test return |
︙ | ︙ | |||
230 231 232 233 234 235 236 | # xfer_check insert4-3.22 1 {1 9} \ {a int, b int} \ {x integer, b int} # Ticket #2291. # | > | > > > > < > | 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 | # xfer_check insert4-3.22 1 {1 9} \ {a int, b int} \ {x integer, b int} # Ticket #2291. # do_test insert4-4.1a { execsql {CREATE TABLE t4(a, b, UNIQUE(a,b))} } {} ifcapable vacuum { do_test insert4-4.1b { execsql { INSERT INTO t4 VALUES(NULL,0); INSERT INTO t4 VALUES(NULL,1); INSERT INTO t4 VALUES(NULL,1); VACUUM; } } {} } # Check some error conditions: # do_test insert4-5.1 { # Table does not exist. catchsql { INSERT INTO t2 SELECT * FROM nosuchtable } } {1 {no such table: nosuchtable}} |
︙ | ︙ |
Changes to test/io.test.
︙ | ︙ | |||
9 10 11 12 13 14 15 | # #*********************************************************************** # # The focus of this file is testing some specific characteristics of the # IO traffic generated by SQLite (making sure SQLite is not writing out # more database pages than it has to, stuff like that). # | | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # #*********************************************************************** # # The focus of this file is testing some specific characteristics of the # IO traffic generated by SQLite (making sure SQLite is not writing out # more database pages than it has to, stuff like that). # # $Id: io.test,v 1.12 2007/10/09 08:29:32 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Test summary: # # io-1.* - Test that quick-balance does not journal pages unnecessarily. |
︙ | ︙ | |||
225 226 227 228 229 230 231 232 233 234 235 236 237 238 | # Test that if the database modification is part of multi-file commit, # the journal file is always created. In this case, the journal file # is created during execution of the COMMIT statement, so we have to # use the same technique to check that it is created as in the above # block. file delete -force test2.db test2.db-journal do_test io-2.7.1 { execsql { ATTACH 'test2.db' AS aux; PRAGMA aux.page_size = 1024; CREATE TABLE aux.abc2(a, b); BEGIN; INSERT INTO abc VALUES(9, 10); | > | 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 | # Test that if the database modification is part of multi-file commit, # the journal file is always created. In this case, the journal file # is created during execution of the COMMIT statement, so we have to # use the same technique to check that it is created as in the above # block. file delete -force test2.db test2.db-journal ifcapable attach { do_test io-2.7.1 { execsql { ATTACH 'test2.db' AS aux; PRAGMA aux.page_size = 1024; CREATE TABLE aux.abc2(a, b); BEGIN; INSERT INTO abc VALUES(9, 10); |
︙ | ︙ | |||
255 256 257 258 259 260 261 262 263 264 265 266 267 268 | do_test io-2.7.5 { file delete -force test2.db-journal catchsql { COMMIT } } {1 {cannot commit - no transaction is active}} do_test io-2.7.6 { execsql { SELECT * FROM abc UNION ALL SELECT * FROM abc2 } } {1 2 3 4 5 6 7 8} # Try an explicit ROLLBACK before the journal file is created. # do_test io-2.8.1 { execsql { BEGIN; DELETE FROM abc; | > | 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | do_test io-2.7.5 { file delete -force test2.db-journal catchsql { COMMIT } } {1 {cannot commit - no transaction is active}} do_test io-2.7.6 { execsql { SELECT * FROM abc UNION ALL SELECT * FROM abc2 } } {1 2 3 4 5 6 7 8} } # Try an explicit ROLLBACK before the journal file is created. # do_test io-2.8.1 { execsql { BEGIN; DELETE FROM abc; |
︙ | ︙ |
Changes to test/ioerr.test.
︙ | ︙ | |||
11 12 13 14 15 16 17 | # 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. # | | | 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.33 2007/10/09 08:29:32 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. |
︙ | ︙ | |||
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | SELECT * FROM abc; } # Test IO errors that may occur during a multi-file commit. # # Tests 8 and 17 are excluded when auto-vacuum is enabled for the same # reason as in test cases ioerr-1.XXX set ex "" if {[string match [execsql {pragma auto_vacuum}] 1]} { set ex [list 4 17] } do_ioerr_test ioerr-5 -sqlprep { ATTACH 'test2.db' AS test2; } -sqlbody { BEGIN; CREATE TABLE t1(a,b,c); CREATE TABLE test2.t2(a,b,c); COMMIT; } -exclude $ex # Test IO errors when replaying two hot journals from a 2-file # transaction. This test only runs on UNIX. | > > | | 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | SELECT * FROM abc; } # Test IO errors that may occur during a multi-file commit. # # Tests 8 and 17 are excluded when auto-vacuum is enabled for the same # reason as in test cases ioerr-1.XXX ifcapable attach { set ex "" if {[string match [execsql {pragma auto_vacuum}] 1]} { set ex [list 4 17] } do_ioerr_test ioerr-5 -sqlprep { ATTACH 'test2.db' AS test2; } -sqlbody { BEGIN; CREATE TABLE t1(a,b,c); CREATE TABLE test2.t2(a,b,c); COMMIT; } -exclude $ex } # Test IO errors when replaying two hot journals from a 2-file # transaction. This test only runs on UNIX. ifcapable crashtest&&attach { if {![catch {sqlite3 -has_codec} r] && !$r} { do_ioerr_test ioerr-6 -tclprep { execsql { ATTACH 'test2.db' as aux; CREATE TABLE tx(a, b); CREATE TABLE aux.ty(a, b); } |
︙ | ︙ |
Changes to test/malloc.test.
︙ | ︙ | |||
12 13 14 15 16 17 18 | # This file attempts to check the behavior of the SQLite library in # an out-of-memory situation. When compiled with -DSQLITE_DEBUG=1, # the SQLite library accepts a special command (sqlite3_memdebug_fail N C) # which causes the N-th malloc to fail. This special feature is used # to see what happens in the library if a malloc were to really fail # due to an out-of-memory situation. # | | | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | # This file attempts to check the behavior of the SQLite library in # an out-of-memory situation. When compiled with -DSQLITE_DEBUG=1, # the SQLite library accepts a special command (sqlite3_memdebug_fail N C) # which causes the N-th malloc to fail. This special feature is used # to see what happens in the library if a malloc were to really fail # due to an out-of-memory situation. # # $Id: malloc.test,v 1.51 2007/10/09 08:29:33 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Only run these tests if memory debugging is turned on. # ifcapable !memdebug { |
︙ | ︙ | |||
289 290 291 292 293 294 295 | append sql16 "\00\00" set ::STMT [sqlite3_prepare16 db $sql16 -1 DUMMY] sqlite3_finalize $::STMT } # Test malloc errors when replaying two hot journals from a 2-file # transaction. | | | 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 | append sql16 "\00\00" set ::STMT [sqlite3_prepare16 db $sql16 -1 DUMMY] sqlite3_finalize $::STMT } # Test malloc errors when replaying two hot journals from a 2-file # transaction. ifcapable crashtest&&attach { do_malloc_test 13 -tclprep { set rc [crashsql -delay 1 -file test2.db { ATTACH 'test2.db' as aux; PRAGMA cache_size = 10; BEGIN; CREATE TABLE aux.t2(a, b, c); CREATE TABLE t1(a, b, c); |
︙ | ︙ | |||
473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 | } } unset static_string # Make sure SQLITE_NOMEM is reported out on an ATTACH failure even # when the malloc failure occurs within the nested parse. # do_malloc_test 20 -tclprep { db close file delete -force test2.db test2.db-journal sqlite3 db test2.db sqlite3_extended_result_codes db 1 db eval {CREATE TABLE t1(x);} db close } -tclbody { if {[catch {sqlite3 db test.db}]} { error "out of memory" } sqlite3_extended_result_codes db 1 } -sqlbody { ATTACH DATABASE 'test2.db' AS t2; SELECT * FROM t1; DETACH DATABASE t2; } # Test malloc failure whilst installing a foreign key. # ifcapable foreignkey { do_malloc_test 21 -sqlbody { CREATE TABLE abc(a, b, c, FOREIGN KEY(a) REFERENCES abc(b)) } | > > | 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 | } } unset static_string # Make sure SQLITE_NOMEM is reported out on an ATTACH failure even # when the malloc failure occurs within the nested parse. # ifcapable attach { do_malloc_test 20 -tclprep { db close file delete -force test2.db test2.db-journal sqlite3 db test2.db sqlite3_extended_result_codes db 1 db eval {CREATE TABLE t1(x);} db close } -tclbody { if {[catch {sqlite3 db test.db}]} { error "out of memory" } sqlite3_extended_result_codes db 1 } -sqlbody { ATTACH DATABASE 'test2.db' AS t2; SELECT * FROM t1; DETACH DATABASE t2; } } # Test malloc failure whilst installing a foreign key. # ifcapable foreignkey { do_malloc_test 21 -sqlbody { CREATE TABLE abc(a, b, c, FOREIGN KEY(a) REFERENCES abc(b)) } |
︙ | ︙ |
Changes to test/malloc3.test.
︙ | ︙ | |||
9 10 11 12 13 14 15 | # #*********************************************************************** # # This file contains tests to ensure that the library handles malloc() failures # correctly. The emphasis of these tests are the _prepare(), _step() and # _finalize() calls. # | | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # #*********************************************************************** # # This file contains tests to ensure that the library handles malloc() failures # correctly. The emphasis of these tests are the _prepare(), _step() and # _finalize() calls. # # $Id: malloc3.test,v 1.17 2007/10/09 08:29:33 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Only run these tests if memory debugging is turned on. # ifcapable !memdebug { |
︙ | ︙ | |||
458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 | } } {a b c a b c 1 2 3 1 2 3} } # Test a simple multi-file transaction # file delete -force test2.db SQL {ATTACH 'test2.db' AS aux;} SQL {BEGIN} SQL {CREATE TABLE aux.tbl2(x, y, z)} SQL {INSERT INTO tbl2 VALUES(1, 2, 3)} SQL {INSERT INTO def VALUES(4, 5, 6)} TEST 30 { do_test $testid { execsql { SELECT * FROM tbl2, def WHERE d = x; } } {1 2 3 1 2 3} } SQL {COMMIT} TEST 31 { do_test $testid { execsql { SELECT * FROM tbl2, def WHERE d = x; } } {1 2 3 1 2 3} } # Test what happens when a malloc() fails while there are other active # statements. This changes the way sqlite3VdbeHalt() works. TEST 32 { if {![info exists ::STMT32]} { set sql "SELECT name FROM sqlite_master" set ::STMT32 [sqlite3_prepare $::DB $sql -1 DUMMY] | > > | 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 | } } {a b c a b c 1 2 3 1 2 3} } # Test a simple multi-file transaction # file delete -force test2.db ifcapable attach { SQL {ATTACH 'test2.db' AS aux;} SQL {BEGIN} SQL {CREATE TABLE aux.tbl2(x, y, z)} SQL {INSERT INTO tbl2 VALUES(1, 2, 3)} SQL {INSERT INTO def VALUES(4, 5, 6)} TEST 30 { do_test $testid { execsql { SELECT * FROM tbl2, def WHERE d = x; } } {1 2 3 1 2 3} } SQL {COMMIT} TEST 31 { do_test $testid { execsql { SELECT * FROM tbl2, def WHERE d = x; } } {1 2 3 1 2 3} } } # Test what happens when a malloc() fails while there are other active # statements. This changes the way sqlite3VdbeHalt() works. TEST 32 { if {![info exists ::STMT32]} { set sql "SELECT name FROM sqlite_master" set ::STMT32 [sqlite3_prepare $::DB $sql -1 DUMMY] |
︙ | ︙ |
Changes to test/mallocD.test.
1 2 3 4 5 6 7 8 9 10 11 | # 2007 Aug 29 # # 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. # #*********************************************************************** # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | # 2007 Aug 29 # # 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: mallocD.test,v 1.4 2007/10/09 08:29:33 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Only run these tests if memory debugging is turned on. # ifcapable !memdebug { |
︙ | ︙ | |||
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | do_malloc_test mallocD-3 -sqlprep $PREP -sqlbody { BEGIN; INSERT INTO abc VALUES(1, 2, 3); INSERT INTO abc VALUES(4, 5, randstr(1500,1500)); COMMIT; } do_malloc_test mallocD-4 -sqlprep $PREP -sqlbody { ATTACH 'test2.db' AS aux; BEGIN; CREATE TABLE aux.def(d, e, f); INSERT INTO abc VALUES(4, 5, 6); COMMIT; } sqlite3_simulate_device -char {} finish_test | > > | 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | do_malloc_test mallocD-3 -sqlprep $PREP -sqlbody { BEGIN; INSERT INTO abc VALUES(1, 2, 3); INSERT INTO abc VALUES(4, 5, randstr(1500,1500)); COMMIT; } ifcapable attach { do_malloc_test mallocD-4 -sqlprep $PREP -sqlbody { ATTACH 'test2.db' AS aux; BEGIN; CREATE TABLE aux.def(d, e, f); INSERT INTO abc VALUES(4, 5, 6); COMMIT; } } sqlite3_simulate_device -char {} finish_test |
Changes to test/pragma.test.
︙ | ︙ | |||
8 9 10 11 12 13 14 | # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. # # This file implements tests for the PRAGMA command. # | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. # # This file implements tests for the PRAGMA command. # # $Id: pragma.test,v 1.55 2007/10/09 08:29:33 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Test organization: # # pragma-1.*: Test cache_size, default_cache_size and synchronous on main db. |
︙ | ︙ | |||
206 207 208 209 210 211 212 213 214 215 216 217 218 219 | do_test pragma-1.18 { execsql { PRAGMA bogus = -1234; -- Parsing of negative values } } {} # Test modifying the safety_level of an attached database. do_test pragma-2.1 { file delete -force test2.db file delete -force test2.db-journal execsql { ATTACH 'test2.db' AS aux; } } {} | > < | 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | do_test pragma-1.18 { execsql { PRAGMA bogus = -1234; -- Parsing of negative values } } {} # Test modifying the safety_level of an attached database. ifcapable pager_pragmas&&attach { do_test pragma-2.1 { file delete -force test2.db file delete -force test2.db-journal execsql { ATTACH 'test2.db' AS aux; } } {} do_test pragma-2.2 { execsql { pragma aux.synchronous; } } {2} do_test pragma-2.3 { execsql { |
︙ | ︙ | |||
255 256 257 258 259 260 261 262 263 264 265 266 267 268 | CREATE INDEX i2 ON t2(a); INSERT INTO t2 VALUES(11,2,3); INSERT INTO t2 VALUES(22,3,4); COMMIT; SELECT rowid, * from t2; } } {1 11 2 3 2 22 3 4} if {![sqlite3 -has-codec] && $sqlite_options(integrityck)} { do_test pragma-3.2 { set rootpage [execsql {SELECT rootpage FROM sqlite_master WHERE name='i2'}] set db [btree_open test.db 100 0] btree_begin_transaction $db set c [btree_cursor $db $rootpage 1] btree_first $c | > | 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 | CREATE INDEX i2 ON t2(a); INSERT INTO t2 VALUES(11,2,3); INSERT INTO t2 VALUES(22,3,4); COMMIT; SELECT rowid, * from t2; } } {1 11 2 3 2 22 3 4} ifcapable attach { if {![sqlite3 -has-codec] && $sqlite_options(integrityck)} { do_test pragma-3.2 { set rootpage [execsql {SELECT rootpage FROM sqlite_master WHERE name='i2'}] set db [btree_open test.db 100 0] btree_begin_transaction $db set c [btree_cursor $db $rootpage 1] btree_first $c |
︙ | ︙ | |||
404 405 406 407 408 409 410 | } do_test pragma-3.99 { catchsql {DETACH t3} catchsql {DETACH t2} file delete -force testerr.db testerr.db-journal catchsql {DROP INDEX i2} } {0 {}} | | > | | 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 | } do_test pragma-3.99 { catchsql {DETACH t3} catchsql {DETACH t2} file delete -force testerr.db testerr.db-journal catchsql {DROP INDEX i2} } {0 {}} } # Test modifying the cache_size of an attached database. ifcapable pager_pragmas&&attach { do_test pragma-4.1 { execsql { ATTACH 'test2.db' AS aux; pragma aux.cache_size; pragma aux.default_cache_size; } } [list $DFLT_CACHE_SZ $DFLT_CACHE_SZ] |
︙ | ︙ | |||
477 478 479 480 481 482 483 | } {2} catchsql {COMMIT;} } ;# ifcapable pager_pragmas # Test schema-query pragmas # ifcapable schema_pragmas { | | | 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 | } {2} catchsql {COMMIT;} } ;# ifcapable pager_pragmas # Test schema-query pragmas # ifcapable schema_pragmas { ifcapable tempdb&&attach { do_test pragma-6.1 { set res {} execsql {SELECT * FROM sqlite_temp_master} foreach {idx name file} [execsql {pragma database_list}] { lappend res $idx $name } set res |
︙ | ︙ | |||
643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 | do_test pragma-8.1.10 { sqlite3_finalize $::STMT } SQLITE_SCHEMA # Make sure the schema-version can be manipulated in an attached database. file delete -force test2.db file delete -force test2.db-journal do_test pragma-8.1.11 { execsql { ATTACH 'test2.db' AS aux; CREATE TABLE aux.t1(a, b, c); PRAGMA aux.schema_version = 205; } } {} do_test pragma-8.1.12 { execsql { PRAGMA aux.schema_version; } } 205 do_test pragma-8.1.13 { execsql { PRAGMA schema_version; } } 108 # And check that modifying the schema-version in an attached database # forces the second connection to reload the schema. do_test pragma-8.1.14 { sqlite3 db2 test.db; set ::DB2 [sqlite3_connection_pointer db2] execsql { ATTACH 'test2.db' AS aux; SELECT * FROM aux.t1; } db2 } {} | > > > | 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 | do_test pragma-8.1.10 { sqlite3_finalize $::STMT } SQLITE_SCHEMA # Make sure the schema-version can be manipulated in an attached database. file delete -force test2.db file delete -force test2.db-journal ifcapable attach { do_test pragma-8.1.11 { execsql { ATTACH 'test2.db' AS aux; CREATE TABLE aux.t1(a, b, c); PRAGMA aux.schema_version = 205; } } {} do_test pragma-8.1.12 { execsql { PRAGMA aux.schema_version; } } 205 } do_test pragma-8.1.13 { execsql { PRAGMA schema_version; } } 108 # And check that modifying the schema-version in an attached database # forces the second connection to reload the schema. ifcapable attach { do_test pragma-8.1.14 { sqlite3 db2 test.db; set ::DB2 [sqlite3_connection_pointer db2] execsql { ATTACH 'test2.db' AS aux; SELECT * FROM aux.t1; } db2 } {} |
︙ | ︙ | |||
685 686 687 688 689 690 691 692 693 694 695 696 697 698 | } SQLITE_ERROR do_test pragma-8.1.17 { sqlite3_finalize $::STMT } SQLITE_SCHEMA do_test pragma-8.1.18 { db2 close } {} # Now test that the user-version can be read and written (and that we aren't # accidentally manipulating the schema-version instead). do_test pragma-8.2.1 { execsql2 { PRAGMA user_version; } | > | 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 | } SQLITE_ERROR do_test pragma-8.1.17 { sqlite3_finalize $::STMT } SQLITE_SCHEMA do_test pragma-8.1.18 { db2 close } {} } # Now test that the user-version can be read and written (and that we aren't # accidentally manipulating the schema-version instead). do_test pragma-8.2.1 { execsql2 { PRAGMA user_version; } |
︙ | ︙ | |||
728 729 730 731 732 733 734 735 736 737 738 739 740 741 | } {2} do_test pragma-8.2.4.3 { execsql { PRAGMA schema_version; } } {109} } db eval {ATTACH 'test2.db' AS aux} # Check that the user-version in the auxilary database can be manipulated ( # and that we aren't accidentally manipulating the same in the main db). do_test pragma-8.2.5 { execsql { PRAGMA aux.user_version; | > > | 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 | } {2} do_test pragma-8.2.4.3 { execsql { PRAGMA schema_version; } } {109} } ifcapable attach { db eval {ATTACH 'test2.db' AS aux} # Check that the user-version in the auxilary database can be manipulated ( # and that we aren't accidentally manipulating the same in the main db). do_test pragma-8.2.5 { execsql { PRAGMA aux.user_version; |
︙ | ︙ | |||
783 784 785 786 787 788 789 790 791 792 793 794 795 796 | } } {3} do_test pragma-8.2.13 { execsql { PRAGMA main.user_version; } } {2} # Try a negative value for the user-version do_test pragma-8.2.14 { execsql { PRAGMA user_version = -450; } } {} | > | 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 | } } {3} do_test pragma-8.2.13 { execsql { PRAGMA main.user_version; } } {2} } # Try a negative value for the user-version do_test pragma-8.2.14 { execsql { PRAGMA user_version = -450; } } {} |
︙ | ︙ |
Changes to test/pragma2.test.
︙ | ︙ | |||
8 9 10 11 12 13 14 | # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. # # This file implements tests for the PRAGMA command. # | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. # # This file implements tests for the PRAGMA command. # # $Id: pragma2.test,v 1.4 2007/10/09 08:29:33 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Test organization: # # pragma2-1.*: Test freelist_count pragma on the main database. |
︙ | ︙ | |||
60 61 62 63 64 65 66 67 68 69 70 71 72 73 | PRAGMA main.freelist_count; } } {1} file delete -force test2.db file delete -force test2.db-journal do_test pragma2-2.1 { execsql { ATTACH 'test2.db' AS aux; PRAGMA aux.auto_vacuum=OFF; PRAGMA aux.freelist_count; } } {0} | > | 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | PRAGMA main.freelist_count; } } {1} file delete -force test2.db file delete -force test2.db-journal ifcapable attach { do_test pragma2-2.1 { execsql { ATTACH 'test2.db' AS aux; PRAGMA aux.auto_vacuum=OFF; PRAGMA aux.freelist_count; } } {0} |
︙ | ︙ | |||
109 110 111 112 113 114 115 | } {1 1} do_test pragma2-3.3 { execsql { PRAGMA aux.freelist_count = 500; PRAGMA aux.freelist_count; } } {9 9} | | > | 110 111 112 113 114 115 116 117 118 119 | } {1 1} do_test pragma2-3.3 { execsql { PRAGMA aux.freelist_count = 500; PRAGMA aux.freelist_count; } } {9 9} } finish_test |
Changes to test/schema.test.
︙ | ︙ | |||
9 10 11 12 13 14 15 | # #*********************************************************************** # This file implements regression tests for SQLite library. # # This file tests the various conditions under which an SQLITE_SCHEMA # error should be returned. # | | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # #*********************************************************************** # This file implements regression tests for SQLite library. # # This file tests the various conditions under which an SQLITE_SCHEMA # error should be returned. # # $Id: schema.test,v 1.8 2007/10/09 08:29:33 danielk1977 Exp $ #--------------------------------------------------------------------- # When any of the following types of SQL statements or actions are # executed, all pre-compiled statements are invalidated. An attempt # to execute an invalidated statement always returns SQLITE_SCHEMA. # # CREATE/DROP TABLE...................................schema-1.* |
︙ | ︙ | |||
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | sqlite3_finalize $::STMT } {SQLITE_SCHEMA} #--------------------------------------------------------------------- # Tests 5.1 to 5.4 check that prepared statements are invalidated when # a database is DETACHed (but not when one is ATTACHed). # do_test schema-5.1 { set sql {SELECT * FROM abc;} set ::STMT [sqlite3_prepare $::DB $sql -1 TAIL] execsql { ATTACH 'test2.db' AS aux; } sqlite3_step $::STMT } {SQLITE_DONE} do_test schema-5.2 { sqlite3_reset $::STMT } {SQLITE_OK} do_test schema-5.3 { execsql { DETACH aux; } sqlite3_step $::STMT } {SQLITE_ERROR} do_test schema-5.4 { sqlite3_finalize $::STMT } {SQLITE_SCHEMA} #--------------------------------------------------------------------- # Tests 6.* check that prepared statements are invalidated when # a user-function is deleted (but not when one is added). do_test schema-6.1 { set sql {SELECT * FROM abc;} set ::STMT [sqlite3_prepare $::DB $sql -1 TAIL] | > > | 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | sqlite3_finalize $::STMT } {SQLITE_SCHEMA} #--------------------------------------------------------------------- # Tests 5.1 to 5.4 check that prepared statements are invalidated when # a database is DETACHed (but not when one is ATTACHed). # ifcapable attach { do_test schema-5.1 { set sql {SELECT * FROM abc;} set ::STMT [sqlite3_prepare $::DB $sql -1 TAIL] execsql { ATTACH 'test2.db' AS aux; } sqlite3_step $::STMT } {SQLITE_DONE} do_test schema-5.2 { sqlite3_reset $::STMT } {SQLITE_OK} do_test schema-5.3 { execsql { DETACH aux; } sqlite3_step $::STMT } {SQLITE_ERROR} do_test schema-5.4 { sqlite3_finalize $::STMT } {SQLITE_SCHEMA} } #--------------------------------------------------------------------- # Tests 6.* check that prepared statements are invalidated when # a user-function is deleted (but not when one is added). do_test schema-6.1 { set sql {SELECT * FROM abc;} set ::STMT [sqlite3_prepare $::DB $sql -1 TAIL] |
︙ | ︙ |
Changes to test/schema2.test.
︙ | ︙ | |||
10 11 12 13 14 15 16 | #*********************************************************************** # This file implements regression tests for SQLite library. # # This file tests the various conditions under which an SQLITE_SCHEMA # error should be returned. This is a copy of schema.test that # has been altered to use sqlite3_prepare_v2 instead of sqlite3_prepare # | | | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | #*********************************************************************** # This file implements regression tests for SQLite library. # # This file tests the various conditions under which an SQLITE_SCHEMA # error should be returned. This is a copy of schema.test that # has been altered to use sqlite3_prepare_v2 instead of sqlite3_prepare # # $Id: schema2.test,v 1.3 2007/10/09 08:29:33 danielk1977 Exp $ #--------------------------------------------------------------------- # When any of the following types of SQL statements or actions are # executed, all pre-compiled statements are invalidated. An attempt # to execute an invalidated statement always returns SQLITE_SCHEMA. # # CREATE/DROP TABLE...................................schema2-1.* |
︙ | ︙ | |||
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | sqlite3_finalize $::STMT } {SQLITE_OK} #--------------------------------------------------------------------- # Tests 5.1 to 5.4 check that prepared statements are invalidated when # a database is DETACHed (but not when one is ATTACHed). # do_test schema2-5.1 { set sql {SELECT * FROM abc;} set ::STMT [sqlite3_prepare_v2 $::DB $sql -1 TAIL] execsql { ATTACH 'test2.db' AS aux; } sqlite3_step $::STMT } {SQLITE_DONE} do_test schema2-5.2 { sqlite3_reset $::STMT } {SQLITE_OK} do_test schema2-5.3 { execsql { DETACH aux; } sqlite3_step $::STMT } {SQLITE_DONE} do_test schema2-5.4 { sqlite3_finalize $::STMT } {SQLITE_OK} #--------------------------------------------------------------------- # Tests 6.* check that prepared statements are invalidated when # a user-function is deleted (but not when one is added). do_test schema2-6.1 { set sql {SELECT * FROM abc;} set ::STMT [sqlite3_prepare_v2 $::DB $sql -1 TAIL] | > > | 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | sqlite3_finalize $::STMT } {SQLITE_OK} #--------------------------------------------------------------------- # Tests 5.1 to 5.4 check that prepared statements are invalidated when # a database is DETACHed (but not when one is ATTACHed). # ifcapable attach { do_test schema2-5.1 { set sql {SELECT * FROM abc;} set ::STMT [sqlite3_prepare_v2 $::DB $sql -1 TAIL] execsql { ATTACH 'test2.db' AS aux; } sqlite3_step $::STMT } {SQLITE_DONE} do_test schema2-5.2 { sqlite3_reset $::STMT } {SQLITE_OK} do_test schema2-5.3 { execsql { DETACH aux; } sqlite3_step $::STMT } {SQLITE_DONE} do_test schema2-5.4 { sqlite3_finalize $::STMT } {SQLITE_OK} } #--------------------------------------------------------------------- # Tests 6.* check that prepared statements are invalidated when # a user-function is deleted (but not when one is added). do_test schema2-6.1 { set sql {SELECT * FROM abc;} set ::STMT [sqlite3_prepare_v2 $::DB $sql -1 TAIL] |
︙ | ︙ |
Changes to test/shared.test.
1 2 3 4 5 6 7 8 9 10 11 | # 2005 December 30 # # 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. # #*********************************************************************** # | | > > | | 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 | # 2005 December 30 # # 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: shared.test,v 1.28 2007/10/09 08:29:33 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl db close # These tests cannot be run without the ATTACH command. # ifcapable !shared_cache||!attach { finish_test return } set ::enable_shared_cache [sqlite3_enable_shared_cache 1] foreach av [list 0 1] { |
︙ | ︙ |
Changes to test/speed3.test.
︙ | ︙ | |||
8 9 10 11 12 13 14 | # May you share freely, never taking more than you give. # #************************************************************************* # This file implements regression tests for SQLite library. The # focus of this script is testing that the overflow-page related # enhancements added after version 3.3.17 speed things up. # | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | # May you share freely, never taking more than you give. # #************************************************************************* # This file implements regression tests for SQLite library. The # focus of this script is testing that the overflow-page related # enhancements added after version 3.3.17 speed things up. # # $Id: speed3.test,v 1.5 2007/10/09 08:29:33 danielk1977 Exp $ # #--------------------------------------------------------------------- # Test plan: # # If auto-vacuum is enabled for the database, the following cases # should show performance improvement with respect to 3.3.17. |
︙ | ︙ | |||
31 32 33 34 35 36 37 | # page and the overflow page containing the value do not have # to be read (test cases speed3-2.X). # set testdir [file dirname $argv0] source $testdir/tester.tcl | | | 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | # page and the overflow page containing the value do not have # to be read (test cases speed3-2.X). # set testdir [file dirname $argv0] source $testdir/tester.tcl ifcapable !tclvar||!attach { finish_test return } speed_trial_init speed1 # Set a uniform random seed |
︙ | ︙ |
Changes to test/sqllimits1.test.
︙ | ︙ | |||
8 9 10 11 12 13 14 | # May you share freely, never taking more than you give. # #*********************************************************************** # # This file contains tests to verify that the limits defined in # sqlite source file limits.h are enforced. # | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | # May you share freely, never taking more than you give. # #*********************************************************************** # # This file contains tests to verify that the limits defined in # sqlite source file limits.h are enforced. # # $Id: sqllimits1.test,v 1.19 2007/10/09 08:29:33 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Test organization: # # sqllimits-1.*: SQLITE_MAX_LENGTH |
︙ | ︙ | |||
436 437 438 439 440 441 442 | } catchsql "SELECT myfunc([join $vals ,])" } {1 {too many arguments on function myfunc}} #-------------------------------------------------------------------- # Test cases sqllimits-8.*: Test the SQLITE_MAX_ATTACHED limit. # | | > | 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 | } catchsql "SELECT myfunc([join $vals ,])" } {1 {too many arguments on function myfunc}} #-------------------------------------------------------------------- # Test cases sqllimits-8.*: Test the SQLITE_MAX_ATTACHED limit. # ifcapable attach { do_test sqllimits-1.8.1 { set max $::SQLITE_MAX_ATTACHED for {set i 0} {$i < ($max)} {incr i} { file delete -force test${i}.db test${i}.db-journal } for {set i 0} {$i < ($max)} {incr i} { execsql "ATTACH 'test${i}.db' AS aux${i}" } catchsql "ATTACH 'test${i}.db' AS aux${i}" } "1 {too many attached databases - max $::SQLITE_MAX_ATTACHED}" do_test sqllimits-1.8.2 { set max $::SQLITE_MAX_ATTACHED for {set i 0} {$i < ($max)} {incr i} { execsql "DETACH aux${i}" } } {} } #-------------------------------------------------------------------- # Test cases sqllimits-9.*: Check that the SQLITE_MAX_VARIABLE_NUMBER # limit works. # do_test sqllimits-1.9.1 { set max $::SQLITE_MAX_VARIABLE_NUMBER |
︙ | ︙ |
Changes to test/sync.test.
︙ | ︙ | |||
9 10 11 12 13 14 15 | # #*********************************************************************** # This file implements regression tests for SQLite library. # # This file implements tests to verify that fsync is disabled when # pragma synchronous=off even for multi-database commits. # | | | > | | 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 | # #*********************************************************************** # This file implements regression tests for SQLite library. # # This file implements tests to verify that fsync is disabled when # pragma synchronous=off even for multi-database commits. # # $Id: sync.test,v 1.6 2007/10/09 08:29:33 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # # These tests are only applicable on unix when pager pragma are # enabled. Also, since every test uses an ATTACHed database, they # are only run when ATTACH is enabled. # if {$::tcl_platform(platform)!="unix"} { finish_test return } ifcapable !pager_pragmas||!attach { finish_test return } do_test sync-1.1 { set sqlite_sync_count 0 file delete -force test2.db |
︙ | ︙ |
Changes to test/table.test.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # 2001 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 implements regression tests for SQLite library. The # focus of this file is testing the CREATE TABLE statement. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # 2001 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 implements regression tests for SQLite library. The # focus of this file is testing the CREATE TABLE statement. # # $Id: table.test,v 1.48 2007/10/09 08:29:33 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Create a basic table and verify it is added to sqlite_master # do_test table-1.1 { |
︙ | ︙ | |||
608 609 610 611 612 613 614 | } } msg ] set result [list $rc $msg] } {0 {}} # Try to drop a table from within a callback: | | > | | > | 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 | } } msg ] set result [list $rc $msg] } {0 {}} # Try to drop a table from within a callback: do_test table-14.2 { set rc [ catch { db eval {SELECT * FROM tablet8 LIMIT 1} {} { db eval {DROP TABLE t9;} } } msg ] set result [list $rc $msg] } {1 {database table is locked}} ifcapable attach { # Now attach a database and ensure that a table can be created in the # attached database whilst in a callback from a query on the main database. do_test table-14.3 { file delete -force test2.db file delete -force test2.db-journal execsql { ATTACH 'test2.db' as aux; } db eval {SELECT * FROM tablet8 LIMIT 1} {} { db eval {CREATE TABLE aux.t1(a, b, c)} } } {} # On the other hand, it should be impossible to drop a table when any VMs # are active. This is because VerifyCookie instructions may have already # been executed, and btree root-pages may not move after this (which a # delete table might do). do_test table-14.4 { set rc [ catch { db eval {SELECT * FROM tablet8 LIMIT 1} {} { db eval {DROP TABLE aux.t1;} } } msg ] set result [list $rc $msg] } {1 {database table is locked}} } # Create and drop 2000 tables. This is to check that the balance_shallow() # routine works correctly on the sqlite_master table. At one point it # contained a bug that would prevent the right-child pointer of the # child page from being copied to the root page. # do_test table-15.1 { |
︙ | ︙ |
Changes to test/temptable.test.
︙ | ︙ | |||
8 9 10 11 12 13 14 | # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. # # This file implements tests for temporary tables and indices. # | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. # # This file implements tests for temporary tables and indices. # # $Id: temptable.test,v 1.19 2007/10/09 08:29:33 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl ifcapable !tempdb { finish_test return |
︙ | ︙ | |||
400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 | sqlite3 db test.db catchsql { SELECT * FROM t8,t9; } } {1 {no such table: t9}} file delete -force test2.db test2.db-journal do_test temptable-7.1 { catchsql { ATTACH 'test2.db' AS two; CREATE TEMP TABLE two.abc(x,y); } } {1 {temporary table name must be unqualified}} # Need to do the following for tcl 8.5 on mac. On that configuration, the # -readonly flag is taken so seriously that a subsequent [file delete -force] # (required before the next test file can be executed) will fail. # catch {file attributes test.db -readonly 0} finish_test | > > | 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 | sqlite3 db test.db catchsql { SELECT * FROM t8,t9; } } {1 {no such table: t9}} file delete -force test2.db test2.db-journal ifcapable attach { do_test temptable-7.1 { catchsql { ATTACH 'test2.db' AS two; CREATE TEMP TABLE two.abc(x,y); } } {1 {temporary table name must be unqualified}} } # Need to do the following for tcl 8.5 on mac. On that configuration, the # -readonly flag is taken so seriously that a subsequent [file delete -force] # (required before the next test file can be executed) will fail. # catch {file attributes test.db -readonly 0} finish_test |
Changes to test/thread002.test.
︙ | ︙ | |||
8 9 10 11 12 13 14 | # May you share freely, never taking more than you give. # #*********************************************************************** # # This test attempts to deadlock SQLite in shared-cache mode. # # | | > > > > > | 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 | # May you share freely, never taking more than you give. # #*********************************************************************** # # This test attempts to deadlock SQLite in shared-cache mode. # # # $Id: thread002.test,v 1.2 2007/10/09 08:29:33 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl source $testdir/thread_common.tcl if {[info commands sqlthread] eq ""} { finish_test return } ifcapable !attach { finish_test return } db close sqlite3_enable_shared_cache 1 set ::NTHREAD 10 |
︙ | ︙ |
Changes to test/tkt1873.test.
︙ | ︙ | |||
10 11 12 13 14 15 16 | #*********************************************************************** # This file implements regression tests for SQLite library. # # This file implements tests to verify that ticket #1873 has been # fixed. # # | | > > > > > | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | #*********************************************************************** # This file implements regression tests for SQLite library. # # This file implements tests to verify that ticket #1873 has been # fixed. # # # $Id: tkt1873.test,v 1.2 2007/10/09 08:29:33 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl ifcapable !attach { finish_test return } file delete -force test2.db test2.db-journal do_test tkt1873-1.1 { execsql { CREATE TABLE t1(x, y); ATTACH 'test2.db' AS aux; |
︙ | ︙ |
Changes to test/trigger1.test.
︙ | ︙ | |||
528 529 530 531 532 533 534 | # Ticket #764. At one stage TEMP triggers would fail to re-install when the # schema was reloaded. The following tests ensure that TEMP triggers are # correctly re-installed. # # Also verify that references within trigger programs are resolved at # statement compile time, not trigger installation time. This means, for # example, that you can drop and re-create tables referenced by triggers. | | | 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 | # Ticket #764. At one stage TEMP triggers would fail to re-install when the # schema was reloaded. The following tests ensure that TEMP triggers are # correctly re-installed. # # Also verify that references within trigger programs are resolved at # statement compile time, not trigger installation time. This means, for # example, that you can drop and re-create tables referenced by triggers. ifcapable tempdb&&attach { do_test trigger1-10.0 { file delete -force test2.db file delete -force test2.db-journal execsql { ATTACH 'test2.db' AS aux; } } {} |
︙ | ︙ |
Changes to test/view.test.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # 2002 February 26 # # 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 VIEW statements. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # 2002 February 26 # # 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 VIEW statements. # # $Id: view.test,v 1.34 2007/10/09 08:29:33 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Omit this entire file if the library is not configured with views enabled. ifcapable !view { finish_test return |
︙ | ︙ | |||
446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 | # do_test view-12.1 { catchsql { CREATE VIEW v12 AS SELECT a FROM t1 WHERE b=? } } {1 {parameters are not allowed in views}} do_test view-13.1 { file delete -force test2.db catchsql { ATTACH 'test2.db' AS two; CREATE TABLE two.t2(x,y); CREATE VIEW v13 AS SELECT y FROM two.t2; } } {1 {view v13 cannot reference objects in database two}} # Ticket #1658 # do_test view-14.1 { catchsql { CREATE TEMP VIEW t1 AS SELECT a,b FROM t1; SELECT * FROM temp.t1; | > > | 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 | # do_test view-12.1 { catchsql { CREATE VIEW v12 AS SELECT a FROM t1 WHERE b=? } } {1 {parameters are not allowed in views}} ifcapable attach { do_test view-13.1 { file delete -force test2.db catchsql { ATTACH 'test2.db' AS two; CREATE TABLE two.t2(x,y); CREATE VIEW v13 AS SELECT y FROM two.t2; } } {1 {view v13 cannot reference objects in database two}} } # Ticket #1658 # do_test view-14.1 { catchsql { CREATE TEMP VIEW t1 AS SELECT a,b FROM t1; SELECT * FROM temp.t1; |
︙ | ︙ |
Changes to test/vtab1.test.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # 2006 June 10 # # 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 creating and dropping virtual tables. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # 2006 June 10 # # 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 creating and dropping virtual tables. # # $Id: vtab1.test,v 1.47 2007/10/09 08:29:33 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl ifcapable !vtab||!schema_pragmas { finish_test return |
︙ | ︙ | |||
758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 | } {31429} do_test vtab1.7-13 { execsql { SELECT rowid, a, b, c FROM real_abc } } {} do_test vtab1.8-1 { set echo_module "" execsql { ATTACH 'test2.db' AS aux; CREATE VIRTUAL TABLE aux.e2 USING echo(real_abc); } set echo_module } [list xCreate echo aux e2 real_abc \ xSync echo(real_abc) \ xCommit echo(real_abc) \ ] do_test vtab1.8-2 { | > > | > > | 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 | } {31429} do_test vtab1.7-13 { execsql { SELECT rowid, a, b, c FROM real_abc } } {} ifcapable attach { do_test vtab1.8-1 { set echo_module "" execsql { ATTACH 'test2.db' AS aux; CREATE VIRTUAL TABLE aux.e2 USING echo(real_abc); } set echo_module } [list xCreate echo aux e2 real_abc \ xSync echo(real_abc) \ xCommit echo(real_abc) \ ] } do_test vtab1.8-2 { catchsql { DROP TABLE aux.e2; } execsql { DROP TABLE treal; DROP TABLE techo; DROP TABLE echo_abc; DROP TABLE real_abc; } } {} |
︙ | ︙ |
Changes to test/vtab7.test.
︙ | ︙ | |||
8 9 10 11 12 13 14 | # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The focus # of this test is reading and writing to the database from within a # virtual table xSync() callback. # | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The focus # of this test is reading and writing to the database from within a # virtual table xSync() callback. # # $Id: vtab7.test,v 1.3 2007/10/09 08:29:33 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl ifcapable !vtab { finish_test return |
︙ | ︙ | |||
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 | execsql { INSERT INTO abc2 VALUES(1, 2, 3); SELECT name FROM sqlite_master ORDER BY name; } } {abc abc2 log} # Write to an attached database from xSync(). do_test vtab7-3.1 { file delete -force test2.db file delete -force test2.db-journal execsql { ATTACH 'test2.db' AS db2; CREATE TABLE db2.stuff(description, shape, color); } set ::callbacks(xSync,abc) { execsql { INSERT INTO db2.stuff VALUES('abc', 'square', 'green'); } } execsql { INSERT INTO abc2 VALUES(1, 2, 3); SELECT * from stuff; } } {abc square green} # UPDATE: The next test passes, but leaks memory. So leave it out. # # The following tests test that writing to the database from within # the xCommit callback causes a misuse error. # do_test vtab7-4.1 { # unset -nocomplain ::callbacks(xSync,abc) | > > | 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | execsql { INSERT INTO abc2 VALUES(1, 2, 3); SELECT name FROM sqlite_master ORDER BY name; } } {abc abc2 log} # Write to an attached database from xSync(). ifcapable attach { do_test vtab7-3.1 { file delete -force test2.db file delete -force test2.db-journal execsql { ATTACH 'test2.db' AS db2; CREATE TABLE db2.stuff(description, shape, color); } set ::callbacks(xSync,abc) { execsql { INSERT INTO db2.stuff VALUES('abc', 'square', 'green'); } } execsql { INSERT INTO abc2 VALUES(1, 2, 3); SELECT * from stuff; } } {abc square green} } # UPDATE: The next test passes, but leaks memory. So leave it out. # # The following tests test that writing to the database from within # the xCommit callback causes a misuse error. # do_test vtab7-4.1 { # unset -nocomplain ::callbacks(xSync,abc) |
︙ | ︙ |