/ Check-in [b5f72f10]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix issues with the previous check-in and add more VDBE branch coverage testing macros.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | oops
Files: files | file ages | folders
SHA3-256: b5f72f10f2dfdbee9fe98c63ffb933e841203790746a920b99df14ca5c14127c
User & Date: drh 2019-03-30 20:37:04
Context
2019-03-30
20:43
Improvements to VdbeCoverage macros. check-in: 10ee9e33 user: drh tags: trunk
20:37
Fix issues with the previous check-in and add more VDBE branch coverage testing macros. Closed-Leaf check-in: b5f72f10 user: drh tags: oops
20:10
Enhanced VdbeCoverage() macros in the new windows function code. Later: This check-in causes an assertion fault. check-in: f24066f8 user: drh tags: oops
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/wherecode.c.

  2193   2193           ** that compares BLOBs. */
  2194   2194   #ifdef SQLITE_LIKE_DOESNT_MATCH_BLOBS
  2195   2195           continue;
  2196   2196   #else
  2197   2197           u32 x = pLevel->iLikeRepCntr;
  2198   2198           if( x>0 ){
  2199   2199             skipLikeAddr = sqlite3VdbeAddOp1(v, (x&1)?OP_IfNot:OP_If,(int)(x>>1));
         2200  +          VdbeCoverageIf(v, (x&1)==1);
         2201  +          VdbeCoverageIf(v, (x&1)==0);
  2200   2202           }
  2201         -        VdbeCoverage(v);
  2202   2203   #endif
  2203   2204         }
  2204   2205   #ifdef WHERETRACE_ENABLED /* 0xffff */
  2205   2206         if( sqlite3WhereTrace ){
  2206   2207           VdbeNoopComment((v, "WhereTerm[%d] (%p) priority=%d",
  2207   2208                            pWC->nTerm-j, pTerm, iLoop));
  2208   2209         }

Changes to src/window.c.

  1306   1306     assert( eCond>=0 && eCond<ArraySize(azErr) );
  1307   1307     sqlite3VdbeAddOp2(v, OP_Integer, 0, regZero);
  1308   1308     if( eCond>=WINDOW_STARTING_NUM ){
  1309   1309       int regString = sqlite3GetTempReg(pParse);
  1310   1310       sqlite3VdbeAddOp4(v, OP_String8, 0, regString, 0, "", P4_STATIC);
  1311   1311       sqlite3VdbeAddOp3(v, OP_Ge, regString, sqlite3VdbeCurrentAddr(v)+2, reg);
  1312   1312       sqlite3VdbeChangeP5(v, SQLITE_AFF_NUMERIC);
         1313  +    VdbeCoverage(v);
         1314  +    assert( eCond==3 || eCond==4 );
         1315  +    VdbeCoverageIf(v, eCond==3);
         1316  +    VdbeCoverageIf(v, eCond==4);
  1313   1317     }else{
  1314   1318       sqlite3VdbeAddOp2(v, OP_MustBeInt, reg, sqlite3VdbeCurrentAddr(v)+2);
         1319  +    VdbeCoverage(v);
         1320  +    assert( eCond==0 || eCond==1 || eCond==2 );
         1321  +    VdbeCoverageIf(v, eCond==0);
         1322  +    VdbeCoverageIf(v, eCond==1);
         1323  +    VdbeCoverageIf(v, eCond==2);
  1315   1324     }
  1316         -  VdbeCoverageIf(v, eCond==0);
  1317         -  VdbeCoverageIf(v, eCond==1);
  1318         -  VdbeCoverageIf(v, eCond==2);
  1319         -  VdbeCoverageIf(v, eCond==3);
  1320         -  VdbeCoverageIf(v, eCond==4);
  1321   1325     sqlite3VdbeAddOp3(v, aOp[eCond], regZero, sqlite3VdbeCurrentAddr(v)+2, reg);
  1322   1326     VdbeCoverageNeverNullIf(v, eCond==0);
  1323   1327     VdbeCoverageNeverNullIf(v, eCond==1);
  1324   1328     VdbeCoverageNeverNullIf(v, eCond==2);
  1325   1329     VdbeCoverageNeverNullIf(v, eCond==3);
  1326   1330     VdbeCoverageNeverNullIf(v, eCond==4);
  1327   1331     sqlite3MayAbort(pParse);
................................................................................
  1829   1833     ** it to the smallest possible string - ''. If it is, jump over the
  1830   1834     ** OP_Add or OP_Subtract operation and proceed directly to the comparison. */
  1831   1835     sqlite3VdbeAddOp4(v, OP_String8, 0, regString, 0, "", P4_STATIC);
  1832   1836     addrGe = sqlite3VdbeAddOp3(v, OP_Ge, regString, 0, reg1);
  1833   1837     VdbeCoverage(v);
  1834   1838     sqlite3VdbeAddOp3(v, arith, regVal, reg1, reg1);
  1835   1839     sqlite3VdbeJumpHere(v, addrGe);
  1836         -  sqlite3VdbeAddOp3(v, op, reg2, lbl, reg1);
         1840  +  sqlite3VdbeAddOp3(v, op, reg2, lbl, reg1); VdbeCoverage(v);
  1837   1841     sqlite3VdbeChangeP5(v, SQLITE_NULLEQ);
  1838         -  assert( op==OP_Ge || op==OP_Gt || op==OP_Le );
  1839         -  VdbeCoverageIf(v, op==OP_Ge);
  1840         -  VdbeCoverageIf(v, op==OP_Gt);
  1841         -  VdbeCoverageIf(v, op==OP_Le);
         1842  +  assert( op==OP_Ge || op==OP_Gt || op==OP_Lt || op==OP_Le );
         1843  +  testcase(op==OP_Ge); VdbeCoverageIf(v, op==OP_Ge);
         1844  +  testcase(op==OP_Lt); VdbeCoverageIf(v, op==OP_Lt);
         1845  +  testcase(op==OP_Le); VdbeCoverageIf(v, op==OP_Le);
         1846  +  testcase(op==OP_Gt); VdbeCoverageIf(v, op==OP_Gt);
  1842   1847   
  1843   1848     sqlite3ReleaseTempReg(pParse, reg1);
  1844   1849     sqlite3ReleaseTempReg(pParse, reg2);
  1845   1850   }
  1846   1851   
  1847   1852   /*
  1848   1853   ** Helper function for sqlite3WindowCodeStep(). Each call to this function
................................................................................
  2532   2537       sqlite3ExprCode(pParse, pMWin->pEnd, regEnd);
  2533   2538       windowCheckValue(pParse, regEnd, 1 + (pMWin->eFrmType==TK_RANGE ? 3 : 0));
  2534   2539     }
  2535   2540   
  2536   2541     if( pMWin->eStart==pMWin->eEnd && regStart ){
  2537   2542       int op = ((pMWin->eStart==TK_FOLLOWING) ? OP_Ge : OP_Le);
  2538   2543       int addrGe = sqlite3VdbeAddOp3(v, op, regStart, 0, regEnd);
         2544  +    VdbeCoverage(v);
  2539   2545       VdbeCoverageIf(v, op==OP_Ge);
  2540   2546       VdbeCoverageIf(v, op==OP_Le);
  2541   2547       windowAggFinal(&s, 0);
  2542   2548       sqlite3VdbeAddOp2(v, OP_Rewind, s.current.csr, 1);
  2543   2549       VdbeCoverageNeverTaken(v);
  2544   2550       windowReturnOneRow(&s);
  2545   2551       sqlite3VdbeAddOp1(v, OP_ResetSorter, s.current.csr);