xref: /sqlite-3.40.0/test/fuzzerfault.test (revision 4965ebce)
1# 2012 February 21
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 TCL interface to the
12# SQLite library.
13#
14
15set testdir [file dirname $argv0]
16source $testdir/tester.tcl
17ifcapable !vtab { finish_test ; return }
18set ::testprefix fuzzerfault
19
20register_fuzzer_module db
21
22do_test 1-pre1 {
23  execsql {
24    CREATE TABLE x1_rules(ruleset, cFrom, cTo, cost);
25    INSERT INTO x1_rules VALUES(0, 'a', 'b', 1);
26    INSERT INTO x1_rules VALUES(0, 'a', 'c', 2);
27    INSERT INTO x1_rules VALUES(0, 'a', 'd', 3);
28  }
29  faultsim_save_and_close
30} {}
31
32do_faultsim_test 1 -faults oom-t* -prep {
33  faultsim_restore_and_reopen
34  register_fuzzer_module db
35} -body {
36  execsql {
37    CREATE VIRTUAL TABLE x1 USING fuzzer(x1_rules);
38    SELECT word FROM x1 WHERE word MATCH 'xax';
39  }
40} -test {
41  faultsim_test_result {0 {xax xbx xcx xdx}}               \
42                       {1 {vtable constructor failed: x1}}
43}
44
45
46
47finish_test
48