Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(326)

Side by Side Diff: third_party/sqlite/sqlite-src-3170000/test/shrink.test

Issue 2747283002: [sql] Import reference version of SQLite 3.17.. (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 # 2011 November 16
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 file contains test cases for sqlite3_db_release_memory and
13 # the PRAGMA shrink_memory statement.
14 #
15
16 set testdir [file dirname $argv0]
17 source $testdir/tester.tcl
18 test_set_config_pagecache 0 0
19
20 unset -nocomplain baseline
21 do_test shrink-1.1 {
22 db eval {
23 PRAGMA cache_size = 2000;
24 CREATE TABLE t1(x,y);
25 INSERT INTO t1 VALUES(randomblob(1000000),1);
26 }
27 set ::baseline sqlite3_memory_used
28 # EVIDENCE-OF: R-58814-63508 The sqlite3_db_release_memory(D) interface
29 # attempts to free as much heap memory as possible from database
30 # connection D.
31 sqlite3_db_release_memory db
32 expr {$::baseline > [sqlite3_memory_used]+500000}
33 } {1}
34 do_test shrink-1.2 {
35 set baseline [sqlite3_memory_used]
36 db eval {
37 UPDATE t1 SET y=y+1;
38 }
39 expr {$::baseline+500000 < [sqlite3_memory_used]}
40 } {1}
41 do_test shrink-1.3 {
42 set baseline [sqlite3_memory_used]
43 db eval {PRAGMA shrink_memory}
44 expr {$::baseline > [sqlite3_memory_used]+500000}
45 } {1}
46
47 test_restore_config_pagecache
48 finish_test
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698