blob: b5980d417d753e1f6278d2da0209ebe4d7151385 [file] [log] [blame]
dan995f8b92015-04-27 19:53:55 +00001# 2015 April 28
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#
12
13set testdir [file dirname $argv0]
14source $testdir/tester.tcl
15source $testdir/malloc_common.tcl
16set testprefix statfault
17
18ifcapable !vtab||!compound {
19 finish_test
20 return
21}
22
23register_dbstat_vtab db
24do_execsql_test statfault-1 {
25 CREATE TABLE t1(a, b UNIQUE);
26 INSERT INTO t1 VALUES(1, randomblob(500));
27 INSERT INTO t1 VALUES(randomblob(500), 1);
28 INSERT INTO t1 VALUES(2, randomblob(250));
29 INSERT INTO t1 VALUES(randomblob(250), 2);
30 CREATE VIRTUAL TABLE sss USING dbstat;
31} {}
32faultsim_save_and_close
33
34do_faultsim_test 1 -faults * -prep {
35 faultsim_restore_and_reopen
36 register_dbstat_vtab db
37 execsql { SELECT 1 FROM sqlite_master LIMIT 1 }
38} -body {
39 execsql { SELECT count(*) FROM sss }
40} -test {
41 faultsim_test_result {0 8}
42}
43
danc28cc322021-09-25 18:21:01 +000044do_faultsim_test 2 -faults * -prep {
45 faultsim_restore_and_reopen
46 register_dbstat_vtab db
47 execsql { SELECT 1 FROM sqlite_master LIMIT 1 }
48} -body {
49 db eval { SELECT * FROM sss } { db eval { SELECT randomblob(5000) } }
50} -test {
51 faultsim_test_result {0 {}}
52}
dan995f8b92015-04-27 19:53:55 +000053
54finish_test
danc28cc322021-09-25 18:21:01 +000055