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/vec1/test/vec1fault3.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 / vec1 / test / vec1fault3.test` 106 lines ยท 2539 bytes Raw Blame History 1 # 2026-04-01 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 # 13 14 source [file join [file dirname [info script]] vec1_common.tcl] 15 set testprefix vec1fault3 16 vec1_load db 17 18 do_execsql_test 1.0 { 19 CREATE VIRTUAL TABLE t1 USING vec1(a, b, c, d, e); 20 INSERT INTO t1(cmd, arg) VALUES('rebuild', '{index:"flat"}'); 21 } 22 faultsim_save_and_close 23 24 do_faultsim_test 1 -faults oom-t* -prep { 25 faultsim_restore_and_reopen 26 vec1_load db 27 db eval { PRAGMA table_info = t1 } 28 execsql { 29 INSERT INTO t1 VALUES(random_vector(8), NULL, $f, 'helloworld', X'123456') 30 } 31 } -body { 32 execsql BEGIN 33 for {set ii 0} {$ii < 1000} {incr ii} { 34 set f [expr rand()] 35 execsql { 36 INSERT INTO t1 VALUES(random_vector(8), NULL, $f, 'helloworld', X'123456') 37 } 38 } 39 execsql COMMIT 40 } -test { 41 faultsim_test_result {0 {}} 42 catchsql ROLLBACK 43 } 44 45 do_faultsim_test 2 -faults oom* -prep { 46 faultsim_restore_and_reopen 47 vec1_load db 48 } -body { 49 execsql { 50 BEGIN; 51 INSERT INTO t1(rowid, a) VALUES(5555, random_vector(24)); 52 INSERT INTO t1(rowid, a) VALUES(20_000_000_000, random_vector(24)); 53 COMMIT; 54 } 55 56 } -test { 57 faultsim_test_result {0 {}} 58 catchsql ROLLBACK 59 } 60 61 #-------------------------------------------------------------------------- 62 reset_db 63 vec1_load db 64 65 do_execsql_test 3.0 { 66 CREATE VIRTUAL TABLE t1 USING vec1(a, b); 67 INSERT INTO t1(cmd, arg) VALUES('rebuild', ( 68 WITH s(i) AS ( 69 SELECT 1 UNION ALL SELECT i+1 FROM s WHERE i<1000 70 ) SELECT vec1_train( random_vector(16), '{codesize:8}' ) FROM s 71 )); 72 } 73 faultsim_save_and_close 74 75 do_faultsim_test 3.1 -faults oom* -prep { 76 faultsim_restore_and_reopen 77 vec1_load db 78 execsql { 79 BEGIN; 80 WITH s(i) AS ( 81 SELECT 1 UNION ALL SELECT i+1 FROM s WHERE i<100 82 ) INSERT INTO t1(a, b) SELECT random_vector(16), i FROM s; 83 } 84 } -body { 85 for {set ii 1} {$ii < 30} {incr ii} { 86 execsql { DELETE FROM t1 WHERE rowid=$ii } 87 } 88 } -test { 89 faultsim_test_result {0 {}} 90 catchsql ROLLBACK 91 } 92 93 do_faultsim_test 3.2 -faults oom* -prep { 94 faultsim_restore_and_reopen 95 vec1_load db 96 execsql { PRAGMA table_info = t1 } 97 } -body { 98 execsql { 99 INSERT INTO t1 VALUES( random_vector(16), 1100 ); 100 } 101 } -test { 102 faultsim_test_result {0 {}} 103 } 104 105 finish_test 106