From 5180d683a00d719728eaa53bf94112b302898c84 Mon Sep 17 00:00:00 2001 From: drh Date: Mon, 6 Aug 2018 01:39:31 +0000 Subject: [PATCH] Add the --info option to the fuzzcheck test utility. FossilOrigin-Name: 1caaaaa70f21fe71fbe0af227eea8d1367870e2575eedf248cc2a0b515783390 --- manifest | 14 +++++++------- manifest.uuid | 2 +- test/fuzzcheck.c | 43 ++++++++++++++++++++++++++++++++++++++++++- test/fuzzdata2.db | Bin 17021952 -> 17021952 bytes 4 files changed, 50 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 98532d589b..f911303b3d 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\san\soverzealous\sassert()\sstatement\sdiscovered\sby\sOSSFuzz. -D 2018-08-06T01:21:53.563 +C Add\sthe\s--info\soption\sto\sthe\sfuzzcheck\stest\sutility. +D 2018-08-06T01:39:31.617 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F Makefile.in 0a3a6c81e6fcb969ff9106e882f0a08547014ba463cb6beca4c4efaecc924ee6 @@ -950,9 +950,9 @@ F test/fuzz2.test 76dc35b32b6d6f965259508508abce75a6c4d7e1 F test/fuzz3.test 9c813e6613b837cb7a277b0383cd66bfa07042b4cf0317157c35852f30043c31 F test/fuzz_common.tcl a87dfbb88c2a6b08a38e9a070dabd129e617b45b F test/fuzz_malloc.test 5b257a7652d8ee90b22e9cf80d9dbea31a4f3e6fed1d33de57b24b1bdb211d79 -F test/fuzzcheck.c 3885207dc217c4dcdb2de4a3cb169a263afeef51ab9bd0ba8567289f0a19a470 +F test/fuzzcheck.c 8074a35ed4ec3735a5e144b7e0e9123d9821a92281756c1a40d43e302dd79243 F test/fuzzdata1.db 7ee3227bad0e7ccdeb08a9e6822916777073c664 -F test/fuzzdata2.db f03a420d3b822cc82e4f894ca957618fbe9c4973 +F test/fuzzdata2.db 128b3feeb78918d075c9b14b48610145a0dd4c8d6f1ca7c2870c7e425f5bf31f F test/fuzzdata3.db c6586d3e3cef0fbc18108f9bb649aa77bfc38aba F test/fuzzdata4.db b502c7d5498261715812dd8b3c2005bad08b3a26e6489414bd13926cd3e42ed2 F test/fuzzdata5.db 5e8394be0245224340c26fc592746dd560479b0dcb12d4b43edf2c612848e748 @@ -1754,7 +1754,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P cdff3af7bedc5ebea04bd9b5e2112d3db451a475c18c9a9ebd45f6f3a89a43cb -R 6e44cb0e82bbab33cfe6ecf882309ef6 +P d9c9fe9f5ad3fc9123ad29ebafcb7f40dcecd448fb7a928bb31bea8181d81ec1 +R cf4929d6e11c98e78cbb0fcf83b76d5c U drh -Z f0dc4a845ad041547ed953532f8f84f9 +Z 9a0757ff0ae714f2c7ead44f5087933f diff --git a/manifest.uuid b/manifest.uuid index 7891e5824b..49f492e75b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -d9c9fe9f5ad3fc9123ad29ebafcb7f40dcecd448fb7a928bb31bea8181d81ec1 \ No newline at end of file +1caaaaa70f21fe71fbe0af227eea8d1367870e2575eedf248cc2a0b515783390 \ No newline at end of file diff --git a/test/fuzzcheck.c b/test/fuzzcheck.c index 05d944758e..85126e19a8 100644 --- a/test/fuzzcheck.c +++ b/test/fuzzcheck.c @@ -806,7 +806,7 @@ static void showHelp(void){ " --export-db DIR Write databases to files(s) in DIR. Works with --dbid\n" " --export-sql DIR Write SQL to file(s) in DIR. Also works with --sqlid\n" " --help Show this help text\n" -" -q|--quiet Reduced output\n" +" --info Show information about SOURCE-DB w/o running tests\n" " --limit-mem N Limit memory used by test SQLite instance to N bytes\n" " --limit-vdbe Panic if any test runs for more than 100,000 cycles\n" " --load-sql ARGS... Load SQL scripts fron files into SOURCE-DB\n" @@ -816,6 +816,7 @@ static void showHelp(void){ " --native-malloc Turn off MEMSYS3/5 and Lookaside\n" " --oss-fuzz Enable OSS-FUZZ testing\n" " --prng-seed N Seed value for the PRGN inside of SQLite\n" +" -q|--quiet Reduced output\n" " --rebuild Rebuild and vacuum the database file\n" " --result-trace Show the results of each SQL command\n" " --sqlid N Use only SQL where sqlid=N\n" @@ -841,6 +842,7 @@ int main(int argc, char **argv){ int nativeFlag = 0; /* --native-vfs */ int rebuildFlag = 0; /* --rebuild */ int vdbeLimitFlag = 0; /* --limit-vdbe */ + int infoFlag = 0; /* --info */ int timeoutTest = 0; /* undocumented --timeout-test flag */ int runFlags = 0; /* Flags sent to runSql() */ char *zMsg = 0; /* Add this message */ @@ -897,6 +899,9 @@ int main(int argc, char **argv){ showHelp(); return 0; }else + if( strcmp(z,"info")==0 ){ + infoFlag = 1; + }else if( strcmp(z,"limit-mem")==0 ){ #if !defined(SQLITE_ENABLE_MEMSYS3) && !defined(SQLITE_ENABLE_MEMSYS5) fatalError("the %s option requires -DSQLITE_ENABLE_MEMSYS5 or _MEMSYS3", @@ -996,6 +1001,42 @@ int main(int argc, char **argv){ fatalError("cannot open source database %s - %s", azSrcDb[iSrcDb], sqlite3_errmsg(db)); } + + /* Print the description, if there is one */ + if( infoFlag ){ + int n; + zDbName = azSrcDb[iSrcDb]; + i = (int)strlen(zDbName) - 1; + while( i>0 && zDbName[i-1]!='/' && zDbName[i-1]!='\\' ){ i--; } + zDbName += i; + sqlite3_prepare_v2(db, "SELECT msg FROM readme", -1, &pStmt, 0); + if( pStmt && sqlite3_step(pStmt)==SQLITE_ROW ){ + printf("%s: %s", zDbName, sqlite3_column_text(pStmt,0)); + }else{ + printf("%s: (empty \"readme\")", zDbName); + } + sqlite3_finalize(pStmt); + sqlite3_prepare_v2(db, "SELECT count(*) FROM db", -1, &pStmt, 0); + if( pStmt + && sqlite3_step(pStmt)==SQLITE_ROW + && (n = sqlite3_column_int(pStmt,0))>0 + ){ + printf(" - %d DBs", n); + } + sqlite3_finalize(pStmt); + sqlite3_prepare_v2(db, "SELECT count(*) FROM xsql", -1, &pStmt, 0); + if( pStmt + && sqlite3_step(pStmt)==SQLITE_ROW + && (n = sqlite3_column_int(pStmt,0))>0 + ){ + printf(" - %d scripts", n); + } + sqlite3_finalize(pStmt); + printf("\n"); + sqlite3_close(db); + continue; + } + rc = sqlite3_exec(db, "CREATE TABLE IF NOT EXISTS db(\n" " dbid INTEGER PRIMARY KEY, -- database id\n" diff --git a/test/fuzzdata2.db b/test/fuzzdata2.db index 598814622c677a91137856c37c4e3f65bf823a2b..76827900465ceda18fe65359d402bb8d771cac72 100644 GIT binary patch delta 876 zc-jrn2UisY06<|M50tbNT4q2#E0YEU6sBgSV%dNSX^A$7i$XFAP)aK?y($_AHi*GJ7Y};_OlhOv~-0u(E%8r`I%1*U0fylbpw1~(qiShZ5?Ir%N25^WXfpClB?uuxkj#)>tu{%%UBsF*UJrZqueApa+*)Y zDR0T!@{X*N^|C=W$|iYN-jnxbv$V?=`9MCDkK|+dM7GK{*)BU|r+g}($u9X^zK}2F zEBRW!k#A+Ud?(+_5Avhzk-f4{_RCN5v-~2z%5U=PU7VV=^;JkNI6P+NpCq?j*$dOlqBgReI+Ev%5ieMoFFGk zKj|+6y*T}VUom?+t^zR`A_!B|FTc^%YkYF zH3T|E1X>9Onp+~X7t0I(< emz|qg5E`3VkW*fgpBE}B45cQgq=l0^OF0PR2#bsW -- 2.47.2