3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing:
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.
10 #***********************************************************************
11 # This file implements regression tests for SQLite library. The
12 # focus of this file is percentile.c extension
15 set testdir [file dirname $argv0]
16 source $testdir/tester.tcl
17 set testprefix unionvtabfault
26 ATTACH 'test.db2' AS aux;
27 CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT);
28 CREATE TABLE t2(a INTEGER PRIMARY KEY, b TEXT);
29 CREATE TABLE aux.t3(a INTEGER PRIMARY KEY, b TEXT);
31 INSERT INTO t1 VALUES(1, 'one'), (2, 'two'), (3, 'three');
32 INSERT INTO t2 VALUES(10, 'ten'), (11, 'eleven'), (12, 'twelve');
33 INSERT INTO t3 VALUES(20, 'twenty'), (21, 'twenty-one'), (22, 'twenty-two');
35 faultsim_save_and_close
37 do_faultsim_test 1.1 -faults * -prep {
38 faultsim_restore_and_reopen
39 load_static_extension db unionvtab
40 execsql { ATTACH 'test.db2' AS aux; }
41 execsql { CREATE TEMP TABLE xyz(x); }
44 CREATE VIRTUAL TABLE temp.uuu USING unionvtab(
45 "VALUES(NULL, 't1', 1, 9), ('main', 't2', 10, 19), ('aux', 't3', 20, 29)"
49 faultsim_test_result {0 {}} \
50 {1 {vtable constructor failed: uuu}} \
51 {1 {sql error: interrupted}}
54 faultsim_restore_and_reopen
55 load_static_extension db unionvtab
56 execsql { ATTACH 'test.db2' AS aux; }
57 execsql { CREATE TEMP TABLE xyz(x); }
59 CREATE VIRTUAL TABLE temp.uuu USING unionvtab(
60 "VALUES(NULL, 't1', 1, 9), ('main', 't2', 10, 19), ('aux', 't3', 20, 29)"
63 do_faultsim_test 1.2 -faults oom* -prep {
65 execsql { SELECT * FROM uuu }
67 faultsim_test_result {0 {1 one 2 two 3 three 10 ten 11 eleven 12 twelve 20 twenty 21 twenty-one 22 twenty-two}}
70 #-------------------------------------------------------------------------
71 # Error while registering the two vtab modules.
72 do_faultsim_test 2.0 -faults * -prep {
76 load_static_extension db unionvtab
78 faultsim_test_result {0 {}} {1 {initialization of unionvtab failed: }}