Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Add some tests with attached databases to savepoint.test. Also tests of creating and dropping tables in auto-vacuum mode inside of a savepoint. (CVS 6108) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
ca7f11d50d1a73443d18c79dfe4223c9 |
User & Date: | danielk1977 2009-01-03 15:06:38.000 |
Context
2009-01-05
| ||
17:15 | Fix some test code problems in "permutations.test journaltest pager.test". (CVS 6109) (check-in: cf627752c4 user: danielk1977 tags: trunk) | |
2009-01-03
| ||
15:06 | Add some tests with attached databases to savepoint.test. Also tests of creating and dropping tables in auto-vacuum mode inside of a savepoint. (CVS 6108) (check-in: ca7f11d50d user: danielk1977 tags: trunk) | |
14:04 | When the commit_hook calls a query recursively, make sure the commit_hook is not invoked recursively. Ticket #3564. (CVS 6107) (check-in: 27ae406537 user: drh tags: trunk) | |
Changes
Changes to test/permutations.test.
1 2 3 4 5 6 7 8 9 10 11 | # 2008 June 21 # # 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 | # 2008 June 21 # # 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: permutations.test,v 1.42 2009/01/03 15:06:38 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Argument processing. # #puts "PERM-DEBUG: argv=$argv" |
︙ | ︙ | |||
68 69 70 71 72 73 74 75 76 77 78 79 80 81 | crash7.test memleak.test sqllimits1.test crash.test memsubsys1.test thread001.test exclusive3.test memsubsys2.test thread002.test fts3.test misc7.test utf16.test fuzz_malloc.test misuse.test veryquick.test fuzz.test mutex2.test vtab_err.test lookaside.test fuzz3.test savepoint4.test } set ALLTESTS [list] foreach filename [glob $testdir/*.test] { set filename [file tail $filename] if {[lsearch $EXCLUDE $filename] < 0} { lappend ALLTESTS $filename } } set ALLTESTS [lsort $ALLTESTS] | > | 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | crash7.test memleak.test sqllimits1.test crash.test memsubsys1.test thread001.test exclusive3.test memsubsys2.test thread002.test fts3.test misc7.test utf16.test fuzz_malloc.test misuse.test veryquick.test fuzz.test mutex2.test vtab_err.test lookaside.test fuzz3.test savepoint4.test savepoint6.test } set ALLTESTS [list] foreach filename [glob $testdir/*.test] { set filename [file tail $filename] if {[lsearch $EXCLUDE $filename] < 0} { lappend ALLTESTS $filename } } set ALLTESTS [lsort $ALLTESTS] |
︙ | ︙ | |||
709 710 711 712 713 714 715 | Check that pages are synced before being written (test_journal.c). } -initialize { set ISQUICK 1 catch {db close} register_jt_vfs -default "" } -shutdown { unregister_jt_vfs | > | < > | 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 | Check that pages are synced before being written (test_journal.c). } -initialize { set ISQUICK 1 catch {db close} register_jt_vfs -default "" } -shutdown { unregister_jt_vfs } -include [concat $::ALLTESTS savepoint6.test ] -exclude { incrvacuum.test ioerr.test corrupt4.test io.test } # End of tests ############################################################################# if {$::perm::testmode eq "targets"} { puts "" ; exit } # Restore the [sqlite3] command. |
︙ | ︙ |
Changes to test/savepoint.test.
1 2 3 4 5 6 7 8 9 10 11 | # 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. # #*********************************************************************** # | | | 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.7 2009/01/03 15:06:38 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl #---------------------------------------------------------------------- # The following tests - savepoint-1.* - test that the SAVEPOINT, RELEASE |
︙ | ︙ | |||
520 521 522 523 524 525 526 | concat $::authdata $res } {SQLITE_SAVEPOINT ROLLBACK sp1 {} {} 1 {not authorized}} do_test savepoint-9.6 { set ::authdata [list] set res [catchsql { RELEASE sp1 }] concat $::authdata $res } {SQLITE_SAVEPOINT RELEASE sp1 {} {} 1 {not authorized}} | | > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 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 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 | concat $::authdata $res } {SQLITE_SAVEPOINT ROLLBACK sp1 {} {} 1 {not authorized}} do_test savepoint-9.6 { set ::authdata [list] set res [catchsql { RELEASE sp1 }] concat $::authdata $res } {SQLITE_SAVEPOINT RELEASE sp1 {} {} 1 {not authorized}} catch { db eval ROLLBACK } db auth "" } #------------------------------------------------------------------------- # The following tests - savepoint-10.* - test the interaction of # savepoints and ATTACH statements. # # First make sure it is not possible to attach or detach a database while # a savepoint is open (it is not possible if any transaction is open). # do_test savepoint-10.1.1 { catchsql { SAVEPOINT one; ATTACH 'test2.db' AS aux; } } {1 {cannot ATTACH database within transaction}} do_test savepoint-10.1.2 { execsql { RELEASE one; ATTACH 'test2.db' AS aux; } catchsql { SAVEPOINT one; DETACH aux; } } {1 {cannot DETACH database within transaction}} do_test savepoint-10.1.3 { execsql { RELEASE one; DETACH aux; } } {} do_test savepoint-10.2.1 { file delete -force test3.db file delete -force test2.db execsql { ATTACH 'test2.db' AS aux1; ATTACH 'test3.db' AS aux2; DROP TABLE t1; CREATE TABLE main.t1(x, y); CREATE TABLE aux1.t2(x, y); CREATE TABLE aux2.t3(x, y); SELECT name FROM sqlite_master UNION ALL SELECT name FROM aux1.sqlite_master UNION ALL SELECT name FROM aux2.sqlite_master; } } {t1 t2 t3} do_test savepoint-10.2.2 { execsql { PRAGMA lock_status } } {main unlocked temp unlocked aux1 unlocked aux2 unlocked} do_test savepoint-10.2.3 { execsql { SAVEPOINT one; INSERT INTO t1 VALUES(1, 2); PRAGMA lock_status; } } {main reserved temp unlocked aux1 unlocked aux2 unlocked} do_test savepoint-10.2.4 { execsql { INSERT INTO t3 VALUES(3, 4); PRAGMA lock_status; } } {main reserved temp unlocked aux1 unlocked aux2 reserved} do_test savepoint-10.2.5 { execsql { SAVEPOINT two; INSERT INTO t2 VALUES(5, 6); PRAGMA lock_status; } } {main reserved temp unlocked aux1 reserved aux2 reserved} do_test savepoint-10.2.6 { execsql { SELECT * FROM t2 } } {5 6} do_test savepoint-10.2.7 { execsql { ROLLBACK TO two } execsql { SELECT * FROM t2 } } {} do_test savepoint-10.2.8 { execsql { PRAGMA lock_status } } {main reserved temp unlocked aux1 reserved aux2 reserved} do_test savepoint-10.2.9 { execsql { SELECT 'a', * FROM t1 UNION ALL SELECT 'b', * FROM t3 } } {a 1 2 b 3 4} do_test savepoint-10.2.9 { execsql { INSERT INTO t2 VALUES(5, 6); RELEASE one; } execsql { SELECT * FROM t1; SELECT * FROM t2; SELECT * FROM t3; } } {1 2 5 6 3 4} do_test savepoint-10.2.9 { execsql { PRAGMA lock_status } } {main unlocked temp unlocked aux1 unlocked aux2 unlocked} do_test savepoint-10.2.10 { execsql { SAVEPOINT one; INSERT INTO t1 VALUES('a', 'b'); SAVEPOINT two; INSERT INTO t2 VALUES('c', 'd'); SAVEPOINT three; INSERT INTO t3 VALUES('e', 'f'); } execsql { SELECT * FROM t1; SELECT * FROM t2; SELECT * FROM t3; } } {1 2 a b 5 6 c d 3 4 e f} do_test savepoint-10.2.11 { execsql { ROLLBACK TO two } execsql { SELECT * FROM t1; SELECT * FROM t2; SELECT * FROM t3; } } {1 2 a b 5 6 3 4} do_test savepoint-10.2.12 { execsql { INSERT INTO t3 VALUES('g', 'h'); ROLLBACK TO two; } execsql { SELECT * FROM t1; SELECT * FROM t2; SELECT * FROM t3; } } {1 2 a b 5 6 3 4} do_test savepoint-10.2.13 { execsql { ROLLBACK } execsql { SELECT * FROM t1; SELECT * FROM t2; SELECT * FROM t3; } } {1 2 5 6 3 4} do_test savepoint-10.2.14 { execsql { PRAGMA lock_status } } {main unlocked temp unlocked aux1 unlocked aux2 unlocked} #------------------------------------------------------------------------- # The following tests - savepoint-11.* - test the interaction of # savepoints and creating or dropping tables and indexes in # auto-vacuum mode. # do_test savepoint-11.1 { db close file delete -force test.db sqlite3 db test.db execsql { PRAGMA auto_vacuum = full; CREATE TABLE t1(a, b, UNIQUE(a, b)); INSERT INTO t1 VALUES(1, randstr(1000,1000)); INSERT INTO t1 VALUES(2, randstr(1000,1000)); } } {} do_test savepoint-11.2 { execsql { SAVEPOINT one; CREATE TABLE t2(a, b, UNIQUE(a, b)); SAVEPOINT two; CREATE TABLE t3(a, b, UNIQUE(a, b)); } } {} integrity_check savepoint-11.3 do_test savepoint-11.4 { execsql { ROLLBACK TO two } } {} integrity_check savepoint-11.5 do_test savepoint-11.6 { execsql { CREATE TABLE t3(a, b, UNIQUE(a, b)); ROLLBACK TO one; } } {} integrity_check savepoint-11.7 do_test savepoint-11.6 { execsql { ROLLBACK } file size test.db } {8192} finish_test |