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

Side by Side Diff: third_party/sqlite/sqlite-src-3100200/ext/fts5/test/fts5fault5.test

Issue 1610543003: [sql] Import reference version of SQLite 3.10.2. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
(Empty)
1 # 2014 June 17
2 #
3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing:
5 #
6 # May you do good and not evil.
7 # May you find forgiveness for yourself and forgive others.
8 # May you share freely, never taking more than you give.
9 #
10 #*************************************************************************
11 #
12 # This file is focused on OOM errors.
13 #
14
15 source [file join [file dirname [info script]] fts5_common.tcl]
16 source $testdir/malloc_common.tcl
17 set testprefix fts5fault5
18
19 # If SQLITE_ENABLE_FTS3 is defined, omit this file.
20 ifcapable !fts5 {
21 finish_test
22 return
23 }
24
25 #-------------------------------------------------------------------------
26 # OOM while creating an FTS5 table.
27 #
28 do_faultsim_test 1.1 -faults oom-t* -prep {
29 db eval { DROP TABLE IF EXISTS abc }
30 } -body {
31 db eval { CREATE VIRTUAL TABLE abc USING fts5(x,y) }
32 } -test {
33 faultsim_test_result {0 {}}
34 }
35
36
37 #-------------------------------------------------------------------------
38 # OOM while writing a multi-tier doclist-index. And while running
39 # integrity-check on the same.
40 #
41 reset_db
42 do_execsql_test 2.0 {
43 CREATE VIRTUAL TABLE tt USING fts5(x);
44 INSERT INTO tt(tt, rank) VALUES('pgsz', 32);
45 }
46 faultsim_save_and_close
47
48 do_faultsim_test 2.1 -faults oom-t* -prep {
49 faultsim_restore_and_reopen
50 db eval { SELECT * FROM tt }
51 } -body {
52 set str [string repeat "abc " 50]
53 db eval {
54 WITH ii(i) AS (SELECT 1 UNION ALL SELECT i+1 FROM ii WHERE i<100)
55 INSERT INTO tt(rowid, x) SELECT i, $str FROM ii;
56 }
57 } -test {
58 faultsim_test_result {0 {}}
59 }
60
61 do_faultsim_test 2.2 -faults oom-t* -body {
62 db eval { INSERT INTO tt(tt) VALUES('integrity-check') }
63 } -test {
64 faultsim_test_result {0 {}}
65 }
66
67 #-------------------------------------------------------------------------
68 # OOM while scanning an fts5vocab table.
69 #
70 reset_db
71 do_test 3.0 {
72 execsql {
73 CREATE VIRTUAL TABLE tt USING fts5(x);
74 CREATE VIRTUAL TABLE tv USING fts5vocab(tt, 'row');
75 INSERT INTO tt(tt, rank) VALUES('pgsz', 32);
76 BEGIN;
77 }
78 for {set i 0} {$i < 20} {incr i} {
79 set str [string repeat "$i " 50]
80 execsql { INSERT INTO tt VALUES($str) }
81 }
82 execsql COMMIT
83 } {}
84
85 do_faultsim_test 3.1 -faults oom-t* -body {
86 db eval {
87 SELECT term FROM tv;
88 }
89 } -test {
90 faultsim_test_result {0 {0 1 10 11 12 13 14 15 16 17 18 19 2 3 4 5 6 7 8 9}}
91 }
92
93 do_faultsim_test 3.2 -faults oom-t* -body {
94 db eval {
95 SELECT term FROM tv WHERE term BETWEEN '1' AND '2';
96 }
97 } -test {
98 faultsim_test_result {0 {1 10 11 12 13 14 15 16 17 18 19 2}}
99 }
100
101
102
103 finish_test
104
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698