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

Unified Diff: third_party/sqlite/src/test/mmap1.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/sqlite/src/test/misc8.test ('k') | third_party/sqlite/src/test/mmap3.test » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/sqlite/src/test/mmap1.test
diff --git a/third_party/sqlite/src/test/mmap1.test b/third_party/sqlite/src/test/mmap1.test
index 18aec9f8fa638e6e98776e83b6b6debea74e6a49..c7c72c0ab2c93ca43b009f782e254ee57a569d79 100644
--- a/third_party/sqlite/src/test/mmap1.test
+++ b/third_party/sqlite/src/test/mmap1.test
@@ -28,6 +28,10 @@ proc nRead {db} {
return $stats(read)
}
+# Return a Tcl script that registers a user-defined scalar function
+# named rblob() with database handle $dbname. The function returns a
+# sequence of pseudo-random blobs based on seed value $seed.
+#
proc register_rblob_code {dbname seed} {
return [subst -nocommands {
set ::rcnt $seed
@@ -40,6 +44,7 @@ proc register_rblob_code {dbname seed} {
}]
}
+
# For cases 1.1 and 1.4, the number of pages read using xRead() is 4 on
# unix and 9 on windows. The difference is that windows only ever maps
# an integer number of OS pages (i.e. creates mappings that are a multiple
@@ -83,7 +88,7 @@ foreach {t mmap_size nRead c2init} {
sql2 { DELETE FROM t1 WHERE rowid%2; }
do_test $t.$tn.2 {
sql1 "SELECT count(*) FROM t1; PRAGMA integrity_check ; PRAGMA page_count"
- } {16 ok 42}
+ } "16 ok [expr {42+[nonzero_reserved_bytes]}]"
# Have connection 2 grow the file. Check connection 1 can still read it.
sql2 { INSERT INTO t1 SELECT rblob(500), rblob(500) FROM t1 }
@@ -99,7 +104,9 @@ foreach {t mmap_size nRead c2init} {
# Check that the number of pages read by connection 1 indicates that the
# "PRAGMA mmap_size" command worked.
- do_test $t.$tn.5 { nRead db } $nRead
+ if {[nonzero_reserved_bytes]==0} {
+ do_test $t.$tn.5 { nRead db } $nRead
+ }
}
}
@@ -269,65 +276,5 @@ do_test 5.5 {
sqlite3_finalize $::STMT
} SQLITE_OK
-#-------------------------------------------------------------------------
-# Test various mmap_size settings.
-#
-foreach {tn1 mmap1 mmap2} {
- 1 6144 167773
- 2 18432 140399
- 3 43008 401302
- 4 92160 253899
- 5 190464 2
- 6 387072 752431
- 7 780288 291143
- 8 1566720 594306
- 9 3139584 829137
- 10 6285312 793963
- 11 12576768 1015590
-} {
- do_multiclient_test tn {
- sql1 {
- CREATE TABLE t1(a PRIMARY KEY);
- CREATE TABLE t2(x);
- INSERT INTO t2 VALUES('');
- }
-
- code1 [register_rblob_code db 0]
- code2 [register_rblob_code db2 444]
-
- sql1 "PRAGMA mmap_size = $mmap1"
- sql2 "PRAGMA mmap_size = $mmap2"
-
- do_test $tn1.$tn {
- for {set i 1} {$i <= 100} {incr i} {
- if {$i % 2} {
- set c1 sql1
- set c2 sql2
- } else {
- set c1 sql2
- set c2 sql1
- }
-
- $c1 {
- INSERT INTO t1 VALUES( rblob(5000) );
- UPDATE t2 SET x = (SELECT md5sum(a) FROM t1);
- }
-
- set res [$c2 {
- SELECT count(*) FROM t1;
- SELECT x == (SELECT md5sum(a) FROM t1) FROM t2;
- PRAGMA integrity_check;
- }]
- if {$res != [list $i 1 ok]} {
- do_test $tn1.$tn.$i {
- set ::res
- } [list $i 1 ok]
- }
- }
- set res 1
- } {1}
- }
-}
-
finish_test
« no previous file with comments | « third_party/sqlite/src/test/misc8.test ('k') | third_party/sqlite/src/test/mmap3.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698