| 1 |
# 2017 March 13 |
| 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 |
# Further OOM tests. |
| 12 |
# |
| 13 |
|
| 14 |
set testdir [file dirname $argv0] |
| 15 |
source $testdir/tester.tcl |
| 16 |
source $testdir/malloc_common.tcl |
| 17 |
set testprefix mallocM |
| 18 |
|
| 19 |
sqlite3_db_config_lookaside db 0 0 0 |
| 20 |
|
| 21 |
do_execsql_test 1.0 { |
| 22 |
CREATE TABLE t1(x); |
| 23 |
} |
| 24 |
do_faultsim_test 1 -faults oom* -body { |
| 25 |
execsql { |
| 26 |
SELECT 'abc' FROM ( SELECT 'xyz' FROM t1 WHERE (SELECT 1) ) |
| 27 |
} |
| 28 |
} -test { |
| 29 |
faultsim_test_result {0 {}} |
| 30 |
} |
| 31 |
|
| 32 |
do_execsql_test 2.0.1 { SELECT instr(x'', x'') } {1} |
| 33 |
do_execsql_test 2.0.2 { SELECT instr(x'12345678', x'') } {1} |
| 34 |
do_execsql_test 2.0.3 { SELECT instr(x'', x'1234') } {0} |
| 35 |
|
| 36 |
do_faultsim_test 2.1 -faults oom* -body { |
| 37 |
execsql { SELECT instr (x'00', zeroblob(1)) } |
| 38 |
} -test { |
| 39 |
faultsim_test_result {0 1} |
| 40 |
} |
| 41 |
|
| 42 |
do_faultsim_test 2.2 -faults oom* -body { |
| 43 |
execsql { SELECT instr (zeroblob(1), x'00') } |
| 44 |
} -test { |
| 45 |
faultsim_test_result {0 1} |
| 46 |
} |
| 47 |
|
| 48 |
finish_test |