SQLite

Check-in [d43ff7bb8f]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Update the memsubsys1 test script to take into account the buffer size changes of the previous check-in. (CVS 5513)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: d43ff7bb8fc59c54b85658aaeb3dd088a324276f
User & Date: drh 2008-07-31 17:20:59.000
Context
2008-07-31
17:35
Define _GNU_SOURCE only if it is not already defined. Ticket #3263. (CVS 5514) (check-in: bc5abd31a7 user: drh tags: trunk)
17:20
Update the memsubsys1 test script to take into account the buffer size changes of the previous check-in. (CVS 5513) (check-in: d43ff7bb8f user: drh tags: trunk)
17:16
Change the definition of SQLITE_CONFIG_PAGECACHE and SQLITE_CONFIG_SCRATCH to omit the magic "+4" in the buffer size calculation. (CVS 5512) (check-in: e7ed0fe640 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to test/memsubsys1.test.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# 2008 June 18
#
# 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 file contains tests of the memory allocation subsystem
#
# $Id: memsubsys1.test,v 1.6 2008/07/28 19:34:54 drh Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl
sqlite3_reset_auto_extension

# This procedure constructs a new database in test.db.  It fills
# this database with many small records (enough to force multiple













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# 2008 June 18
#
# 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 file contains tests of the memory allocation subsystem
#
# $Id: memsubsys1.test,v 1.7 2008/07/31 17:20:59 drh Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl
sqlite3_reset_auto_extension

# This procedure constructs a new database in test.db.  It fills
# this database with many small records (enough to force multiple
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
do_test memsubsys1-2.3 {
  set pg_ovfl [lindex [sqlite3_status SQLITE_STATUS_PAGECACHE_OVERFLOW 0] 2]
  set pg_used [lindex [sqlite3_status SQLITE_STATUS_PAGECACHE_USED 0] 2]
  expr {$pg_used*1024 + $pg_ovfl}
} $max_pagecache
do_test memsubsys1-2.4 {
  set pg_used [lindex [sqlite3_status SQLITE_STATUS_PAGECACHE_USED 0] 2]
} 20
do_test memsubsys1-2.5 {
  set s_used [lindex [sqlite3_status SQLITE_STATUS_SCRATCH_USED 0] 2]
} 0

# Test 3:  Activate PAGECACHE with 20 pages but use the wrong page size
# so that PAGECACHE is not used.
#







|







73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
do_test memsubsys1-2.3 {
  set pg_ovfl [lindex [sqlite3_status SQLITE_STATUS_PAGECACHE_OVERFLOW 0] 2]
  set pg_used [lindex [sqlite3_status SQLITE_STATUS_PAGECACHE_USED 0] 2]
  expr {$pg_used*1024 + $pg_ovfl}
} $max_pagecache
do_test memsubsys1-2.4 {
  set pg_used [lindex [sqlite3_status SQLITE_STATUS_PAGECACHE_USED 0] 2]
} 19
do_test memsubsys1-2.5 {
  set s_used [lindex [sqlite3_status SQLITE_STATUS_SCRATCH_USED 0] 2]
} 0

# Test 3:  Activate PAGECACHE with 20 pages but use the wrong page size
# so that PAGECACHE is not used.
#
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
build_test_db memsubsys1-3.2 {PRAGMA page_size=2048}
#show_memstats
do_test memsubsys1-3.2.3 {
  db eval {PRAGMA page_size}
} 2048
do_test memsubsys1-3.2.4 {
  set pg_used [lindex [sqlite3_status SQLITE_STATUS_PAGECACHE_USED 0] 2]
} 20
do_test memsubsys1-3.2.5 {
  set s_used [lindex [sqlite3_status SQLITE_STATUS_SCRATCH_USED 0] 2]
} 0

# Test 4:  Activate both PAGECACHE and SCRATCH.
#
db close
sqlite3_shutdown
sqlite3_config_pagecache 1024 50
sqlite3_config_scratch 6000 2
sqlite3_initialize
build_test_db memsubsys1-4 {PRAGMA page_size=1024}
#show_memstats
do_test memsubsys1-4.3 {
  set pg_used [lindex [sqlite3_status SQLITE_STATUS_PAGECACHE_USED 0] 2]
} 50
do_test memsubsys1-4.4 {
  set pg_ovfl [lindex [sqlite3_status SQLITE_STATUS_PAGECACHE_OVERFLOW 0] 2]
  set pg_used [lindex [sqlite3_status SQLITE_STATUS_PAGECACHE_USED 0] 2]
  expr {$pg_used*1024 + $pg_ovfl}
} $max_pagecache
do_test memsubsys1-4.5 {
  set maxreq [lindex [sqlite3_status SQLITE_STATUS_MALLOC_SIZE 0] 2]







|















|







107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
build_test_db memsubsys1-3.2 {PRAGMA page_size=2048}
#show_memstats
do_test memsubsys1-3.2.3 {
  db eval {PRAGMA page_size}
} 2048
do_test memsubsys1-3.2.4 {
  set pg_used [lindex [sqlite3_status SQLITE_STATUS_PAGECACHE_USED 0] 2]
} 19
do_test memsubsys1-3.2.5 {
  set s_used [lindex [sqlite3_status SQLITE_STATUS_SCRATCH_USED 0] 2]
} 0

# Test 4:  Activate both PAGECACHE and SCRATCH.
#
db close
sqlite3_shutdown
sqlite3_config_pagecache 1024 50
sqlite3_config_scratch 6000 2
sqlite3_initialize
build_test_db memsubsys1-4 {PRAGMA page_size=1024}
#show_memstats
do_test memsubsys1-4.3 {
  set pg_used [lindex [sqlite3_status SQLITE_STATUS_PAGECACHE_USED 0] 2]
} 49
do_test memsubsys1-4.4 {
  set pg_ovfl [lindex [sqlite3_status SQLITE_STATUS_PAGECACHE_OVERFLOW 0] 2]
  set pg_used [lindex [sqlite3_status SQLITE_STATUS_PAGECACHE_USED 0] 2]
  expr {$pg_used*1024 + $pg_ovfl}
} $max_pagecache
do_test memsubsys1-4.5 {
  set maxreq [lindex [sqlite3_status SQLITE_STATUS_MALLOC_SIZE 0] 2]
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
sqlite3_config_pagecache 4096 24
sqlite3_config_scratch 6000 2
sqlite3_initialize
build_test_db memsubsys1-5 {PRAGMA page_size=4096}
#show_memstats
do_test memsubsys1-5.3 {
  set pg_used [lindex [sqlite3_status SQLITE_STATUS_PAGECACHE_USED 0] 2]
} 24
do_test memsubsys1-5.4 {
  set maxreq [lindex [sqlite3_status SQLITE_STATUS_MALLOC_SIZE 0] 2]
  expr {$maxreq>4096}
} 1
do_test memsubsys1-5.5 {
  set s_used [lindex [sqlite3_status SQLITE_STATUS_SCRATCH_USED 0] 2]
} 0







|







149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
sqlite3_config_pagecache 4096 24
sqlite3_config_scratch 6000 2
sqlite3_initialize
build_test_db memsubsys1-5 {PRAGMA page_size=4096}
#show_memstats
do_test memsubsys1-5.3 {
  set pg_used [lindex [sqlite3_status SQLITE_STATUS_PAGECACHE_USED 0] 2]
} 23
do_test memsubsys1-5.4 {
  set maxreq [lindex [sqlite3_status SQLITE_STATUS_MALLOC_SIZE 0] 2]
  expr {$maxreq>4096}
} 1
do_test memsubsys1-5.5 {
  set s_used [lindex [sqlite3_status SQLITE_STATUS_SCRATCH_USED 0] 2]
} 0
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
sqlite3_config_pagecache 4096 24
sqlite3_config_scratch 25000 1
sqlite3_initialize
build_test_db memsubsys1-6 {PRAGMA page_size=4096}
#show_memstats
do_test memsubsys1-6.3 {
  set pg_used [lindex [sqlite3_status SQLITE_STATUS_PAGECACHE_USED 0] 2]
} 24
do_test memsubsys1-6.4 {
  set maxreq [lindex [sqlite3_status SQLITE_STATUS_MALLOC_SIZE 0] 2]
} 4096
do_test memsubsys1-6.5 {
  set s_used [lindex [sqlite3_status SQLITE_STATUS_SCRATCH_USED 0] 2]
} 1
do_test memsubsys1-6.6 {







|







174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
sqlite3_config_pagecache 4096 24
sqlite3_config_scratch 25000 1
sqlite3_initialize
build_test_db memsubsys1-6 {PRAGMA page_size=4096}
#show_memstats
do_test memsubsys1-6.3 {
  set pg_used [lindex [sqlite3_status SQLITE_STATUS_PAGECACHE_USED 0] 2]
} 23
do_test memsubsys1-6.4 {
  set maxreq [lindex [sqlite3_status SQLITE_STATUS_MALLOC_SIZE 0] 2]
} 4096
do_test memsubsys1-6.5 {
  set s_used [lindex [sqlite3_status SQLITE_STATUS_SCRATCH_USED 0] 2]
} 1
do_test memsubsys1-6.6 {