]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Bind the new debug parameters in fuzzinvariants.c.
authordrh <>
Fri, 9 Aug 2024 12:35:27 +0000 (12:35 +0000)
committerdrh <>
Fri, 9 Aug 2024 12:35:27 +0000 (12:35 +0000)
FossilOrigin-Name: 7e1dc263051cf50db04643d1a2aa9f91559b2b121859b750ce4446012d5f3c3e

manifest
manifest.uuid
test/fuzzinvariants.c

index 0de0ea94ddd927f03a6c89301b3d0d7d1b438240..10fc3d74d8a8182ddabf6f336d0eb54c1125fb13 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Remove\sunused\sstatic\svar\scBadGroup\sfrom\sext/consio/console_io.c\sto\sresolve\sa\scompiler\swarning\sreported\sin\sthe\sfossil\sforum.\sThis\sis\sa\sbuild\sfix,\snot\sa\sfunctional\schange.
-D 2024-08-09T12:19:11.913
+C Bind\sthe\snew\sdebug\sparameters\sin\sfuzzinvariants.c.
+D 2024-08-09T12:35:27.067
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -1272,7 +1272,7 @@ F test/fuzzdata8.db 4a53b6d077c6a5c23b609d8d3ac66996fa55ba3f8d02f9b6efdd0214a767
 F test/fuzzer1.test 3d4c4b7e547aba5e5511a2991e3e3d07166cfbb8
 F test/fuzzer2.test a85ef814ce071293bce1ad8dffa217cbbaad4c14
 F test/fuzzerfault.test f64c4aef4c9e9edf1d6dc0d3f1e65dcc81e67c996403c88d14f09b74807a42bc
-F test/fuzzinvariants.c 0729b9d8ed77ad0f8c5c7601168a707d5803087d2da030ede9057c51c809cc6c
+F test/fuzzinvariants.c 81167c9a7e82c0539a1d704aeb3384046d01f4108cda160a2447cb2a149d6362
 F test/gcfault.test 4ea410ac161e685f17b19e1f606f58514a2850e806c65b846d05f60d436c5b0d
 F test/gencol1.test e169bdfa11c7ed5e9f322a98a7db3afe9e66235750b68c923efee8e1876b46ec
 F test/genesis.tcl 1e2e2e8e5cc4058549a154ff1892fe5c9de19f98
@@ -2204,8 +2204,8 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 123b154ce3b6fee1bbf483704812bd6f8538966f9687520b4470d700f0270719
-R dfb7fc0d7f5895fabd0ef74030340b71
-U stephan
-Z 5f05148caae955ae7f0f151431a9b4b8
+P fa047c3ea7a03d76afd6a11f58ef7b84c653f583ed795e0de5be2a6b986e558e
+R 4385e87b815ad1924711e2dcdab3d5bb
+U drh
+Z 5861d6c430a2b6c91eb7ed0d9c3ba80b
 # Remove this line to create a well-formed Fossil manifest.
index 367363b980df838434288e7d162ef0a20a9234d0..c2f77959c0a1d28cf4dba64d853a3e48c2f616ce 100644 (file)
@@ -1 +1 @@
-fa047c3ea7a03d76afd6a11f58ef7b84c653f583ed795e0de5be2a6b986e558e
+7e1dc263051cf50db04643d1a2aa9f91559b2b121859b750ce4446012d5f3c3e
index 80eb4aecb716ae0183f5591a035d240395b1192c..36121963f57f78e1afa2b057d437aa7faa9a6906 100644 (file)
@@ -38,6 +38,31 @@ static void reportInvariantFailed(
   int noOpt              /* True if opt flags inverted for pTest */
 );
 
+/*
+** Special parameter binding, for testing and debugging purposes.
+**
+**     $int_NNN      ->   integer value NNN
+**     $text_TTTT    ->   floating point value TTT with destructor
+*/
+static void bindDebugParameters(sqlite3_stmt *pStmt){
+  int nVar = sqlite3_bind_parameter_count(pStmt);
+  int i;
+  for(i=0; i<nVar; i++){
+    const char *zVar = sqlite3_bind_parameter_name(pStmt, i+1);
+    if( zVar==0 ) continue;
+    if( strncmp(zVar, "$int_", 5)==0 ){
+      sqlite3_bind_int(pStmt, i+1, atoi(&zVar[5]));
+    }else
+    if( strncmp(zVar, "$text_", 6)==0 ){
+      char *zBuf = sqlite3_malloc64( strlen(zVar)-5 );
+      if( zBuf ){
+        memcpy(zBuf, &zVar[6], strlen(zVar)-5);
+        sqlite3_bind_text64(pStmt, i+1, zBuf, -1, sqlite3_free, SQLITE_UTF8);
+      }
+    }
+  }
+}
+
 /*
 ** Do an invariant check on pStmt.  iCnt determines which invariant check to
 ** perform.  The first check is iCnt==0.
@@ -107,6 +132,7 @@ int fuzz_invariant(
     return rc;
   }
   sqlite3_free(zTest);
+  bindDebugParameters(pTestStmt);
   nCol = sqlite3_column_count(pStmt);
   for(i=0; i<nCol; i++){
     rc = sqlite3_bind_value(pTestStmt,i+1+nParam,sqlite3_column_value(pStmt,i));
@@ -171,6 +197,7 @@ int fuzz_invariant(
       printf("invariant-validity-check #2:\n%s\n", zSql);
       sqlite3_free(zSql);
     }
+    bindDebugParameters(pCk);
     while( (rc = sqlite3_step(pCk))==SQLITE_ROW ){
       for(i=0; i<nCol; i++){
         if( !sameValue(pStmt, i, pTestStmt, i, 0) ) break;
@@ -199,6 +226,7 @@ int fuzz_invariant(
       }
 
       sqlite3_reset(pTestStmt);
+      bindDebugParameters(pCk);
       while( (rc = sqlite3_step(pTestStmt))==SQLITE_ROW ){
         for(i=0; i<nCol; i++){
           if( !sameValue(pStmt, i, pTestStmt, i, pCk) ) break;
@@ -298,6 +326,7 @@ static char *fuzz_invariant_sql(sqlite3_stmt *pStmt, int iCnt){
     sqlite3_finalize(pBase);
     pBase = pStmt;
   }
+  bindDebugParameters(pBase);
   for(i=0; i<sqlite3_column_count(pStmt); i++){
     const char *zColName = sqlite3_column_name(pBase,i);
     const char *zSuffix = zColName ? strrchr(zColName, ':') : 0;