3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing:
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.
10 #***********************************************************************
13 source [file join [file dirname [info script]] rbu_common.tcl]
14 if_no_rbu_support { finish_test ; return }
15 source $testdir/malloc_common.tcl
16 set ::testprefix rbufault2
20 CREATE TABLE target(x UNIQUE, y, z, PRIMARY KEY(y));
21 INSERT INTO target VALUES(1, 2, 3);
22 INSERT INTO target VALUES(4, 5, 6);
24 ATTACH 'rbu.db' AS rbu;
25 CREATE TABLE rbu.data_target(x, y, z, rbu_control);
26 INSERT INTO data_target VALUES(7, 8, 9, 0);
27 INSERT INTO data_target VALUES(1, 11, 12, 0);
32 forcecopy test.db test.db-bak
33 forcecopy rbu.db rbu.db-bak
35 do_faultsim_test 1 -faults oom* -prep {
36 forcecopy test.db-bak test.db
37 forcecopy rbu.db-bak rbu.db
38 forcedelete test.db-oal test.db-wal rbu.db-journal
39 sqlite3rbu rbu test.db rbu.db
41 while {[rbu step]=="SQLITE_OK"} { }
44 faultsim_test_result \
45 {1 {SQLITE_CONSTRAINT - UNIQUE constraint failed: target.x}} \
46 {1 SQLITE_CONSTRAINT} \
48 {1 {SQLITE_NOMEM - unable to open a temporary database file for storing temporary tables}} \
49 {1 {SQLITE_NOMEM - out of memory}}
53 sqlite3rbu_create_vfs -default rbu ""
55 set ::vfsname [file_control_vfsname db]
56 do_faultsim_test 2 -faults oom* -prep {
58 file_control_vfsname db
61 sqlite3rbu_destroy_vfs rbu