If the library is built with SQLITE_VDBE_COVERAGE defined, have the Tcl tests generate a vdbe coverage report in file testdir/vdbe_coverage.txt.
FossilOrigin-Name: f0ed714637bf30443d0551d9b6fececa00fc9dfe9669fe720c4598ef71c61e2c
This commit is contained in:
parent
495ed62e85
commit
1d07f1d8c7
@ -422,6 +422,7 @@ TESTSRC = \
|
||||
$(TOP)/src/test_tclsh.c \
|
||||
$(TOP)/src/test_tclvar.c \
|
||||
$(TOP)/src/test_thread.c \
|
||||
$(TOP)/src/test_vdbecov.c \
|
||||
$(TOP)/src/test_vfs.c \
|
||||
$(TOP)/src/test_windirent.c \
|
||||
$(TOP)/src/test_window.c \
|
||||
|
@ -1517,6 +1517,7 @@ TESTSRC = \
|
||||
$(TOP)\src\test_tclsh.c \
|
||||
$(TOP)\src\test_tclvar.c \
|
||||
$(TOP)\src\test_thread.c \
|
||||
$(TOP)\src\test_vdbecov.c \
|
||||
$(TOP)\src\test_vfs.c \
|
||||
$(TOP)\src\test_windirent.c \
|
||||
$(TOP)\src\test_window.c \
|
||||
|
1
main.mk
1
main.mk
@ -348,6 +348,7 @@ TESTSRC = \
|
||||
$(TOP)/src/test_tclsh.c \
|
||||
$(TOP)/src/test_tclvar.c \
|
||||
$(TOP)/src/test_thread.c \
|
||||
$(TOP)/src/test_vdbecov.c \
|
||||
$(TOP)/src/test_vfs.c \
|
||||
$(TOP)/src/test_windirent.c \
|
||||
$(TOP)/src/test_window.c \
|
||||
|
27
manifest
27
manifest
@ -1,11 +1,11 @@
|
||||
C Frame\srange\scomparisons\scan\snever\sbe\sNULL\sbecause\sthe\svalues\swill\shave\nbeen\schecked\sfor\sNULL\sprior\sto\sthe\stest.
|
||||
D 2019-04-01T16:23:21.090
|
||||
C If\sthe\slibrary\sis\sbuilt\swith\sSQLITE_VDBE_COVERAGE\sdefined,\shave\sthe\sTcl\stests\sgenerate\sa\svdbe\scoverage\sreport\sin\sfile\stestdir/vdbe_coverage.txt.
|
||||
D 2019-04-01T17:24:20.449
|
||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
|
||||
F Makefile.in 236d2739dc3e823c3c909bca2d6cef93009bafbefd7018a8f3281074ecb92954
|
||||
F Makefile.in 6c3b7f3e54cb88b28d7663fb07de2320491e2bccefcaa04cfeec4deb0635182f
|
||||
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
|
||||
F Makefile.msc 6c2faad38c42216b29ce76d1731802f724d8c64d673309a156d2e3ea65195a76
|
||||
F Makefile.msc bb7f028d34a3d0d18fddf149ad799ca8323f1933db5a7d1babb6c735d3ba0630
|
||||
F README.md 623c225551b176659e443ae9e466e91a2c8ff16157260618295db91aef0800b7
|
||||
F VERSION 288d756b1b7be03ecdbf1795c23af2c8425f2e46ba6979a14ef53360308f080d
|
||||
F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50
|
||||
@ -439,7 +439,7 @@ F ext/userauth/userauth.c f81aa5a3ecacf406f170c62a144405858f6f6de51dbdc0920134e6
|
||||
F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x
|
||||
F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8
|
||||
F magic.txt 8273bf49ba3b0c8559cb2774495390c31fd61c60
|
||||
F main.mk 3930eb2fcbebe49ab7408f6fef3baa8c4bf3c84540f9f29dfe849bf561ff6e51
|
||||
F main.mk 55be8c12e73fd1d7faddc09093c231794fd25a2f8d8af63f34e800e825ddc104
|
||||
F mkso.sh fd21c06b063bb16a5d25deea1752c2da6ac3ed83
|
||||
F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271
|
||||
F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504
|
||||
@ -570,9 +570,10 @@ F src/test_server.c a2615049954cbb9cfb4a62e18e2f0616e4dc38fe
|
||||
F src/test_sqllog.c 11e6ce7575f489155c604ac4b439f2ac1d3d5aef
|
||||
F src/test_superlock.c 4839644b9201da822f181c5bc406c0b2385f672e
|
||||
F src/test_syscall.c 1073306ba2e9bfc886771871a13d3de281ed3939
|
||||
F src/test_tclsh.c 06317648b0d85a85fd823f7973b55535c59a3156c1ef59394fe511f932cfa78d
|
||||
F src/test_tclsh.c eeafce33ad2136d57e5dec10f1e9a4347447eb72ffd504a1c7b9c6bfe2e71578
|
||||
F src/test_tclvar.c 33ff42149494a39c5fbb0df3d25d6fafb2f668888e41c0688d07273dcb268dfc
|
||||
F src/test_thread.c 911d15fb14e19c0c542bdc8aabf981c2f10a4858
|
||||
F src/test_vdbecov.c acabb99f510041cb4c9428078f5a7113793a53fa48d5fe28a2e7b7047ea6e6a8
|
||||
F src/test_vfs.c c6c6a58f66b26876c7b5769fb323a58b2c7120299b5084e7212c4116f902cbaa
|
||||
F src/test_vfstrace.c bab9594adc976cbe696ff3970728830b4c5ed698
|
||||
F src/test_windirent.c a895e2c068a06644eef91a7f0a32182445a893b9a0f33d0cdb4283dca2486ac1
|
||||
@ -1376,7 +1377,7 @@ F test/temptable.test d2c9b87a54147161bcd1822e30c1d1cd891e5b30
|
||||
F test/temptable2.test d2940417496e2b9548e01d09990763fbe88c316504033256d51493e1f1a5ce6a
|
||||
F test/temptable3.test d11a0974e52b347e45ee54ef1923c91ed91e4637
|
||||
F test/temptrigger.test 38f0ca479b1822d3117069e014daabcaacefffcc
|
||||
F test/tester.tcl 499a5086815aa416d971ff438d7425c64f41ed3233251db4836d270f9a6671e8
|
||||
F test/tester.tcl 6e7b44695fc072765921ceb8a23bc745eeb86acc3a0e6c3023ab20160af7dab7
|
||||
F test/thread001.test b61a29dd87cf669f5f6ac96124a7c97d71b0c80d9012746072055877055cf9ef
|
||||
F test/thread002.test e630504f8a06c00bf8bbe68528774dd96aeb2e58
|
||||
F test/thread003.test ee4c9efc3b86a6a2767516a37bd64251272560a7
|
||||
@ -1691,8 +1692,8 @@ F test/window7.tcl 6a1210f05d40ec89c22960213a22cd3f98d4e2f2eb20646c83c8c30d4d761
|
||||
F test/window7.test ce7f865241fdd1c5c4db869cd7bb2986c3be836bc2e73649a6846dd920f63e0f
|
||||
F test/window8.tcl 97de3829e0e1aae2c3aaae41a55c54bc1b0751bbc80dfdd93020431b7a889dad
|
||||
F test/window8.test 0dd7e2d32605bf59dc6163b924faeff5951419c1c17a9e506e5a38606e97ab7e
|
||||
F test/windowerr.tcl 678bb2c3ddcaaf605163bd9fe647454fa0097688cfd2fecc5dd9f3a5b45b13f2
|
||||
F test/windowerr.test 7eb7439332d3855dd53c58dca8838f6990746f40fac7045c0153172083a9452b
|
||||
F test/windowerr.tcl abf4d6d0c6d360213af98ed7d538295d905689e83692106f3ece0e3afb9d7f36
|
||||
F test/windowerr.test 675b5e6debfc9370bfacb0b91e2a93a8923512f92600b16f4ea70a1cd9b8e6e4
|
||||
F test/windowfault.test 16e906a2c4110c88372ff4bd5de59ac7397ec2f025912eff8e5677eedd126898
|
||||
F test/with1.test a07b5aad7f77acdf13e52e8814ea94606fcc72e9ea4c99baf293e9d7c63940be
|
||||
F test/with2.test e0030e2f0267a910d6c0e4f46f2dfe941c1cc0d4f659ba69b3597728e7e8f1ab
|
||||
@ -1814,7 +1815,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 a69bb4f257500e40ef4056d5628ef25266def5bcef07eebdb471a79fffe80237
|
||||
R 6d364528f50c302348e507fdadd69990
|
||||
U drh
|
||||
Z bef8059dc047f9b4a9aef3c5115a18a8
|
||||
P fa37cf9a6aa3e4325674cb6af68f617d25e349c3f694d0117a19a36fc42daf15
|
||||
R 5a984bd4dc22a21ee2cbeb73c0aebdfa
|
||||
U dan
|
||||
Z c5db50cf41ee79fb991a649e5739587f
|
||||
|
@ -1 +1 @@
|
||||
fa37cf9a6aa3e4325674cb6af68f617d25e349c3f694d0117a19a36fc42daf15
|
||||
f0ed714637bf30443d0551d9b6fececa00fc9dfe9669fe720c4598ef71c61e2c
|
@ -106,6 +106,7 @@ const char *sqlite3TestInit(Tcl_Interp *interp){
|
||||
#endif
|
||||
extern int TestExpert_Init(Tcl_Interp*);
|
||||
extern int Sqlitetest_window_Init(Tcl_Interp *);
|
||||
extern int Sqlitetestvdbecov_Init(Tcl_Interp *);
|
||||
|
||||
Tcl_CmdInfo cmdInfo;
|
||||
|
||||
@ -171,6 +172,7 @@ const char *sqlite3TestInit(Tcl_Interp *interp){
|
||||
#endif
|
||||
TestExpert_Init(interp);
|
||||
Sqlitetest_window_Init(interp);
|
||||
Sqlitetestvdbecov_Init(interp);
|
||||
|
||||
Tcl_CreateObjCommand(
|
||||
interp, "load_testfixture_extensions", load_testfixture_extensions,0,0
|
||||
|
107
src/test_vdbecov.c
Normal file
107
src/test_vdbecov.c
Normal file
@ -0,0 +1,107 @@
|
||||
/*
|
||||
** 2019 April 02
|
||||
**
|
||||
** The author disclaims copyright to this source code. In place of
|
||||
** a legal notice, here is a blessing:
|
||||
**
|
||||
** May you do good and not evil.
|
||||
** May you find forgiveness for yourself and forgive others.
|
||||
** May you share freely, never taking more than you give.
|
||||
**
|
||||
******************************************************************************
|
||||
**
|
||||
*/
|
||||
#if SQLITE_TEST /* This file is used for testing only */
|
||||
|
||||
#include "sqlite3.h"
|
||||
#include "sqliteInt.h"
|
||||
#if defined(INCLUDE_SQLITE_TCL_H)
|
||||
# include "sqlite_tcl.h"
|
||||
#else
|
||||
# include "tcl.h"
|
||||
#endif
|
||||
|
||||
#ifdef SQLITE_VDBE_COVERAGE
|
||||
|
||||
static u8 aBranchArray[200000];
|
||||
|
||||
static void test_vdbe_branch(
|
||||
void *pCtx,
|
||||
unsigned int iSrc,
|
||||
unsigned char iBranch,
|
||||
unsigned char iType
|
||||
){
|
||||
if( iSrc<sizeof(aBranchArray) ){
|
||||
aBranchArray[iSrc] |= iBranch;
|
||||
}
|
||||
}
|
||||
|
||||
static void appendToList(Tcl_Obj *pList, int iLine, int iPath){
|
||||
Tcl_Obj *pNew = Tcl_NewObj();
|
||||
Tcl_IncrRefCount(pNew);
|
||||
Tcl_ListObjAppendElement(0, pNew, Tcl_NewIntObj(iLine));
|
||||
Tcl_ListObjAppendElement(0, pNew, Tcl_NewIntObj(iPath));
|
||||
Tcl_ListObjAppendElement(0, pList, pNew);
|
||||
Tcl_DecrRefCount(pNew);
|
||||
}
|
||||
|
||||
|
||||
static int SQLITE_TCLAPI test_vdbe_coverage(
|
||||
ClientData cd,
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Obj *CONST objv[]
|
||||
){
|
||||
const char *aSub[] = { "start", "report", "stop", 0 };
|
||||
int iSub = -1;
|
||||
if( objc!=2 ){
|
||||
Tcl_WrongNumArgs(interp, 1, objv, "sub-command");
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
if( Tcl_GetIndexFromObj(interp, objv[1], aSub, "sub-command", 0, &iSub) ){
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
Tcl_ResetResult(interp);
|
||||
assert( iSub==0 || iSub==1 || iSub==2 );
|
||||
switch( iSub ){
|
||||
case 0: /* start */
|
||||
memset(aBranchArray, 0, sizeof(aBranchArray));
|
||||
sqlite3_test_control(SQLITE_TESTCTRL_VDBE_COVERAGE, test_vdbe_branch, 0);
|
||||
break;
|
||||
case 1: { /* report */
|
||||
int i;
|
||||
Tcl_Obj *pRes = Tcl_NewObj();
|
||||
Tcl_IncrRefCount(pRes);
|
||||
for(i=0; i<sizeof(aBranchArray); i++){
|
||||
u8 b = aBranchArray[i];
|
||||
if( b ){
|
||||
if( (b & 0x01)==0 ) appendToList(pRes, i, 0);
|
||||
if( (b & 0x02)==0 ) appendToList(pRes, i, 1);
|
||||
if( (b & 0x04)==0 ) appendToList(pRes, i, 2);
|
||||
}
|
||||
}
|
||||
Tcl_SetObjResult(interp, pRes);
|
||||
Tcl_DecrRefCount(pRes);
|
||||
break;
|
||||
};
|
||||
|
||||
default: /* stop */
|
||||
sqlite3_test_control(SQLITE_TESTCTRL_VDBE_COVERAGE, 0, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
#endif /* SQLITE_VDBE_COVERAGE */
|
||||
|
||||
int Sqlitetestvdbecov_Init(Tcl_Interp *interp){
|
||||
#ifdef SQLITE_VDBE_COVERAGE
|
||||
Tcl_CreateObjCommand(interp, "vdbe_coverage", test_vdbe_coverage, 0, 0);
|
||||
#endif
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
#endif
|
@ -576,6 +576,10 @@ if {[info exists cmdlinearg]==0} {
|
||||
if {$cmdlinearg(verbose)==""} {
|
||||
set cmdlinearg(verbose) 1
|
||||
}
|
||||
|
||||
if {[info commands vdbe_coverage]!=""} {
|
||||
vdbe_coverage start
|
||||
}
|
||||
}
|
||||
|
||||
# Update the soft-heap-limit each time this script is run. In that
|
||||
@ -1296,6 +1300,9 @@ proc finalize_testing {} {
|
||||
memdebug_log_sql leaks.tcl
|
||||
}
|
||||
}
|
||||
if {[info commands vdbe_coverage]!=""} {
|
||||
vdbe_coverage_report
|
||||
}
|
||||
foreach f [glob -nocomplain test.db-*-journal] {
|
||||
forcedelete $f
|
||||
}
|
||||
@ -1305,6 +1312,39 @@ proc finalize_testing {} {
|
||||
exit [expr {$nErr>0}]
|
||||
}
|
||||
|
||||
proc vdbe_coverage_report {} {
|
||||
puts "Writing vdbe coverage report to vdbe_coverage.txt"
|
||||
set lSrc [list]
|
||||
set iLine 0
|
||||
if {[file exists ../sqlite3.c]} {
|
||||
set fd [open ../sqlite3.c]
|
||||
set iLine
|
||||
while { ![eof $fd] } {
|
||||
set line [gets $fd]
|
||||
incr iLine
|
||||
if {[regexp {^/\** Begin file (.*\.c) \**/} $line -> file]} {
|
||||
lappend lSrc [list $iLine $file]
|
||||
}
|
||||
}
|
||||
close $fd
|
||||
}
|
||||
set fd [open vdbe_coverage.txt w]
|
||||
foreach miss [vdbe_coverage report] {
|
||||
foreach {line branch} $miss {}
|
||||
set nextfile ""
|
||||
while {[llength $lSrc]>0 && [lindex $lSrc 0 0] < $line} {
|
||||
set nextfile [lindex $lSrc 0 1]
|
||||
set lSrc [lrange $lSrc 1 end]
|
||||
}
|
||||
if {$nextfile != ""} {
|
||||
puts $fd ""
|
||||
puts $fd "### $nextfile ###"
|
||||
}
|
||||
puts $fd "Vdbe branch $line: path $branch never taken"
|
||||
}
|
||||
close $fd
|
||||
}
|
||||
|
||||
# Display memory statistics for analysis and debugging purposes.
|
||||
#
|
||||
proc show_memstats {} {
|
||||
|
@ -55,6 +55,15 @@ errorsql_test 2.2 {
|
||||
SELECT sum(a) OVER () AS xyz FROM t1 ORDER BY sum(xyz);
|
||||
}
|
||||
|
||||
errorsql_test 3.0 {
|
||||
SELECT sum(a) OVER win FROM t1
|
||||
WINDOW win AS (ROWS BETWEEN 'hello' PRECEDING AND 10 FOLLOWING)
|
||||
}
|
||||
errorsql_test 3.2 {
|
||||
SELECT sum(a) OVER win FROM t1
|
||||
WINDOW win AS (ROWS BETWEEN 10 PRECEDING AND x'ABCD' FOLLOWING)
|
||||
}
|
||||
|
||||
|
||||
finish_test
|
||||
|
||||
|
@ -96,4 +96,16 @@ do_test 2.2 { catch { execsql {
|
||||
SELECT sum(a) OVER () AS xyz FROM t1 ORDER BY sum(xyz);
|
||||
} } } 1
|
||||
|
||||
# PG says ERROR: invalid input syntax for integer: "hello"
|
||||
do_test 3.0 { catch { execsql {
|
||||
SELECT sum(a) OVER win FROM t1
|
||||
WINDOW win AS (ROWS BETWEEN 'hello' PRECEDING AND 10 FOLLOWING)
|
||||
} } } 1
|
||||
|
||||
# PG says ERROR: argument of ROWS must be type bigint, not type bit
|
||||
do_test 3.2 { catch { execsql {
|
||||
SELECT sum(a) OVER win FROM t1
|
||||
WINDOW win AS (ROWS BETWEEN 10 PRECEDING AND x'ABCD' FOLLOWING)
|
||||
} } } 1
|
||||
|
||||
finish_test
|
||||
|
Loading…
x
Reference in New Issue
Block a user