2012-03-21 14:34:23 +00:00
proc bc_find_binaries { zCaption } {
# Search for binaries to test against. Any executable files that match
# our naming convention are assumed to be testfixture binaries to test
# against.
#
set binaries [ list ]
2016-03-14 15:43:03 +00:00
set self [ info nameofexec]
2015-11-02 23:21:17 +00:00
set pattern " $ s e l f ? * "
2012-03-21 14:34:23 +00:00
if { $::tcl_platform ( platform ) == " w i n d o w s " } {
set pattern [ string map { \ .exe { } } $pattern ]
}
foreach file [ glob - nocomplain $pattern ] {
2015-11-02 23:21:17 +00:00
if { $file == $self } continue
2012-03-21 14:34:23 +00:00
if { [ file executable $file ] && [ file isfile $file ] } { lappend binaries $file }
}
if { [ llength $binaries ] == 0 } {
puts " W A R N I N G : N o h i s t o r i c a l b i n a r i e s t o t e s t a g a i n s t . "
2012-03-24 02:20:43 +00:00
puts " W A R N I N G : O m i t t i n g b a c k w a r d s - c o m p a t i b i l i t y t e s t s "
2012-03-21 14:34:23 +00:00
}
foreach bin $binaries {
puts - nonewline " T e s t i n g a g a i n s t $ b i n - "
flush stdout
puts " v e r s i o n [ g e t _ v e r s i o n $ b i n ] "
}
set : : BC( binaries ) $binaries
return $binaries
}
proc get_version { binary } {
set chan [ launch_testfixture $binary ]
set v [ testfixture $chan { sqlite3 - version } ]
close $chan
set v
}
proc do_bc_test { bin script} {
forcedelete test.db
set : : bc_chan [ launch_testfixture $bin ]
proc code1 { tcl } { uplevel # 0 $tcl }
proc code2 { tcl } { testfixture $::bc_chan $tcl }
proc sql1 sql { code1 [ list db eval $sql ] }
proc sql2 sql { code2 [ list db eval $sql ] }
code1 { sqlite3 db test.db }
code2 { sqlite3 db test.db }
2016-03-14 15:43:03 +00:00
set bintag $bin
regsub { . * testfixture\ .} $bintag { } bintag
2012-03-21 14:34:23 +00:00
set bintag [ string map { \ .exe { } } $bintag ]
if { $bintag == " " } { set bintag self}
set saved_prefix $::testprefix
append : : testprefix " . $ b i n t a g "
uplevel $script
set : : testprefix $saved_prefix
catch { code1 { db close } }
catch { code2 { db close } }
catch { close $::bc_chan }
}
proc do_all_bc_test { script } {
foreach bin $::BC ( binaries ) {
uplevel [ list do_bc_test $bin $script ]
}
}