1
0
mirror of https://github.com/sqlite/sqlite.git synced 2026-10-25 09:59:22 +03:00
Files
sqlite/test/crash.test
danielk1977 d1e3bee1a0 Add crash.test script. (CVS 1660)
FossilOrigin-Name: 64a6d805178af8947ccca19898c06979c226d92b
2004-06-22 13:12:51 +00:00

74 lines
1.4 KiB
Plaintext

# 2001 September 15
#
# 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.
#
# $Id: crash.test,v 1.1 2004/06/22 13:12:52 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
proc run_testfixturex {script} {
set f [open crash.tcl w]
puts $f $script
close $f
exec ./testfixturex crash.tcl
}
do_test crash-1.1 {
execsql {
CREATE TABLE abc(a, b, c);
INSERT INTO abc VALUES(1, 2, 3);
INSERT INTO abc VALUES(4, 5, 6);
}
} {}
do_test crash-1.2 {
set script {
sqlite3_crashseed 1
sqlite3 db test.db
db eval {pragma synchronous=full;}
db eval {DELETE FROM abc WHERE a = 1;}
}
catch {
run_testfixturex $script
} msg
set msg
} {child process exited abnormally}
do_test crash-1.3 {
catchsql {
SELECT * FROM abc;
}
} {0 {1 2 3 4 5 6}}
do_test crash-1.4 {
set script {
sqlite3_crashseed 2
sqlite3 db test.db
db eval {DELETE FROM abc WHERE a = 1;}
}
catch {
run_testfixturex $script
} msg
set msg
} {child process exited abnormally}
do_test crash-1.5 {
catch {
SELECT * FROM abc;
}
} {1 2 3 4 5 6}
finish_test