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

Side by Side Diff: third_party/sqlite/src/test/vacuummem.test

Issue 2751253002: [sql] Import SQLite 3.17.0. (Closed)
Patch Set: also clang on Linux i386 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
« no previous file with comments | « third_party/sqlite/src/test/vacuum5.test ('k') | third_party/sqlite/src/test/view.test » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # 2005 February 15
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 # This file implements regression tests for SQLite library. The
12 # focus of this file is testing that the VACUUM statement correctly
13 # frees any memory used for a temporary cache.
14 #
15
16 set testdir [file dirname $argv0]
17 source $testdir/tester.tcl
18 set testprefix vacuummem
19
20 if {[permutation]=="memsubsys1"} {
21 finish_test
22 return
23 }
24
25 # If ENABLE_MEMORY_MANAGEMENT is defined, when VACUUM is run the temp db
26 # is able to borrow space from the main db (and it does, because the
27 # temp db is configure with a very small cache). When the VACUUM is
28 # finished and the temp db closed, all the page-cache memory currently
29 # assigned to the temp db is freed. If ENABLE_MEMORY_MANAGEMENT is defined
30 # this causes the total memory usage to drop much more than expected,
31 # causing tests in this file to fail.
32 #
33 ifcapable memorymanage {
34 finish_test
35 return
36 }
37
38
39 proc memory_used {} {
40 set stat [sqlite3_status SQLITE_STATUS_MEMORY_USED 1]
41 lindex $stat 1
42 }
43
44 do_execsql_test 1.0 {
45 PRAGMA cache_size = -2000;
46 CREATE TABLE t1(a, b, c);
47
48 WITH r(i) AS (
49 SELECT 1 UNION ALL SELECT i+1 FROM r WHERE i<100000
50 )
51 INSERT INTO t1 SELECT randomblob(100),randomblob(100),randomblob(100) FROM r;
52
53 CREATE INDEX t1a ON t1(a);
54 CREATE INDEX t1b ON t1(b);
55 CREATE INDEX t1c ON t1(c);
56 }
57 set ans "#/[memory_used]/"
58
59 do_test 1.1 { memory_used } $ans
60
61 do_execsql_test 1.2 VACUUM
62
63 do_test 1.3 { memory_used } $ans
64
65 do_execsql_test 1.4 {
66 SELECT count(*) FROM t1 WHERE +a IS NOT NULL
67 } {100000}
68
69 do_test 1.5 { memory_used } $ans
70
71
72
73 finish_test
OLDNEW
« no previous file with comments | « third_party/sqlite/src/test/vacuum5.test ('k') | third_party/sqlite/src/test/view.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698