1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-30 19:03:16 +03:00

Updates to testrunner.tcl so that it runs "make fuzztest" using multiple jobs.

FossilOrigin-Name: 7596ea7074e0ac73312586ed3d28cdacf97f54b8af73f804cbc8066c94d4b4ef
This commit is contained in:
dan
2023-08-26 21:04:54 +00:00
parent 506a8b52f3
commit 1f1169ad09
7 changed files with 503 additions and 378 deletions

View File

@ -370,15 +370,45 @@ proc trd_configs {platform bld} {
proc trd_extras {platform bld} {
trd_import
if {[info exists extra($platform.$bld)]==0} { return [list] }
return $extra($platform.$bld)
}
set elist [list]
if {[info exists extra($platform.$bld)]} {
set elist $extra($platform.$bld)
# Usage:
#
# trd_fuzztest_data
#
# This returns data used by testrunner.tcl to run commands equivalent
# to [make fuzztest]. The returned value is a list, which should be
# interpreted as a sequence of pairs. The first element of each pair
# is an interpreter name. The second element is a list of files.
# testrunner.tcl automatically creates one job to build each interpreter,
# and one to run each of the files with it once it has been built.
#
# In practice, the returned value looks like this:
#
# {
# {fuzzcheck {$testdir/fuzzdata1.db $testdir/fuzzdata2.db ...}}
# {{sessionfuzz run} $testdir/sessionfuzz-data1.db}
# }
#
# where $testdir is replaced by the full-path to the test-directory (the
# directory containing this file). "fuzzcheck" and "sessionfuzz" have .exe
# extensions on windows.
#
proc trd_fuzztest_data {} {
set EXE ""
if {$::tcl_platform(platform)=="windows"} {
set EXE ".exe"
}
set elist
set lFuzzDb [glob [file join $::testdir fuzzdata*.db]]
set lSessionDb [glob [file join $::testdir sessionfuzz-data*.db]]
return [list fuzzcheck$EXE $lFuzzDb "sessionfuzz$EXE run" $lSessionDb]
}
proc trd_all_configs {} {
trd_import
set all_configs
@ -394,7 +424,7 @@ proc make_sh_script {srcdir opts cflags makeOpts configOpts} {
set myopts ""
if {[info exists ::env(OPTS)]} {
append myopts "# From environment variable:\n"
append myopts "OPTS=$::env(OPTS)\n"
append myopts "OPTS=$::env(OPTS)\n\n"
}
foreach o [lsort $opts] {
append myopts "OPTS=\"\$OPTS $o\"\n"
@ -560,4 +590,36 @@ proc trd_buildscript {config srcdir bMsvc} {
return [make_script $build($config) $srcdir $bMsvc]
}
# Usage:
#
# trd_test_script_properties PATH
#
# The argument must be a path to a Tcl test script. This function scans the
# first 100 lines of the script for lines that look like:
#
# TESTRUNNER: <properties>
#
# where <properties> is a list of identifiers, each of which defines a
# property of the test script. Example properties are "slow" or "superslow".
#
proc trd_test_script_properties {path} {
# Use this global array as a cache:
global trd_test_script_properties_cache
if {![info exists trd_test_script_properties_cache($path)]} {
set fd [open $path]
set ret [list]
for {set line 0} {$line < 100 && ![eof $fd]} {incr line} {
set text [gets $fd]
if {[string match -nocase *testrunner:* $text]} {
regexp -nocase {.*testrunner:(.*)} $text -> properties
lappend ret {*}$properties
}
}
set trd_test_script_properties_cache($path) $ret
close $fd
}
set trd_test_script_properties_cache($path)
}