]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Add new test file "bigmmap.test". For testing builds with
authordan <dan@noemail.net>
Mon, 7 Aug 2017 17:14:30 +0000 (17:14 +0000)
committerdan <dan@noemail.net>
Mon, 7 Aug 2017 17:14:30 +0000 (17:14 +0000)
-DSQLITE_MAX_MMAP_SIZE > 2GB.

FossilOrigin-Name: 17447062799239ee978bedbf7fcc67f4c7d2cad2e82dcf9349a966fc8f67d390

manifest
manifest.uuid
test/bigmmap.test [new file with mode: 0644]

index a26480da8d3df47d429b6eb393129168fbb9f3b2..5d6a67a26458d53c781b2cd848d7780357a5ed09 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sa\ssegfault\sin\sswarmvtab\sthat\scould\soccur\sif\sthere\swas\san\serror\sin\sthe\sSQL\nstatement\spassed\sto\sthe\sconstructor.\sAdd\sother\stest\scases.
-D 2017-08-05T16:15:33.260
+C Add\snew\stest\sfile\s"bigmmap.test".\sFor\stesting\sbuilds\swith\n-DSQLITE_MAX_MMAP_SIZE\s>\s2GB.
+D 2017-08-07T17:14:30.170
 F Makefile.in d9873c9925917cca9990ee24be17eb9613a668012c85a343aef7e5536ae266e8
 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
 F Makefile.msc 02b469e9dcd5b7ee63fc1fb05babc174260ee4cfa4e0ef2e48c3c6801567a016
@@ -608,6 +608,7 @@ F test/bestindex4.test 4cb5ff7dbaebadb87d366f51969271778423b455
 F test/between.test 34d375fb5ce1ae283ffe82b6b233e9f38e84fc6c
 F test/bigfile.test aa74f4e5db51c8e54a1d9de9fa65d01d1eb20b59
 F test/bigfile2.test 1b489a3a39ae90c7f027b79110d6b4e1dbc71bfc
+F test/bigmmap.test 736009b1fa591b4e12b4569d189e8e2020d9c2532aa270db924e6a662d18cd98
 F test/bigrow.test f0aeb7573dcb8caaafea76454be3ade29b7fc747
 F test/bigsort.test 8299fa9298f4f1e02fc7d2712e8b77d6cd60e5a2
 F test/bind.test 1e136709b306f7ed3192d349c2930d89df6ab621654ad6f1a72381d3fe76f483
@@ -1643,7 +1644,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 422cd9f39403feeacd70133c7a147e23572c75d617ac564344f016ae6611162c
-R dfa04873a550ce06576a091a701d0729
+P 6ce8b7ca62fcf97875395fc1a989179309e0abb48d4465658ef0d871434ea057
+R 3b0c549f417e6fd62b9ba8e08d16cf4f
 U dan
