Update test file walprotocol.test to account for the changes in the wal
[sqlite.git] / test / gcfault.test
blobd54b78fafcba1951b4fa674733f3026cdc2e652c
1 # 2016 December 30
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 #***********************************************************************
11 # This file implements regression tests for SQLite library.  The
12 # focus of this file is testing OOM error handling within the built-in 
13 # group_concat() function.
16 set testdir [file dirname $argv0]
17 source $testdir/tester.tcl
18 set testprefix gcfault
21 foreach {enc} {
22   utf16
23   utf8
24 } {
25   reset_db
26   sqlite3_db_config_lookaside db 0 0 0
27   execsql "PRAGMA encoding = $enc"
29   do_execsql_test 1.$enc.1 {
30     CREATE TABLE s(i, s);
31     INSERT INTO s VALUES(1, ',0123456789,');
32     INSERT INTO s VALUES(2, X'2c303132333435363738392c');
34     CREATE TABLE e(e);
35     INSERT INTO e VALUES('v1'), ('v2');
36   } {}
38   do_faultsim_test 1.$enc.1 -faults oom* -body {
39     execsql { SELECT group_concat(e, (SELECT s FROM s WHERE i=1)) FROM e }
40   }
42   do_faultsim_test 1.$enc.2 -faults oom-t* -body {
43     execsql { SELECT group_concat(e, (SELECT s FROM s WHERE i=2)) FROM e }
44   }
46   do_faultsim_test 1.$enc.3 -faults oom-t* -prep {
47     set ::STMT [sqlite3_prepare db {SELECT group_concat(e, ?) FROM e} -1 dummy]
48     sqlite3_bind_text $::STMT 1 ",0123456789," 12
49   } -body {
50     while { "SQLITE_ROW"==[sqlite3_step $::STMT] } { }
51   } -test {
52     sqlite3_finalize $::STMT
53   }
56 finish_test