From: drh <> Date: Tue, 19 May 2026 15:13:03 +0000 (+0000) Subject: Add the "make" subcommand to testrunner.tcl X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=cbbeddbd6781d7a1dac2a505d41ff151b1de4bf8;p=thirdparty%2Fsqlite.git Add the "make" subcommand to testrunner.tcl FossilOrigin-Name: 00d546812810252a4d51ff796931dc2ff5bdd5173ddb8f95fb5efccd897087ff --- diff --git a/manifest b/manifest index eecaa7ac48..95040d26ec 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Early\sdetection\sof\sattempts\sto\soverwrite\san\sin-use\scache\spage\sdue\nto\sdatabase\scorruption.\n[https://issues.chromium.org/issues/513858286|Chromium\s513858286]. -D 2026-05-19T12:40:00.891 +C Add\sthe\s"make"\ssubcommand\sto\stestrunner.tcl +D 2026-05-19T15:13:03.161 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea @@ -1721,8 +1721,8 @@ F test/temptrigfault.tes fc5918e64f3867156fefe7cfca9d8e1f495134a5229b2b511b0dc11 F test/temptrigger.test a00f258ed8d21a0e8fd4f322f15e8cfb5cef2e43655670e07a753e3fb4769d61 F test/tester.tcl 2d943f60200e0a36bcd3f1f0baf181a751cd3604ef6b6bd4c8dc39b4e8a53116 F test/testloadext.c 862b848783eaed9985fbce46c65cd214664376b549fae252b364d5d1ef350a27 -F test/testrunner.tcl 6d13732185c13aef87540ebf9daafb8d9657e66f0ac00eb082d93f4749311d4e x -F test/testrunner_data.tcl dfcf192d274e965845189cc014ac89fff91dde92b6e2ac9e1262897fc21ee2e0 +F test/testrunner.tcl ca474a06ef014260fa2b26489dd7896e0920944a8f4f4beae1339c0a9c862df8 x +F test/testrunner_data.tcl 4b3cf036d39c98b83f9289a5c047eb01089c932d4f59a81bf764f6800589b959 F test/testrunner_estwork.tcl 81e2ae10238f50540f42fbf2d94913052a99bfb494b69e546506323f195dcff9 F test/thread001.test a0985c117eab62c0c65526e9fa5d1360dd1cac5b03bde223902763274ce21899 F test/thread002.test c24c83408e35ba5a952a3638b7ac03ccdf1ce4409289c54a050ac4c5f1de7502 @@ -2205,8 +2205,8 @@ F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee F tool/warnings.sh a554d13f6e5cf3760f041b87939e3d616ec6961859c3245e8ef701d1eafc2ca2 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f F tool/winmain.c 00c8fb88e365c9017db14c73d3c78af62194d9644feaf60e220ab0f411f3604c -P 2d3fbbe421d3b0ad8fa08255fd30af7f2d947919ebb90fa9c9c4ee72ffd880b4 -R 76b0f2819f1dc68826fc6d0bf7bc6e51 +P 6193e4105b6a58eac2bc17c5b2d55fdae332816b59beed1fe24c15dff1372322 +R 47c0b19a1e0edb9eaefa4cec284fc032 U drh -Z d5ceec0f442ad447afe0c71effc41b77 +Z 86ab4f0d052a2398e753f15ef922bf21 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 01bb414560..b7855b4157 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -6193e4105b6a58eac2bc17c5b2d55fdae332816b59beed1fe24c15dff1372322 +00d546812810252a4d51ff796931dc2ff5bdd5173ddb8f95fb5efccd897087ff diff --git a/test/testrunner.tcl b/test/testrunner.tcl index e08bca4577..377a516753 100755 --- a/test/testrunner.tcl +++ b/test/testrunner.tcl @@ -113,6 +113,7 @@ Usage: $a0 joblist ?PATTERN? $a0 njob ?NJOB? $a0 retest + $a0 make CONFIG TARGETS $a0 script ?-msvc? CONFIG $a0 status ?-d SECS? ?--cls? @@ -171,6 +172,8 @@ as complete. Testing will halt when all tests currently running complete. The "clean" command removes files and directories created by a prior invocation of testrunner.tcl. +The "make" command runs "make" configured for the specific CONFIG. + The "script" command outputs the script used to build a configuration. Add the "-msvc" option for a Windows-compatible script. For a list of available configurations enter "$a0 script help". @@ -585,6 +588,87 @@ if {[string compare -nocase script [lindex $argv 0]]==0} { exit } +#-------------------------------------------------------------------------- +# Check if this is the "make" command. Example: +# +# test/testrunner.tcl make Debug-Two clean testfixture +# \_______/ \_______________/ +# Configuration ----------^ ^---------- Arguments to "make" +# +# This works by running the equivalent of "testrunner.tcl script" to generate +# the approprate shell script or BAT file, then invoking that script. The +# generated script is usually deleted automatically, but that can be suppressed +# using the --keep option. +# +if {[string compare -nocase "make" [lindex $argv 0]]==0} { + set bKeep 0 + set bDryRun 0 + set Config {} + set MakeArgs [list] + for {set i 1} {$i<[llength $argv]} {incr i} { + set arg [lindex $argv $i] + if {$arg eq "-keep" || $arg eq "--keep"} { + set bKeep 1 + continue + } + if {[regexp {^--?dry-?run$} $arg] || [regexp {^--?n$} $arg]} { + set bDryRun 1 + continue + } + if {$Config eq ""} { + if {![info exists ::trd::build($arg)]} { + puts stderr "No such configuration: $arg" + puts stderr "Should be one of: [lsort [array names ::trd::build]]" + exit 1 + } + set Config $arg + continue + } + lappend MakeArgs $arg + } + if {$Config eq ""} { + puts stderr "Missing configuration name" + puts stderr "Run \"$argv0 help\" for help" + exit 1 + } + set scriptname testrunner-[expr {int(rand()*1000000)}][clock seconds] + if {$tcl_platform(platform) eq "windows"} { + set bMsvc 1 + append scriptname .bat + } else { + set bMsvc 0 + append scriptname .sh + } + if {$bDryRun} { + puts "Script \"$scriptname\" would have been:" + puts [trd_buildscript $Config [file dirname $testdir] $bMsvc $MakeArgs] + exit 0 + } + set fd [open $scriptname w] + puts $fd [trd_buildscript $Config [file dirname $testdir] $bMsvc $MakeArgs] + close $fd + if {$bMsvc} { + set rc [catch { + exec $scriptname >@stdout + } msg] + set rc 0 + } else { + set rc [catch { + exec sh $scriptname >@stdout 2>@stderr + } msg] + } + if {$bKeep} { + puts "script retained in \"$scriptname\" + } else { + file delete -force $scriptname + } + if {$rc} { + puts stderr "make failed: $msg" + exit 1 + } + exit +} + # Compute an elapse time string MM:SS or HH:MM:SS based on the # number of milliseconds in the argument. # @@ -2052,6 +2136,3 @@ if {$TRG(explain)} { } trdb close exit $exit_status - - - diff --git a/test/testrunner_data.tcl b/test/testrunner_data.tcl index a30402826c..822ab6193e 100644 --- a/test/testrunner_data.tcl +++ b/test/testrunner_data.tcl @@ -473,10 +473,12 @@ proc trd_all_configs {} { } proc trimscript {text} { - set text [string map {"\n " "\n"} [string trim $text]] + set text [string map {"\n " "\n"} [string trim $text]] + set text [string map {"\n\n" "\n"} $text] + return $text } -proc make_sh_script {srcdir opts cflags makeOpts configOpts} { +proc make_sh_script {srcdir opts cflags makeOpts configOpts {targets {}}} { set tcldir [::tcl::pkgconfig get libdir,install] set myopts "" @@ -488,43 +490,54 @@ proc make_sh_script {srcdir opts cflags makeOpts configOpts} { append myopts "OPTS=\"\$OPTS $o\"\n" } - return [trimscript [subst -nocommands { - set -e - if [ "\$#" -ne 1 ] ; then - echo "Usage: \$0 " - exit -1 - fi - - SRCDIR="$srcdir" - TCLDIR="$tcldir" - - if [ ! -f Makefile ] ; then - \$SRCDIR/configure --with-tcl=\$TCLDIR $configOpts - fi - - $myopts - CFLAGS="$cflags" - - make \$1 "CFLAGS=\$CFLAGS" "OPTS=\$OPTS" $makeOpts + set out "set -e\n" + if {[llength $targets]==0} { + set out [trimscript { + if [ "$#" -lt 1 ] ; then + echo "Usage: $0 " + exit -1 + fi + }]\n + } + append out [trimscript [subst -nocommands { + SRCDIR="$srcdir" + TCLDIR="$tcldir" + if [ ! -f Makefile ] ; then + \$SRCDIR/configure --with-tcl=\$TCLDIR $configOpts + fi + $myopts + CFLAGS="$cflags" + }]]\n + if {[llength $targets]==0} {set targets {$*}} + append out [trimscript [subst -nocommands { + make $targets "CFLAGS=\$CFLAGS" "OPTS=\$OPTS" $makeOpts }]] + return $out } # Generate the text of a *.bat script. # -proc make_bat_file {srcdir opts cflags makeOpts} { +proc make_bat_file {srcdir opts cflags makeOpts {targets {}}} { set srcdir [file nativename [file normalize $srcdir]] - - return [trimscript [subst -nocommands { - set TARGET=%1 - set TMP=%CD% - nmake /f $srcdir\\Makefile.msc TOP="$srcdir" %TARGET% "CCOPTS=$cflags" "OPTS=$opts" $makeOpts - }]] + set makefile $srcdir\\Makefile.msc + if {[llength $targets]==0} { + return [trimscript [subst -nocommands { + set TARGET=%1 + set TMP=%CD% + nmake /f $makefile TOP="$srcdir" %TARGET% "CCOPTS=$cflags" "OPTS=$opts" $makeOpts + }]] + } else { + return [trimscript [subst -nocommands { + set TMP=%CD% + nmake /f $makefile TOP="$srcdir" $targets "CCOPTS=$cflags" "OPTS=$opts" $makeOpts + }]] + } } # Generate the text of a shell script. # -proc make_script {cfg srcdir bMsvc} { +proc make_script {cfg srcdir bMsvc {targets {}}} { set opts [list] ;# OPTS value set cflags [expr {$bMsvc ? "-Zi" : "-g"}] ;# CFLAGS value set makeOpts [list] ;# Extra args for [make] @@ -624,9 +637,9 @@ proc make_script {cfg srcdir bMsvc} { } if {$bMsvc==0} { - set zRet [make_sh_script $srcdir $opts $cflags $makeOpts $configOpts] + return [make_sh_script $srcdir $opts $cflags $makeOpts $configOpts $targets] } else { - set zRet [make_bat_file $srcdir $opts $cflags $makeOpts] + return [make_bat_file $srcdir $opts $cflags $makeOpts $targets] } } @@ -643,7 +656,7 @@ proc make_script {cfg srcdir bMsvc} { # directory of that containing this script). MSVC is a boolean - true to # use the MSVC compiler, false otherwise. # -proc trd_buildscript {config srcdir bMsvc} { +proc trd_buildscript {config srcdir bMsvc {targets {}}} { trd_import # Ensure that the named configuration exists. @@ -657,7 +670,7 @@ proc trd_buildscript {config srcdir bMsvc} { } # Generate and return the script. - return [make_script $build($config) $srcdir $bMsvc] + return [make_script $build($config) $srcdir $bMsvc $targets] } # Usage: