xref: /sqlite-3.40.0/test/mallocI.test (revision 701bb3b4)
1# 2008 August 01
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# This test script checks malloc failures in various obscure operations.
13#
14# $Id: mallocI.test,v 1.1 2008/08/02 03:50:39 drh Exp $
15
16set testdir [file dirname $argv0]
17source $testdir/tester.tcl
18source $testdir/malloc_common.tcl
19
20# Malloc failures in a view.
21#
22do_malloc_test mallocI-1 -sqlprep {
23  CREATE TABLE t1(a,b,c,d);
24  CREATE VIEW v1 AS SELECT a*b, c*d FROM t1 ORDER BY b-d;
25} -sqlbody {
26  SELECT * FROM v1
27}
28
29# Malloc failure while trying to service a pragma on a TEMP database.
30#
31do_malloc_test mallocI-2 -sqlbody {
32  PRAGMA temp.page_size
33}
34
35# Malloc failure while creating a table from a SELECT statement.
36#
37do_malloc_test mallocI-3 -sqlprep {
38  CREATE TABLE t1(a,b,c);
39} -sqlbody {
40  CREATE TABLE t2 AS SELECT b,c FROM t1;
41}
42
43finish_test
44