Debian Codegraph @

ext/intck/intckfault.test

raw
1 # 2024 February 24
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 source [file join [file dirname [info script]] intck_common.tcl]
14 set testprefix intckfault
15 return_if_no_intck
16
17 do_execsql_test 1.0 {
18 CREATE TABLE t1(a INTEGER PRIMARY KEY, b, c);
19 INSERT INTO t1 VALUES(1, 2, 3);
20 INSERT INTO t1 VALUES(2, 'two', 'three');
21 INSERT INTO t1 VALUES(3, NULL, NULL);
22 CREATE INDEX i1 ON t1(b, c);
23 }
24
25 do_faultsim_test 1 -faults oom-t* -prep {
26 } -body {
27 set ::ic [sqlite3_intck db main]
28 set nStep 0
29 while {"SQLITE_OK"==[$::ic step]} {
30 incr nStep
31 if {$nStep==3} { $::ic unlock }
32 }
33 set res [$::ic error]
34 $::ic close
35 set res
36 } -test {
37 catch { $::ic close }
38 faultsim_test_result {0 {SQLITE_OK {}}} {0 {SQLITE_NOMEM {}}} {0 {SQLITE_NOMEM {out of memory}}}
39 }
40
41 finish_test
42