| Index: third_party/sqlite/src/ext/fts5/test/fts5faultB.test
|
| diff --git a/third_party/sqlite/src/ext/fts5/test/fts5faultB.test b/third_party/sqlite/src/ext/fts5/test/fts5faultB.test
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..2ce33f4bc4207585b3d5da72b78fe92669f50c76
|
| --- /dev/null
|
| +++ b/third_party/sqlite/src/ext/fts5/test/fts5faultB.test
|
| @@ -0,0 +1,111 @@
|
| +# 2016 February 17
|
| +#
|
| +# The author disclaims copyright to this source code. In place of
|
| +# a legal notice, here is a blessing:
|
| +#
|
| +# May you do good and not evil.
|
| +# May you find forgiveness for yourself and forgive others.
|
| +# May you share freely, never taking more than you give.
|
| +#
|
| +#*************************************************************************
|
| +#
|
| +# This file is focused on OOM errors.
|
| +#
|
| +
|
| +source [file join [file dirname [info script]] fts5_common.tcl]
|
| +source $testdir/malloc_common.tcl
|
| +set testprefix fts5faultB
|
| +
|
| +# If SQLITE_ENABLE_FTS3 is defined, omit this file.
|
| +ifcapable !fts5 {
|
| + finish_test
|
| + return
|
| +}
|
| +
|
| +proc mit {blob} {
|
| + set scan(littleEndian) i*
|
| + set scan(bigEndian) I*
|
| + binary scan $blob $scan($::tcl_platform(byteOrder)) r
|
| + return $r
|
| +}
|
| +db func mit mit
|
| +
|
| +
|
| +#-------------------------------------------------------------------------
|
| +# Errors while registering the matchinfo() demo function.
|
| +#
|
| +do_faultsim_test 1 -faults oom* -prep {
|
| + sqlite3 db test.db
|
| +} -body {
|
| + sqlite3_fts5_register_matchinfo db
|
| +} -test {
|
| + faultsim_test_result {0 {}} {1 SQLITE_ERROR} {1 SQLITE_NOMEM}
|
| +}
|
| +
|
| +
|
| +#-------------------------------------------------------------------------
|
| +# Errors while executing the matchinfo() demo function.
|
| +#
|
| +reset_db
|
| +sqlite3_fts5_register_matchinfo db
|
| +db func mit mit
|
| +do_execsql_test 2 {
|
| + CREATE VIRTUAL TABLE t1 USING fts5(a, b);
|
| + INSERT INTO t1 VALUES('x y z', '1 2 3');
|
| + INSERT INTO t1 VALUES('x', '1 2 3 4 5 6 7');
|
| +}
|
| +
|
| +do_faultsim_test 2.1 -faults oom* -body {
|
| + execsql { SELECT mit(matchinfo(t1, 'a')) FROM t1('x') }
|
| +} -test {
|
| + faultsim_test_result {0 {{2 5} {2 5}}}
|
| +}
|
| +
|
| +do_faultsim_test 2.2 -faults oom* -body {
|
| + execsql { SELECT mit(matchinfo(t1, 'l')) FROM t1('x') }
|
| +} -test {
|
| + faultsim_test_result {0 {{3 3} {1 7}}}
|
| +}
|
| +
|
| +do_execsql_test 2.3 {
|
| + INSERT INTO t1 VALUES('a b c d e f', 'a b d e f c');
|
| + INSERT INTO t1 VALUES('l m b c a', 'n o a b c z');
|
| +}
|
| +
|
| +do_faultsim_test 2.4 -faults oom* -body {
|
| + execsql { SELECT mit(matchinfo(t1, 's')) FROM t1('a b c') }
|
| +} -test {
|
| + faultsim_test_result {0 {{3 2} {2 3}}}
|
| +}
|
| +
|
| +#-------------------------------------------------------------------------
|
| +#
|
| +reset_db
|
| +do_execsql_test 3.0 {
|
| + CREATE VIRTUAL TABLE x1 USING fts5(z);
|
| +}
|
| +
|
| +do_faultsim_test 3.1 -faults oom* -body {
|
| + execsql {
|
| + SELECT rowid FROM x1('c') WHERE rowid>1;
|
| + }
|
| +} -test {
|
| + faultsim_test_result {0 {}}
|
| +}
|
| +
|
| +do_execsql_test 3.2 {
|
| + INSERT INTO x1 VALUES('a b c');
|
| + INSERT INTO x1 VALUES('b c d');
|
| + INSERT INTO x1 VALUES('c d e');
|
| + INSERT INTO x1 VALUES('d e f');
|
| +}
|
| +do_faultsim_test 3.3 -faults oom* -body {
|
| + execsql {
|
| + SELECT rowid FROM x1('c') WHERE rowid>1;
|
| + }
|
| +} -test {
|
| + faultsim_test_result {0 {2 3}}
|
| +}
|
| +
|
| +finish_test
|
| +
|
|
|