# The testrunner.tcl Script
+<ul type=none>
+ <li> 1. <a href=#overview>Overview</a>
+ <li> 2. <a href=#binary_tests>Binary Tests</a>
+<ul type=none>
+ <li> 2.1. <a href=#organization_tests>Organization of Tcl Tests</a>
+ <li> 2.2. <a href=#run_tests>Commands to Run Tests</a>
+ <li> 2.3. <a href=#binary_test_failures>Investigating Binary Test Failures</a>
+</ul>
+ <li> 3. <a href=#source_code_tests>Source Tests</a>
+<ul type=none>
+ <li> 3.1. <a href=#commands_to_run_tests>Commands to Run SQLite Tests</a>
+ <li> 3.2. <a href=#zipvfs_tests>Running ZipVFS Tests</a>
+ <li> 3.3. <a href=#source_code_test_failures>Investigating Source Code Test Failures</a>
+</ul>
+ <li> 4. <a href=#testrunner_options>Extra testrunner.tcl Options</a>
+# 4. Extra testrunner.tcl Options
+ <li> 5. <a href=#cpu_cores>Controlling CPU Core Utilization</a>
+</ul>
+
+<a name=overview></a>
# 1. Overview
testrunner.tcl is a Tcl script used to run multiple SQLite tests using
to run tests (see "Binary Tests" below). Sometimes it builds testfixture and
other binaries in specific configurations to test (see "Source Tests").
+<a name=binary_tests></a>
# 2. Binary Tests
The commands described in this section all run various combinations of the Tcl
The following sub-sections describe the various options that can be
passed to testrunner.tcl to test binary testfixture builds.
+<a name=organization_tests></a>
## 2.1. Organization of Tcl Tests
Tcl tests are stored in files that match the pattern *\*.test*. They are
or so permutations. The specific permutations that are run as part of "all"
are defined in file *testrunner_data.tcl*.
+<a name=run_tests></a>
## 2.2. Commands to Run Tests
To run the "veryquick" test set, use either of the following:
TODO: ./configure + Makefile.msc build systems.
-## Commands to Run SQLite Tests
+<a name=commands_to_run_tests></a>
+## 3.1. Commands to Run SQLite Tests
The **mdevtest** command is equivalent to running the veryquick tests and
the [make fuzztest] target once for each of two --enable-all builds - one
tclsh $TESTDIR/testrunner.tcl release rtree%
```
-## Running ZipVFS Tests
+<a name=zipvfs_tests></a>
+## 3.2. Running ZipVFS Tests
testrunner.tcl can build a zipvfs-enabled testfixture and use it to run
tests from the Zipvfs project with the following command:
tclsh $TESTDIR/testrunner.tcl --zipvfs $PATH_TO_ZIPVFS mdevtest
```
-## Investigating Source Code Test Failures
+<a name=source_code_test_failures></a>
+## 3.3. Investigating Source Code Test Failures
Investigating a test failure that occurs during source code testing is a
two step process:
or else to build a testfixture (or testfixture.exe) binary with which to
run a Tcl test script, as <a href=#binary_test_failures>described above</a>.
+<a name=testrunner_options></a>
+# 4. Extra testrunner.tcl Options
+The testrunner.tcl script options in this section may be used with both source
+code and binary tests.
-# 4. Controlling CPU Core Utilization
+The **--buildonly** option instructs testrunner.tcl just to build the binaries
+required by a test, not to run any actual tests. For example:
+
+```
+ # Build binaries required by release test.
+ tclsh $TESTDIR/testrunner.tcl --buildonly release"
+```
+
+The **--dryrun** option prevents testrunner.tcl from building any binaries
+or running any tests. Instead, it just writes the shell commands that it
+would normally execute into the testrunner.log file. Example:
+
+```
+ # Log the shell commmands that make up the mdevtest test.
+ tclsh $TESTDIR/testrunner.tcl --dryrun mdevtest"
+```
+
+<a name=cpu_cores></a>
+# 5. Controlling CPU Core Utilization
When running either binary or source code tests, testrunner.tcl reports the
number of jobs it intends to use to stdout. e.g.
-C Allow\sa\spattern\sto\sfilter\stest\sscripts\sto\sbe\sappended\sto\stestrunner.tcl\s"mdevtest",\s"sdevtest"\sand\s"release"\scommands.\se.g.\s"tclsh\stest/testrunner.tcl\ssdevtest\sfts5%".
-D 2023-11-24T18:33:40.234
+C Add\sthe\s--buildonly\sand\s--dryrun\soptions\sto\stestrunner.tcl.
+D 2023-11-24T20:14:18.100
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
F doc/json-enhancements.md e356fc834781f1f1aa22ee300027a270b2c960122468499bf347bb123ce1ea4f
F doc/lemon.html 44a53a1d2b42d7751f7b2f478efb23c978e258d794bfd172442307a755b9fa44
F doc/pager-invariants.txt 27fed9a70ddad2088750c4a2b493b63853da2710
-F doc/testrunner.md 727ef3877f5cea152a56f04566d0e095e0761918e9d771fc914db233a91bdd2e
+F doc/testrunner.md 8d36ec692cf4994bb66d84a4645b9afa1ce9d47dc12cbf8d437c5a5fb6ddeedb
F doc/trusted-schema.md 33625008620e879c7bcfbbfa079587612c434fa094d338b08242288d358c3e8a
F doc/vdbesort-memory.md 4da2639c14cd24a31e0af694b1a8dd37eaf277aff3867e9a8cc14046bc49df56
F doc/vfs-shm.txt e101f27ea02a8387ce46a05be2b1a902a021d37a
F test/temptable3.test d11a0974e52b347e45ee54ef1923c91ed91e4637
F test/temptrigger.test 38f0ca479b1822d3117069e014daabcaacefffcc
F test/tester.tcl 68454ef88508c196d19e8694daa27bff7107a91857799eaa12f417188ae53ede
-F test/testrunner.tcl 3ce1f7d0541bcb60f23e843fcde6c66f76acd907bbfa0192620f40ad78a4c9c3
+F test/testrunner.tcl e18d71f2e797da808ba6d31335e504ed6b2791581b89287a72b697a2f31b1ea1
F test/testrunner_data.tcl e4d5017290a6d5c11785e36cc94c67d8bb950c8cdc2dbe4c1db2a3a583812560
F test/thread001.test a0985c117eab62c0c65526e9fa5d1360dd1cac5b03bde223902763274ce21899
F test/thread002.test c24c83408e35ba5a952a3638b7ac03ccdf1ce4409289c54a050ac4c5f1de7502
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P e9951ede184ce07cf725152723d795f299922460715ab76225cd3071bf0f18ee
-R b6b078e60149e99b226063ed1104d74a
+P f8ea0b58b37f4052ded448e595d6d2992988a33b8ecfe58d68f20532f8cb5a37
+R a09b448e8fa45e3193b13a1fe5b499b2
U dan
-Z 8e4057a95f8c06424678eb8234c037ec
+Z ce0098ca9d7841ef7ea900cfd937f5a5
# Remove this line to create a well-formed Fossil manifest.
-f8ea0b58b37f4052ded448e595d6d2992988a33b8ecfe58d68f20532f8cb5a37
\ No newline at end of file
+a0c87ae9d3db914d18e2c8811db0d0ae3ad7b15c63de84fa975efce28bace27e
\ No newline at end of file
set TRG(reporttime) 2000
set TRG(fuzztest) 0 ;# is the fuzztest option present.
set TRG(zipvfs) "" ;# -zipvfs option, if any
+set TRG(buildonly) 0 ;# True if --buildonly option
+set TRG(dryrun) 0 ;# True if --dryrun option
switch -nocase -glob -- $tcl_platform(os) {
*darwin* {
incr ii
set TRG(zipvfs) [file normalize [lindex $argv $ii]]
if {$isLast} { usage }
+ } elseif {($n>2 && [string match "$a*" --buildonly]) || $a=="-b"} {
+ set TRG(buildonly) 1
+ } elseif {($n>2 && [string match "$a*" --dryrun]) || $a=="-d"} {
+ set TRG(dryrun) 1
} else {
usage
}
}
+proc mark_job_as_finished {jobid output state endtm} {
+ r_write_db {
+ trdb eval {
+ UPDATE jobs
+ SET output=$output, state=$state, endtime=$endtm
+ WHERE jobid=$jobid;
+ UPDATE jobs SET state='ready' WHERE depid=$jobid;
+ }
+ }
+}
+
proc script_input_ready {fd iJob jobid} {
global TRG
global O
puts $TRG(log) "### $job(displayname) ${jobtm}ms ($state)"
puts $TRG(log) [string trim $O($iJob)]
- r_write_db {
- set output $O($iJob)
- trdb eval {
- UPDATE jobs
- SET output=$output, state=$state, endtime=$tm
- WHERE jobid=$jobid;
- UPDATE jobs SET state='ready' WHERE depid=$jobid;
- }
- }
+ mark_job_as_finished $jobid $O($iJob) $state $tm
dirs_freeDir $iJob
launch_some_jobs
close $fd
}
- set pwd [pwd]
- cd $dir
- set fd [open $TRG(run) w]
- puts $fd $job(cmd)
- close $fd
- set fd [open "|$TRG(runcmd) 2>@1" r]
- cd $pwd
+ if { $TRG(dryrun) } {
+
+ mark_job_as_finished $job(jobid) "" done 0
+ dirs_freeDir $iJob
+ if {$job(build)!=""} {
+ puts $TRG(log) "(cd $dir ; $job(cmd) )"
+ } else {
+ puts $TRG(log) "$job(cmd)"
+ }
+
+ } else {
+ set pwd [pwd]
+ cd $dir
+ set fd [open $TRG(run) w]
+ puts $fd $job(cmd)
+ close $fd
+ set fd [open "|$TRG(runcmd) 2>@1" r]
+ cd $pwd
- fconfigure $fd -blocking false
- fileevent $fd readable [list script_input_ready $fd $iJob $job(jobid)]
+ fconfigure $fd -blocking false
+ fileevent $fd readable [list script_input_ready $fd $iJob $job(jobid)]
+ }
return 1
}
puts "Test log is $TRG(logname)"
}
+# Handle the --buildonly option, if it was specified.
+#
+proc handle_buildonly {} {
+ global TRG
+ if {$TRG(buildonly)} {
+ r_write_db {
+ trdb eval { DELETE FROM jobs WHERE displaytype!='bld' }
+ }
+ }
+}
sqlite3 trdb $TRG(dbname)
trdb timeout $TRG(timeout)
puts "splitting work across $TRG(nJob) jobs"
}
puts "built testset in [expr $tm/1000]ms.."
+
+handle_buildonly
run_testset
trdb close
#puts [pwd]