OLD | NEW |
(Empty) | |
| 1 # 2014 March 25. |
| 2 # |
| 3 # The author disclaims copyright to this source code. In place of |
| 4 # a legal notice, here is a blessing: |
| 5 # |
| 6 # May you do good and not evil. |
| 7 # May you find forgiveness for yourself and forgive others. |
| 8 # May you share freely, never taking more than you give. |
| 9 # |
| 10 #*********************************************************************** |
| 11 # This file implements regression tests for SQLite library. |
| 12 # |
| 13 # The tests in this file verify that sorting works when the library is |
| 14 # configured to use mmap(), but the temporary files generated by the |
| 15 # sorter are too large to be completely mapped. |
| 16 # |
| 17 |
| 18 set testdir [file dirname $argv0] |
| 19 source $testdir/tester.tcl |
| 20 set testprefix sort3 |
| 21 |
| 22 # Sort roughly 20MB of data. Once with a mmap limit of 5MB and once without. |
| 23 # |
| 24 foreach {itest limit} { |
| 25 1 5000000 |
| 26 2 0x7FFFFFFF |
| 27 } { |
| 28 sqlite3_test_control SQLITE_TESTCTRL_SORTER_MMAP db $limit |
| 29 do_execsql_test 1.$itest { |
| 30 WITH r(x,y) AS ( |
| 31 SELECT 1, randomblob(1000) |
| 32 UNION ALL |
| 33 SELECT x+1, randomblob(1000) FROM r |
| 34 LIMIT 20000 |
| 35 ) |
| 36 SELECT count(*), sum(length(y)) FROM r GROUP BY (x%5); |
| 37 } { |
| 38 4000 4000000 |
| 39 4000 4000000 |
| 40 4000 4000000 |
| 41 4000 4000000 |
| 42 4000 4000000 |
| 43 } |
| 44 } |
| 45 |
| 46 # Sort more than 2GB of data. At one point this was causing a problem. |
| 47 # This test might take one minute or more to run. |
| 48 # |
| 49 do_execsql_test 2 { |
| 50 PRAGMA cache_size = 20000; |
| 51 WITH r(x,y) AS ( |
| 52 SELECT 1, randomblob(1000) |
| 53 UNION ALL |
| 54 SELECT x+1, randomblob(1000) FROM r |
| 55 LIMIT 2200000 |
| 56 ) |
| 57 SELECT count(*), sum(length(y)) FROM r GROUP BY (x%5); |
| 58 } { |
| 59 440000 440000000 |
| 60 440000 440000000 |
| 61 440000 440000000 |
| 62 440000 440000000 |
| 63 440000 440000000 |
| 64 } |
| 65 |
| 66 finish_test |
| 67 |
OLD | NEW |