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# Specifically, it tests the effects of fault injection on the sorter 14# module (code in vdbesort.c). 15# 16 17set testdir [file dirname $argv0] 18source $testdir/tester.tcl 19set testprefix sortfault 20 21 22do_execsql_test 1.0 { 23 PRAGMA cache_size = 5; 24} 25 26foreach {tn mmap_limit} { 27 1 0 28 2 100000 29} { 30 do_faultsim_test 1.$tn -prep { 31 sqlite3 db test.db 32 sqlite3_test_control SQLITE_TESTCTRL_SORTER_MMAP db $::mmap_limit 33 } -body { 34 execsql { 35 WITH r(x,y) AS ( 36 SELECT 1, randomblob(1000) 37 UNION ALL 38 SELECT x+1, randomblob(1000) FROM r 39 LIMIT 500 40 ) 41 SELECT count(x), length(y) FROM r GROUP BY (x%5) 42 } 43 } -test { 44 faultsim_test_result {0 {100 1000 100 1000 100 1000 100 1000 100 1000}} 45 } 46} 47 48finish_test 49 50