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

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

Issue 901033002: Import SQLite 3.8.7.4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Chromium changes to support SQLite 3.8.7.4. Created 5 years, 10 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
1 # 2007 March 24 1 # 2007 March 24
2 # 2 #
3 # The author disclaims copyright to this source code. In place of 3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing: 4 # a legal notice, here is a blessing:
5 # 5 #
6 # May you do good and not evil. 6 # May you do good and not evil.
7 # May you find forgiveness for yourself and forgive others. 7 # May you find forgiveness for yourself and forgive others.
8 # May you share freely, never taking more than you give. 8 # May you share freely, never taking more than you give.
9 # 9 #
10 #*********************************************************************** 10 #***********************************************************************
11 # This file implements regression tests for SQLite library. 11 # This file implements regression tests for SQLite library.
12 # 12 #
13 # $Id: exclusive2.test,v 1.10 2008/11/27 02:22:11 drh Exp $ 13 # $Id: exclusive2.test,v 1.10 2008/11/27 02:22:11 drh Exp $
14 14
15 set testdir [file dirname $argv0] 15 set testdir [file dirname $argv0]
16 source $testdir/tester.tcl 16 source $testdir/tester.tcl
17 17
18 # Do not use a codec for tests in this file, as the database file is 18 # Do not use a codec for tests in this file, as the database file is
19 # manipulated directly using tcl scripts (using the [hexio_write] command). 19 # manipulated directly using tcl scripts (using the [hexio_write] command).
20 # 20 #
21 do_not_use_codec 21 do_not_use_codec
22 22
23 ifcapable {!pager_pragmas} { 23 ifcapable {!pager_pragmas} {
24 finish_test 24 finish_test
25 return 25 return
26 } 26 }
27 27
28 # Tests in this file verify that locking_mode=exclusive causes SQLite to
29 # use cached pages even if the database is changed on disk. This doesn't
30 # work with mmap.
31 if {[permutation]=="mmap"} {
32 finish_test
33 return
34 }
35
28 # This module does not work right if the cache spills at unexpected 36 # This module does not work right if the cache spills at unexpected
29 # moments. So disable the soft-heap-limit. 37 # moments. So disable the soft-heap-limit.
30 # 38 #
31 sqlite3_soft_heap_limit 0 39 sqlite3_soft_heap_limit 0
32 40
33 proc pagerChangeCounter {filename new {fd ""}} { 41 proc pagerChangeCounter {filename new {fd ""}} {
34 if {$fd==""} { 42 if {$fd==""} {
35 set fd [open $filename RDWR] 43 set fd [open $filename RDWR]
36 fconfigure $fd -translation binary -encoding binary 44 fconfigure $fd -translation binary -encoding binary
37 set needClose 1 45 set needClose 1
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 260
253 #-------------------------------------------------------------------- 261 #--------------------------------------------------------------------
254 # These tests - exclusive2-3.X - verify that the pager change-counter 262 # These tests - exclusive2-3.X - verify that the pager change-counter
255 # is only incremented by the first change when in exclusive access 263 # is only incremented by the first change when in exclusive access
256 # mode. In normal mode, the change-counter is incremented once 264 # mode. In normal mode, the change-counter is incremented once
257 # per write-transaction. 265 # per write-transaction.
258 # 266 #
259 267
260 db close 268 db close
261 catch {close $::fd} 269 catch {close $::fd}
262 file delete -force test.db 270 forcedelete test.db
263 file delete -force test.db-journal 271 forcedelete test.db-journal
264 272
265 do_test exclusive2-3.0 { 273 do_test exclusive2-3.0 {
266 sqlite3 db test.db 274 sqlite3 db test.db
267 execsql { 275 execsql {
268 BEGIN; 276 BEGIN;
269 CREATE TABLE t1(a UNIQUE); 277 CREATE TABLE t1(a UNIQUE);
270 INSERT INTO t1 VALUES(randstr(200, 200)); 278 INSERT INTO t1 VALUES(randstr(200, 200));
271 INSERT INTO t1 VALUES(randstr(200, 200)); 279 INSERT INTO t1 VALUES(randstr(200, 200));
272 COMMIT; 280 COMMIT;
273 } 281 }
(...skipping 12 matching lines...) Expand all
286 readPagerChangeCounter test.db 294 readPagerChangeCounter test.db
287 } {3} 295 } {3}
288 do_test exclusive2-3.3 { 296 do_test exclusive2-3.3 {
289 execsql { 297 execsql {
290 PRAGMA locking_mode = exclusive; 298 PRAGMA locking_mode = exclusive;
291 INSERT INTO t1 VALUES(randstr(200, 200)); 299 INSERT INTO t1 VALUES(randstr(200, 200));
292 } 300 }
293 readPagerChangeCounter test.db 301 readPagerChangeCounter test.db
294 } {4} 302 } {4}
295 do_test exclusive2-3.4 { 303 do_test exclusive2-3.4 {
296 breakpoint
297 execsql { 304 execsql {
298 INSERT INTO t1 VALUES(randstr(200, 200)); 305 INSERT INTO t1 VALUES(randstr(200, 200));
299 } 306 }
300 readPagerChangeCounter test.db 307 readPagerChangeCounter test.db
301 } {4} 308 } {4}
302 do_test exclusive2-3.5 { 309 do_test exclusive2-3.5 {
303 execsql { 310 execsql {
304 PRAGMA locking_mode = normal; 311 PRAGMA locking_mode = normal;
305 INSERT INTO t1 VALUES(randstr(200, 200)); 312 INSERT INTO t1 VALUES(randstr(200, 200));
306 } 313 }
307 readPagerChangeCounter test.db 314 readPagerChangeCounter test.db
308 } {4} 315 } {4}
309 do_test exclusive2-3.6 { 316 do_test exclusive2-3.6 {
310 execsql { 317 execsql {
311 INSERT INTO t1 VALUES(randstr(200, 200)); 318 INSERT INTO t1 VALUES(randstr(200, 200));
312 } 319 }
313 readPagerChangeCounter test.db 320 readPagerChangeCounter test.db
314 } {5} 321 } {5}
315 sqlite3_soft_heap_limit $cmdlinearg(soft-heap-limit) 322 sqlite3_soft_heap_limit $cmdlinearg(soft-heap-limit)
316 323
317 finish_test 324 finish_test
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698