# 2014 March 25. # # 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. # #*********************************************************************** # This file implements regression tests for SQLite library. # # Specifically, it tests the effects of fault injection on the sorter # module (code in vdbesort.c). # set testdir [file dirname $argv0] source $testdir/tester.tcl set testprefix sortfault do_execsql_test 1.0 { PRAGMA cache_size = 5; } foreach {tn mmap_limit nWorker tmpstore threadsmode fakeheap} { 1 0 0 file multithread false 2 100000 0 file multithread false } { catch { db close } sqlite3_shutdown sqlite3_config_worker_threads $nWorker sqlite3_config $threadsmode sqlite3_initialize sorter_test_fakeheap $fakeheap set str [string repeat a 1000] do_faultsim_test 1.$tn -prep { sqlite3 db test.db sqlite3_test_control SQLITE_TESTCTRL_SORTER_MMAP db $::mmap_limit execsql { PRAGMA cache_size = 5 } } -body { execsql { WITH r(x,y) AS ( SELECT 1, $::str UNION ALL SELECT x+1, $::str FROM r LIMIT 200 ) SELECT count(x), length(y) FROM r GROUP BY (x%5) } } -test { faultsim_test_result {0 {40 1000 40 1000 40 1000 40 1000 40 1000}} } } catch { db close } sqlite3_shutdown sqlite3_config_worker_threads 0 set t(0) singlethread set t(1) multithread set t(2) serialized sqlite3_config $t($sqlite_options(threadsafe)) sqlite3_initialize finish_test