Add tests for a couple of previously untested branches in the ota code.
FossilOrigin-Name: a3c1bc5d5e3f4b197f48cbbc240608e94bfc2b45
This commit is contained in:
parent
7551c5c3e6
commit
20ab217f93
@ -200,6 +200,8 @@ do_test 5.3 {
|
||||
expr {[file size test.db-wal] > (1024 * 1200)}
|
||||
} 1
|
||||
|
||||
do_test 6.1 { sqlite3ota_internal_test } {}
|
||||
|
||||
finish_test
|
||||
|
||||
|
||||
|
58
ext/ota/otafault2.test
Normal file
58
ext/ota/otafault2.test
Normal file
@ -0,0 +1,58 @@
|
||||
# 2014 October 22
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
#***********************************************************************
|
||||
#
|
||||
|
||||
if {![info exists testdir]} {
|
||||
set testdir [file join [file dirname [info script]] .. .. test]
|
||||
}
|
||||
source $testdir/tester.tcl
|
||||
source $testdir/malloc_common.tcl
|
||||
set ::testprefix otafault2
|
||||
|
||||
forcedelete ota.db
|
||||
do_execsql_test 1.0 {
|
||||
CREATE TABLE target(x UNIQUE, y, z, PRIMARY KEY(y));
|
||||
INSERT INTO target VALUES(1, 2, 3);
|
||||
INSERT INTO target VALUES(4, 5, 6);
|
||||
|
||||
ATTACH 'ota.db' AS ota;
|
||||
CREATE TABLE ota.data_target(x, y, z, ota_control);
|
||||
INSERT INTO data_target VALUES(7, 8, 9, 0);
|
||||
INSERT INTO data_target VALUES(1, 11, 12, 0);
|
||||
DETACH ota;
|
||||
}
|
||||
db close
|
||||
|
||||
forcecopy test.db test.db-bak
|
||||
forcecopy ota.db ota.db-bak
|
||||
|
||||
do_faultsim_test 1 -faults oom* -prep {
|
||||
forcecopy test.db-bak test.db
|
||||
forcecopy ota.db-bak ota.db
|
||||
forcedelete test.db-oal test.db-wal ota.db-journal
|
||||
sqlite3ota ota test.db ota.db
|
||||
} -body {
|
||||
while {[ota step]=="SQLITE_OK"} { }
|
||||
ota close
|
||||
} -test {
|
||||
faultsim_test_result \
|
||||
{1 {SQLITE_CONSTRAINT - UNIQUE constraint failed: target.x}} \
|
||||
{1 SQLITE_CONSTRAINT} \
|
||||
{1 SQLITE_NOMEM} \
|
||||
{1 {SQLITE_NOMEM - unable to open a temporary database file for storing temporary tables}} \
|
||||
{1 {SQLITE_NOMEM - out of memory}}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
finish_test
|
||||
|
@ -1930,6 +1930,11 @@ static void otaIncrSchemaCookie(sqlite3ota *p){
|
||||
"PRAGMA schema_version"
|
||||
);
|
||||
if( p->rc==SQLITE_OK ){
|
||||
/* Coverage: it may be that this sqlite3_step() cannot fail. There
|
||||
** is already a transaction open, so the prepared statement cannot
|
||||
** throw an SQLITE_SCHEMA exception. The only database page the
|
||||
** statement reads is page 1, which is guaranteed to be in the cache.
|
||||
** And no memory allocations are required. */
|
||||
if( SQLITE_ROW==sqlite3_step(pStmt) ){
|
||||
iCookie = sqlite3_column_int(pStmt, 0);
|
||||
}
|
||||
|
@ -195,6 +195,30 @@ static int test_sqlite3ota_destroy_vfs(
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
** Tclcmd: sqlite3ota_internal_test
|
||||
*/
|
||||
static int test_sqlite3ota_internal_test(
|
||||
ClientData clientData,
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Obj *CONST objv[]
|
||||
){
|
||||
sqlite3 *db;
|
||||
|
||||
if( objc!=1 ){
|
||||
Tcl_WrongNumArgs(interp, 1, objv, "");
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
db = sqlite3ota_db(0);
|
||||
if( db!=0 ){
|
||||
Tcl_AppendResult(interp, "sqlite3ota_db(0)!=0", 0);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
int SqliteOta_Init(Tcl_Interp *interp){
|
||||
static struct {
|
||||
@ -204,6 +228,7 @@ int SqliteOta_Init(Tcl_Interp *interp){
|
||||
{ "sqlite3ota", test_sqlite3ota },
|
||||
{ "sqlite3ota_create_vfs", test_sqlite3ota_create_vfs },
|
||||
{ "sqlite3ota_destroy_vfs", test_sqlite3ota_destroy_vfs },
|
||||
{ "sqlite3ota_internal_test", test_sqlite3ota_internal_test },
|
||||
};
|
||||
int i;
|
||||
for(i=0; i<sizeof(aObjCmd)/sizeof(aObjCmd[0]); i++){
|
||||
|
17
manifest
17
manifest
@ -1,5 +1,5 @@
|
||||
C Add\snew\sfile\sota12.test,\scontaining\stests\sfor\sapplying\sota\supdates\sto\slive\sdatabases\swith\sother\sactive\sreader/writer\sclients.
|
||||
D 2015-02-18T20:17:14.502
|
||||
C Add\stests\sfor\sa\scouple\sof\spreviously\suntested\sbranches\sin\sthe\sota\scode.
|
||||
D 2015-02-19T13:36:02.845
|
||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||
F Makefile.in 6b9e7677829aa94b9f30949656e27312aefb9a46
|
||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||
@ -129,7 +129,7 @@ F ext/ota/ota1.test ba408c5e777c320ef72f328e20cd2ae2a8888cda
|
||||
F ext/ota/ota10.test 85e0f6e7964db5007590c1b299e75211ed4240d4
|
||||
F ext/ota/ota11.test 2f606cd2b4af260a86b549e91b9f395450fc75cb
|
||||
F ext/ota/ota12.test 0dff44474de448fb4b0b28c20da63273a4149abb
|
||||
F ext/ota/ota3.test 1f12eba0b69ef12a45e5c17bb1bebd13211663e7
|
||||
F ext/ota/ota3.test 3fe3521fbdce32d0e4e116a60999c3cba47712c5
|
||||
F ext/ota/ota5.test ad0799daf8923ddebffe75ae8c5504ca90b7fadb
|
||||
F ext/ota/ota6.test 3bde7f69a894748b27206b6753462ec3b75b6bb6
|
||||
F ext/ota/ota7.test 1fe2c5761705374530e29f70c39693076028221a
|
||||
@ -137,9 +137,10 @@ F ext/ota/ota8.test cd70e63a0c29c45c0906692827deafa34638feda
|
||||
F ext/ota/ota9.test d3eee95dd836824d07a22e5efcdb7bf6e869358b
|
||||
F ext/ota/otaA.test ef4bfa8cfd4ed814ae86f7457b64aa2f18c90171
|
||||
F ext/ota/otafault.test 8c43586c2b96ca16bbce00b5d7e7d67316126db8
|
||||
F ext/ota/sqlite3ota.c 981bbfae01063fa176a2851e4564f89cc53efe96
|
||||
F ext/ota/otafault2.test fa202a98ca221faec318f3e5c5f39485b1256561
|
||||
F ext/ota/sqlite3ota.c 6c329a3c1f1ca625f51161321724b25c24646f2d
|
||||
F ext/ota/sqlite3ota.h 1cc7201086fe65a36957740381485a24738c4077
|
||||
F ext/ota/test_ota.c 5dd58e4e6eb3ae7b471566616d44b701971bce88
|
||||
F ext/ota/test_ota.c 9ec6ea945282f65f67f0e0468dad79a489818f44
|
||||
F ext/rtree/README 6315c0d73ebf0ec40dedb5aa0e942bc8b54e3761
|
||||
F ext/rtree/rtree.c 14e6239434d4e3f65d3e90320713f26aa24e167f
|
||||
F ext/rtree/rtree.h 834dbcb82dc85b2481cde6a07cdadfddc99e9b9e
|
||||
@ -1257,7 +1258,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
|
||||
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
||||
F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
|
||||
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
|
||||
P 2b10c5d2b8b8b535d3dec0c68a777db16268e1e5
|
||||
R e6e6a761469f9b7bde91bfe8bec8a34e
|
||||
P 0864d127fe42fc0db7ab30a3ebf74c0114095648
|
||||
R dd716412c97fca8f0f6fe7ccf55a32c1
|
||||
U dan
|
||||
Z 3faf6af4ff9eafb0628a6c29cfea0807
|
||||
Z 5a79311824410c4dc238effcc077c46a
|
||||
|
@ -1 +1 @@
|
||||
0864d127fe42fc0db7ab30a3ebf74c0114095648
|
||||
a3c1bc5d5e3f4b197f48cbbc240608e94bfc2b45
|
Loading…
x
Reference in New Issue
Block a user