Skip to content
Tcl Source Code View Ticket
Login

View Ticket

tcltest -relateddir does not work

Closed / Invalid3ed219955f21fb674be4616bf226e3d4272c20faCreated 12 years agoUpdated 12 years ago
Descriptionplain2015-04-18 20:34:49
tcltest's -relateddir does not function correctly.
Using the script below on linux to set up a test directory and then running all.tcl, only the top level test and the test in the d.d/ directory run.  The a.d/, b.d/ and c.d/ directories are completely bypassed.

#!/bin/sh

mkall () {
echo "all:$*"
  dir=$1
  n=$2

cat > ${dir}/all.tcl << _HERE_
#!/usr/bin/tclsh

package require Tcl 8.6
package require tcltest 2.2

set testdir [file dirname [file normalize [info script]]]

::tcltest::configure -testdir \$testdir
::tcltest::configure -verbose {line error start}
::tcltest::configure -relateddir {*.d}

::tcltest::runAllTests
exit
_HERE_
chmod a+rx ${dir}/all.tcl

}

mktest () {
echo "test:$*"
  dir=$1
  n=$2

cat > ${dir}/${n}.test << _HERE_
#!/usr/bin/tclsh
#

package require tcltest 2.2
namespace import -force tcltest::*
::tcltest::configure -verbose {start skip line error}

namespace eval ::sometests::test {
  test test-${n} {test-${n}} -body {
    set rc true
  } -result true

  cleanupTests
}
namespace delete ::sometests::test
_HERE_
chmod a+rx ${dir}/${n}.test

}

mkdir z
for d in . a.d b.d c.d d.d; do
  test -d z/$d || mkdir z/$d
  nm=`echo $d | sed 's/\.d//'`
  if [ $d = . ]; then
    nm=top
  fi
  mkall z/$d $nm
  mktest z/$d $nm
done
anonymous (claiming to be aspect)plain2015-04-20 15:32:45
emoving [exit] from the end of all.tcl causes all the tests to run.  The hint is that you never see the normal output after the first subdirectory:

> d.d test ended at Tue Apr 21 01:29:17 AEST 2015
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
anonymousplain2015-04-20 17:03:18
Ok, thanks.  I wouldn't have called d.d/ the first directory.   It is processing the -relateddirs in natural order.   Unfortunately, this is not useful to me.  A sort would be nice.
Log in (anonymous is fine) to add a comment.