2014-04-16 00:52:27 +04:00
|
|
|
# 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.
|
|
|
|
#
|
2014-05-03 18:28:14 +04:00
|
|
|
# Specifically, it tests the effects of fault injection on the sorter
|
|
|
|
# module (code in vdbesort.c).
|
|
|
|
#
|
2014-04-16 00:52:27 +04:00
|
|
|
|
|
|
|
set testdir [file dirname $argv0]
|
|
|
|
source $testdir/tester.tcl
|
|
|
|
set testprefix sortfault
|
|
|
|
|
|
|
|
|
|
|
|
do_execsql_test 1.0 {
|
|
|
|
PRAGMA cache_size = 5;
|
|
|
|
}
|
|
|
|
|
2014-05-03 18:28:14 +04:00
|
|
|
foreach {tn mmap_limit} {
|
|
|
|
1 0
|
|
|
|
2 100000
|
|
|
|
} {
|
|
|
|
do_faultsim_test 1.$tn -prep {
|
|
|
|
sqlite3 db test.db
|
|
|
|
sqlite3_test_control SQLITE_TESTCTRL_SORTER_MMAP db $::mmap_limit
|
|
|
|
} -body {
|
|
|
|
execsql {
|
|
|
|
WITH r(x,y) AS (
|
|
|
|
SELECT 1, randomblob(1000)
|
|
|
|
UNION ALL
|
|
|
|
SELECT x+1, randomblob(1000) FROM r
|
|
|
|
LIMIT 500
|
|
|
|
)
|
|
|
|
SELECT count(x), length(y) FROM r GROUP BY (x%5)
|
|
|
|
}
|
|
|
|
} -test {
|
|
|
|
faultsim_test_result {0 {100 1000 100 1000 100 1000 100 1000 100 1000}}
|
|
|
|
}
|
2014-04-16 00:52:27 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
finish_test
|
|
|
|
|