]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Add test file mmapwarm.test. With tests for the sqlite3_mmap_warm() extension.
authordan <dan@noemail.net>
Wed, 11 Oct 2017 20:27:03 +0000 (20:27 +0000)
committerdan <dan@noemail.net>
Wed, 11 Oct 2017 20:27:03 +0000 (20:27 +0000)
FossilOrigin-Name: 5c4980ef17291dcea5e93ead353b9a95e2fbff56ff7257e9878d095f6827b4e9

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

index b8e6ca811e12daaee625352997bd2eecbac3c2d2..d3e7c578b68b12e6f07ffb1da019d803050055df 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C In\sthe\sspeed-check.sh\stest\sscript,\sallow\san\sadditional\stest-name\sargument\nwhich\sbecomes\sthe\scomparison\sbaseline,\sin\splace\sof\s"trunk".
-D 2017-10-11T12:20:36.082
+C Add\stest\sfile\smmapwarm.test.\sWith\stests\sfor\sthe\ssqlite3_mmap_warm()\sextension.
+D 2017-10-11T20:27:03.845
 F Makefile.in 4bc36d913c2e3e2d326d588d72f618ac9788b2fd4b7efda61102611a6495c3ff
 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
 F Makefile.msc 6033b51b6aea702ea059f6ab2d47b1d3cef648695f787247dd4fb395fe60673f
@@ -1054,6 +1054,7 @@ F test/mmap2.test 9d6dd9ddb4ad2379f29cc78f38ce1e63ed418022
 F test/mmap3.test b3c297e78e6a8520aafcc1a8f140535594c9086e
 F test/mmap4.test 2e2b4e32555b58da15176e6fe750f17c9dcf7f93
 F test/mmapfault.test d4c9eff9cd8c2dc14bc43e71e042f175b0a26fe3
+F test/mmapwarm.test fea1c17c538afaf4cdc914ad2a3f9c9c34a5d00e9a5d6423ddb6083c91aed6ab
 F test/multiplex.test dc0d67b66f84b484a83cb8bbdf3f0a7f49562ccd
 F test/multiplex2.test 580ca5817c7edbe4cc68fa150609c9473393003a
 F test/multiplex3.test d228f59eac91839a977eac19f21d053f03e4d101
@@ -1656,7 +1657,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 b8c1b5a584aeb6ab63cff875ca16135efeadac16b4b32afa589845477feebf32
-R 9a03aa36b167c86705816bfaa31cdc19
-U drh
-Z 8f5e2f1e221681e7d4bf20eb32b86754
+P 0245adffc6f9b580217e0d2feb396d6895e54cdc25f5dfc9c8f4090b919e9e49
+R a1117ec420d64b4ef2d3498dc99fc25e
+U dan
+Z 24c1dfd62587ab303e50a574dce24d2b
index 7305d2515a0bfb6c5cc322b75d749cd765d511b3..c1604490912be25ebba5d8aa7cb5e61b2673df50 100644 (file)
@@ -1 +1 @@
-0245adffc6f9b580217e0d2feb396d6895e54cdc25f5dfc9c8f4090b919e9e49
\ No newline at end of file
+5c4980ef17291dcea5e93ead353b9a95e2fbff56ff7257e9878d095f6827b4e9
\ No newline at end of file
diff --git a/test/mmapwarm.test b/test/mmapwarm.test
new file mode 100644 (file)
index 0000000..6072ab8
--- /dev/null
@@ -0,0 +1,80 @@
+# 20 September 18
+#
+# 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.
+#
+#***********************************************************************
+#
+
+set testdir [file dirname $argv0]
+source $testdir/tester.tcl
+
+
+if 0 {
+  db close
+  sqlite3_shutdown
+  proc msg {args} { puts $args }
+  test_sqlite3_log msg
+  sqlite3 db test.db
+}
+
+set testprefix mmapwarm
+
+
+do_execsql_test 1.0 {
+  CREATE TABLE t1(x, y);
+  WITH s(i) AS (
+    SELECT 1 UNION ALL SELECT i+1 FROM s WHERE i<500
+  )
+  INSERT INTO t1 SELECT randomblob(400), randomblob(500) FROM s;
+  PRAGMA page_count;
+} {507}
+db close
+
+do_test 1.1 {
+  sqlite3 db test.db
+  db eval {PRAGMA mmap_size = 1000000}
+  sqlite3_mmap_warm db
+} {SQLITE_OK}
+
+do_test 1.2 {
+  db close
+  sqlite3 db test.db
+  db eval {PRAGMA mmap_size = 1000000}
+  sqlite3_mmap_warm db "main"
+} {SQLITE_OK}
+
+do_test 1.3 {
+  sqlite3 db test.db
+  sqlite3_mmap_warm db
+} {SQLITE_OK}
+
+do_test 1.4 {
+  db close
+  sqlite3 db test.db
+  sqlite3_mmap_warm db "main"
+} {SQLITE_OK}
+
+do_test 2.0 {
+  db close
+  sqlite3 db test.db
+  db eval BEGIN
+  sqlite3_mmap_warm db "main"
+} {SQLITE_MISUSE}
+
+do_faultsim_test 3 -faults oom* -prep {
+  sqlite3 db test.db
+  sqlite3_db_config_lookaside db 0 0 0
+  db eval { PRAGMA mmap_size = 1000000 }
+  db eval { SELECT * FROM sqlite_master }
+} -body {
+  sqlite3_mmap_warm db "main"
+} -test {
+  faultsim_test_result {0 SQLITE_OK} {0 SQLITE_NOMEM}
+}
+finish_test