commit - 68387571bb42b2ef15f43bcd8d4c4ad81f839f7a
commit + 33de5889e9067573cb46e089a1530129b609e4de
blob - 75fe16f17df18747e7bdad8f364adfb0ccc22acd
blob + 7eb267c9622bba9d8ab2a38b7c7d1caca676d9bc
--- exercise
+++ exercise
}
proc main {argc argv} {
- global opts
+ global opts env
set counters {run 0 ok 0 fail 0 error 0}
+ # handle environment variables
+ if {[info exists env(EXERCISEDIR)]} {set opts(-D) $env(EXERCISEDIR)}
+
# handle command line options
set u {[-q] [-B dir] [-C dir] [-D dir] [-p k=pattern] [path ...]}
set prog [file tail $::argv0]
set paths [expr {$argc == 0 ? "." : $argv}]
set files [find_files $basedir $paths]
- # change into (late) workdir if requested with -D
+ # change into (late) workdir if requested with -D or EXERCISEDIR
if {[info exists opts(-D)]} {
set basedir [pwd]
cd $opts(-D)
blob - 5f9c84c36621aa23b20ff31d7d8950b6b8da3c4a
blob + 88ca135f4cca04a357ad0bdb8a8aea42708a4769
--- exercise.1
+++ exercise.1
.Nm
utility requires Tcl 8.4 or above.
.
+.Sh ENVIRONMENT
+.Bl -tag -width EXERCISEDIR
+.It Ev EXERCISEDIR
+The working directory from which to execute tests.
+Overriden by the
+.Fl D
+option.
+If a relative path is provided,
+it is interpreted after any
+.Fl C
+option takes effect.
+.El
+.
.Sh EXIT STATUS
The
.Nm
blob - 3b02d67710f009efc1a83a639432cf1b01d1c0eb
blob + 51d1d10281f8d7e0e23be8e069b12c4d2c76397d
--- tests/exercise/test/noexec.t
+++ tests/exercise/test/noexec.t
# not set executable!
# execute
+unset EXERCISEDIR # clean environment
$exe $tst 1>$out 2>$err
# compare
blob - 86bd0a4b63c4c47398caa3061d8f3a78d6f91fcc
blob + 39902fa1ebd9f8ff0801014f6a96b920af323606
--- tests/helpers/assert-exercise
+++ tests/helpers/assert-exercise
# execute & compare
shift 3
+unset EXERCISEDIR # clean environment
$exe "$@" $pth 1>$out 2>$err
test "$?" = "127" && exit 127
diff -u $experr $err >&2 && \