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 if {![info exists testdir]} {
14 set testdir [file join [file dirname [info script]] .. .. test]
16 source $testdir/tester.tcl
17 source $testdir/malloc_common.tcl
18 set ::testprefix rbufault2
22 CREATE TABLE target(x UNIQUE, y, z, PRIMARY KEY(y));
23 INSERT INTO target VALUES(1, 2, 3);
24 INSERT INTO target VALUES(4, 5, 6);
26 ATTACH 'rbu.db' AS rbu;
27 CREATE TABLE rbu.data_target(x, y, z, rbu_control);
28 INSERT INTO data_target VALUES(7, 8, 9, 0);
29 INSERT INTO data_target VALUES(1, 11, 12, 0);
34 forcecopy test.db test.db-bak
35 forcecopy rbu.db rbu.db-bak
37 do_faultsim_test 1 -faults oom* -prep {
38 forcecopy test.db-bak test.db
39 forcecopy rbu.db-bak rbu.db
40 forcedelete test.db-oal test.db-wal rbu.db-journal
41 sqlite3rbu rbu test.db rbu.db
43 while {[rbu step]=="SQLITE_OK"} { }
46 faultsim_test_result \
47 {1 {SQLITE_CONSTRAINT - UNIQUE constraint failed: target.x}} \
48 {1 SQLITE_CONSTRAINT} \
50 {1 {SQLITE_NOMEM - unable to open a temporary database file for storing temporary tables}} \
51 {1 {SQLITE_NOMEM - out of memory}}
55 sqlite3rbu_create_vfs -default rbu ""
57 set ::vfsname [file_control_vfsname db]
58 do_faultsim_test 2 -faults oom* -prep {
60 file_control_vfsname db
63 sqlite3rbu_destroy_vfs rbu