Debian Codegraph @

ext/session/sessionfault3.test

raw
1 # 2016 October 6
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 # The focus of this file is testing the session module.
13 #
14
15 if {![info exists testdir]} {
16 set testdir [file join [file dirname [info script]] .. .. test]
17 }
18 source [file join [file dirname [info script]] session_common.tcl]
19 source $testdir/tester.tcl
20 ifcapable !session {finish_test; return}
21 set testprefix sessionfault3
22
23 do_execsql_test 1.0 {
24 CREATE TABLE t1(a, b, PRIMARY KEY(a));
25 INSERT INTO t1 VALUES(1, 2);
26 INSERT INTO t1 VALUES(3, 4);
27 INSERT INTO t1 VALUES('five', 'six');
28 }
29
30 set C1 [changeset_from_sql {
31 INSERT INTO t1 VALUES('seven', 'eight');
32 UPDATE t1 SET b=6 WHERE a='five';
33 DELETE FROM t1 WHERE a=1;
34 }]
35
36 do_execsql_test 1.1 {
37 ALTER TABLE t1 ADD COLUMN d DEFAULT 123;
38 ALTER TABLE t1 ADD COLUMN e DEFAULT 'string';
39 }
40
41 set C2 [changeset_from_sql {
42 UPDATE t1 SET e='new value' WHERE a='seven';
43 INSERT INTO t1 VALUES(0, 0, 0, 0);
44 }]
45
46 do_faultsim_test 1 -faults oom* -prep {
47 sqlite3changegroup G
48 } -body {
49 G schema db main
50 G add $::C1
51 G add $::C2
52 G output
53 set {} {}
54 } -test {
55 catch { G delete }
56 faultsim_test_result {0 {}} {1 SQLITE_NOMEM}
57 }
58
59 finish_test