-Z f26bc896b278db4548da6d42aa588fb6
+Z e94b45dfaab9d16336ea58094ef5df91
index 257235744fa3edc44db2504033bb3f2d07068e3b..9f1b204c34f67ea73812ccaa521f59f6bd769c8f 100644 (file)
@@ -1 +1 @@
-6ce8b7ca62fcf97875395fc1a989179309e0abb48d4465658ef0d871434ea057
\ No newline at end of file
+17447062799239ee978bedbf7fcc67f4c7d2cad2e82dcf9349a966fc8f67d390
\ No newline at end of file
diff --git a/test/bigmmap.test b/test/bigmmap.test
new file mode 100644 (file)
index 0000000..8ab93dd
--- /dev/null
@@ -0,0 +1,104 @@
+# 2017 August 07
+#
+# The author disclaims copyright to this source code.  In place of
+# a legal notice, here is a blessing:
+#
+#    May you do good and not evil.
+#    May you find forgiveness for yourself and forgive others.
+#    May you share freely, never taking more than you give.
+#
+#***********************************************************************
+# This file implements regression tests for SQLite library.  The
+# focus of this script testing the ability of SQLite to use mmap
+# to access files larger than 4GiB.
+#
+
+if {[file exists skip-big-file]} return
+if {$tcl_platform(os)=="Darwin"} return
+
+set testdir [file dirname $argv0]
+source $testdir/tester.tcl
+set testprefix bigmmap
+
+ifcapable !mmap {
+  finish_test
+  return
+}
+
+set mmap_limit 0
+db eval { 
+  SELECT compile_options AS x FROM pragma_compile_options 
+  WHERE x LIKE 'max_mmap_size=%' 
+} {
+  regexp {MAX_MMAP_SIZE=(.*)} $x -> mmap_limit
+}
+if {$mmap_limit < [expr 8 * 1<<30]} {
+  puts "Skipping bigmmap.test - requires SQLITE_MAX_MMAP_SIZE >= 8G"
+  finish_test
+  return
+}
+
+
+#-------------------------------------------------------------------------
+# Create the database file roughly 8GiB in size. Most pages are unused,
+# except that there is a table and index clustered around each 1GiB
+# boundary.
+#
+do_execsql_test 1.0 {
+  PRAGMA page_size = 4096;
+  CREATE TABLE t0(a INTEGER PRIMARY KEY, b, c, UNIQUE(b, c));
+  WITH  s(i) AS ( SELECT 1 UNION ALL SELECT i+1 FROM s LIMIT 100 )
+  INSERT INTO t0 SELECT i, 't0', randomblob(800) FROM s;
+}
+
+for {set i 1} {$i < 8} {incr i} {
+  fake_big_file [expr $i*1024] [get_pwd]/test.db
+  hexio_write test.db 28 [format %.8x [expr ($i*1024*1024*1024/4096) - 5]]
+
+  do_execsql_test 1.$i "
+    CREATE TABLE t$i (a INTEGER PRIMARY KEY, b, c, UNIQUE(b, c));
+    WITH  s(i) AS ( SELECT 1 UNION ALL SELECT i+1 FROM s LIMIT 100 )
+      INSERT INTO t$i SELECT i, 't$i', randomblob(800) FROM s;
+  "
+}
+
+#-------------------------------------------------------------------------
+# Check that data can be retrieved from the db with a variety of 
+# configured mmap size limits.
+#
+for {set i 0} {$i < 9} {incr i} {
+
+  # Configure a memory mapping $i GB in size.
+  #
+  set val [expr $i*1024*1024*1024]
+  execsql "PRAGMA main.mmap_size = $val"
+  do_execsql_test 2.$i.0 {
+    PRAGMA main.mmap_size
+  } $val
+
+  for {set t 0} {$t < 8} {incr t} {
+    do_execsql_test 2.$i.$t.1 "
+      SELECT count(*) FROM t$t;
+      SELECT count(b || c) FROM t$t GROUP BY b;
+    " {100 100}
+  
+    do_execsql_test 2.$i.$t.2 "
+      SELECT * FROM t$t AS o WHERE 
+        NOT EXISTS( SELECT * FROM t$t AS i WHERE a=o.a AND +b=o.b AND +c=o.c )
+      ORDER BY b, c;
+    " {}
+    
+    do_eqp_test 2.$i.$t.3 "
+      SELECT * FROM t$t AS o WHERE 
+        NOT EXISTS( SELECT * FROM t$t AS i WHERE a=o.a AND +b=o.b AND +c=o.c )
+      ORDER BY b, c;
+    " "
+      0 0 0 {SCAN TABLE t$t AS o USING COVERING INDEX sqlite_autoindex_t${t}_1}
+      0 0 0 {EXECUTE CORRELATED SCALAR SUBQUERY 1}
+      1 0 0 {SEARCH TABLE t$t AS i USING INTEGER PRIMARY KEY (rowid=?)}
+    "
+  }
+}
+
+finish_test
+