xref: /sqlite-3.40.0/test/mallocL.test (revision a23bc8a3)
1*793bd861Sdan# 2014 August 12
2*793bd861Sdan#
3*793bd861Sdan# The author disclaims copyright to this source code.  In place of
4*793bd861Sdan# a legal notice, here is a blessing:
5*793bd861Sdan#
6*793bd861Sdan#    May you do good and not evil.
7*793bd861Sdan#    May you find forgiveness for yourself and forgive others.
8*793bd861Sdan#    May you share freely, never taking more than you give.
9*793bd861Sdan#
10*793bd861Sdan#***********************************************************************
11*793bd861Sdan#
12*793bd861Sdan# This test script is designed to show that the assert() fix at
13*793bd861Sdan# [f1cb48f412] really is required.
14*793bd861Sdan#
15*793bd861Sdan
16*793bd861Sdanset testdir [file dirname $argv0]
17*793bd861Sdansource $testdir/tester.tcl
18*793bd861Sdansource $testdir/malloc_common.tcl
19*793bd861Sdanset testprefix mallocL
20*793bd861Sdan
21*793bd861Sdando_test 1.0 {
22*793bd861Sdan  for {set i 0} {$i < 40} {incr i} {
23*793bd861Sdan    lappend cols "c$i"
24*793bd861Sdan    lappend vals $i
25*793bd861Sdan  }
26*793bd861Sdan
27*793bd861Sdan  execsql "CREATE TABLE t1([join $cols ,])"
28*793bd861Sdan  execsql "CREATE INDEX i1 ON t1([join $cols ,])"
29*793bd861Sdan  execsql "INSERT INTO t1 VALUES([join $vals ,])"
30*793bd861Sdan} {}
31*793bd861Sdan
32*793bd861Sdanfor {set j 1} {$j < 40} {incr j} {
33*793bd861Sdan  set ::sql "SELECT DISTINCT [join [lrange $cols 0 $j] ,] FROM t1"
34*793bd861Sdan  do_faultsim_test 1.$j -faults oom* -body {
35*793bd861Sdan    execsql $::sql
36*793bd861Sdan  } -test {
37*793bd861Sdan    faultsim_test_result [list 0 [lrange $::vals 0 $::j]]
38*793bd861Sdan  }
39*793bd861Sdan}
40*793bd861Sdan
41*793bd861Sdan
42*793bd861Sdanfinish_test
43