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

Unified Diff: third_party/sqlite/src/test/sort3.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/sort2.test ('k') | third_party/sqlite/src/test/sort5.test » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/sqlite/src/test/sort3.test
diff --git a/third_party/sqlite/src/test/sort3.test b/third_party/sqlite/src/test/sort3.test
index 80d8bbca3f0e0d0717d4ce03305a2ec722ac1065..088ae1642d6d62bde6fbeb3f8a1517e2d39c922e 100644
--- a/third_party/sqlite/src/test/sort3.test
+++ b/third_party/sqlite/src/test/sort3.test
@@ -19,6 +19,53 @@ set testdir [file dirname $argv0]
source $testdir/tester.tcl
set testprefix sort3
+#-------------------------------------------------------------------------
+# Sort some large ( > 4KiB) records.
+#
+proc cksum {x} {
+ set i1 1
+ set i2 2
+ binary scan $x c* L
+ foreach {a b} $L {
+ set i1 [expr (($i2<<3) + $a) & 0x7FFFFFFF]
+ set i2 [expr (($i1<<3) + $b) & 0x7FFFFFFF]
+ }
+ list $i1 $i2
+}
+db func cksum cksum
+
+do_execsql_test 1.0 {
+ PRAGMA cache_size = 5;
+ CREATE TABLE t11(a, b);
+ INSERT INTO t11 VALUES(randomblob(5000), NULL);
+ INSERT INTO t11 SELECT randomblob(5000), NULL FROM t11; --2
+ INSERT INTO t11 SELECT randomblob(5000), NULL FROM t11; --3
+ INSERT INTO t11 SELECT randomblob(5000), NULL FROM t11; --4
+ INSERT INTO t11 SELECT randomblob(5000), NULL FROM t11; --5
+ INSERT INTO t11 SELECT randomblob(5000), NULL FROM t11; --6
+ INSERT INTO t11 SELECT randomblob(5000), NULL FROM t11; --7
+ INSERT INTO t11 SELECT randomblob(5000), NULL FROM t11; --8
+ INSERT INTO t11 SELECT randomblob(5000), NULL FROM t11; --9
+ UPDATE t11 SET b = cksum(a);
+}
+
+foreach {tn mmap_limit} {
+ 1 0
+ 2 1000000
+} {
+ do_test 1.$tn {
+ sqlite3_test_control SQLITE_TESTCTRL_SORTER_MMAP db $mmap_limit
+ set prev ""
+ db eval { SELECT * FROM t11 ORDER BY b } {
+ if {$b != [cksum $a]} {error "checksum failed"}
+ if {[string compare $b $prev] < 0} {error "sort failed"}
+ set prev $b
+ }
+ set {} {}
+ } {}
+}
+
+
# Sort roughly 20MB of data. Once with a mmap limit of 5MB and once without.
#
foreach {itest limit} {
@@ -26,7 +73,7 @@ foreach {itest limit} {
2 0x7FFFFFFF
} {
sqlite3_test_control SQLITE_TESTCTRL_SORTER_MMAP db $limit
- do_execsql_test 1.$itest {
+ do_execsql_test 2.$itest {
WITH r(x,y) AS (
SELECT 1, randomblob(1000)
UNION ALL
@@ -46,7 +93,7 @@ foreach {itest limit} {
# Sort more than 2GB of data. At one point this was causing a problem.
# This test might take one minute or more to run.
#
-do_execsql_test 2 {
+do_execsql_test 3 {
PRAGMA cache_size = 20000;
WITH r(x,y) AS (
SELECT 1, randomblob(1000)
@@ -64,4 +111,3 @@ do_execsql_test 2 {
}
finish_test
-
« no previous file with comments | « third_party/sqlite/src/test/sort2.test ('k') | third_party/sqlite/src/test/sort5.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698