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

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

Issue 901033002: Import SQLite 3.8.7.4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Chromium changes to support SQLite 3.8.7.4. Created 5 years, 10 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
OLDNEW
1 # 2008 August 01 1 # 2008 August 01
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 # 11 #
12 # This test script checks malloc failures in WHERE clause analysis. 12 # This test script checks malloc failures in WHERE clause analysis.
13 # 13 #
14 # $Id: mallocK.test,v 1.3 2009/01/08 21:00:03 drh Exp $ 14 # $Id: mallocK.test,v 1.3 2009/01/08 21:00:03 drh Exp $
15 15
16 set testdir [file dirname $argv0] 16 set testdir [file dirname $argv0]
17 source $testdir/tester.tcl 17 source $testdir/tester.tcl
18 source $testdir/malloc_common.tcl 18 source $testdir/malloc_common.tcl
19 set testprefix mallocK
19 20
20 set sql {SELECT * FROM t1, t2 WHERE (a=1 OR a=2)} 21 set sql {SELECT * FROM t1, t2 WHERE (a=1 OR a=2)}
21 for {set x 1} {$x<5} {incr x} { 22 for {set x 1} {$x<5} {incr x} {
22 append sql " AND b=y" 23 append sql " AND b=y"
23 do_malloc_test mallocK-1.$x -sqlbody $sql -sqlprep { 24 do_malloc_test mallocK-1.$x -sqlbody $sql -sqlprep {
24 CREATE TABLE t1(a,b); 25 CREATE TABLE t1(a,b);
25 CREATE TABLE t2(x,y); 26 CREATE TABLE t2(x,y);
26 } 27 }
27 } 28 }
28 29
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 do_malloc_test mallocK-5.$x -sqlbody $sql -tclprep { 62 do_malloc_test mallocK-5.$x -sqlbody $sql -tclprep {
62 register_echo_module [sqlite3_connection_pointer db] 63 register_echo_module [sqlite3_connection_pointer db]
63 db eval { 64 db eval {
64 CREATE TABLE t1(a,b); 65 CREATE TABLE t1(a,b);
65 CREATE VIRTUAL TABLE t2 USING echo(t1); 66 CREATE VIRTUAL TABLE t2 USING echo(t1);
66 } 67 }
67 } 68 }
68 } 69 }
69 } 70 }
70 71
72 #-------------------------------------------------------------------------
73 # Test that OOM errors are correctly handled by the code that uses stat4
74 # data to estimate the number of rows visited by a skip-scan range query.
75 #
76 add_alignment_test_collations db
77 do_execsql_test 6.0 {
78 CREATE TABLE t3(a TEXT, b TEXT COLLATE utf16_aligned, c);
79 INSERT INTO t3 VALUES('one', '.....', 0);
80 INSERT INTO t3 VALUES('one', '....x', 1);
81 INSERT INTO t3 VALUES('one', '...x.', 2);
82 INSERT INTO t3 VALUES('one', '...xx', 3);
83 INSERT INTO t3 VALUES('one', '..x..', 4);
84 INSERT INTO t3 VALUES('one', '..x.x', 5);
85 INSERT INTO t3 VALUES('one', '..xx.', 6);
86 INSERT INTO t3 VALUES('one', '..xxx', 7);
87 INSERT INTO t3 VALUES('one', '.x...', 8);
88 INSERT INTO t3 VALUES('one', '.x..x', 9);
89 INSERT INTO t3 VALUES('one', '.x.x.', 10);
90 INSERT INTO t3 VALUES('one', '.x.xx', 11);
91 INSERT INTO t3 VALUES('one', '.xx..', 12);
92 INSERT INTO t3 VALUES('one', '.xx.x', 13);
93 INSERT INTO t3 VALUES('one', '.xxx.', 14);
94 INSERT INTO t3 VALUES('one', '.xxxx', 15);
95
96 INSERT INTO t3 VALUES('two', 'x....', 16);
97 INSERT INTO t3 VALUES('two', 'x...x', 17);
98 INSERT INTO t3 VALUES('two', 'x..x.', 18);
99 INSERT INTO t3 VALUES('two', 'x..xx', 19);
100 INSERT INTO t3 VALUES('two', 'x.x..', 20);
101 INSERT INTO t3 VALUES('two', 'x.x.x', 21);
102 INSERT INTO t3 VALUES('two', 'x.xx.', 22);
103 INSERT INTO t3 VALUES('two', 'x.xxx', 23);
104 INSERT INTO t3 VALUES('two', 'xx...', 24);
105 INSERT INTO t3 VALUES('two', 'xx..x', 25);
106 INSERT INTO t3 VALUES('two', 'xx.x.', 26);
107 INSERT INTO t3 VALUES('two', 'xx.xx', 27);
108 INSERT INTO t3 VALUES('two', 'xxx..', 28);
109 INSERT INTO t3 VALUES('two', 'xxx.x', 29);
110 INSERT INTO t3 VALUES('two', 'xxxx.', 30);
111 INSERT INTO t3 VALUES('two', 'xxxxx', 31);
112
113 INSERT INTO t3 SELECT * FROM t3;
114
115 CREATE INDEX i3 ON t3(a, b);
116 ANALYZE;
117
118 SELECT 'x' > '.';
119 } {1}
120
121 ifcapable stat4 {
122 do_eqp_test 6.1 {
123 SELECT DISTINCT c FROM t3 WHERE b BETWEEN '.xx..' AND '.xxxx';
124 } {
125 0 0 0 {SEARCH TABLE t3 USING INDEX i3 (ANY(a) AND b>? AND b<?)}
126 0 0 0 {USE TEMP B-TREE FOR DISTINCT}
127 }
128 }
129
130 do_faultsim_test 6 -faults oom* -body {
131 db cache flush
132 db eval { SELECT DISTINCT c FROM t3 WHERE b BETWEEN '.xx..' AND '.xxxx' }
133 } -test {
134 faultsim_test_result {0 {12 13 14 15}}
135 }
71 136
72 finish_test 137 finish_test
138
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698