Add testcase() macros beside each sqlite3_log() call to make sure it is

tested with both logging enable and disabled.

FossilOrigin-Name: 1168763d2cd96acfa0488198e8bc82f0c4fa35a3
This commit is contained in:
drh 2010-02-24 21:44:07 +00:00
parent 915c8bdbbd
commit af46dc12f7
7 changed files with 31 additions and 13 deletions

View File

@ -1,5 +1,8 @@
C Changes\sto\scompile\stime\soption\sdiags\sto\sreport\svalues\sfor\ssome\sdefines.\s\s\nAdded\stest\scases\sto\sTCL\stest\ssuite\s(ctime.test).
D 2010-02-24T19:36:10
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
C Add\stestcase()\smacros\sbeside\seach\ssqlite3_log()\scall\sto\smake\ssure\sit\sis\ntested\swith\sboth\slogging\senable\sand\sdisabled.
D 2010-02-24T21:44:07
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in 4f2f967b7e58a35bb74fb7ec8ae90e0f4ca7868b
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@ -131,13 +134,13 @@ F src/journal.c b0ea6b70b532961118ab70301c00a33089f9315c
F src/legacy.c a199d7683d60cef73089e892409113e69c23a99f
F src/lempar.c 7f026423f4d71d989e719a743f98a1cbd4e6d99e
F src/loadext.c 1c7a61ce1281041f437333f366a96aa0d29bb581
F src/main.c f4226ebd8c0e7d6ee712072356455e7712ce99c9
F src/main.c 5e4a918c068b9d6c87fb4721b0b5c21cd52f0f4e
F src/malloc.c 5fa175797f982b178eaf38afba9c588a866be729
F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
F src/mem1.c 760dbac6ead11b901a8dcfa210f891b638a87507
F src/mem1.c 89d4ea8d5cdd55635cbaa48ad53132af6294cbb2
F src/mem2.c 92b4f772b1ee7469e256f1c2eff0b51a0ba19460
F src/mem3.c 9b237d911ba9904142a804be727cc6664873f8a3
F src/mem5.c 7060e51b8dfe04c3d1e4297ccdbbba3a331c9673
F src/mem5.c eb7a5cb98915dd7a086fa415ce3a5a0f20d0acff
F src/memjournal.c 5bfc2f33c914946e2f77ed3f882aff14dfc9355d
F src/mutex.c 581a272e09098040ca3ef543cb5f3d643eff7d50
F src/mutex.h 6fde601e55fa6c3fae768783c439797ab84c87c6
@ -209,9 +212,9 @@ F src/tokenize.c 25ceb0f0a746ea1d0f9553787f3f0a56853cfaeb
F src/trigger.c 340c9eca0fb24b1197468d96ba059f867c9834c7
F src/update.c c0dc6b75ad28b76b619042d934f337b02acee208
F src/utf.c dad16adcc0c35ef2437dca125a4b07419d361052
F src/util.c 57256361d9794ae9b8c7d7d9df8ee239ba7f9b01
F src/util.c 5a15aa0cc1a642aeb3ebb37c8c2bba7e1c014581
F src/vacuum.c deb50c41c39849770ab1bf27e8a35ba1036e3962
F src/vdbe.c 815ec0f55b184be47f7e354790d55e505eb3b8d3
F src/vdbe.c 6de14d95ade1193f2a694ce673f69ac20032fa17
F src/vdbe.h bea1f0cd530775bdb58a340265f3cf3ee920e9b2
F src/vdbeInt.h e276691b6835da5c0008cc5beaaecedcd7bdba8e
F src/vdbeapi.c e0398d74af46911033b92088f740582f3c400515
@ -792,7 +795,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
P 69a493182fd77bec91598516ee42c11a6db1d039
R 0595378132dd801ca4b7473a352dc602
U shaneh
Z ced54587bc46e680be6da59f4025dfb3
P dd480f62afa56ff85c2dd57ee7a16eee427e823f
R c9523526f48a8860988dae54cadcdbf1
U drh
Z 1dbd84d12743933d537cbe784ede4bca
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFLhZ2qoxKgR168RlERAtqjAJ9ekluC7QTqJi+Q6cIzjOZVf34HNACfUmiQ
TteOSExg+iy0J6i1CF0ncys=
=oaDc
-----END PGP SIGNATURE-----

View File

@ -1 +1 @@
dd480f62afa56ff85c2dd57ee7a16eee427e823f
1168763d2cd96acfa0488198e8bc82f0c4fa35a3

View File

@ -1956,15 +1956,18 @@ int sqlite3_get_autocommit(sqlite3 *db){
** a low-level error is first detected.
*/
int sqlite3CorruptError(int lineno){
testcase( sqlite3GlobalConfig.xLog!=0 );
sqlite3_log(SQLITE_CORRUPT,
"database corruption found by source line %d", lineno);
return SQLITE_CORRUPT;
}
int sqlite3MisuseError(int lineno){
testcase( sqlite3GlobalConfig.xLog!=0 );
sqlite3_log(SQLITE_MISUSE, "misuse detected by source line %d", lineno);
return SQLITE_MISUSE;
}
int sqlite3CantopenError(int lineno){
testcase( sqlite3GlobalConfig.xLog!=0 );
sqlite3_log(SQLITE_CANTOPEN, "cannot open file at source line %d", lineno);
return SQLITE_CANTOPEN;
}

View File

@ -43,6 +43,7 @@ static void *sqlite3MemMalloc(int nByte){
p[0] = nByte;
p++;
}else{
testcase( sqlite3GlobalConfig.xLog!=0 );
sqlite3_log(SQLITE_NOMEM, "failed to allocate %u bytes of memory", nByte);
}
return (void *)p;
@ -95,6 +96,7 @@ static void *sqlite3MemRealloc(void *pPrior, int nByte){
p[0] = nByte;
p++;
}else{
testcase( sqlite3GlobalConfig.xLog!=0 );
sqlite3_log(SQLITE_NOMEM,
"failed memory resize %u to %u bytes",
sqlite3MemSize(pPrior), nByte);

View File

@ -269,6 +269,7 @@ static void *memsys5MallocUnsafe(int nByte){
*/
for(iBin=iLogsize; mem5.aiFreelist[iBin]<0 && iBin<=LOGMAX; iBin++){}
if( iBin>LOGMAX ){
testcase( sqlite3GlobalConfig.xLog!=0 );
sqlite3_log(SQLITE_NOMEM, "failed to allocate %u bytes", nByte);
return 0;
}

View File

@ -1057,7 +1057,7 @@ int sqlite3SafetyCheckSickOrOk(sqlite3 *db){
if( magic!=SQLITE_MAGIC_SICK &&
magic!=SQLITE_MAGIC_OPEN &&
magic!=SQLITE_MAGIC_BUSY ){
logBadConnection( magic==SQLITE_MAGIC_CLOSED ? "closed" : "invalid" );
logBadConnection("invalid");
return 0;
}else{
return 1;

View File

@ -849,8 +849,10 @@ case OP_Halt: {
if( pOp->p4.z ){
assert( p->rc!=SQLITE_OK );
sqlite3SetString(&p->zErrMsg, db, "%s", pOp->p4.z);
testcase( sqlite3GlobalConfig.xLog!=0 );
sqlite3_log(pOp->p1, "abort at %d in [%s]: %s", pc, p->zSql, pOp->p4.z);
}else if( p->rc ){
testcase( sqlite3GlobalConfig.xLog!=0 );
sqlite3_log(pOp->p1, "constraint failed at %d in [%s]", pc, p->zSql);
}
rc = sqlite3VdbeHalt(p);