xref: /sqlite-3.40.0/test/mallocG.test (revision c4dd3fd2)
1# 2007 Aug 29
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: mallocG.test,v 1.1 2008/01/22 01:48:09 drh Exp $
15
16set testdir [file dirname $argv0]
17source $testdir/tester.tcl
18
19# Only run these tests if memory debugging is turned on.
20#
21ifcapable !memdebug {
22   puts "Skipping mallocG tests: not compiled with -DSQLITE_MEMDEBUG..."
23   finish_test
24   return
25}
26source $testdir/malloc_common.tcl
27
28# Malloc failures while opening a database connection.
29#
30do_malloc_test malloeG-1 -tclbody {
31  db close
32  sqlite3 db test.db
33}
34
35do_malloc_test mallocG-2 -sqlprep {
36  CREATE TABLE t1(x, y);
37  CREATE TABLE t2(x INTEGER PRIMARY KEY);
38} -sqlbody {
39  SELECT y FROM t1 WHERE x IN t2;
40}
41
42finish_test
43