diff options
author | Jan Mercl <0xjnml@gmail.com> | 2020-07-26 22:36:18 +0200 |
---|---|---|
committer | Jan Mercl <0xjnml@gmail.com> | 2020-07-26 22:36:18 +0200 |
commit | b406626c64313ae348996c243a0a05d3f6ed2c3c (patch) | |
tree | 0eaae4fa6348b150568725e6f2ec0b4c4203b5f8 /testdata/tcl/mallocH.test | |
parent | d8d9f40ce80062793349c0ea47520b6878312f4a (diff) |
release v1.4.0-beta1v1.4.0-beta1
Diffstat (limited to 'testdata/tcl/mallocH.test')
-rw-r--r-- | testdata/tcl/mallocH.test | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/testdata/tcl/mallocH.test b/testdata/tcl/mallocH.test new file mode 100644 index 0000000..7017b38 --- /dev/null +++ b/testdata/tcl/mallocH.test @@ -0,0 +1,73 @@ +# 2008 August 01 +# +# 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 test script checks malloc failures in various obscure operations. +# +# $Id: mallocH.test,v 1.2 2008/08/01 20:10:09 drh Exp $ + +set testdir [file dirname $argv0] +source $testdir/tester.tcl +source $testdir/malloc_common.tcl + +# Malloc failures in journaling of in-memory databases. +# +do_malloc_test mallocH-1 -tclprep { + db close + sqlite3 db :memory: + db eval { + CREATE TABLE t1(x UNIQUE, y); + INSERT INTO t1 VALUES(1,2); + } +} -sqlbody { + INSERT INTO t1 SELECT x+1, y+100 FROM t1; +} + +# Malloc failures while parsing a CASE expression. +# +do_malloc_test mallocH-2 -sqlbody { + SELECT CASE WHEN 1 THEN 1 END; +} + +# Malloc failures while parsing a EXISTS(SELECT ...) +# +do_malloc_test mallocH-3 -sqlbody { + SELECT 3+EXISTS(SELECT * FROM sqlite_master); +} + +# Malloc failures within the replace() function. +# +do_malloc_test mallocH-3 -sqlbody { + SELECT replace('ababa','a','xyzzy'); +} + +# Malloc failures during EXPLAIN. +# +ifcapable explain { + do_malloc_test mallocH-4 -sqlprep { + CREATE TABLE abc(a PRIMARY KEY, b, c); + } -sqlbody { + EXPLAIN SELECT * FROM abc AS t2 WHERE rowid=1; + EXPLAIN QUERY PLAN SELECT * FROM abc AS t2 WHERE rowid=1; + } +} + +# Malloc failure during integrity_check pragma. +# +do_malloc_test mallocH-5 -sqlprep { + CREATE TABLE t1(a PRIMARY KEY, b UNIQUE); + CREATE TABLE t2(x,y); + INSERT INTO t1 VALUES(1,2); + INSERT INTO t2 SELECT * FROM t1; +} -sqlbody { + PRAGMA integrity_check; +} + +finish_test |