Merge latest trunk changes with this branch.
FossilOrigin-Name: 1c78d8920fb59da3cb97dd2eb09b3e08dfd14259
This commit is contained in:
commit
ef8b74324d
13
Makefile.in
13
Makefile.in
@ -951,7 +951,7 @@ testfixture$(TEXE): $(TESTFIXTURE_SRC)
|
|||||||
-o $@ $(TESTFIXTURE_SRC) $(LIBTCL) $(TLIBS)
|
-o $@ $(TESTFIXTURE_SRC) $(LIBTCL) $(TLIBS)
|
||||||
|
|
||||||
# A very detailed test running most or all test cases
|
# A very detailed test running most or all test cases
|
||||||
fulltest: testfixture$(TEXE) sqlite3$(TEXE)
|
fulltest: testfixture$(TEXE) sqlite3$(TEXE) fuzztest
|
||||||
./testfixture$(TEXE) $(TOP)/test/all.test
|
./testfixture$(TEXE) $(TOP)/test/all.test
|
||||||
|
|
||||||
# Really really long testing
|
# Really really long testing
|
||||||
@ -962,23 +962,28 @@ soaktest: testfixture$(TEXE) sqlite3$(TEXE)
|
|||||||
fulltestonly: testfixture$(TEXE) sqlite3$(TEXE)
|
fulltestonly: testfixture$(TEXE) sqlite3$(TEXE)
|
||||||
./testfixture$(TEXE) $(TOP)/test/full.test
|
./testfixture$(TEXE) $(TOP)/test/full.test
|
||||||
|
|
||||||
|
# Fuzz testing
|
||||||
|
fuzztest: fuzzershell$(TEXE)
|
||||||
|
./fuzzershell$(TEXE) -f $(TOP)/test/fuzzdata1.txt
|
||||||
|
|
||||||
# This is the common case. Run many tests but not those that take
|
# This is the common case. Run many tests but not those that take
|
||||||
# a really long time.
|
# a really long time.
|
||||||
#
|
#
|
||||||
test: testfixture$(TEXE) sqlite3$(TEXE)
|
test: testfixture$(TEXE) sqlite3$(TEXE) fuzztest
|
||||||
./testfixture$(TEXE) $(TOP)/test/veryquick.test
|
./testfixture$(TEXE) $(TOP)/test/veryquick.test
|
||||||
|
|
||||||
# Run a test using valgrind. This can take a really long time
|
# Run a test using valgrind. This can take a really long time
|
||||||
# because valgrind is so much slower than a native machine.
|
# because valgrind is so much slower than a native machine.
|
||||||
#
|
#
|
||||||
valgrindtest: testfixture$(TEXE) sqlite3$(TEXE)
|
valgrindtest: testfixture$(TEXE) sqlite3$(TEXE) fuzzershell$(TEXE)
|
||||||
|
valgrind -v ./fuzzershell$(TEXE) -f $(TOP)/test/fuzzdata1.txt
|
||||||
OMIT_MISUSE=1 valgrind -v ./testfixture$(TEXE) $(TOP)/test/permutations.test valgrind
|
OMIT_MISUSE=1 valgrind -v ./testfixture$(TEXE) $(TOP)/test/permutations.test valgrind
|
||||||
|
|
||||||
# A very fast test that checks basic sanity. The name comes from
|
# A very fast test that checks basic sanity. The name comes from
|
||||||
# the 60s-era electronics testing: "Turn it on and see if smoke
|
# the 60s-era electronics testing: "Turn it on and see if smoke
|
||||||
# comes out."
|
# comes out."
|
||||||
#
|
#
|
||||||
smoketest: testfixture$(TEXE)
|
smoketest: testfixture$(TEXE) fuzzershell$(TEXE)
|
||||||
./testfixture$(TEXE) $(TOP)/test/main.test
|
./testfixture$(TEXE) $(TOP)/test/main.test
|
||||||
|
|
||||||
sqlite3_analyzer.c: sqlite3.c $(TOP)/src/test_stat.c $(TOP)/src/tclsqlite.c $(TOP)/tool/spaceanal.tcl
|
sqlite3_analyzer.c: sqlite3.c $(TOP)/src/test_stat.c $(TOP)/src/tclsqlite.c $(TOP)/tool/spaceanal.tcl
|
||||||
|
@ -1624,19 +1624,22 @@ testfixture.exe: $(TESTFIXTURE_SRC) $(LIBRESOBJS) $(HDR)
|
|||||||
extensiontest: testfixture.exe testloadext.dll
|
extensiontest: testfixture.exe testloadext.dll
|
||||||
.\testfixture.exe $(TOP)\test\loadext.test
|
.\testfixture.exe $(TOP)\test\loadext.test
|
||||||
|
|
||||||
fulltest: testfixture.exe sqlite3.exe
|
fulltest: testfixture.exe sqlite3.exe fuzztest
|
||||||
.\testfixture.exe $(TOP)\test\all.test
|
.\testfixture.exe $(TOP)\test\all.test
|
||||||
|
|
||||||
soaktest: testfixture.exe sqlite3.exe
|
soaktest: testfixture.exe sqlite3.exe
|
||||||
.\testfixture.exe $(TOP)\test\all.test -soak=1
|
.\testfixture.exe $(TOP)\test\all.test -soak=1
|
||||||
|
|
||||||
fulltestonly: testfixture.exe sqlite3.exe
|
fulltestonly: testfixture.exe sqlite3.exe fuzztest
|
||||||
.\testfixture.exe $(TOP)\test\full.test
|
.\testfixture.exe $(TOP)\test\full.test
|
||||||
|
|
||||||
queryplantest: testfixture.exe sqlite3.exe
|
queryplantest: testfixture.exe sqlite3.exe
|
||||||
.\testfixture.exe $(TOP)\test\permutations.test queryplanner
|
.\testfixture.exe $(TOP)\test\permutations.test queryplanner
|
||||||
|
|
||||||
test: testfixture.exe sqlite3.exe
|
fuzztest: fuzzershell.exe
|
||||||
|
.\fuzzershell.exe -f $(TOP)\test\fuzzdata1.txt
|
||||||
|
|
||||||
|
test: testfixture.exe sqlite3.exe fuzztest
|
||||||
.\testfixture.exe $(TOP)\test\veryquick.test
|
.\testfixture.exe $(TOP)\test\veryquick.test
|
||||||
|
|
||||||
smoketest: testfixture.exe
|
smoketest: testfixture.exe
|
||||||
|
@ -2810,7 +2810,7 @@ static int fts3SegReaderCursor(
|
|||||||
** calls out here. */
|
** calls out here. */
|
||||||
if( iLevel<0 && p->aIndex ){
|
if( iLevel<0 && p->aIndex ){
|
||||||
Fts3SegReader *pSeg = 0;
|
Fts3SegReader *pSeg = 0;
|
||||||
rc = sqlite3Fts3SegReaderPending(p, iIndex, zTerm, nTerm, isPrefix, &pSeg);
|
rc = sqlite3Fts3SegReaderPending(p, iIndex, zTerm, nTerm, isPrefix||isScan, &pSeg);
|
||||||
if( rc==SQLITE_OK && pSeg ){
|
if( rc==SQLITE_OK && pSeg ){
|
||||||
rc = fts3SegReaderCursorAppend(pCsr, pSeg);
|
rc = fts3SegReaderCursorAppend(pCsr, pSeg);
|
||||||
}
|
}
|
||||||
|
@ -326,7 +326,7 @@ static int fts3SqlStmt(
|
|||||||
/* 25 */ "",
|
/* 25 */ "",
|
||||||
|
|
||||||
/* 26 */ "DELETE FROM %Q.'%q_segdir' WHERE level BETWEEN ? AND ?",
|
/* 26 */ "DELETE FROM %Q.'%q_segdir' WHERE level BETWEEN ? AND ?",
|
||||||
/* 27 */ "SELECT DISTINCT level / (1024 * ?) FROM %Q.'%q_segdir'",
|
/* 27 */ "SELECT ? UNION SELECT level / (1024 * ?) FROM %Q.'%q_segdir'",
|
||||||
|
|
||||||
/* This statement is used to determine which level to read the input from
|
/* This statement is used to determine which level to read the input from
|
||||||
** when performing an incremental merge. It returns the absolute level number
|
** when performing an incremental merge. It returns the absolute level number
|
||||||
@ -3444,7 +3444,8 @@ static int fts3DoOptimize(Fts3Table *p, int bReturnDone){
|
|||||||
rc = fts3SqlStmt(p, SQL_SELECT_ALL_LANGID, &pAllLangid, 0);
|
rc = fts3SqlStmt(p, SQL_SELECT_ALL_LANGID, &pAllLangid, 0);
|
||||||
if( rc==SQLITE_OK ){
|
if( rc==SQLITE_OK ){
|
||||||
int rc2;
|
int rc2;
|
||||||
sqlite3_bind_int(pAllLangid, 1, p->nIndex);
|
sqlite3_bind_int(pAllLangid, 1, p->iPrevLangid);
|
||||||
|
sqlite3_bind_int(pAllLangid, 2, p->nIndex);
|
||||||
while( sqlite3_step(pAllLangid)==SQLITE_ROW ){
|
while( sqlite3_step(pAllLangid)==SQLITE_ROW ){
|
||||||
int i;
|
int i;
|
||||||
int iLangid = sqlite3_column_int(pAllLangid, 0);
|
int iLangid = sqlite3_column_int(pAllLangid, 0);
|
||||||
@ -4776,7 +4777,7 @@ static int fts3IncrmergeHintPop(Blob *pHint, i64 *piAbsLevel, int *pnInput){
|
|||||||
pHint->n = i;
|
pHint->n = i;
|
||||||
i += sqlite3Fts3GetVarint(&pHint->a[i], piAbsLevel);
|
i += sqlite3Fts3GetVarint(&pHint->a[i], piAbsLevel);
|
||||||
i += fts3GetVarint32(&pHint->a[i], pnInput);
|
i += fts3GetVarint32(&pHint->a[i], pnInput);
|
||||||
if( i!=nHint ) return SQLITE_CORRUPT_VTAB;
|
if( i!=nHint ) return FTS_CORRUPT_VTAB;
|
||||||
|
|
||||||
return SQLITE_OK;
|
return SQLITE_OK;
|
||||||
}
|
}
|
||||||
@ -5144,7 +5145,8 @@ static int fts3IntegrityCheck(Fts3Table *p, int *pbOk){
|
|||||||
rc = fts3SqlStmt(p, SQL_SELECT_ALL_LANGID, &pAllLangid, 0);
|
rc = fts3SqlStmt(p, SQL_SELECT_ALL_LANGID, &pAllLangid, 0);
|
||||||
if( rc==SQLITE_OK ){
|
if( rc==SQLITE_OK ){
|
||||||
int rc2;
|
int rc2;
|
||||||
sqlite3_bind_int(pAllLangid, 1, p->nIndex);
|
sqlite3_bind_int(pAllLangid, 1, p->iPrevLangid);
|
||||||
|
sqlite3_bind_int(pAllLangid, 2, p->nIndex);
|
||||||
while( rc==SQLITE_OK && sqlite3_step(pAllLangid)==SQLITE_ROW ){
|
while( rc==SQLITE_OK && sqlite3_step(pAllLangid)==SQLITE_ROW ){
|
||||||
int iLangid = sqlite3_column_int(pAllLangid, 0);
|
int iLangid = sqlite3_column_int(pAllLangid, 0);
|
||||||
int i;
|
int i;
|
||||||
@ -5157,7 +5159,6 @@ static int fts3IntegrityCheck(Fts3Table *p, int *pbOk){
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* This block calculates the checksum according to the %_content table */
|
/* This block calculates the checksum according to the %_content table */
|
||||||
rc = fts3SqlStmt(p, SQL_SELECT_ALL_LANGID, &pAllLangid, 0);
|
|
||||||
if( rc==SQLITE_OK ){
|
if( rc==SQLITE_OK ){
|
||||||
sqlite3_tokenizer_module const *pModule = p->pTokenizer->pModule;
|
sqlite3_tokenizer_module const *pModule = p->pTokenizer->pModule;
|
||||||
sqlite3_stmt *pStmt = 0;
|
sqlite3_stmt *pStmt = 0;
|
||||||
@ -5254,7 +5255,7 @@ static int fts3DoIntegrityCheck(
|
|||||||
int rc;
|
int rc;
|
||||||
int bOk = 0;
|
int bOk = 0;
|
||||||
rc = fts3IntegrityCheck(p, &bOk);
|
rc = fts3IntegrityCheck(p, &bOk);
|
||||||
if( rc==SQLITE_OK && bOk==0 ) rc = SQLITE_CORRUPT_VTAB;
|
if( rc==SQLITE_OK && bOk==0 ) rc = FTS_CORRUPT_VTAB;
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -407,10 +407,10 @@ static int fts5ConfigDefaultTokenizer(Fts5Global *pGlobal, Fts5Config *pConfig){
|
|||||||
** set if a parse error (failed to find close quote) occurs.
|
** set if a parse error (failed to find close quote) occurs.
|
||||||
*/
|
*/
|
||||||
static const char *fts5ConfigGobbleWord(
|
static const char *fts5ConfigGobbleWord(
|
||||||
int *pRc,
|
int *pRc, /* IN/OUT: Error code */
|
||||||
const char *zIn,
|
const char *zIn, /* Buffer to gobble string/bareword from */
|
||||||
char **pzOut,
|
char **pzOut, /* OUT: malloc'd buffer containing str/bw */
|
||||||
int *pbQuoted
|
int *pbQuoted /* OUT: Set to true if dequoting required */
|
||||||
){
|
){
|
||||||
const char *zRet = 0;
|
const char *zRet = 0;
|
||||||
*pbQuoted = 0;
|
*pbQuoted = 0;
|
||||||
|
16
main.mk
16
main.mk
@ -711,21 +711,31 @@ fts3-testfixture$(EXE): sqlite3.c fts3amal.c $(TESTSRC) $(TOP)/src/tclsqlite.c
|
|||||||
$(TESTSRC) $(TOP)/src/tclsqlite.c sqlite3.c fts3amal.c \
|
$(TESTSRC) $(TOP)/src/tclsqlite.c sqlite3.c fts3amal.c \
|
||||||
-o testfixture$(EXE) $(LIBTCL) $(THREADLIB)
|
-o testfixture$(EXE) $(LIBTCL) $(THREADLIB)
|
||||||
|
|
||||||
fulltest: testfixture$(EXE) sqlite3$(EXE)
|
fulltest: testfixture$(EXE) sqlite3$(EXE) fuzztest
|
||||||
./testfixture$(EXE) $(TOP)/test/all.test
|
./testfixture$(EXE) $(TOP)/test/all.test
|
||||||
|
|
||||||
soaktest: testfixture$(EXE) sqlite3$(EXE)
|
soaktest: testfixture$(EXE) sqlite3$(EXE)
|
||||||
./testfixture$(EXE) $(TOP)/test/all.test -soak=1
|
./testfixture$(EXE) $(TOP)/test/all.test -soak=1
|
||||||
|
|
||||||
fulltestonly: testfixture$(EXE) sqlite3$(EXE)
|
fulltestonly: testfixture$(EXE) sqlite3$(EXE) fuzztest
|
||||||
./testfixture$(EXE) $(TOP)/test/full.test
|
./testfixture$(EXE) $(TOP)/test/full.test
|
||||||
|
|
||||||
queryplantest: testfixture$(EXE) sqlite3$(EXE)
|
queryplantest: testfixture$(EXE) sqlite3$(EXE)
|
||||||
./testfixture$(EXE) $(TOP)/test/permutations.test queryplanner
|
./testfixture$(EXE) $(TOP)/test/permutations.test queryplanner
|
||||||
|
|
||||||
test: testfixture$(EXE) sqlite3$(EXE)
|
fuzztest: fuzzershell$(EXE)
|
||||||
|
./fuzzershell$(EXE) -f $(TOP)/test/fuzzdata1.txt
|
||||||
|
|
||||||
|
test: testfixture$(EXE) sqlite3$(EXE) fuzztest
|
||||||
./testfixture$(EXE) $(TOP)/test/veryquick.test
|
./testfixture$(EXE) $(TOP)/test/veryquick.test
|
||||||
|
|
||||||
|
# Run a test using valgrind. This can take a really long time
|
||||||
|
# because valgrind is so much slower than a native machine.
|
||||||
|
#
|
||||||
|
valgrindtest: testfixture$(EXE) sqlite3$(EXE) fuzzershell$(EXE)
|
||||||
|
valgrind -v ./fuzzershell$(EXE) -f $(TOP)/test/fuzzdata1.txt
|
||||||
|
OMIT_MISUSE=1 valgrind -v ./testfixture$(EXE) $(TOP)/test/permutations.test valgrind
|
||||||
|
|
||||||
# The next two rules are used to support the "threadtest" target. Building
|
# The next two rules are used to support the "threadtest" target. Building
|
||||||
# threadtest runs a few thread-safety tests that are implemented in C. This
|
# threadtest runs a few thread-safety tests that are implemented in C. This
|
||||||
# target is invoked by the releasetest.tcl script.
|
# target is invoked by the releasetest.tcl script.
|
||||||
|
37
manifest
37
manifest
@ -1,9 +1,9 @@
|
|||||||
C Add\sthe\s"unindexed"\scolumn\soption\sto\sfts5.
|
C Merge\slatest\strunk\schanges\swith\sthis\sbranch.
|
||||||
D 2015-04-24T19:41:43.259
|
D 2015-04-24T20:18:21.844
|
||||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||||
F Makefile.in faaf75b89840659d74501bea269c7e33414761c1
|
F Makefile.in 31b38b9da2e4b36f54a013bd71a5c3f6e45ca78f
|
||||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||||
F Makefile.msc 32d8fe89ac5c130f9f14293fb4a59b120895c943
|
F Makefile.msc 4a546e42ecfd0fe53c31e05c2a965e17fb591637
|
||||||
F Makefile.vxworks e1b65dea203f054e71653415bd8f96dcaed47858
|
F Makefile.vxworks e1b65dea203f054e71653415bd8f96dcaed47858
|
||||||
F README.md d58e3bebc0a4145e0f2a87994015fdb575a8e866
|
F README.md d58e3bebc0a4145e0f2a87994015fdb575a8e866
|
||||||
F VERSION 2e244662b71e6e68a5c29b014ebc5b7564f4cc5a
|
F VERSION 2e244662b71e6e68a5c29b014ebc5b7564f4cc5a
|
||||||
@ -78,7 +78,7 @@ F ext/fts3/README.content fdc666a70d5257a64fee209f97cf89e0e6e32b51
|
|||||||
F ext/fts3/README.syntax a19711dc5458c20734b8e485e75fb1981ec2427a
|
F ext/fts3/README.syntax a19711dc5458c20734b8e485e75fb1981ec2427a
|
||||||
F ext/fts3/README.tokenizers e0a8b81383ea60d0334d274fadf305ea14a8c314
|
F ext/fts3/README.tokenizers e0a8b81383ea60d0334d274fadf305ea14a8c314
|
||||||
F ext/fts3/README.txt 8c18f41574404623b76917b9da66fcb0ab38328d
|
F ext/fts3/README.txt 8c18f41574404623b76917b9da66fcb0ab38328d
|
||||||
F ext/fts3/fts3.c 1b198ddb76cd706722dacbbaeb17a2fde6fca2cc
|
F ext/fts3/fts3.c 81f9ed55ad58614828ad9d8b1e0525ad78fede1b
|
||||||
F ext/fts3/fts3.h 62a77d880cf06a2865052726f8325c8fabcecad7
|
F ext/fts3/fts3.h 62a77d880cf06a2865052726f8325c8fabcecad7
|
||||||
F ext/fts3/fts3Int.h 3626655d6ba903a3919bb44e1c38e5f0f9d6be82
|
F ext/fts3/fts3Int.h 3626655d6ba903a3919bb44e1c38e5f0f9d6be82
|
||||||
F ext/fts3/fts3_aux.c 5c211e17a64885faeb16b9ba7772f9d5445c2365
|
F ext/fts3/fts3_aux.c 5c211e17a64885faeb16b9ba7772f9d5445c2365
|
||||||
@ -96,7 +96,7 @@ F ext/fts3/fts3_tokenizer.h 64c6ef6c5272c51ebe60fc607a896e84288fcbc3
|
|||||||
F ext/fts3/fts3_tokenizer1.c 5c98225a53705e5ee34824087478cf477bdb7004
|
F ext/fts3/fts3_tokenizer1.c 5c98225a53705e5ee34824087478cf477bdb7004
|
||||||
F ext/fts3/fts3_unicode.c a93f5edc0aff44ef8b06d7cb55b52026541ca145
|
F ext/fts3/fts3_unicode.c a93f5edc0aff44ef8b06d7cb55b52026541ca145
|
||||||
F ext/fts3/fts3_unicode2.c c3d01968d497bd7001e7dc774ba75b372738c057
|
F ext/fts3/fts3_unicode2.c c3d01968d497bd7001e7dc774ba75b372738c057
|
||||||
F ext/fts3/fts3_write.c 7104ec015474ee61a8a570349b925f35c6b0a294
|
F ext/fts3/fts3_write.c 4f005f78592a1447ca96c8475ef5342ab7dbe02a
|
||||||
F ext/fts3/fts3speed.tcl b54caf6a18d38174f1a6e84219950d85e98bb1e9
|
F ext/fts3/fts3speed.tcl b54caf6a18d38174f1a6e84219950d85e98bb1e9
|
||||||
F ext/fts3/mkfts3amal.tcl 252ecb7fe6467854f2aa237bf2c390b74e71f100
|
F ext/fts3/mkfts3amal.tcl 252ecb7fe6467854f2aa237bf2c390b74e71f100
|
||||||
F ext/fts3/tool/fts3view.c 8e53d0190a7b3443764bbd32ad47be2bd852026d
|
F ext/fts3/tool/fts3view.c 8e53d0190a7b3443764bbd32ad47be2bd852026d
|
||||||
@ -109,7 +109,7 @@ F ext/fts5/fts5.h 24a2cc35b5e76eec57b37ba48c12d9d2cb522b3a
|
|||||||
F ext/fts5/fts5Int.h 803fd2fc03e3799a38ebb404f2f1309ded5d3e8b
|
F ext/fts5/fts5Int.h 803fd2fc03e3799a38ebb404f2f1309ded5d3e8b
|
||||||
F ext/fts5/fts5_aux.c fcea18b1a2a3f95a498b52aba2983557d7678a22
|
F ext/fts5/fts5_aux.c fcea18b1a2a3f95a498b52aba2983557d7678a22
|
||||||
F ext/fts5/fts5_buffer.c 3ba56cc6824c9f7b1e0695159e0a9c636f6b4a23
|
F ext/fts5/fts5_buffer.c 3ba56cc6824c9f7b1e0695159e0a9c636f6b4a23
|
||||||
F ext/fts5/fts5_config.c adf7110b0e8a9bdd64cb61c6f9da0bf6b80d9a1d
|
F ext/fts5/fts5_config.c 43fcf838d3a3390d1245e3d5e651fa5cc1df575b
|
||||||
F ext/fts5/fts5_expr.c 05da381ab26031243266069302c6eb4094b2c5dd
|
F ext/fts5/fts5_expr.c 05da381ab26031243266069302c6eb4094b2c5dd
|
||||||
F ext/fts5/fts5_hash.c 3cb5a3d04dd2030eb0ac8d544711dfd37c0e6529
|
F ext/fts5/fts5_hash.c 3cb5a3d04dd2030eb0ac8d544711dfd37c0e6529
|
||||||
F ext/fts5/fts5_index.c 39810b25a017f2626ac72b3e44afe9b534e5d5db
|
F ext/fts5/fts5_index.c 39810b25a017f2626ac72b3e44afe9b534e5d5db
|
||||||
@ -202,7 +202,7 @@ F ext/userauth/userauth.c 5fa3bdb492f481bbc1709fc83c91ebd13460c69e
|
|||||||
F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x
|
F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x
|
||||||
F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8
|
F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8
|
||||||
F magic.txt 8273bf49ba3b0c8559cb2774495390c31fd61c60
|
F magic.txt 8273bf49ba3b0c8559cb2774495390c31fd61c60
|
||||||
F main.mk 2f5c69b4d942b4084f61c7a9e76e6ad2c9912bcd
|
F main.mk 76306018b967871262c6c8290e3914685f279ded
|
||||||
F mkopcodec.awk c2ff431854d702cdd2d779c9c0d1f58fa16fa4ea
|
F mkopcodec.awk c2ff431854d702cdd2d779c9c0d1f58fa16fa4ea
|
||||||
F mkopcodeh.awk d5e22023b5238985bb54a72d33e0ac71fe4f8a32
|
F mkopcodeh.awk d5e22023b5238985bb54a72d33e0ac71fe4f8a32
|
||||||
F mkso.sh fd21c06b063bb16a5d25deea1752c2da6ac3ed83
|
F mkso.sh fd21c06b063bb16a5d25deea1752c2da6ac3ed83
|
||||||
@ -232,7 +232,7 @@ F src/complete.c a5cf5b4b56390cfb7b8636e8f7ddef90258dd575
|
|||||||
F src/ctime.c 98f89724adc891a1a4c655bee04e33e716e05887
|
F src/ctime.c 98f89724adc891a1a4c655bee04e33e716e05887
|
||||||
F src/date.c e4d50b3283696836ec1036b695ead9a19e37a5ac
|
F src/date.c e4d50b3283696836ec1036b695ead9a19e37a5ac
|
||||||
F src/delete.c 37964e6c1d73ff49cbea9ff690c9605fb15f600e
|
F src/delete.c 37964e6c1d73ff49cbea9ff690c9605fb15f600e
|
||||||
F src/expr.c 5555f768c05d7d4a7840c6c2e72ad7aecbe0fe54
|
F src/expr.c 4c05a28eebe63b288fda1db0e8de556a82ca2ec6
|
||||||
F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb
|
F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb
|
||||||
F src/fkey.c c9b63a217d86582c22121699a47f22f524608869
|
F src/fkey.c c9b63a217d86582c22121699a47f22f524608869
|
||||||
F src/func.c 1414c24c873c48796ad45942257a179a423ba42f
|
F src/func.c 1414c24c873c48796ad45942257a179a423ba42f
|
||||||
@ -278,7 +278,7 @@ F src/pragma.h 09c89bca58e9a44de2116cc8272b8d454657129f
|
|||||||
F src/prepare.c 1fffbdcd6f8a0173a8f70d71f22528f4c0e1e3d3
|
F src/prepare.c 1fffbdcd6f8a0173a8f70d71f22528f4c0e1e3d3
|
||||||
F src/printf.c 08fa675c200aac29e561c6153f91f909ed17612f
|
F src/printf.c 08fa675c200aac29e561c6153f91f909ed17612f
|
||||||
F src/random.c ba2679f80ec82c4190062d756f22d0c358180696
|
F src/random.c ba2679f80ec82c4190062d756f22d0c358180696
|
||||||
F src/resolve.c 53486a98c17b7ae09b8c2b398013e973ce4c1aae
|
F src/resolve.c 13109bc3b5ab404446296efa17039640de5bc35d
|
||||||
F src/rowset.c eccf6af6d620aaa4579bd3b72c1b6395d9e9fa1e
|
F src/rowset.c eccf6af6d620aaa4579bd3b72c1b6395d9e9fa1e
|
||||||
F src/select.c 35433ea8894ac42594ddc31eb0165a6d6401cfe5
|
F src/select.c 35433ea8894ac42594ddc31eb0165a6d6401cfe5
|
||||||
F src/shell.c 78eabce4c16c45e36fea2368f95118116399ba8a
|
F src/shell.c 78eabce4c16c45e36fea2368f95118116399ba8a
|
||||||
@ -656,7 +656,7 @@ F test/fts3tok1.test 178c050199af8c05299b1ad572514ce1c54b7827
|
|||||||
F test/fts3tok_err.test 52273cd193b9036282f7bacb43da78c6be87418d
|
F test/fts3tok_err.test 52273cd193b9036282f7bacb43da78c6be87418d
|
||||||
F test/fts3varint.test 752c08ed5d32c5d7dc211b056f4ed68a76b7e36e
|
F test/fts3varint.test 752c08ed5d32c5d7dc211b056f4ed68a76b7e36e
|
||||||
F test/fts4aa.test 10aac8e9d62c7357590acfabe3fad01e9a9ce1cb
|
F test/fts4aa.test 10aac8e9d62c7357590acfabe3fad01e9a9ce1cb
|
||||||
F test/fts4check.test 74d77f6cdb768ac49df5afda575cef14ae3d239a
|
F test/fts4check.test 9d9e818fd6cb29c0e007cd6d00447739d4fde430
|
||||||
F test/fts4content.test abb0c77bc3da3df64fec72e00844d2257a90025d
|
F test/fts4content.test abb0c77bc3da3df64fec72e00844d2257a90025d
|
||||||
F test/fts4docid.test e33c383cfbdff0284685604d256f347a18fdbf01
|
F test/fts4docid.test e33c383cfbdff0284685604d256f347a18fdbf01
|
||||||
F test/fts4growth.test df10fde9f47cf5c71861e63fd8efcd573c4f7e53
|
F test/fts4growth.test df10fde9f47cf5c71861e63fd8efcd573c4f7e53
|
||||||
@ -681,6 +681,7 @@ F test/fuzz2.test 76dc35b32b6d6f965259508508abce75a6c4d7e1
|
|||||||
F test/fuzz3.test efd384b896c647b61a2c1848ba70d42aad60a7b3
|
F test/fuzz3.test efd384b896c647b61a2c1848ba70d42aad60a7b3
|
||||||
F test/fuzz_common.tcl a87dfbb88c2a6b08a38e9a070dabd129e617b45b
|
F test/fuzz_common.tcl a87dfbb88c2a6b08a38e9a070dabd129e617b45b
|
||||||
F test/fuzz_malloc.test 328f70aaca63adf29b4c6f06505ed0cf57ca7c26
|
F test/fuzz_malloc.test 328f70aaca63adf29b4c6f06505ed0cf57ca7c26
|
||||||
|
F test/fuzzdata1.txt c7929942f6820873fdd9ae6bb542651fefea40f7
|
||||||
F test/fuzzer1.test d4c52aaf3ef923da293a2653cfab33d02f718a36
|
F test/fuzzer1.test d4c52aaf3ef923da293a2653cfab33d02f718a36
|
||||||
F test/fuzzerfault.test 8792cd77fd5bce765b05d0c8e01b9edcf8af8536
|
F test/fuzzerfault.test 8792cd77fd5bce765b05d0c8e01b9edcf8af8536
|
||||||
F test/genesis.tcl 1e2e2e8e5cc4058549a154ff1892fe5c9de19f98
|
F test/genesis.tcl 1e2e2e8e5cc4058549a154ff1892fe5c9de19f98
|
||||||
@ -863,8 +864,8 @@ F test/randexpr1.test eda062a97e60f9c38ae8d806b03b0ddf23d796df
|
|||||||
F test/rdonly.test 64e2696c322e3538df0b1ed624e21f9a23ed9ff8
|
F test/rdonly.test 64e2696c322e3538df0b1ed624e21f9a23ed9ff8
|
||||||
F test/regexp1.test 497ea812f264d12b6198d6e50a76be4a1973a9d8
|
F test/regexp1.test 497ea812f264d12b6198d6e50a76be4a1973a9d8
|
||||||
F test/reindex.test 44edd3966b474468b823d481eafef0c305022254
|
F test/reindex.test 44edd3966b474468b823d481eafef0c305022254
|
||||||
F test/releasetest.tcl a37cd82092c8be438255d65804b5951d6e3ecdae
|
F test/releasetest.tcl f649253610c8b0b0d63ad85b0d2961867d4f0ac0
|
||||||
F test/resolver01.test 33abf37ff8335e6bf98f2b45a0af3e06996ccd9a
|
F test/resolver01.test f4022acafda7f4d40eca94dbf16bc5fc4ac30ceb
|
||||||
F test/rollback.test 458fe73eb3ffdfdf9f6ba3e9b7350a6220414dea
|
F test/rollback.test 458fe73eb3ffdfdf9f6ba3e9b7350a6220414dea
|
||||||
F test/rollback2.test fc14cf6d1a2b250d2735ef16124b971bce152f14
|
F test/rollback2.test fc14cf6d1a2b250d2735ef16124b971bce152f14
|
||||||
F test/rollbackfault.test 6a004f71087cc399296cffbb5429ea6da655ae65
|
F test/rollbackfault.test 6a004f71087cc399296cffbb5429ea6da655ae65
|
||||||
@ -1122,7 +1123,7 @@ F test/tkt4018.test 7c2c9ba4df489c676a0a7a0e809a1fb9b2185bd1
|
|||||||
F test/tokenize.test ce430a7aed48fc98301611429595883fdfcab5d7
|
F test/tokenize.test ce430a7aed48fc98301611429595883fdfcab5d7
|
||||||
F test/tpch01.test 04adbf8d8300fa60a222f28d901abd76e7be6dd4
|
F test/tpch01.test 04adbf8d8300fa60a222f28d901abd76e7be6dd4
|
||||||
F test/trace.test 73a5508100f7fccfbc3f8018d5f6963ed478eea0
|
F test/trace.test 73a5508100f7fccfbc3f8018d5f6963ed478eea0
|
||||||
F test/trace2.test 93b47ca6996c66b47f57224cfb146f34e07df382
|
F test/trace2.test f5cb67ad3bc09e0c58e8cca78dfd0b5639259983
|
||||||
F test/trans.test 6e1b4c6a42dba31bd65f8fa5e61a2708e08ddde6
|
F test/trans.test 6e1b4c6a42dba31bd65f8fa5e61a2708e08ddde6
|
||||||
F test/trans2.test 62bd045bfc7a1c14c5ba83ba64d21ade31583f76
|
F test/trans2.test 62bd045bfc7a1c14c5ba83ba64d21ade31583f76
|
||||||
F test/trans3.test 91a100e5412b488e22a655fe423a14c26403ab94
|
F test/trans3.test 91a100e5412b488e22a655fe423a14c26403ab94
|
||||||
@ -1254,7 +1255,7 @@ F tool/diffdb.c 7524b1b5df217c20cd0431f6789851a4e0cb191b
|
|||||||
F tool/extract.c 054069d81b095fbdc189a6f5d4466e40380505e2
|
F tool/extract.c 054069d81b095fbdc189a6f5d4466e40380505e2
|
||||||
F tool/fast_vacuum.c 5ba0d6f5963a0a63bdc42840f678bad75b2ebce1
|
F tool/fast_vacuum.c 5ba0d6f5963a0a63bdc42840f678bad75b2ebce1
|
||||||
F tool/fragck.tcl 5265a95126abcf6ab357f7efa544787e5963f439
|
F tool/fragck.tcl 5265a95126abcf6ab357f7efa544787e5963f439
|
||||||
F tool/fuzzershell.c 00c12b1e95095f43980ae3cafb51938eda577fe2
|
F tool/fuzzershell.c a13c48cb83bbea8966442d777e14595b87023701
|
||||||
F tool/genfkey.README cf68fddd4643bbe3ff8e31b8b6d8b0a1b85e20f4
|
F tool/genfkey.README cf68fddd4643bbe3ff8e31b8b6d8b0a1b85e20f4
|
||||||
F tool/genfkey.test 4196a8928b78f51d54ef58e99e99401ab2f0a7e5
|
F tool/genfkey.test 4196a8928b78f51d54ef58e99e99401ab2f0a7e5
|
||||||
F tool/getlock.c f4c39b651370156cae979501a7b156bdba50e7ce
|
F tool/getlock.c f4c39b651370156cae979501a7b156bdba50e7ce
|
||||||
@ -1303,7 +1304,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
|
|||||||
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
||||||
F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
|
F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
|
||||||
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
|
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
|
||||||
P 41449f7a0b5da6332eef48386c91ef63382c4783
|
P 86309961344f4076ddcf55d730d3600ec3b6e45c dc88fe7e641c52d27fba8c753cee590db87388c5
|
||||||
R 6f8967f9e2552e4661a21d901cb3fab7
|
R e0fc7874fca6c46f36b4c18c43a12035
|
||||||
U dan
|
U dan
|
||||||
Z c90c5f944e45872447f2bae768eb92e5
|
Z 339a1949f9a5bc9b03407831c5b374c4
|
||||||
|
@ -1 +1 @@
|
|||||||
86309961344f4076ddcf55d730d3600ec3b6e45c
|
1c78d8920fb59da3cb97dd2eb09b3e08dfd14259
|
@ -3383,7 +3383,7 @@ void sqlite3TreeViewExpr(TreeView *pView, const Expr *pExpr, u8 moreToFollow){
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TK_ID: {
|
case TK_ID: {
|
||||||
sqlite3TreeViewLine(pView,"ID %Q", pExpr->u.zToken);
|
sqlite3TreeViewLine(pView,"ID \"%w\"", pExpr->u.zToken);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#ifndef SQLITE_OMIT_CAST
|
#ifndef SQLITE_OMIT_CAST
|
||||||
|
@ -79,7 +79,7 @@ static void incrAggFunctionDepth(Expr *pExpr, int N){
|
|||||||
** SELECT a+b, c+d FROM t1 ORDER BY (a+b) COLLATE nocase;
|
** SELECT a+b, c+d FROM t1 ORDER BY (a+b) COLLATE nocase;
|
||||||
**
|
**
|
||||||
** The nSubquery parameter specifies how many levels of subquery the
|
** The nSubquery parameter specifies how many levels of subquery the
|
||||||
** alias is removed from the original expression. The usually value is
|
** alias is removed from the original expression. The usual value is
|
||||||
** zero but it might be more if the alias is contained within a subquery
|
** zero but it might be more if the alias is contained within a subquery
|
||||||
** of the original expression. The Expr.op2 field of TK_AGG_FUNCTION
|
** of the original expression. The Expr.op2 field of TK_AGG_FUNCTION
|
||||||
** structures must be increased by the nSubquery amount.
|
** structures must be increased by the nSubquery amount.
|
||||||
@ -99,7 +99,7 @@ static void resolveAlias(
|
|||||||
assert( iCol>=0 && iCol<pEList->nExpr );
|
assert( iCol>=0 && iCol<pEList->nExpr );
|
||||||
pOrig = pEList->a[iCol].pExpr;
|
pOrig = pEList->a[iCol].pExpr;
|
||||||
assert( pOrig!=0 );
|
assert( pOrig!=0 );
|
||||||
assert( pOrig->flags & EP_Resolved );
|
assert( (pOrig->flags & EP_Resolved)!=0 || zType[0]==0 );
|
||||||
db = pParse->db;
|
db = pParse->db;
|
||||||
pDup = sqlite3ExprDup(db, pOrig, 0);
|
pDup = sqlite3ExprDup(db, pOrig, 0);
|
||||||
if( pDup==0 ) return;
|
if( pDup==0 ) return;
|
||||||
|
@ -179,5 +179,35 @@ do_test 4.2 {
|
|||||||
} {1 {database disk image is malformed}}
|
} {1 {database disk image is malformed}}
|
||||||
reset_db
|
reset_db
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------------
|
||||||
|
# Test case 5.*
|
||||||
|
#
|
||||||
|
# Test that the integrity-check works if there is uncommitted data.
|
||||||
|
#
|
||||||
|
do_execsql_test 5.0 {
|
||||||
|
BEGIN;
|
||||||
|
CREATE VIRTUAL TABLE t5 USING fts4(a, prefix="1,2,3");
|
||||||
|
INSERT INTO t5 VALUES('And down by Kosiosko, where the reed-banks sweep');
|
||||||
|
INSERT INTO t5 VALUES('and sway, and the rolling plains are wide, the');
|
||||||
|
INSERT INTO t5 VALUES('man from snowy river is a household name today,');
|
||||||
|
INSERT INTO t5 VALUES('and the stockmen tell the story of his ride');
|
||||||
|
}
|
||||||
|
|
||||||
|
do_execsql_test 5.1 {
|
||||||
|
INSERT INTO t5(t5) VALUES('integrity-check');
|
||||||
|
} {}
|
||||||
|
|
||||||
|
do_catchsql_test 5.2 {
|
||||||
|
INSERT INTO t5_content VALUES(5, 'his hardy mountain pony');
|
||||||
|
INSERT INTO t5(t5) VALUES('integrity-check');
|
||||||
|
} {1 {database disk image is malformed}}
|
||||||
|
|
||||||
|
do_execsql_test 5.3 ROLLBACK
|
||||||
|
|
||||||
|
do_execsql_test 5.4 {
|
||||||
|
CREATE VIRTUAL TABLE t5 USING fts4(a, prefix="1,2,3");
|
||||||
|
INSERT INTO t5(t5) VALUES('integrity-check');
|
||||||
|
} {}
|
||||||
|
|
||||||
finish_test
|
finish_test
|
||||||
|
|
||||||
|
BIN
test/fuzzdata1.txt
Normal file
BIN
test/fuzzdata1.txt
Normal file
Binary file not shown.
@ -18,6 +18,7 @@ optional) are:
|
|||||||
--buildonly (Just build testfixture - do not run)
|
--buildonly (Just build testfixture - do not run)
|
||||||
--dryrun (Print what would have happened)
|
--dryrun (Print what would have happened)
|
||||||
--info (Show diagnostic info)
|
--info (Show diagnostic info)
|
||||||
|
--with-tcl=DIR (Use TCL build at DIR)
|
||||||
|
|
||||||
The default value for --srcdir is the parent of the directory holding
|
The default value for --srcdir is the parent of the directory holding
|
||||||
this script.
|
this script.
|
||||||
@ -199,6 +200,8 @@ array set ::Configs [strip_comments {
|
|||||||
Fail2 {-O0}
|
Fail2 {-O0}
|
||||||
Fail3 {-O0}
|
Fail3 {-O0}
|
||||||
Fail4 {-O0}
|
Fail4 {-O0}
|
||||||
|
FuzzFail1 {-O0}
|
||||||
|
FuzzFail2 {-O0}
|
||||||
}]
|
}]
|
||||||
|
|
||||||
array set ::Platforms [strip_comments {
|
array set ::Platforms [strip_comments {
|
||||||
@ -255,6 +258,8 @@ array set ::Platforms [strip_comments {
|
|||||||
Fail2 "TEST_FAILURE=2 valgrindtest"
|
Fail2 "TEST_FAILURE=2 valgrindtest"
|
||||||
Fail3 "TEST_FAILURE=3 valgrindtest"
|
Fail3 "TEST_FAILURE=3 valgrindtest"
|
||||||
Fail4 "TEST_FAILURE=4 test"
|
Fail4 "TEST_FAILURE=4 test"
|
||||||
|
FuzzFail1 "TEST_FAILURE=5 test"
|
||||||
|
FuzzFail2 "TEST_FAILURE=5 valgrindtest"
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
|
|
||||||
@ -351,7 +356,7 @@ proc run_test_suite {name testtarget config} {
|
|||||||
set cflags [expr {$::MSVC ? "-Zi" : "-g"}]
|
set cflags [expr {$::MSVC ? "-Zi" : "-g"}]
|
||||||
set opts ""
|
set opts ""
|
||||||
set title ${name}($testtarget)
|
set title ${name}($testtarget)
|
||||||
set configOpts ""
|
set configOpts $::WITHTCL
|
||||||
|
|
||||||
regsub -all {#[^\n]*\n} $config \n config
|
regsub -all {#[^\n]*\n} $config \n config
|
||||||
foreach arg $config {
|
foreach arg $config {
|
||||||
@ -482,6 +487,7 @@ proc process_options {argv} {
|
|||||||
set ::DRYRUN 0
|
set ::DRYRUN 0
|
||||||
set ::EXEC exec
|
set ::EXEC exec
|
||||||
set ::TRACE 0
|
set ::TRACE 0
|
||||||
|
set ::WITHTCL {}
|
||||||
set config {}
|
set config {}
|
||||||
set platform $::tcl_platform(os)-$::tcl_platform(machine)
|
set platform $::tcl_platform(os)-$::tcl_platform(machine)
|
||||||
|
|
||||||
@ -556,6 +562,10 @@ proc process_options {argv} {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-with-tcl=* {
|
||||||
|
set ::WITHTCL -$x
|
||||||
|
}
|
||||||
|
|
||||||
-D* -
|
-D* -
|
||||||
-O* -
|
-O* -
|
||||||
-enable-* -
|
-enable-* -
|
||||||
|
@ -11,10 +11,12 @@
|
|||||||
#
|
#
|
||||||
# This file tests features of the name resolver (the component that
|
# This file tests features of the name resolver (the component that
|
||||||
# figures out what identifiers in the SQL statement refer to) that
|
# figures out what identifiers in the SQL statement refer to) that
|
||||||
# were fixed by ticket [2500cdb9be]
|
# were fixed by ticket [2500cdb9be].
|
||||||
#
|
#
|
||||||
# See also tickets [1c69be2daf] and [f617ea3125] from 2013-08-14.
|
# See also tickets [1c69be2daf] and [f617ea3125] from 2013-08-14.
|
||||||
#
|
#
|
||||||
|
# Also a fuzzer-discovered problem on 2015-04-23.
|
||||||
|
#
|
||||||
|
|
||||||
set testdir [file dirname $argv0]
|
set testdir [file dirname $argv0]
|
||||||
source $testdir/tester.tcl
|
source $testdir/tester.tcl
|
||||||
@ -201,6 +203,12 @@ do_execsql_test resolver01-6.3 {
|
|||||||
GROUP BY lower(name);
|
GROUP BY lower(name);
|
||||||
} {1 {} 1 {}}
|
} {1 {} 1 {}}
|
||||||
|
|
||||||
|
do_execsql_test resolver01-7.1 {
|
||||||
|
SELECT 2 AS x WHERE (SELECT x AS y WHERE 3>y);
|
||||||
|
} {2}
|
||||||
|
do_execsql_test resolver01-7.2 {
|
||||||
|
SELECT 2 AS x WHERE (SELECT x AS y WHERE 1>y);
|
||||||
|
} {}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ ifcapable fts3 {
|
|||||||
INSERT INTO x1(x1) VALUES('optimize');
|
INSERT INTO x1(x1) VALUES('optimize');
|
||||||
} {
|
} {
|
||||||
"INSERT INTO x1(x1) VALUES('optimize');"
|
"INSERT INTO x1(x1) VALUES('optimize');"
|
||||||
"-- SELECT DISTINCT level / (1024 * ?) FROM 'main'.'x1_segdir'"
|
"-- SELECT ? UNION SELECT level / (1024 * ?) FROM 'main'.'x1_segdir'"
|
||||||
"-- SELECT idx, start_block, leaves_end_block, end_block, root FROM 'main'.'x1_segdir' WHERE level BETWEEN ? AND ?ORDER BY level DESC, idx ASC"
|
"-- SELECT idx, start_block, leaves_end_block, end_block, root FROM 'main'.'x1_segdir' WHERE level BETWEEN ? AND ?ORDER BY level DESC, idx ASC"
|
||||||
"-- SELECT max(level) FROM 'main'.'x1_segdir' WHERE level BETWEEN ? AND ?"
|
"-- SELECT max(level) FROM 'main'.'x1_segdir' WHERE level BETWEEN ? AND ?"
|
||||||
"-- SELECT coalesce((SELECT max(blockid) FROM 'main'.'x1_segments') + 1, 1)"
|
"-- SELECT coalesce((SELECT max(blockid) FROM 'main'.'x1_segments') + 1, 1)"
|
||||||
|
@ -39,9 +39,8 @@
|
|||||||
**
|
**
|
||||||
** where the "..." is arbitrary text, except the "|" should really be "/".
|
** where the "..." is arbitrary text, except the "|" should really be "/".
|
||||||
** ("|" is used here to avoid compiler warnings about nested comments.)
|
** ("|" is used here to avoid compiler warnings about nested comments.)
|
||||||
** Each such SQL comment is printed as it is encountered. A separate
|
** A separate in-memory SQLite database is created to run each chunk of SQL.
|
||||||
** in-memory SQLite database is created to run each chunk of SQL. This
|
** This feature allows the "queue" of AFL to be captured into a single big
|
||||||
** feature allows the "queue" of AFL to be captured into a single big
|
|
||||||
** file using a command like this:
|
** file using a command like this:
|
||||||
**
|
**
|
||||||
** (for i in id:*; do echo '|****<'$i'>****|'; cat $i; done) >~/all-queue.txt
|
** (for i in id:*; do echo '|****<'$i'>****|'; cat $i; done) >~/all-queue.txt
|
||||||
@ -49,11 +48,17 @@
|
|||||||
** (Once again, change the "|" to "/") Then all elements of the AFL queue
|
** (Once again, change the "|" to "/") Then all elements of the AFL queue
|
||||||
** can be run in a single go (for regression testing, for example) by typing:
|
** can be run in a single go (for regression testing, for example) by typing:
|
||||||
**
|
**
|
||||||
** fuzzershell -f ~/all-queue.txt >out.txt
|
** fuzzershell -f ~/all-queue.txt
|
||||||
**
|
**
|
||||||
** After running each chunk of SQL, the database connection is closed. The
|
** After running each chunk of SQL, the database connection is closed. The
|
||||||
** program aborts if the close fails or if there is any unfreed memory after
|
** program aborts if the close fails or if there is any unfreed memory after
|
||||||
** the close.
|
** the close.
|
||||||
|
**
|
||||||
|
** New cases can be appended to all-queue.txt at any time. If redundant cases
|
||||||
|
** are added, that can be eliminated by running:
|
||||||
|
**
|
||||||
|
** fuzzershell -f ~/all-queue.txt --unique-cases ~/unique-cases.txt
|
||||||
|
**
|
||||||
*/
|
*/
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -138,7 +143,11 @@ static int execCallback(void *NotUsed, int argc, char **argv, char **colv){
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
static int execNoop(void *NotUsed, int argc, char **argv, char **colv){
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef SQLITE_OMIT_TRACE
|
||||||
/*
|
/*
|
||||||
** This callback is invoked by sqlite3_trace() as each SQL statement
|
** This callback is invoked by sqlite3_trace() as each SQL statement
|
||||||
** starts.
|
** starts.
|
||||||
@ -146,6 +155,7 @@ static int execCallback(void *NotUsed, int argc, char **argv, char **colv){
|
|||||||
static void traceCallback(void *NotUsed, const char *zMsg){
|
static void traceCallback(void *NotUsed, const char *zMsg){
|
||||||
printf("TRACE: %s\n", zMsg);
|
printf("TRACE: %s\n", zMsg);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
** eval() implementation copied from ../ext/misc/eval.c
|
** eval() implementation copied from ../ext/misc/eval.c
|
||||||
@ -243,17 +253,22 @@ static void showHelp(void){
|
|||||||
printf(
|
printf(
|
||||||
"Read SQL text from standard input and evaluate it.\n"
|
"Read SQL text from standard input and evaluate it.\n"
|
||||||
"Options:\n"
|
"Options:\n"
|
||||||
" --autovacuum Enable AUTOVACUUM mode\n"
|
" --autovacuum Enable AUTOVACUUM mode\n"
|
||||||
" -f FILE Read SQL text from FILE instead of standard input\n"
|
" -f FILE Read SQL text from FILE instead of standard input\n"
|
||||||
" --heap SZ MIN Memory allocator uses SZ bytes & min allocation MIN\n"
|
" --heap SZ MIN Memory allocator uses SZ bytes & min allocation MIN\n"
|
||||||
" --help Show this help text\n"
|
" --help Show this help text\n"
|
||||||
" --initdb DBFILE Initialize the in-memory database using template DBFILE\n"
|
" --initdb DBFILE Initialize the in-memory database using template DBFILE\n"
|
||||||
" --lookaside N SZ Configure lookaside for N slots of SZ bytes each\n"
|
" --lookaside N SZ Configure lookaside for N slots of SZ bytes each\n"
|
||||||
" --pagesize N Set the page size to N\n"
|
" --pagesize N Set the page size to N\n"
|
||||||
" --pcache N SZ Configure N pages of pagecache each of size SZ bytes\n"
|
" --pcache N SZ Configure N pages of pagecache each of size SZ bytes\n"
|
||||||
" --scratch N SZ Configure scratch memory for N slots of SZ bytes each\n"
|
" -q Reduced output\n"
|
||||||
" --utf16be Set text encoding to UTF-16BE\n"
|
" --quiet Reduced output\n"
|
||||||
" --utf16le Set text encoding to UTF-16LE\n"
|
" --scratch N SZ Configure scratch memory for N slots of SZ bytes each\n"
|
||||||
|
" --unique-cases FILE Write all unique test cases to FILE\n"
|
||||||
|
" --utf16be Set text encoding to UTF-16BE\n"
|
||||||
|
" --utf16le Set text encoding to UTF-16LE\n"
|
||||||
|
" -v Increased output\n"
|
||||||
|
" --verbose Increased output\n"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -351,6 +366,16 @@ int main(int argc, char **argv){
|
|||||||
char *zSql; /* SQL to run */
|
char *zSql; /* SQL to run */
|
||||||
char *zToFree = 0; /* Call sqlite3_free() on this afte running zSql */
|
char *zToFree = 0; /* Call sqlite3_free() on this afte running zSql */
|
||||||
int iMode = FZMODE_Generic; /* Operating mode */
|
int iMode = FZMODE_Generic; /* Operating mode */
|
||||||
|
const char *zCkGlob = 0; /* Inputs must match this glob */
|
||||||
|
int verboseFlag = 0; /* --verbose or -v flag */
|
||||||
|
int quietFlag = 0; /* --quiet or -q flag */
|
||||||
|
int nTest = 0; /* Number of test cases run */
|
||||||
|
int multiTest = 0; /* True if there will be multiple test cases */
|
||||||
|
int lastPct = -1; /* Previous percentage done output */
|
||||||
|
sqlite3 *dataDb = 0; /* Database holding compacted input data */
|
||||||
|
sqlite3_stmt *pStmt = 0; /* Statement to insert testcase into dataDb */
|
||||||
|
const char *zDataOut = 0; /* Write compacted data to this output file */
|
||||||
|
int nHeader = 0; /* Bytes of header comment text on input file */
|
||||||
|
|
||||||
|
|
||||||
g.zArgv0 = argv[0];
|
g.zArgv0 = argv[0];
|
||||||
@ -392,12 +417,16 @@ int main(int argc, char **argv){
|
|||||||
z = argv[++i];
|
z = argv[++i];
|
||||||
if( strcmp(z,"generic")==0 ){
|
if( strcmp(z,"generic")==0 ){
|
||||||
iMode = FZMODE_Printf;
|
iMode = FZMODE_Printf;
|
||||||
|
zCkGlob = 0;
|
||||||
}else if( strcmp(z, "glob")==0 ){
|
}else if( strcmp(z, "glob")==0 ){
|
||||||
iMode = FZMODE_Glob;
|
iMode = FZMODE_Glob;
|
||||||
|
zCkGlob = "'*','*'";
|
||||||
}else if( strcmp(z, "printf")==0 ){
|
}else if( strcmp(z, "printf")==0 ){
|
||||||
iMode = FZMODE_Printf;
|
iMode = FZMODE_Printf;
|
||||||
|
zCkGlob = "'*',*";
|
||||||
}else if( strcmp(z, "strftime")==0 ){
|
}else if( strcmp(z, "strftime")==0 ){
|
||||||
iMode = FZMODE_Strftime;
|
iMode = FZMODE_Strftime;
|
||||||
|
zCkGlob = "'*',*";
|
||||||
}else{
|
}else{
|
||||||
abendError("unknown --mode: %s", z);
|
abendError("unknown --mode: %s", z);
|
||||||
}
|
}
|
||||||
@ -412,18 +441,31 @@ int main(int argc, char **argv){
|
|||||||
szPCache = integerValue(argv[i+2]);
|
szPCache = integerValue(argv[i+2]);
|
||||||
i += 2;
|
i += 2;
|
||||||
}else
|
}else
|
||||||
|
if( strcmp(z,"quiet")==0 || strcmp(z,"q")==0 ){
|
||||||
|
quietFlag = 1;
|
||||||
|
verboseFlag = 0;
|
||||||
|
}else
|
||||||
if( strcmp(z,"scratch")==0 ){
|
if( strcmp(z,"scratch")==0 ){
|
||||||
if( i>=argc-2 ) abendError("missing arguments on %s", argv[i]);
|
if( i>=argc-2 ) abendError("missing arguments on %s", argv[i]);
|
||||||
nScratch = integerValue(argv[i+1]);
|
nScratch = integerValue(argv[i+1]);
|
||||||
szScratch = integerValue(argv[i+2]);
|
szScratch = integerValue(argv[i+2]);
|
||||||
i += 2;
|
i += 2;
|
||||||
}else
|
}else
|
||||||
|
if( strcmp(z, "unique-cases")==0 ){
|
||||||
|
if( i>=argc-1 ) abendError("missing arguments on %s", argv[i]);
|
||||||
|
if( zDataOut ) abendError("only one --minimize allowed");
|
||||||
|
zDataOut = argv[++i];
|
||||||
|
}else
|
||||||
if( strcmp(z,"utf16le")==0 ){
|
if( strcmp(z,"utf16le")==0 ){
|
||||||
zEncoding = "utf16le";
|
zEncoding = "utf16le";
|
||||||
}else
|
}else
|
||||||
if( strcmp(z,"utf16be")==0 ){
|
if( strcmp(z,"utf16be")==0 ){
|
||||||
zEncoding = "utf16be";
|
zEncoding = "utf16be";
|
||||||
}else
|
}else
|
||||||
|
if( strcmp(z,"verbose")==0 || strcmp(z,"v")==0 ){
|
||||||
|
quietFlag = 0;
|
||||||
|
verboseFlag = 1;
|
||||||
|
}else
|
||||||
{
|
{
|
||||||
abendError("unknown option: %s", argv[i]);
|
abendError("unknown option: %s", argv[i]);
|
||||||
}
|
}
|
||||||
@ -431,7 +473,7 @@ int main(int argc, char **argv){
|
|||||||
abendError("unknown argument: %s", argv[i]);
|
abendError("unknown argument: %s", argv[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sqlite3_config(SQLITE_CONFIG_LOG, shellLog, 0);
|
if( verboseFlag ) sqlite3_config(SQLITE_CONFIG_LOG, shellLog, 0);
|
||||||
if( nHeap>0 ){
|
if( nHeap>0 ){
|
||||||
pHeap = malloc( nHeap );
|
pHeap = malloc( nHeap );
|
||||||
if( pHeap==0 ) fatalError("cannot allocate %d-byte heap\n", nHeap);
|
if( pHeap==0 ) fatalError("cannot allocate %d-byte heap\n", nHeap);
|
||||||
@ -468,24 +510,53 @@ int main(int argc, char **argv){
|
|||||||
zIn[nIn] = 0;
|
zIn[nIn] = 0;
|
||||||
if( got==0 ) break;
|
if( got==0 ) break;
|
||||||
}
|
}
|
||||||
|
if( in!=stdin ) fclose(in);
|
||||||
|
if( zDataOut ){
|
||||||
|
rc = sqlite3_open(":memory:", &dataDb);
|
||||||
|
if( rc ) abendError("cannot open :memory: database");
|
||||||
|
rc = sqlite3_exec(dataDb,
|
||||||
|
"CREATE TABLE testcase(sql BLOB PRIMARY KEY) WITHOUT ROWID;",0,0,0);
|
||||||
|
if( rc ) abendError("%s", sqlite3_errmsg(dataDb));
|
||||||
|
rc = sqlite3_prepare_v2(dataDb, "INSERT OR IGNORE INTO testcase(sql)VALUES(?1)",
|
||||||
|
-1, &pStmt, 0);
|
||||||
|
if( rc ) abendError("%s", sqlite3_errmsg(dataDb));
|
||||||
|
}
|
||||||
if( zInitDb ){
|
if( zInitDb ){
|
||||||
rc = sqlite3_open_v2(zInitDb, &dbInit, SQLITE_OPEN_READONLY, 0);
|
rc = sqlite3_open_v2(zInitDb, &dbInit, SQLITE_OPEN_READONLY, 0);
|
||||||
if( rc!=SQLITE_OK ){
|
if( rc!=SQLITE_OK ){
|
||||||
abendError("unable to open initialization database \"%s\"", zInitDb);
|
abendError("unable to open initialization database \"%s\"", zInitDb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(i=0; i<nIn; i=iNext){
|
for(i=0; i<nIn; i=iNext+1){ /* Skip initial lines beginning with '#' */
|
||||||
|
if( zIn[i]!='#' ) break;
|
||||||
|
for(iNext=i+1; iNext<nIn && zIn[iNext]!='\n'; iNext++){}
|
||||||
|
}
|
||||||
|
nHeader = i;
|
||||||
|
for(nTest=0; i<nIn; i=iNext, nTest++){
|
||||||
char cSaved;
|
char cSaved;
|
||||||
if( strncmp(&zIn[i], "/****<",6)==0 ){
|
if( strncmp(&zIn[i], "/****<",6)==0 ){
|
||||||
char *z = strstr(&zIn[i], ">****/");
|
char *z = strstr(&zIn[i], ">****/");
|
||||||
if( z ){
|
if( z ){
|
||||||
z += 6;
|
z += 6;
|
||||||
printf("%.*s\n", (int)(z-&zIn[i]), &zIn[i]);
|
if( verboseFlag ) printf("%.*s\n", (int)(z-&zIn[i]), &zIn[i]);
|
||||||
i += (int)(z-&zIn[i]);
|
i += (int)(z-&zIn[i]);
|
||||||
|
multiTest = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(iNext=i; iNext<nIn && strncmp(&zIn[iNext],"/****<",6)!=0; iNext++){}
|
for(iNext=i; iNext<nIn && strncmp(&zIn[iNext],"/****<",6)!=0; iNext++){}
|
||||||
|
if( zDataOut ){
|
||||||
|
sqlite3_bind_blob(pStmt, 1, &zIn[i], iNext-i, SQLITE_STATIC);
|
||||||
|
rc = sqlite3_step(pStmt);
|
||||||
|
if( rc!=SQLITE_DONE ) abendError("%s", sqlite3_errmsg(dataDb));
|
||||||
|
sqlite3_reset(pStmt);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
cSaved = zIn[iNext];
|
||||||
|
zIn[iNext] = 0;
|
||||||
|
if( zCkGlob && sqlite3_strglob(zCkGlob,&zIn[i])!=0 ){
|
||||||
|
zIn[iNext] = cSaved;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
rc = sqlite3_open_v2(
|
rc = sqlite3_open_v2(
|
||||||
"main.db", &db,
|
"main.db", &db,
|
||||||
SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_MEMORY,
|
SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_MEMORY,
|
||||||
@ -507,18 +578,28 @@ int main(int argc, char **argv){
|
|||||||
}
|
}
|
||||||
sqlite3_backup_finish(pBackup);
|
sqlite3_backup_finish(pBackup);
|
||||||
}
|
}
|
||||||
sqlite3_trace(db, traceCallback, 0);
|
#ifndef SQLITE_OMIT_TRACE
|
||||||
|
if( verboseFlag ) sqlite3_trace(db, traceCallback, 0);
|
||||||
|
#endif
|
||||||
sqlite3_create_function(db, "eval", 1, SQLITE_UTF8, 0, sqlEvalFunc, 0, 0);
|
sqlite3_create_function(db, "eval", 1, SQLITE_UTF8, 0, sqlEvalFunc, 0, 0);
|
||||||
sqlite3_create_function(db, "eval", 2, SQLITE_UTF8, 0, sqlEvalFunc, 0, 0);
|
sqlite3_create_function(db, "eval", 2, SQLITE_UTF8, 0, sqlEvalFunc, 0, 0);
|
||||||
sqlite3_limit(db, SQLITE_LIMIT_LENGTH, 1000000);
|
sqlite3_limit(db, SQLITE_LIMIT_LENGTH, 1000000);
|
||||||
if( zEncoding ) sqlexec(db, "PRAGMA encoding=%s", zEncoding);
|
if( zEncoding ) sqlexec(db, "PRAGMA encoding=%s", zEncoding);
|
||||||
if( pageSize ) sqlexec(db, "PRAGMA pagesize=%d", pageSize);
|
if( pageSize ) sqlexec(db, "PRAGMA pagesize=%d", pageSize);
|
||||||
if( doAutovac ) sqlexec(db, "PRAGMA auto_vacuum=FULL");
|
if( doAutovac ) sqlexec(db, "PRAGMA auto_vacuum=FULL");
|
||||||
cSaved = zIn[iNext];
|
|
||||||
zIn[iNext] = 0;
|
|
||||||
printf("INPUT (offset: %d, size: %d): [%s]\n",
|
|
||||||
i, (int)strlen(&zIn[i]), &zIn[i]);
|
|
||||||
zSql = &zIn[i];
|
zSql = &zIn[i];
|
||||||
|
if( verboseFlag ){
|
||||||
|
printf("INPUT (offset: %d, size: %d): [%s]\n",
|
||||||
|
i, (int)strlen(&zIn[i]), &zIn[i]);
|
||||||
|
}else if( multiTest && !quietFlag ){
|
||||||
|
int pct = 10*iNext/nIn;
|
||||||
|
if( pct!=lastPct ){
|
||||||
|
if( lastPct<0 ) printf("fuzz test:");
|
||||||
|
printf(" %d%%", pct*10);
|
||||||
|
fflush(stdout);
|
||||||
|
lastPct = pct;
|
||||||
|
}
|
||||||
|
}
|
||||||
switch( iMode ){
|
switch( iMode ){
|
||||||
case FZMODE_Glob:
|
case FZMODE_Glob:
|
||||||
zSql = zToFree = sqlite3_mprintf("SELECT glob(%s);", zSql);
|
zSql = zToFree = sqlite3_mprintf("SELECT glob(%s);", zSql);
|
||||||
@ -530,18 +611,20 @@ int main(int argc, char **argv){
|
|||||||
zSql = zToFree = sqlite3_mprintf("SELECT strftime(%s);", zSql);
|
zSql = zToFree = sqlite3_mprintf("SELECT strftime(%s);", zSql);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
rc = sqlite3_exec(db, zSql, execCallback, 0, &zErrMsg);
|
zErrMsg = 0;
|
||||||
|
rc = sqlite3_exec(db, zSql, verboseFlag ? execCallback : execNoop, 0, &zErrMsg);
|
||||||
if( zToFree ){
|
if( zToFree ){
|
||||||
sqlite3_free(zToFree);
|
sqlite3_free(zToFree);
|
||||||
zToFree = 0;
|
zToFree = 0;
|
||||||
}
|
}
|
||||||
zIn[iNext] = cSaved;
|
zIn[iNext] = cSaved;
|
||||||
|
if( verboseFlag ){
|
||||||
printf("RESULT-CODE: %d\n", rc);
|
printf("RESULT-CODE: %d\n", rc);
|
||||||
if( zErrMsg ){
|
if( zErrMsg ){
|
||||||
printf("ERROR-MSG: [%s]\n", zErrMsg);
|
printf("ERROR-MSG: [%s]\n", zErrMsg);
|
||||||
sqlite3_free(zErrMsg);
|
}
|
||||||
}
|
}
|
||||||
|
sqlite3_free(zErrMsg);
|
||||||
rc = sqlite3_close(db);
|
rc = sqlite3_close(db);
|
||||||
if( rc ){
|
if( rc ){
|
||||||
abendError("sqlite3_close() failed with rc=%d", rc);
|
abendError("sqlite3_close() failed with rc=%d", rc);
|
||||||
@ -549,6 +632,41 @@ int main(int argc, char **argv){
|
|||||||
if( sqlite3_memory_used()>0 ){
|
if( sqlite3_memory_used()>0 ){
|
||||||
abendError("memory in use after close: %lld bytes", sqlite3_memory_used());
|
abendError("memory in use after close: %lld bytes", sqlite3_memory_used());
|
||||||
}
|
}
|
||||||
|
if( nTest==1 ){
|
||||||
|
/* Simulate an error if the TEST_FAILURE environment variable is "5" */
|
||||||
|
char *zFailCode = getenv("TEST_FAILURE");
|
||||||
|
if( zFailCode ){
|
||||||
|
if( zFailCode[0]=='5' && zFailCode[1]==0 ){
|
||||||
|
abendError("simulated failure");
|
||||||
|
}else if( zFailCode[0]!=0 ){
|
||||||
|
/* If TEST_FAILURE is something other than 5, just exit the test
|
||||||
|
** early */
|
||||||
|
printf("\nExit early due to TEST_FAILURE being set");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( !verboseFlag && multiTest && !quietFlag ) printf("\n");
|
||||||
|
if( nTest>1 && !quietFlag ){
|
||||||
|
printf("%d fuzz tests with no errors\nSQLite %s %s\n",
|
||||||
|
nTest, sqlite3_libversion(), sqlite3_sourceid());
|
||||||
|
}
|
||||||
|
if( zDataOut ){
|
||||||
|
int n = 0;
|
||||||
|
FILE *out = fopen(zDataOut, "wb");
|
||||||
|
if( out==0 ) abendError("cannot open %s for writing", zDataOut);
|
||||||
|
if( nHeader>0 ) fwrite(zIn, nHeader, 1, out);
|
||||||
|
sqlite3_finalize(pStmt);
|
||||||
|
rc = sqlite3_prepare_v2(dataDb, "SELECT sql FROM testcase", -1, &pStmt, 0);
|
||||||
|
if( rc ) abendError("%s", sqlite3_errmsg(dataDb));
|
||||||
|
while( sqlite3_step(pStmt)==SQLITE_ROW ){
|
||||||
|
fprintf(out,"/****<%d>****/", ++n);
|
||||||
|
fwrite(sqlite3_column_blob(pStmt,0),sqlite3_column_bytes(pStmt,0),1,out);
|
||||||
|
}
|
||||||
|
fclose(out);
|
||||||
|
sqlite3_finalize(pStmt);
|
||||||
|
sqlite3_close(dataDb);
|
||||||
}
|
}
|
||||||
free(zIn);
|
free(zIn);
|
||||||
free(pHeap);
|
free(pHeap);
|
||||||
|
Loading…
Reference in New Issue
Block a user