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

Unified Diff: third_party/sqlite/src/test/sort5.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/sort3.test ('k') | third_party/sqlite/src/test/speed3.test » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/sqlite/src/test/sort5.test
diff --git a/third_party/sqlite/src/test/sort5.test b/third_party/sqlite/src/test/sort5.test
index a02b8f920f3821200eb3cb96788783cd22dd589a..6ada81c9ccf073bdbacabe5042665549197ca993 100644
--- a/third_party/sqlite/src/test/sort5.test
+++ b/third_party/sqlite/src/test/sort5.test
@@ -41,5 +41,78 @@ do_execsql_test 1.2 {
db close
tvfs delete
-finish_test
+#-------------------------------------------------------------------------
+# Test that the PMA size is determined correctly. The PMA size should be
+# roughly the same amount of memory allocated to the main pager cache, or
+# 250 pages if this is larger.
+#
+testvfs tvfs
+tvfs script tv_callback
+tvfs filter {xOpen xWrite}
+
+proc tv_callback {method args} {
+ global iTemp
+ global F
+ switch $method {
+ xOpen {
+ if {[lindex $args 0]==""} { return "temp[incr iTemp]" }
+ return "SQLITE_OK"
+ }
+
+ xWrite {
+ foreach {filename id off amt} $args {}
+ if {[info exists F($id)]==0 || $F($id)<($off + $amt)} {
+ set F($id) [expr $off+$amt]
+ }
+ }
+ }
+}
+
+catch { db close }
+forcedelete test.db
+sqlite3 db test.db -vfs tvfs
+execsql { CREATE TABLE t1(x) }
+
+# Each iteration of the following loop attempts to sort 10001 records
+# each a bit over 100 bytes in size. In total a little more than 1MiB
+# of data.
+#
+foreach {tn pgsz cachesz bTemp} {
+ 1 4096 1000 0
+ 2 1024 1000 1
+
+ 3 4096 -1000 1
+ 4 1024 -1000 1
+
+ 5 4096 -9000 0
+ 6 1024 -9000 0
+} {
+ do_execsql_test 2.$tn.0 "
+ PRAGMA page_size = $pgsz;
+ VACUUM;
+ PRAGMA cache_size = $cachesz;
+ "
+
+ if {[db one {PRAGMA page_size}]!=$pgsz} {
+ # SEE is not able to change page sizes and that messes up the
+ # results that follow.
+ continue
+ }
+
+ do_test 2.$tn.1 {
+ set ::iTemp 0
+ catch { array unset F }
+ execsql {
+ WITH x(i, j) AS (
+ SELECT 1, randomblob(100)
+ UNION ALL
+ SELECT i+1, randomblob(100) FROM x WHERE i<10000
+ )
+ SELECT * FROM x ORDER BY j;
+ }
+ expr {[array names F]!=""}
+ } $bTemp
+}
+
+finish_test
« no previous file with comments | « third_party/sqlite/src/test/sort3.test ('k') | third_party/sqlite/src/test/speed3.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698