1# all.tcl -- -*- tcl -*- 2# 3# This file contains a top-level script to run all of the Tcl 4# tests. Execute it by invoking "source all.test" when running tcltest 5# in this directory. 6# 7# Copyright (c) 1998-2000 by Scriptics Corporation. 8# Copyright (c) 2002 Andreas Kupries <andreas_kupries@users.sourceforge.net> 9# All rights reserved. 10# 11# RCS: @(#) $Id: all.tcl 156 2008-10-23 15:52:49Z nijtmans $ 12 13if {[lsearch [namespace children] ::tcltest] == -1} { 14 package require tcltest 15 namespace import ::tcltest::* 16} 17 18proc run_tests {} { 19 set chan $::tcltest::outputChannel 20 21 puts $chan "Tests running in interp: [info nameofexecutable]" 22 puts $chan "Tests running with pwd: [pwd]" 23 puts $chan "Tests running in working dir: $::tcltest::testsDirectory" 24 25 if {[llength $::tcltest::skip] > 0} { 26 puts $chan "Skipping tests that match: $::tcltest::skip" 27 } 28 if {[llength $::tcltest::match] > 0} { 29 puts $chan "Only running tests that match: $::tcltest::match" 30 } 31 if {[llength $::tcltest::skipFiles] > 0} { 32 puts $chan "Skipping test files that match: $::tcltest::skipFiles" 33 } 34 if {[llength $::tcltest::matchFiles] > 0} { 35 puts $chan "Only sourcing test files that match: $::tcltest::matchFiles" 36 } 37 38 set timeCmd {clock format [clock seconds]} 39 puts $chan "Tests began at [eval $timeCmd]" 40 41 # source each of the specified tests 42 foreach file [lsort [::tcltest::getMatchingFiles]] { 43 set tail [file tail $file] 44 puts $chan $tail 45 if {[catch {source $file} msg]} { 46 puts $chan $msg 47 } 48 } 49 50 # cleanup 51 puts $chan "\nTests ended at [eval $timeCmd]" 52 ::tcltest::cleanupTests 1 53 return 54} 55