mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-15 11:41:13 +03:00
Add the SQLITE_TESTCTRL_ASSERT and SQLITE_TESTCTRL_ALWAYS codes for the
sqlite3_test_control() interface. (CVS 6623) FossilOrigin-Name: 38df91c2edebee22d02b5f84260ee9e5e14db48e
This commit is contained in:
14
manifest
14
manifest
@@ -1,5 +1,5 @@
|
|||||||
C Change\ssqlite_blob_open()\sso\sthat\sit\szeros\sthe\soutput\spBlob\spointer\swhen\nit\sfails.\s\sThe\sother\ssqlite3_blob\sinterfaces\saccept\sa\sNULL\spointer\sas\ninput.\s(CVS\s6622)
|
C Add\sthe\sSQLITE_TESTCTRL_ASSERT\sand\sSQLITE_TESTCTRL_ALWAYS\scodes\sfor\sthe\nsqlite3_test_control()\sinterface.\s(CVS\s6623)
|
||||||
D 2009-05-09T15:17:47
|
D 2009-05-09T18:59:42
|
||||||
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
|
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
|
||||||
F Makefile.in 583e87706abc3026960ed759aff6371faf84c211
|
F Makefile.in 583e87706abc3026960ed759aff6371faf84c211
|
||||||
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
|
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
|
||||||
@@ -125,7 +125,7 @@ F src/insert.c 050536ea91c6cf74d87a2386b5da241141943c94
|
|||||||
F src/journal.c e00df0c0da8413ab6e1bb7d7cab5665d4a9000d0
|
F src/journal.c e00df0c0da8413ab6e1bb7d7cab5665d4a9000d0
|
||||||
F src/legacy.c 9a56cf126ceee332b56061bf16bd0fb4ff9e26c0
|
F src/legacy.c 9a56cf126ceee332b56061bf16bd0fb4ff9e26c0
|
||||||
F src/loadext.c 3f96631089fc4f3871a67f02f2e4fc7ea4d51edc
|
F src/loadext.c 3f96631089fc4f3871a67f02f2e4fc7ea4d51edc
|
||||||
F src/main.c c28ad5265f8f488f8e69e4ed67ce5ce3b7637d54
|
F src/main.c eabeb200c8b74e0d117d37474b642eb286ebfd93
|
||||||
F src/malloc.c 7b3b6423f5b355e5d649b91e16ef252d610bcf19
|
F src/malloc.c 7b3b6423f5b355e5d649b91e16ef252d610bcf19
|
||||||
F src/mem0.c f2f84062d1f35814d6535c9f9e33de3bfb3b132c
|
F src/mem0.c f2f84062d1f35814d6535c9f9e33de3bfb3b132c
|
||||||
F src/mem1.c e6d5c23941288df8191b8a98c28e3f57771e2270
|
F src/mem1.c e6d5c23941288df8191b8a98c28e3f57771e2270
|
||||||
@@ -160,7 +160,7 @@ F src/resolve.c 2ce8f8bc8a0c913cbaec3fb3da2be113ea1fa5af
|
|||||||
F src/rowset.c 14d12b5e81b5907b87d511f6f4219805f96a4b55
|
F src/rowset.c 14d12b5e81b5907b87d511f6f4219805f96a4b55
|
||||||
F src/select.c 9587023e906afe2074a718d25d6a4326874fb791
|
F src/select.c 9587023e906afe2074a718d25d6a4326874fb791
|
||||||
F src/shell.c 0a11f831603f17fea20ca97133c0f64e716af4a7
|
F src/shell.c 0a11f831603f17fea20ca97133c0f64e716af4a7
|
||||||
F src/sqlite.h.in 926985a312747e284c21ab32a8e8231a3bed9bd1
|
F src/sqlite.h.in d028ed6e0e991d730644f0b418964df1b51e6c53
|
||||||
F src/sqlite3ext.h 1db7d63ab5de4b3e6b83dd03d1a4e64fef6d2a17
|
F src/sqlite3ext.h 1db7d63ab5de4b3e6b83dd03d1a4e64fef6d2a17
|
||||||
F src/sqliteInt.h 04607d0bee31fdbebf133cf6c764cfc3b447e340
|
F src/sqliteInt.h 04607d0bee31fdbebf133cf6c764cfc3b447e340
|
||||||
F src/sqliteLimit.h ffe93f5a0c4e7bd13e70cd7bf84cfb5c3465f45d
|
F src/sqliteLimit.h ffe93f5a0c4e7bd13e70cd7bf84cfb5c3465f45d
|
||||||
@@ -729,7 +729,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
|
|||||||
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
|
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
|
||||||
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
|
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
|
||||||
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
|
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
|
||||||
P 567ccc68cc8c73b952a91c71a0e00b08bb25c689
|
P 999d507b4432b518cfc7e02e5b0a2473cf1980f6
|
||||||
R 886144e41731ebf2955c0b2ed8aed044
|
R 7622fe4047e835c720d8ae4c0e1b4dfb
|
||||||
U drh
|
U drh
|
||||||
Z fabb4ba3bc1d6719d08d21dcbbdf7cee
|
Z 722579f0a12a6ae69b7dcb4fb246cb46
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
999d507b4432b518cfc7e02e5b0a2473cf1980f6
|
38df91c2edebee22d02b5f84260ee9e5e14db48e
|
||||||
56
src/main.c
56
src/main.c
@@ -14,7 +14,7 @@
|
|||||||
** other files are for internal use by SQLite and should not be
|
** other files are for internal use by SQLite and should not be
|
||||||
** accessed by users of the library.
|
** accessed by users of the library.
|
||||||
**
|
**
|
||||||
** $Id: main.c,v 1.549 2009/05/07 13:43:49 drh Exp $
|
** $Id: main.c,v 1.550 2009/05/09 18:59:42 drh Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
|
|
||||||
@@ -2176,7 +2176,7 @@ int sqlite3_test_control(int op, ...){
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** sqlite3_test_control(PENDING_BYTE, unsigned int X)
|
** sqlite3_test_control(SQLITE_TESTCTRL_PENDING_BYTE, unsigned int X)
|
||||||
**
|
**
|
||||||
** Set the PENDING byte to the value in the argument, if X>0.
|
** Set the PENDING byte to the value in the argument, if X>0.
|
||||||
** Make no changes if X==0. Return the value of the pending byte
|
** Make no changes if X==0. Return the value of the pending byte
|
||||||
@@ -2193,6 +2193,58 @@ int sqlite3_test_control(int op, ...){
|
|||||||
if( newVal ) sqlite3PendingByte = newVal;
|
if( newVal ) sqlite3PendingByte = newVal;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
** sqlite3_test_control(SQLITE_TESTCTRL_ASSERT, int X)
|
||||||
|
**
|
||||||
|
** This action provides a run-time test to see whether or not
|
||||||
|
** assert() was enabled at compile-time. If X is true and assert()
|
||||||
|
** is enabled, then the return value is true. If X is true and
|
||||||
|
** assert() is disabled, then the return value is zero. If X is
|
||||||
|
** false and assert() is enabled, then the assertion fires and the
|
||||||
|
** process aborts. If X is false and assert() is disabled, then the
|
||||||
|
** return value is zero.
|
||||||
|
*/
|
||||||
|
case SQLITE_TESTCTRL_ASSERT: {
|
||||||
|
volatile int x = 0;
|
||||||
|
assert( (x = va_arg(ap,int))!=0 );
|
||||||
|
rc = x;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
** sqlite3_test_control(SQLITE_TESTCTRL_ALWAYS, int X)
|
||||||
|
**
|
||||||
|
** This action provides a run-time test to see how the ALWAYS and
|
||||||
|
** NEVER macros were defined at compile-time.
|
||||||
|
**
|
||||||
|
** The return value is ALWAYS(X).
|
||||||
|
**
|
||||||
|
** The recommended test is X==2. If the return value is 2, that means
|
||||||
|
** ALWAYS() and NEVER() are both no-op pass-through macros, which is the
|
||||||
|
** default setting. If the return value is 1, then ALWAYS() is either
|
||||||
|
** hard-coded to true or else it asserts if its argument is false.
|
||||||
|
** The first behavior (hard-coded to true) is the case if
|
||||||
|
** SQLITE_TESTCTRL_ASSERT shows that assert() is disabled and the second
|
||||||
|
** behavior (assert if the argument to ALWAYS() is false) is the case if
|
||||||
|
** SQLITE_TESTCTRL_ASSERT shows that assert() is enabled.
|
||||||
|
**
|
||||||
|
** The run-time test procedure might look something like this:
|
||||||
|
**
|
||||||
|
** if( sqlite3_test_control(SQLITE_TESTCTRL_ALWAYS, 2)==2 ){
|
||||||
|
** // ALWAYS() and NEVER() are no-op pass-through macros
|
||||||
|
** }else if( sqlite3_test_control(SQLITE_TESTCTRL_ASSERT, 1) ){
|
||||||
|
** // ALWAYS(x) asserts that x is true. NEVER(x) asserts x is false.
|
||||||
|
** }else{
|
||||||
|
** // ALWAYS(x) is a constant 1. NEVER(x) is a constant 0.
|
||||||
|
** }
|
||||||
|
*/
|
||||||
|
case SQLITE_TESTCTRL_ALWAYS: {
|
||||||
|
int x = va_arg(ap,int);
|
||||||
|
rc = ALWAYS(x);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
#endif /* SQLITE_OMIT_BUILTIN_TEST */
|
#endif /* SQLITE_OMIT_BUILTIN_TEST */
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
** the version number) and changes its name to "sqlite3.h" as
|
** the version number) and changes its name to "sqlite3.h" as
|
||||||
** part of the build process.
|
** part of the build process.
|
||||||
**
|
**
|
||||||
** @(#) $Id: sqlite.h.in,v 1.447 2009/04/30 15:59:56 drh Exp $
|
** @(#) $Id: sqlite.h.in,v 1.448 2009/05/09 18:59:42 drh Exp $
|
||||||
*/
|
*/
|
||||||
#ifndef _SQLITE3_H_
|
#ifndef _SQLITE3_H_
|
||||||
#define _SQLITE3_H_
|
#define _SQLITE3_H_
|
||||||
@@ -4852,6 +4852,8 @@ int sqlite3_test_control(int op, ...);
|
|||||||
#define SQLITE_TESTCTRL_FAULT_INSTALL 9
|
#define SQLITE_TESTCTRL_FAULT_INSTALL 9
|
||||||
#define SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS 10
|
#define SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS 10
|
||||||
#define SQLITE_TESTCTRL_PENDING_BYTE 11
|
#define SQLITE_TESTCTRL_PENDING_BYTE 11
|
||||||
|
#define SQLITE_TESTCTRL_ASSERT 12
|
||||||
|
#define SQLITE_TESTCTRL_ALWAYS 13
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** CAPI3REF: SQLite Runtime Status {H17200} <S60200>
|
** CAPI3REF: SQLite Runtime Status {H17200} <S60200>
|
||||||
|
|||||||
Reference in New Issue
Block a user