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

Side by Side Diff: third_party/sqlite/src/test/mmap4.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/mmap3.test ('k') | third_party/sqlite/src/test/multiplex.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 # 2016 February 04
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 tests the effect of the mmap() or mremap() system calls
13 # returning an error on the library.
14 #
15 # If either mmap() or mremap() fails, SQLite should log an error
16 # message, then continue accessing the database using read() and
17 # write() exclusively.
18 #
19 set testdir [file dirname $argv0]
20 source $testdir/tester.tcl
21 ifcapable !mmap {
22 finish_test
23 return
24 }
25 source $testdir/lock_common.tcl
26 set testprefix mmap4
27
28 # Return a Tcl script that registers a user-defined scalar function
29 # named rblob() with database handle $dbname. The function returns a
30 # sequence of pseudo-random blobs based on seed value $seed.
31 #
32 proc register_rblob_code {dbname seed} {
33 return [subst -nocommands {
34 set ::rcnt $seed
35 proc rblob {n} {
36 set ::rcnt [expr (([set ::rcnt] << 3) + [set ::rcnt] + 456) & 0xFFFFFFFF]
37 set str [format %.8x [expr [set ::rcnt] ^ 0xbdf20da3]]
38 string range [string repeat [set str] [expr [set n]/4]] 1 [set n]
39 }
40 $dbname func rblob rblob
41 }]
42 }
43
44 #-------------------------------------------------------------------------
45 # Test various mmap_size settings.
46 #
47 foreach {tn1 mmap1 mmap2} {
48 1 6144 167773
49 2 18432 140399
50 3 43008 401302
51 4 92160 253899
52 5 190464 2
53 6 387072 752431
54 7 780288 291143
55 8 1566720 594306
56 9 3139584 829137
57 10 6285312 793963
58 11 12576768 1015590
59 } {
60 do_multiclient_test tn {
61 sql1 {
62 CREATE TABLE t1(a PRIMARY KEY);
63 CREATE TABLE t2(x);
64 INSERT INTO t2 VALUES('');
65 }
66
67 code1 [register_rblob_code db 0]
68 code2 [register_rblob_code db2 444]
69
70 sql1 "PRAGMA mmap_size = $mmap1"
71 sql2 "PRAGMA mmap_size = $mmap2"
72
73 do_test $tn1.$tn {
74 for {set i 1} {$i <= 100} {incr i} {
75 if {$i % 2} {
76 set c1 sql1
77 set c2 sql2
78 } else {
79 set c1 sql2
80 set c2 sql1
81 }
82
83 $c1 {
84 INSERT INTO t1 VALUES( rblob(5000) );
85 UPDATE t2 SET x = (SELECT md5sum(a) FROM t1);
86 }
87
88 set res [$c2 {
89 SELECT count(*) FROM t1;
90 SELECT x == (SELECT md5sum(a) FROM t1) FROM t2;
91 PRAGMA integrity_check;
92 }]
93 if {$res != [list $i 1 ok]} {
94 do_test $tn1.$tn.$i {
95 set ::res
96 } [list $i 1 ok]
97 }
98 }
99 set res 1
100 } {1}
101 }
102 }
103
104 finish_test
OLDNEW
« no previous file with comments | « third_party/sqlite/src/test/mmap3.test ('k') | third_party/sqlite/src/test/multiplex.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698