xref: /sqlite-3.40.0/test/mem5.test (revision a6ec892b)
1*a6ec892bSshaneh# 2011 March 9
2*a6ec892bSshaneh#
3*a6ec892bSshaneh# The author disclaims copyright to this source code.  In place of
4*a6ec892bSshaneh# a legal notice, here is a blessing:
5*a6ec892bSshaneh#
6*a6ec892bSshaneh#    May you do good and not evil.
7*a6ec892bSshaneh#    May you find forgiveness for yourself and forgive others.
8*a6ec892bSshaneh#    May you share freely, never taking more than you give.
9*a6ec892bSshaneh#
10*a6ec892bSshaneh#***********************************************************************
11*a6ec892bSshaneh#
12*a6ec892bSshaneh# This file contains tests of the mem5 allocation subsystem.
13*a6ec892bSshaneh#
14*a6ec892bSshaneh
15*a6ec892bSshanehset testdir [file dirname $argv0]
16*a6ec892bSshanehsource $testdir/tester.tcl
17*a6ec892bSshaneh
18*a6ec892bSshanehifcapable !mem5 {
19*a6ec892bSshaneh  finish_test
20*a6ec892bSshaneh  return
21*a6ec892bSshaneh}
22*a6ec892bSshaneh
23*a6ec892bSshaneh# The tests in this file configure the lookaside allocator after a
24*a6ec892bSshaneh# connection is opened. This will not work if there is any "presql"
25*a6ec892bSshaneh# configured (SQL run within the [sqlite3] wrapper in tester.tcl).
26*a6ec892bSshanehif {[info exists ::G(perm:presql)]} {
27*a6ec892bSshaneh  finish_test
28*a6ec892bSshaneh  return
29*a6ec892bSshaneh}
30*a6ec892bSshaneh
31*a6ec892bSshanehdo_test mem5-1.1 {
32*a6ec892bSshaneh  catch {db close}
33*a6ec892bSshaneh  sqlite3_shutdown
34*a6ec892bSshaneh  sqlite3_config_heap 25000000 0
35*a6ec892bSshaneh  sqlite3_config_lookaside 0 0
36*a6ec892bSshaneh  sqlite3_initialize
37*a6ec892bSshaneh} {SQLITE_OK}
38*a6ec892bSshaneh
39*a6ec892bSshaneh# try with min request size = 2^30
40*a6ec892bSshanehdo_test mem5-1.2 {
41*a6ec892bSshaneh  catch {db close}
42*a6ec892bSshaneh  sqlite3_shutdown
43*a6ec892bSshaneh  sqlite3_config_heap 1 1073741824
44*a6ec892bSshaneh  sqlite3_config_lookaside 0 0
45*a6ec892bSshaneh  sqlite3_initialize
46*a6ec892bSshaneh} {SQLITE_NOMEM}
47*a6ec892bSshaneh
48*a6ec892bSshaneh# try with min request size = 2^30+1
49*a6ec892bSshaneh# previously this was causing the memsys5Log() func to infinitely loop.
50*a6ec892bSshanehdo_test mem5-1.3 {
51*a6ec892bSshaneh  catch {db close}
52*a6ec892bSshaneh  sqlite3_shutdown
53*a6ec892bSshaneh  sqlite3_config_heap 1 1073741825
54*a6ec892bSshaneh  sqlite3_config_lookaside 0 0
55*a6ec892bSshaneh  sqlite3_initialize
56*a6ec892bSshaneh} {SQLITE_NOMEM}
57*a6ec892bSshaneh
58*a6ec892bSshanehdo_test mem5-1.4 {
59*a6ec892bSshaneh  catch {db close}
60*a6ec892bSshaneh  sqlite3_shutdown
61*a6ec892bSshaneh  sqlite3_config_heap 0 0
62*a6ec892bSshaneh  sqlite3_config_lookaside 0 0
63*a6ec892bSshaneh  sqlite3_initialize
64*a6ec892bSshaneh} {SQLITE_OK}
65*a6ec892bSshaneh
66*a6ec892bSshanehfinish_test
67