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

Side by Side Diff: third_party/sqlite/test/lookaside.test

Issue 3108030: Move bundled copy of sqlite one level deeper to better separate it... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « third_party/sqlite/test/lock7.test ('k') | third_party/sqlite/test/main.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 # 2008 August 01
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 # Tests for the lookaside memory allocator.
13 #
14 # $Id: lookaside.test,v 1.10 2009/04/09 01:23:49 drh Exp $
15
16 set testdir [file dirname $argv0]
17 source $testdir/tester.tcl
18
19 ifcapable !lookaside {
20 finish_test
21 return
22 }
23
24 catch {db close}
25 sqlite3_shutdown
26 sqlite3_config_pagecache 0 0
27 sqlite3_config_scratch 0 0
28 sqlite3_initialize
29 autoinstall_test_functions
30 sqlite3 db test.db
31
32 # Make sure sqlite3_db_config() and sqlite3_db_status are working.
33 #
34 do_test lookaside-1.1 {
35 catch {sqlite3_config_error db}
36 } {0}
37 do_test lookaside-1.2 {
38 sqlite3_db_config_lookaside db 1 18 18
39 } {0}
40 do_test lookaside-1.3 {
41 sqlite3_db_status db SQLITE_DBSTATUS_LOOKASIDE_USED 0
42 } {0 0 0}
43 do_test lookaside-1.4 {
44 db eval {CREATE TABLE t1(w,x,y,z);}
45 foreach {x y z} [sqlite3_db_status db SQLITE_DBSTATUS_LOOKASIDE_USED 0] break
46 expr {$x==0 && $y<$z && $z==18}
47 } {0}
48 do_test lookaside-1.5 {
49 foreach {x y z} [sqlite3_db_status db SQLITE_DBSTATUS_LOOKASIDE_USED 1] break
50 expr {$x==0 && $y<$z && $z==18}
51 } {0}
52 do_test lookaside-1.6 {
53 foreach {x y z} [sqlite3_db_status db SQLITE_DBSTATUS_LOOKASIDE_USED 0] break
54 expr {$x==0 && $y==$z && $y<18}
55 } {1}
56 do_test lookaside-1.7 {
57 db cache flush
58 foreach {x y z} [sqlite3_db_status db SQLITE_DBSTATUS_LOOKASIDE_USED 0] break
59 expr {$x==0 && $y==0 && $z<18}
60 } {1}
61 do_test lookaside-1.8 {
62 db cache flush
63 foreach {x y z} [sqlite3_db_status db SQLITE_DBSTATUS_LOOKASIDE_USED 1] break
64 expr {$x==0 && $y==0 && $z<18}
65 } {1}
66 do_test lookaside-1.9 {
67 db cache flush
68 sqlite3_db_status db SQLITE_DBSTATUS_LOOKASIDE_USED 0
69 } {0 0 0}
70
71 do_test lookaside-2.1 {
72 sqlite3_db_config_lookaside db 0 100 1000
73 } {0}
74 do_test lookaside-2.2 {
75 db eval {CREATE TABLE t2(x);}
76 foreach {x y z} [sqlite3_db_status db SQLITE_DBSTATUS_LOOKASIDE_USED 0] break
77 expr {$x==0 && $y<$z && $z>10 && $z<100}
78 } {1}
79 do_test lookaside-2.3 {
80 sqlite3_db_config_lookaside db 0 50 50
81 } {5} ;# SQLITE_BUSY
82 do_test lookaside-2.4 {
83 db cache flush
84 sqlite3_db_config_lookaside db 0 50 50
85 } {0} ;# SQLITE_OK
86 do_test lookaside-2.5 {
87 sqlite3_db_config_lookaside db 0 -1 50
88 } {0} ;# SQLITE_OK
89 do_test lookaside-2.6 {
90 sqlite3_db_config_lookaside db 0 50 -1
91 } {0} ;# SQLITE_OK
92
93 # sqlite3_db_status() with an invalid verb returns an error.
94 #
95 do_test lookaside-3.1 {
96 sqlite3_db_status db 99999 0
97 } {1 0 0}
98
99 # Test that an invalid verb on sqlite3_config() is detected and
100 # reported as an error.
101 #
102 do_test lookaside-4.1 {
103 db close
104 sqlite3_shutdown
105 catch sqlite3_config_error
106 } {0}
107 sqlite3_initialize
108 autoinstall_test_functions
109
110 finish_test
OLDNEW
« no previous file with comments | « third_party/sqlite/test/lock7.test ('k') | third_party/sqlite/test/main.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698