xref: /sqlite-3.40.0/test/dbpagefault.test (revision 554cb87d)
1# 2022 July 06
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/lock_common.tcl
16source $testdir/malloc_common.tcl
17
18if {[permutation] == "inmemory_journal"} {
19  finish_test
20  return
21}
22
23set testprefix dbpagefault
24
25
26faultsim_save_and_close
27do_faultsim_test 1 -prep {
28  faultsim_restore_and_reopen
29  execsql { ATTACH 'test.db2' AS aux; }
30} -body {
31  execsql {
32    CREATE VIRTUAL TABLE t1 USING sqlite_dbpage();
33  }
34} -test {
35  execsql { PRAGMA journal_mode = off }
36  faultsim_test_result {0 {}}
37}
38
39do_faultsim_test 2 -prep {
40  sqlite3 db "xyz.db" -vfs memdb
41  execsql { ATTACH 'test.db2' AS aux; }
42} -body {
43  execsql {
44    CREATE VIRTUAL TABLE t1 USING sqlite_dbpage();
45    INSERT INTO t1 DEFAULT VALUES;
46  }
47} -test {
48  execsql { PRAGMA journal_mode = off }
49  faultsim_test_result {1 {no such schema}}  {1 {SQL logic error}}
50}
51
52finish_test
53