Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/sqlite/blob/master/ext/fts5/test/fts5fault8.test # sqlite [Ported from github.com/sqlite/sqlite] Fix bugs in and improve the interface to the ".check" command of the CLI. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `sqlite / ext / fts5 / test / fts5fault8.test` 96 lines ยท 2637 bytes Raw Blame History 1 # 2015 September 3 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 fts5fault8 18 19 # If SQLITE_ENABLE_FTS3 is defined, omit this file. 20 ifcapable !fts5 { 21 finish_test 22 return 23 } 24 25 foreach_detail_mode $testprefix { 26 27 fts5_aux_test_functions db 28 do_execsql_test 1.0 { 29 CREATE VIRTUAL TABLE t1 USING fts5(a, b, detail=%DETAIL%); 30 INSERT INTO t1 VALUES('a b c d', '1 2 3 4'); 31 INSERT INTO t1 VALUES('a b a b', NULL); 32 INSERT INTO t1 VALUES(NULL, '1 2 1 2'); 33 } 34 35 do_faultsim_test 1 -faults oom-* -body { 36 execsql { 37 SELECT rowid, fts5_test_poslist(t1) FROM t1 WHERE t1 MATCH 'b OR 2' 38 } 39 } -test { 40 faultsim_test_result {0 {1 {0.0.1 1.1.1} 2 {0.0.1 0.0.3} 3 {1.1.1 1.1.3}}} \ 41 {1 SQLITE_NOMEM} 42 } 43 44 do_faultsim_test 2 -faults oom-* -body { 45 execsql { INSERT INTO t1(t1) VALUES('integrity-check') } 46 } -test { 47 faultsim_test_result {0 {}} {1 SQLITE_NOMEM} 48 } 49 50 if {[detail_is_none]==0} { 51 do_faultsim_test 3 -faults oom-* -body { 52 execsql { SELECT rowid FROM t1('b:2') } 53 } -test { 54 faultsim_test_result {0 {1 3}} {1 SQLITE_NOMEM} 55 } 56 } 57 58 } ;# foreach_detail_mode... 59 60 do_execsql_test 4.0 { 61 CREATE VIRTUAL TABLE x2 USING fts5(a); 62 INSERT INTO x2(x2, rank) VALUES('crisismerge', 2); 63 INSERT INTO x2(x2, rank) VALUES('pgsz', 32); 64 INSERT INTO x2 VALUES('a b c d'); 65 INSERT INTO x2 VALUES('e f g h'); 66 INSERT INTO x2 VALUES('i j k l'); 67 INSERT INTO x2 VALUES('m n o p'); 68 INSERT INTO x2 VALUES('q r s t'); 69 INSERT INTO x2 VALUES('u v w x'); 70 INSERT INTO x2 VALUES('y z a b'); 71 } 72 faultsim_save_and_close 73 74 do_faultsim_test 4 -faults oom-* -prep { 75 faultsim_restore_and_reopen 76 } -body { 77 execsql { INSERT INTO x2(x2) VALUES('optimize') } 78 } -test { 79 faultsim_test_result {0 {}} {1 SQLITE_NOMEM} 80 } 81 82 set TMPDBERROR {1 {unable to open a temporary database file for storing temporary tables}} 83 84 do_faultsim_test 5 -faults oom-t* -prep { 85 faultsim_restore_and_reopen 86 execsql { PRAGMA temp_store = memory } 87 } -body { 88 execsql { PRAGMA integrity_check } 89 } -test { 90 if {[string match {*error code=7*} $testresult]==0} { 91 faultsim_test_result {0 ok} {1 SQLITE_NOMEM} $::TMPDBERROR 92 } 93 } 94 95 96 finish_test