]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Enhance the --load-dbsql and related options of fuzzcheck so that if the
authordrh <>
Fri, 23 Apr 2021 12:58:16 +0000 (12:58 +0000)
committerdrh <>
Fri, 23 Apr 2021 12:58:16 +0000 (12:58 +0000)
argument is a single - then filenames are read from standard input.

FossilOrigin-Name: e1548802b6de7037baf388d27a7f3658abafe07b6f48d5ec97e5f644303592d8

manifest
manifest.uuid
test/fuzzcheck.c

index 30b01a01e9437ca546b1a5627dce8ca311529fbc..023acc4c4fc49daad8da9ea2492e25ec772268ba 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Give\sa\sbetter\sfinal\soutput\sline\sfor\sthe\s--spinner\soption\son\sfuzzcheck.
-D 2021-04-23T12:16:16.167
+C Enhance\sthe\s--load-dbsql\sand\srelated\soptions\sof\sfuzzcheck\sso\sthat\sif\sthe\nargument\sis\sa\ssingle\s-\sthen\sfilenames\sare\sread\sfrom\sstandard\sinput.
+D 2021-04-23T12:58:16.190
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -1049,7 +1049,7 @@ F test/fuzz3.test 9c813e6613b837cb7a277b0383cd66bfa07042b4cf0317157c35852f30043c
 F test/fuzz4.test c229bcdb45518a89e1d208a21343e061503460ac69fae1539320a89f572eb634
 F test/fuzz_common.tcl b7197de6ed1ee8250a4f82d67876f4561b42ee8cbbfc6160dcb66331bad3f830
 F test/fuzz_malloc.test f348276e732e814802e39f042b1f6da6362a610af73a528d8f76898fde6b22f2
-F test/fuzzcheck.c 2913b64b61f516eea47186fd9fcce484d47a517bc68e808959ec8f28d85ed276
+F test/fuzzcheck.c 5884fb8b9ce3f884fb2407b5baca193ef458244fe8bed727e7dfeeaedd106977
 F test/fuzzdata1.db d36e88741b4f23bcbaaf55b006290669d03c6c891cf13c7b3a53bc1b097b693f
 F test/fuzzdata2.db 128b3feeb78918d075c9b14b48610145a0dd4c8d6f1ca7c2870c7e425f5bf31f
 F test/fuzzdata3.db c6586d3e3cef0fbc18108f9bb649aa77bfc38aba
@@ -1914,7 +1914,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 8da88508932e475c8c6af1553268ff02e3e013b78ccc94b14532ec928fc62537
-R 0636bb5c7df9e106c29e61e18eff1e44
+P 93729614e21ee674b83b0d2babb71bb758f1a2ec55bf9bda057fb7739f2e14e0
+R c74134fa30bd59bb0667fa273ac36999
 U drh
-Z 449a373ccfec5f2aae5d22ef16608762
+Z 8e87378c3d4125548230641f32954b37
index a1cebcf5357b8ae29f944ca65aecb5d24de1518d..3882a2d34f81de0e1147f6c0e07363caf347189b 100644 (file)
@@ -1 +1 @@
-93729614e21ee674b83b0d2babb71bb758f1a2ec55bf9bda057fb7739f2e14e0
\ No newline at end of file
+e1548802b6de7037baf388d27a7f3658abafe07b6f48d5ec97e5f644303592d8
\ No newline at end of file
index 7f2f226b43beebe3ba9942b09c1756e6aef43265..2d99fa4be7da9ab36c5386540441b8d3ed50249f 100644 (file)
@@ -1435,9 +1435,10 @@ static void showHelp(void){
 "  --limit-heap N       Limit heap memory to N.  Default: 100M\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"
-"  --load-db ARGS...    Load template databases from files into SOURCE_DB\n"
-"  --load-dbsql ARGS..  Load dbsqlfuzz outputs into the xsql table\n"
+"  --load-sql   FILE..  Load SQL scripts fron files into SOURCE-DB\n"
+"  --load-db    FILE..  Load template databases from files into SOURCE_DB\n"
+"  --load-dbsql FILE..  Load dbsqlfuzz outputs into the xsql table\n"
+"               ^^^^------ Use \"-\" for FILE to read filenames from stdin\n"
 "  -m TEXT              Add a description to the database\n"
 "  --native-vfs         Use the native VFS for initially empty database files\n"
 "  --native-malloc      Turn off MEMSYS3/5 and Lookaside\n"
@@ -1778,10 +1779,23 @@ int main(int argc, char **argv){
       rc = sqlite3_exec(db, "BEGIN", 0, 0, 0);
       if( rc ) fatalError("cannot start a transaction");
       for(i=iFirstInsArg; i<argc; i++){
-        sqlite3_bind_text(pStmt, 1, argv[i], -1, SQLITE_STATIC);
-        sqlite3_step(pStmt);
-        rc = sqlite3_reset(pStmt);
-        if( rc ) fatalError("insert failed for %s", argv[i]);
+        if( strcmp(argv[i],"-")==0 ){
+          /* A filename of "-" means read multiple filenames from stdin */
+          unsigned char zLine[2000];
+          while( rc==0 && fgets(zLine,sizeof(zLine),stdin)!=0 ){
+            size_t kk = strlen(zLine);
+            while( kk>0 && isspace(zLine[kk-1]) ) kk--;
+            sqlite3_bind_text(pStmt, 1, zLine, kk, SQLITE_STATIC);
+            sqlite3_step(pStmt);
+            rc = sqlite3_reset(pStmt);
+            if( rc ) fatalError("insert failed for %s", zLine);
+          }
+        }else{
+          sqlite3_bind_text(pStmt, 1, argv[i], -1, SQLITE_STATIC);
+          sqlite3_step(pStmt);
+          rc = sqlite3_reset(pStmt);
+          if( rc ) fatalError("insert failed for %s", argv[i]);
+        }
       }
       sqlite3_finalize(pStmt);
       rc = sqlite3_exec(db, "COMMIT", 0, 0, 0);