mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-08 14:02:16 +03:00
Improved comments on the VDBE branch coverage testing logic. Fix the
VDBE branch coverage measurement on the OP_MustBeInt opcode. FossilOrigin-Name: 8681750e855a020ee374cb9f973f701a72068e33f97d0101a4fab3a228e5ebda
This commit is contained in:
12
manifest
12
manifest
@@ -1,5 +1,5 @@
|
|||||||
C Fix\sa\sdefect\sin\sthe\sVDBE\sbranch\scoverage\stesting\slogic.
|
C Improved\scomments\son\sthe\sVDBE\sbranch\scoverage\stesting\slogic.\s\sFix\sthe\nVDBE\sbranch\scoverage\smeasurement\son\sthe\sOP_MustBeInt\sopcode.
|
||||||
D 2019-04-01T13:06:19.535
|
D 2019-04-01T14:01:21.321
|
||||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||||
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
|
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
|
||||||
@@ -588,7 +588,7 @@ F src/upsert.c 0dd81b40206841814d46942a7337786932475f085716042d0cb2fc7791bf8ca4
|
|||||||
F src/utf.c 810fbfebe12359f10bc2a011520a6e10879ab2a163bcb26c74768eab82ea62a5
|
F src/utf.c 810fbfebe12359f10bc2a011520a6e10879ab2a163bcb26c74768eab82ea62a5
|
||||||
F src/util.c 82a2e3f691a3b654be872e305dab1f455e565dedf5e6a90c818c1ab307c00432
|
F src/util.c 82a2e3f691a3b654be872e305dab1f455e565dedf5e6a90c818c1ab307c00432
|
||||||
F src/vacuum.c 532553ee1d47f69c1198858107b1f3af3d16af25f2ab4ce3b1263d9e333f26e2
|
F src/vacuum.c 532553ee1d47f69c1198858107b1f3af3d16af25f2ab4ce3b1263d9e333f26e2
|
||||||
F src/vdbe.c 1528ce3ba17a3e6fea4e6826a1fe3a0720649eecf9ec95b50b49c05a98039214
|
F src/vdbe.c eeaf0af94b48379b01a25566013138a68e286c82a2da68b2ab30974442518470
|
||||||
F src/vdbe.h 712bca562eaed1c25506b9faf9680bdc75fc42e2f4a1cd518d883fa79c7a4237
|
F src/vdbe.h 712bca562eaed1c25506b9faf9680bdc75fc42e2f4a1cd518d883fa79c7a4237
|
||||||
F src/vdbeInt.h a76d5eed62c76bcd8de7afd3147fac1bc40c5a870582664bcd7d071ef437c37f
|
F src/vdbeInt.h a76d5eed62c76bcd8de7afd3147fac1bc40c5a870582664bcd7d071ef437c37f
|
||||||
F src/vdbeapi.c 7a052df80d7e2e55382076174633e888f21fe200feb5d49b1b441b4c38ab851a
|
F src/vdbeapi.c 7a052df80d7e2e55382076174633e888f21fe200feb5d49b1b441b4c38ab851a
|
||||||
@@ -1814,7 +1814,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
|
|||||||
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||||
P 6cf8b18ec20f11c25ff7396f29c742404d3a88d5e97a5fd53ccfaff51dec3f33
|
P 1fcf3307d37f0e8e0c8c54491c609b73c7add6eaa38409a41c7cd6614a877a19
|
||||||
R b92610a214fa68c9d99cf58b794058b4
|
R 548d264b85d1f84e31c647fc92a651ab
|
||||||
U drh
|
U drh
|
||||||
Z 48bc3a72c5a2f4b3ff012adefbb09d94
|
Z 3917bade205e6ba6a19fe2a0919e61ee
|
||||||
|
@@ -1 +1 @@
|
|||||||
1fcf3307d37f0e8e0c8c54491c609b73c7add6eaa38409a41c7cd6614a877a19
|
8681750e855a020ee374cb9f973f701a72068e33f97d0101a4fab3a228e5ebda
|
39
src/vdbe.c
39
src/vdbe.c
@@ -122,12 +122,20 @@ int sqlite3_found_count = 0;
|
|||||||
** feature is used for test suite validation only and does not appear an
|
** feature is used for test suite validation only and does not appear an
|
||||||
** production builds.
|
** production builds.
|
||||||
**
|
**
|
||||||
** M is an integer between 2 and 4. 2 indicates a ordinary two-way
|
** M is the type of branch. I is the direction taken for this instance of
|
||||||
** branch (I=0 means fall through and I=1 means taken). 3 indicates
|
** the branch.
|
||||||
** a 3-way branch where the third way is when one of the operands is
|
**
|
||||||
** NULL. 4 indicates the OP_Jump instruction which has three destinations
|
** M: 2 - two-way branch (I=0: fall-thru 1: jump )
|
||||||
** depending on whether the first operand is less than, equal to, or greater
|
** 3 - two-way + NULL (I=0: fall-thru 1: jump 2: NULL )
|
||||||
** than the second.
|
** 4 - OP_Jump (I=0: jump p1 1: jump p2 2: jump p3)
|
||||||
|
**
|
||||||
|
** In other words, if M is 2, then I is either 0 (for fall-through) or
|
||||||
|
** 1 (for when the branch is taken). If M is 3, the I is 0 for an
|
||||||
|
** ordinary fall-through, I is 1 if the branch was taken, and I is 2
|
||||||
|
** if the result of comparison is NULL. For M=3, I=2 the jump may or
|
||||||
|
** may not be taken, depending on the SQLITE_JUMPIFNULL flags in p5.
|
||||||
|
** When M is 4, that means that an OP_Jump is being run. I is 0, 1, or 2
|
||||||
|
** depending on if the operands are less than, equal, or greater than.
|
||||||
**
|
**
|
||||||
** iSrcLine is the source code line (from the __LINE__ macro) that
|
** iSrcLine is the source code line (from the __LINE__ macro) that
|
||||||
** generated the VDBE instruction combined with flag bits. The source
|
** generated the VDBE instruction combined with flag bits. The source
|
||||||
@@ -138,9 +146,9 @@ int sqlite3_found_count = 0;
|
|||||||
** alternate branch are never taken. If a branch is never taken then
|
** alternate branch are never taken. If a branch is never taken then
|
||||||
** flags should be 0x06 since only the fall-through approach is allowed.
|
** flags should be 0x06 since only the fall-through approach is allowed.
|
||||||
**
|
**
|
||||||
** Bit 0x04 of the flags indicates an OP_Jump opcode that is only
|
** Bit 0x08 of the flags indicates an OP_Jump opcode that is only
|
||||||
** interested in equal or not-equal. In other words, I==0 and I==2
|
** interested in equal or not-equal. In other words, I==0 and I==2
|
||||||
** should be treated the same.
|
** should be treated as equivalent
|
||||||
**
|
**
|
||||||
** Since only a line number is retained, not the filename, this macro
|
** Since only a line number is retained, not the filename, this macro
|
||||||
** only works for amalgamation builds. But that is ok, since these macros
|
** only works for amalgamation builds. But that is ok, since these macros
|
||||||
@@ -164,6 +172,18 @@ int sqlite3_found_count = 0;
|
|||||||
mNever = iSrcLine >> 24;
|
mNever = iSrcLine >> 24;
|
||||||
assert( (I & mNever)==0 );
|
assert( (I & mNever)==0 );
|
||||||
if( sqlite3GlobalConfig.xVdbeBranch==0 ) return; /*NO_TEST*/
|
if( sqlite3GlobalConfig.xVdbeBranch==0 ) return; /*NO_TEST*/
|
||||||
|
/* Invoke the branch coverage callback with three arguments:
|
||||||
|
** iSrcLine - the line number of the VdbeCoverage() macro, with
|
||||||
|
** flags removed.
|
||||||
|
** I - Mask of bits 0x07 indicating which cases are are
|
||||||
|
** fulfilled by this instance of the jump. 0x01 means
|
||||||
|
** fall-thru, 0x02 means taken, 0x04 means NULL. Any
|
||||||
|
** impossible cases (ex: if the comparison is never NULL)
|
||||||
|
** are filled in automatically so that the coverage
|
||||||
|
** measurement logic does not flag those impossible cases
|
||||||
|
** as missed coverage.
|
||||||
|
** M - Type of jump. Same as M argument above
|
||||||
|
*/
|
||||||
I |= mNever;
|
I |= mNever;
|
||||||
if( M==2 ) I |= 0x04;
|
if( M==2 ) I |= 0x04;
|
||||||
if( M==4 ){
|
if( M==4 ){
|
||||||
@@ -1734,8 +1754,8 @@ case OP_MustBeInt: { /* jump, in1 */
|
|||||||
pIn1 = &aMem[pOp->p1];
|
pIn1 = &aMem[pOp->p1];
|
||||||
if( (pIn1->flags & MEM_Int)==0 ){
|
if( (pIn1->flags & MEM_Int)==0 ){
|
||||||
applyAffinity(pIn1, SQLITE_AFF_NUMERIC, encoding);
|
applyAffinity(pIn1, SQLITE_AFF_NUMERIC, encoding);
|
||||||
VdbeBranchTaken((pIn1->flags&MEM_Int)==0, 2);
|
|
||||||
if( (pIn1->flags & MEM_Int)==0 ){
|
if( (pIn1->flags & MEM_Int)==0 ){
|
||||||
|
VdbeBranchTaken(1, 2);
|
||||||
if( pOp->p2==0 ){
|
if( pOp->p2==0 ){
|
||||||
rc = SQLITE_MISMATCH;
|
rc = SQLITE_MISMATCH;
|
||||||
goto abort_due_to_error;
|
goto abort_due_to_error;
|
||||||
@@ -1744,6 +1764,7 @@ case OP_MustBeInt: { /* jump, in1 */
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
VdbeBranchTaken(0, 2);
|
||||||
MemSetTypeFlag(pIn1, MEM_Int);
|
MemSetTypeFlag(pIn1, MEM_Int);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user