Index: Makefile.in ================================================================== --- Makefile.in +++ Makefile.in @@ -34,11 +34,11 @@ TCC = @CC@ #### Tcl shell for use in running the fossil testsuite. If you do not # care about testing the end result, this can be blank. # -TCLSH = tclsh +TCLSH = @TCLSH@ CFLAGS = @CFLAGS@ LIB = @LDFLAGS@ @EXTRA_LDFLAGS@ @LIBS@ BCCFLAGS = @CPPFLAGS@ $(CFLAGS) TCCFLAGS = @EXTRA_CFLAGS@ @CPPFLAGS@ $(CFLAGS) -DHAVE_AUTOCONFIG_H -D_HAVE_SQLITE_CONFIG_H Index: auto.def ================================================================== --- auto.def +++ auto.def @@ -33,12 +33,47 @@ } # Use pread/pwrite system calls in place of seek + read/write if possible define USE_PREAD [cc-check-functions pread] -# Find tclsh for the test suite. Can't yet use jimsh for this. +# Find tclsh for the test suite. +# +# We can't use jimsh for this: the test suite uses features of Tcl that +# Jim doesn't support, either statically or due to the way it's built by +# autosetup. For example, Jim supports `file normalize`, but only if +# you build it with HAVE_REALPATH, which won't ever be defined in this +# context because autosetup doesn't try to discover platform-specific +# details like that before it decides to build jimsh0. Besides which, +# autosetup won't build jimsh0 at all if it can find tclsh itself. +# Ironically, this means we may right now be running under either jimsh0 +# or a version of tclsh that we find unsuitable below! cc-check-progs tclsh +set hbtd /usr/local/Cellar/tcl-tk +if {[string equal false [get-define TCLSH]]} { + msg-result "WARNING: 'make test' will not run here." +} else { + set v [exec /bin/sh -c "echo 'puts \$tcl_version' | tclsh"] + if {[expr $v >= 8.6]} { + msg-result "Found Tclsh version $v in the PATH." + define TCLSH tclsh + } elseif {[file isdirectory $hbtd]} { + # This is a macOS system with the Homebrew version of Tcl/Tk + # installed. Select the newest version. It won't normally be + # in the PATH to avoid shadowing /usr/bin/tclsh, and even if it + # were in the PATH, it's bad practice to put /usr/local/bin (the + # Homebrew default) ahead of /usr/bin, especially given that + # it's user-writeable by default with Homebrew. Thus, we can be + # pretty sure the only way to call it is with an absolute path. + set v [exec ls -tr $hbtd | tail -1] + set path "$hbtd/$v/bin/tclsh" + define TCLSH $path + msg-result "Using Homebrew Tcl/Tk version $path." + } else { + msg-result "WARNING: tclsh $v found; need >= 8.6 for 'make test'." + define TCLSH false ;# force "make test" failure via /usr/bin/false + } +} define EXTRA_CFLAGS "-Wall" define EXTRA_LDFLAGS "" define USE_SYSTEM_SQLITE 0 define USE_LINENOISE 0 Index: test/tester.tcl ================================================================== --- test/tester.tcl +++ test/tester.tcl @@ -20,10 +20,14 @@ # tclsh ../test/tester.tcl ../bld/fossil # # Where ../test/tester.tcl is the name of this file and ../bld/fossil # is the name of the executable to be tested. # + +# We use some things introduced in 8.6 such as lmap. auto.def should +# have found us a suitable Tcl installation. +package require Tcl 8.6 set testfiledir [file normalize [file dirname [info script]]] set testrundir [pwd] set testdir [file normalize [file dirname $argv0]] set fossilexe [file normalize [lindex $argv 0]]