OLD | NEW |
(Empty) | |
| 1 # 2016 December 30 |
| 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 # 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. |
| 14 # |
| 15 |
| 16 set testdir [file dirname $argv0] |
| 17 source $testdir/tester.tcl |
| 18 set testprefix gcfault |
| 19 |
| 20 |
| 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" |
| 28 |
| 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'); |
| 33 |
| 34 CREATE TABLE e(e); |
| 35 INSERT INTO e VALUES('v1'), ('v2'); |
| 36 } {} |
| 37 |
| 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 } |
| 41 |
| 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 } |
| 45 |
| 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 } |
| 54 } |
| 55 |
| 56 finish_test |
OLD | NEW |