Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: third_party/sqlite/src/test/avtrans.test

Issue 6990047: Import SQLite 3.7.6.3. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 # 2001 September 15 1 # 2001 September 15
2 # 2 #
3 # The author disclaims copyright to this source code. In place of 3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing: 4 # a legal notice, here is a blessing:
5 # 5 #
6 # May you do good and not evil. 6 # May you do good and not evil.
7 # May you find forgiveness for yourself and forgive others. 7 # May you find forgiveness for yourself and forgive others.
8 # May you share freely, never taking more than you give. 8 # May you share freely, never taking more than you give.
9 # 9 #
10 #*********************************************************************** 10 #***********************************************************************
11 # This file implements regression tests for SQLite library. This 11 # This file implements regression tests for SQLite library. This
12 # file is a copy of "trans.test" modified to run under autovacuum mode. 12 # file is a copy of "trans.test" modified to run under autovacuum mode.
13 # the point is to stress the autovacuum logic and try to get it to fail. 13 # the point is to stress the autovacuum logic and try to get it to fail.
14 # 14 #
15 # $Id: avtrans.test,v 1.6 2007/09/12 17:01:45 danielk1977 Exp $ 15 # $Id: avtrans.test,v 1.6 2007/09/12 17:01:45 danielk1977 Exp $
16 16
17 17
18 set testdir [file dirname $argv0] 18 set testdir [file dirname $argv0]
19 source $testdir/tester.tcl 19 source $testdir/tester.tcl
20 20
21 21
22 # Create several tables to work with. 22 # Create several tables to work with.
23 # 23 #
24 do_test avtrans-1.0 { 24 do_test avtrans-1.0 {
25 execsql { 25 execsql { PRAGMA auto_vacuum=ON }
26 PRAGMA auto_vacuum=ON; 26 wal_set_journal_mode
27 execsql {
27 CREATE TABLE one(a int PRIMARY KEY, b text); 28 CREATE TABLE one(a int PRIMARY KEY, b text);
28 INSERT INTO one VALUES(1,'one'); 29 INSERT INTO one VALUES(1,'one');
29 INSERT INTO one VALUES(2,'two'); 30 INSERT INTO one VALUES(2,'two');
30 INSERT INTO one VALUES(3,'three'); 31 INSERT INTO one VALUES(3,'three');
31 SELECT b FROM one ORDER BY a; 32 SELECT b FROM one ORDER BY a;
32 } 33 }
33 } {one two three} 34 } {one two three}
34 do_test avtrans-1.1 { 35 do_test avtrans-1.1 {
35 execsql { 36 execsql {
36 CREATE TABLE two(a int PRIMARY KEY, b text); 37 CREATE TABLE two(a int PRIMARY KEY, b text);
37 INSERT INTO two VALUES(1,'I'); 38 INSERT INTO two VALUES(1,'I');
38 INSERT INTO two VALUES(5,'V'); 39 INSERT INTO two VALUES(5,'V');
39 INSERT INTO two VALUES(10,'X'); 40 INSERT INTO two VALUES(10,'X');
40 SELECT b FROM two ORDER BY a; 41 SELECT b FROM two ORDER BY a;
41 } 42 }
42 } {I V X} 43 } {I V X}
43 do_test avtrans-1.9 { 44 do_test avtrans-1.9 {
44 sqlite3 altdb test.db 45 sqlite3 altdb test.db
45 execsql {SELECT b FROM one ORDER BY a} altdb 46 execsql {SELECT b FROM one ORDER BY a} altdb
46 } {one two three} 47 } {one two three}
47 do_test avtrans-1.10 { 48 do_test avtrans-1.10 {
48 execsql {SELECT b FROM two ORDER BY a} altdb 49 execsql {SELECT b FROM two ORDER BY a} altdb
49 } {I V X} 50 } {I V X}
50 integrity_check avtrans-1.11 51 integrity_check avtrans-1.11
52 wal_check_journal_mode avtrans-1.12
51 53
52 # Basic transactions 54 # Basic transactions
53 # 55 #
54 do_test avtrans-2.1 { 56 do_test avtrans-2.1 {
55 set v [catch {execsql {BEGIN}} msg] 57 set v [catch {execsql {BEGIN}} msg]
56 lappend v $msg 58 lappend v $msg
57 } {0 {}} 59 } {0 {}}
58 do_test avtrans-2.2 { 60 do_test avtrans-2.2 {
59 set v [catch {execsql {END}} msg] 61 set v [catch {execsql {END}} msg]
60 lappend v $msg 62 lappend v $msg
(...skipping 16 matching lines...) Expand all
77 } {0 {}} 79 } {0 {}}
78 do_test avtrans-2.10 { 80 do_test avtrans-2.10 {
79 execsql { 81 execsql {
80 BEGIN; 82 BEGIN;
81 SELECT a FROM one ORDER BY a; 83 SELECT a FROM one ORDER BY a;
82 SELECT a FROM two ORDER BY a; 84 SELECT a FROM two ORDER BY a;
83 END; 85 END;
84 } 86 }
85 } {1 2 3 1 5 10} 87 } {1 2 3 1 5 10}
86 integrity_check avtrans-2.11 88 integrity_check avtrans-2.11
89 wal_check_journal_mode avtrans-2.12
87 90
88 # Check the locking behavior 91 # Check the locking behavior
89 # 92 #
90 sqlite3_soft_heap_limit 0 93 sqlite3_soft_heap_limit 0
91 do_test avtrans-3.1 { 94 do_test avtrans-3.1 {
92 execsql { 95 execsql {
93 BEGIN; 96 BEGIN;
94 UPDATE one SET a = 0 WHERE 0; 97 UPDATE one SET a = 0 WHERE 0;
95 SELECT a FROM one ORDER BY a; 98 SELECT a FROM one ORDER BY a;
96 } 99 }
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 SELECT a FROM two ORDER BY a; 158 SELECT a FROM two ORDER BY a;
156 } db} msg] 159 } db} msg]
157 lappend v $msg 160 lappend v $msg
158 } {0 {1 4 5 10}} 161 } {0 {1 4 5 10}}
159 do_test avtrans-3.14 { 162 do_test avtrans-3.14 {
160 set v [catch {execsql { 163 set v [catch {execsql {
161 SELECT a FROM one ORDER BY a; 164 SELECT a FROM one ORDER BY a;
162 } db} msg] 165 } db} msg]
163 lappend v $msg 166 lappend v $msg
164 } {0 {1 2 3 4}} 167 } {0 {1 2 3 4}}
165 sqlite3_soft_heap_limit $soft_limit 168 sqlite3_soft_heap_limit $cmdlinearg(soft-heap-limit)
166 integrity_check avtrans-3.15 169 integrity_check avtrans-3.15
167 170
168 do_test avtrans-4.1 { 171 do_test avtrans-4.1 {
169 set v [catch {execsql { 172 set v [catch {execsql {
170 COMMIT; 173 COMMIT;
171 } db} msg] 174 } db} msg]
172 lappend v $msg 175 lappend v $msg
173 } {1 {cannot commit - no transaction is active}} 176 } {1 {cannot commit - no transaction is active}}
174 do_test avtrans-4.2 { 177 do_test avtrans-4.2 {
175 set v [catch {execsql { 178 set v [catch {execsql {
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after
847 # 850 #
848 proc signature {} { 851 proc signature {} {
849 return [db eval {SELECT count(*), md5sum(x) FROM t3}] 852 return [db eval {SELECT count(*), md5sum(x) FROM t3}]
850 } 853 }
851 854
852 # Repeat the following group of tests 20 times for quick testing and 855 # Repeat the following group of tests 20 times for quick testing and
853 # 40 times for full testing. Each iteration of the test makes table 856 # 40 times for full testing. Each iteration of the test makes table
854 # t3 a little larger, and thus takes a little longer, so doing 40 tests 857 # t3 a little larger, and thus takes a little longer, so doing 40 tests
855 # is more than 2.0 times slower than doing 20 tests. Considerably more. 858 # is more than 2.0 times slower than doing 20 tests. Considerably more.
856 # 859 #
857 if {[info exists ISQUICK]} { 860 if {[info exists G(isquick)]} {
858 set limit 20 861 set limit 20
859 } else { 862 } else {
860 set limit 40 863 set limit 40
861 } 864 }
862 865
863 # Do rollbacks. Make sure the signature does not change. 866 # Do rollbacks. Make sure the signature does not change.
864 # 867 #
865 for {set i 2} {$i<=$limit} {incr i} { 868 for {set i 2} {$i<=$limit} {incr i} {
866 set ::sig [signature] 869 set ::sig [signature]
867 set cnt [lindex $::sig 0] 870 set cnt [lindex $::sig 0]
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
906 ifcapable pager_pragmas { 909 ifcapable pager_pragmas {
907 do_test avtrans-9.$i.5-$cnt { 910 do_test avtrans-9.$i.5-$cnt {
908 expr {$sqlite_fullsync_count>0} 911 expr {$sqlite_fullsync_count>0}
909 } [expr {$i%2==0}] 912 } [expr {$i%2==0}]
910 } else { 913 } else {
911 do_test avtrans-9.$i.5-$cnt { 914 do_test avtrans-9.$i.5-$cnt {
912 expr {$sqlite_fullsync_count==0} 915 expr {$sqlite_fullsync_count==0}
913 } {1} 916 } {1}
914 } 917 }
915 } 918 }
919 wal_check_journal_mode avtrans-9.$i-6.$cnt
916 } 920 }
917 set ::pager_old_format 0 921 set ::pager_old_format 0
918 } 922 }
919 integrity_check avtrans-10.1 923 integrity_check avtrans-10.1
924 wal_check_journal_mode avtrans-10.2
920 925
921 finish_test 926 finish_test
OLDNEW
« no previous file with comments | « third_party/sqlite/src/test/autovacuum.test ('k') | third_party/sqlite/src/test/backcompat.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698